text
stringlengths 10
2.72M
|
|---|
package BLL;
import DAL.BorrowerInfo;
import java.util.Date;
import DAL.CardInfo;
import java.util.ArrayList;
/**
*
* @author tunguyen
*/
public class UpdateBorrowingCardInfoController {
private CardInfo cardInfo;
private CardInfo selectedCardInfo;
/**
* Get information of the specified card
* @param cardId a string to identify the selected card
* @return the detail of the selected card
*/
public CardInfo getSelectedCardInfo(int cardId) {
return CardInfo.getCard(cardId);
}
/**
* Get information of the list of cards
* @param numb an arbitrary number which the cardID contains
* @return list of cards that matched
*/
public ArrayList<CardInfo> getCardInfo(int numb) {
ArrayList<CardInfo> card_list = CardInfo.getCardList(numb);
if (card_list != null) {
if (card_list.isEmpty())
return null;
} else {
return null;
}
return card_list;
}
/**
* Get information of borrower by borrowerID
* @param borrowerId the unique Id to identify borrower
* @return a borrower information that matched
*/
public BorrowerInfo getBorrowerById (int borrowerId) {
BorrowerInfo borrower = BorrowerInfo.getBorrowerById(borrowerId);
if (borrower == null) {
return null;
}
return borrower;
}
/**
* Update the information of the card identified by cardId
* @param cardInfo the card that need to be updated
* @param expiredDate the date that you want to update
* @return boolean if update successfully or not
*/
public boolean updateSelectedCardInfo(CardInfo cardInfo, Date expiredDate) {
cardInfo.setExpiredDate(expiredDate);
return cardInfo.updateQuery();
}
}
|
package day25_loops;
public class PrintStars {
public static void main(String[] args) {
for(int star =1; star <=15;star++){
System.out.print("\uD83C\uDF1F ");
}
System.out.println();//star new line
String myStars ="";
for(int n=1; n<=5;n++) {
//myStars = myStars+"* ";
myStars +="* ";
}
System.out.println("my stars "+myStars.trim());
}
}
|
package com.webcloud.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.SlidingDrawer;
/**
* 如果slidingdrawer的属性:android:orientation="vertical",
* 将 childLeft = (width - childWidth) / 2;改成childLeft = l就可以左边
* 如果slidingdrawer的属性:android:orientation="horizontal",
* 将 handleTop = (height - childHeight) / 2;;改成handleTop = t就可以上边
* 如过让Handle在右边,下边 也是一样的方法。
*
* @author bangyue
* @version [版本号, 2013-10-31]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class MySlidingDrawer extends SlidingDrawer {
private int mHandleMarginLeft = 0;
public int getmHandleMarginLeft() {
return mHandleMarginLeft;
}
public void setmHandleMarginLeft(int mHandleMarginLeft) {
this.mHandleMarginLeft = mHandleMarginLeft;
}
public MySlidingDrawer(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
//取得布局高度
final int height = b - t;
//取得布局宽度
final int width = r - l;
//取得手柄
final View handle = this.getHandle();
int childWidth = handle.getMeasuredWidth();
int childHeight = handle.getMeasuredHeight();
int childLeft;
int childTop;
final View content = this.getContent();
//放置于右边
childLeft = width - childWidth;
//放置于底部
childTop = this.isOpened()?0:(height-childHeight);
if (this.isOpened()) {
content.layout(0, this.getPaddingTop() + childHeight, content.getMeasuredWidth(), this.getPaddingTop()
+ childHeight + content.getMeasuredHeight());
} else {
content.layout(0,
this.getPaddingTop() + childHeight + content.getMeasuredHeight(),
content.getMeasuredWidth(),
this.getPaddingTop() + childHeight + content.getMeasuredHeight());
}
handle.layout(childLeft, childTop, childLeft + childWidth, childTop+childHeight);
}
}
|
package za.ac.cput.Service;
import org.junit.Test;
import za.ac.cput.Entity.Receipt;
import za.ac.cput.Factory.ReceiptFactory;
import static org.junit.jupiter.api.Assertions.*;
public class ReceiptServiceTest {
private static ReceiptService service = new ReceiptService();
private static Receipt receipt = ReceiptFactory.createReceiptItem("zg8585");
@Test
void create(){
Receipt created = service.create(receipt);
assertEquals(created.getReceiptID(),receipt.getReceiptID());
System.out.println("Receipt: "+created);
}
@Test
void read(){
Receipt read = service.read(receipt.getReceiptID());
assertNotNull(read);
System.out.println("Receipt: "+read);
}
@Test
void update(){
Receipt update =new Receipt.Builder().copy(receipt).setReceiptID("zg8567").build();
System.out.println("Updated to: "+update);
}
@Test
void delete (){
boolean delete = service.delete(receipt.getReceiptID());
assertTrue(delete);
System.out.println("Deleted: "+ receipt.getReceiptID());
}
}
|
package com.meridal.examples.springbootmysql;
import static org.junit.Assert.*;
import org.junit.Test;
public class LambdaExamplesTest {
private static final String SHORT_SENTENCE = "Wind in the lonely fences";
private static final String LONG_SENTENCE = SHORT_SENTENCE + " rattles and whistles";
private static final String EMPTY = "";
private static final String ELLIPSIS = "...";
private LambdaExamples examples = new LambdaExamples();
@Test
public void testCountWordsWithSentence() {
assertEquals(5, this.examples.countWords(SHORT_SENTENCE));
}
@Test
public void testCountWordsWithEmptyString() {
assertEquals(0, this.examples.countWords(EMPTY));
}
@Test
public void testCountWordsWithNull() {
assertEquals(0, this.examples.countWords(null));
}
@Test
public void testGetStringSummaryWithShortSentence() {
assertEquals(SHORT_SENTENCE, this.examples.getStringSummary(SHORT_SENTENCE, 5));
}
@Test
public void testGetStringSummaryWithLongSentence() {
assertEquals(SHORT_SENTENCE + ELLIPSIS, this.examples.getStringSummary(LONG_SENTENCE, 5));
}
@Test
public void testGetStringSummaryWithEmptyString() {
assertEquals(EMPTY, this.examples.getStringSummary(EMPTY, 5));
}
@Test
public void testGetStringSummaryWithNull() {
assertEquals(null, this.examples.getStringSummary(null, 5));
}
}
|
package com.hackerrank.thirtyDaysJavaProgram;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class JavaLoops2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
List<List<Integer>> queriesParam = new ArrayList<List<Integer>>();
int t = in.nextInt();
for (int i = 0; i < t; i++) {
int a = in.nextInt();
int b = in.nextInt();
int n = in.nextInt();
List<Integer> seriesParam = new ArrayList<Integer>();
seriesParam.add(a);
seriesParam.add(b);
seriesParam.add(n);
queriesParam.add(seriesParam);
}
in.close();
boolean isValidInput = false;
if (t >= 0 && t <= 500) {
for (List<Integer> query : queriesParam) {
int a = query.get(0);
int b = query.get(1);
int n = query.get(2);
if ((a >= 0 && a <= 50) && (b >= 0 && b <= 50)) {
if (n >= 1 && n <= 15) {
isValidInput = true;
}
}
}
}
if (isValidInput) {
for (List<Integer> query : queriesParam) {
int a = query.get(0);
int b = query.get(1);
int n = query.get(2);
int temp = 0;
for (int j = 0; j < n; j++) {
temp += Math.pow(2, j) * b;
int finalValue = temp + a;
System.out.print(finalValue + " ");
}
System.out.println();
}
}
}
}
|
package data;
import java.util.ArrayList;
import model.riskFollow;
public interface riskFollowInterface {
public ArrayList<riskFollow> getRiskFollow(int projectId,int riskId);//
public int addRiskFollow(riskFollow f);//
public int deleteRiskFollow(int riskFollowId);//
}
|
package com.uptc.prg.maze.view;
import java.util.Locale;
import java.util.ResourceBundle;
public enum UIStrings {
;
public static String getString(String key) {
ResourceBundle resourceBundle = ResourceBundle.getBundle("config/UIStrings");
return resourceBundle.getString(key);
}
}
|
/*
* 2012-3 Red Hat Inc. and/or its affiliates and other contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.overlord.rtgov.common.util;
/**
* This interface provides access to Runtime Governance properties.
*
*/
public interface RTGovPropertiesProvider {
/**
* This method returns the property associated with the
* supplied name.
*
* @param name The property name
* @return The value, or null if not found
*/
public String getProperty(String name);
/**
* This method returns the Runtime Governance properties.
*
* @return The properties, or null if not available
*/
public java.util.Properties getProperties();
}
|
package day20;
import java.io.File;
public class test3 {
public static void main(String[] args) {
//demo1();
File file = new File("zzz");
file.setReadable(false);
System.out.println(file.canRead());
file.setWritable(true);
System.out.println(file.canWrite());
File file2 = new File("aaa.txt");
System.out.println(file2.isHidden());
System.out.println(file.isHidden());
}
private static void demo1() {
File dir1 = new File("aaa");
System.out.println(dir1.isDirectory());
File dir2 = new File("yyy");
System.out.println(dir2.isDirectory());
System.out.println(dir1.isFile());
System.out.println(dir2.isFile());
}
}
|
/*
* Copyright 1999-2015 dangdang.com.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package com.dangdang.ddframe.job.api.type;
import com.dangdang.ddframe.job.api.executor.ShardingContexts;
import com.dangdang.ddframe.job.api.exception.JobExecutionEnvironmentException;
import com.dangdang.ddframe.job.api.executor.JobFacade;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ElasticJobAssert {
public static final String JOB_NAME = "test_job";
public static ShardingContexts getShardingContext() {
Map<Integer, String> map = new HashMap<>(2, 1);
map.put(0, "A");
map.put(1, "B");
return new ShardingContexts(JOB_NAME, 10, "", map);
}
public static void prepareForIsNotMisfire(final JobFacade jobFacade, final ShardingContexts shardingContexts) {
when(jobFacade.getShardingContexts()).thenReturn(shardingContexts);
when(jobFacade.misfireIfNecessary(shardingContexts.getShardingItemParameters().keySet())).thenReturn(false);
when(jobFacade.isExecuteMisfired(shardingContexts.getShardingItemParameters().keySet())).thenReturn(false);
}
public static void verifyForIsNotMisfire(final JobFacade jobFacade, final ShardingContexts shardingContexts) {
try {
verify(jobFacade).checkJobExecutionEnvironment();
} catch (final JobExecutionEnvironmentException ex) {
throw new RuntimeException(ex);
}
verify(jobFacade).getShardingContexts();
verify(jobFacade).misfireIfNecessary(shardingContexts.getShardingItemParameters().keySet());
verify(jobFacade).cleanPreviousExecutionInfo();
verify(jobFacade).beforeJobExecuted(shardingContexts);
verify(jobFacade).registerJobBegin(shardingContexts);
verify(jobFacade).registerJobCompleted(shardingContexts);
verify(jobFacade).isExecuteMisfired(shardingContexts.getShardingItemParameters().keySet());
verify(jobFacade).afterJobExecuted(shardingContexts);
}
}
|
/**
* Question #1 from U2L5 AP CS B
*
* @author C. Thurston
* @version 4/16/2014
*/
public class QuestionOne
{
private static int f(int x) {
if (x > 10) {
return f(x-4) + 2;
} else {
return -7;
}
}
public static void main(String[] args) {
System.out.println(f(25));
}
}
|
/*
* $Log::$
*/
package com.goldgov.dygl.module.portal.webservice.deptuserscore.bean;
import java.util.ArrayList;
import java.util.List;
/**
* Title: StudentCourseQueryBean<br>
* Description: <br>
* Copyright @ 2011~2016 Goldgov .All rights reserved.<br>
*
* @author LiBW
* @createDate 2016年3月16日
* @version $Revision: $
*/
public class StudentCourseQueryBean {
private String studentId;
private String studentName;
private List<CourseDetailQueryBean> courseDetail;
public StudentCourseQueryBean(){
courseDetail = new ArrayList<CourseDetailQueryBean>();
}
public List<CourseDetailQueryBean> getCourseDetail() {
return courseDetail;
}
public void setCourseDetail(List<CourseDetailQueryBean> courseDetail) {
this.courseDetail = courseDetail;
}
public String getStudentId() {
return studentId;
}
public void setStudentId(String studentId) {
this.studentId = studentId;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
}
|
package com.youthchina.dto.job;
import com.youthchina.domain.qingyang.Industry;
import com.youthchina.dto.util.DurationDTO;
import com.youthchina.dto.util.LocationDTO;
import java.util.List;
/**
* Created by zhongyangwu on 12/2/18.
*/
public class JobSearchDTO {
private String jobName;
private Integer comId;
private String companyName;
private DurationDTO duration;
private Integer jobType;
private Integer salaryFloor;
private Integer salaryCap;
private Boolean activate;
private List<Industry> industryList;
private DurationDTO durationDTO;
private LocationDTO location;
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public Integer getComId() {
return comId;
}
public void setComId(Integer comId) {
this.comId = comId;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public DurationDTO getDuration() {
return duration;
}
public void setDuration(DurationDTO duration) {
this.duration = duration;
}
public Integer getJobType() {
return jobType;
}
public void setJobType(Integer jobType) {
this.jobType = jobType;
}
public Integer getSalaryFloor() {
return salaryFloor;
}
public void setSalaryFloor(Integer salaryFloor) {
this.salaryFloor = salaryFloor;
}
public Integer getSalaryCap() {
return salaryCap;
}
public void setSalaryCap(Integer salaryCap) {
this.salaryCap = salaryCap;
}
public Boolean getActivate() {
return activate;
}
public void setActivate(Boolean activate) {
this.activate = activate;
}
public List<Industry> getIndustryList() {
return industryList;
}
public void setIndustryList(List<Industry> industryList) {
this.industryList = industryList;
}
public DurationDTO getDurationDTO() {
return durationDTO;
}
public void setDurationDTO(DurationDTO durationDTO) {
this.durationDTO = durationDTO;
}
public LocationDTO getLocation() {
return location;
}
public void setLocation(LocationDTO location) {
this.location = location;
}
}
|
package org.alienideology.jcord.internal.object.client.call;
import org.alienideology.jcord.handle.client.call.ICall;
import org.alienideology.jcord.handle.client.call.ICallUser;
import org.alienideology.jcord.handle.client.call.ICallVoiceState;
import org.alienideology.jcord.internal.object.VoiceState;
import org.alienideology.jcord.internal.object.client.Client;
import org.alienideology.jcord.internal.object.client.ClientObject;
/**
* @author AlienIdeology
*/
public final class CallUser extends ClientObject implements ICallUser {
private Call call;
private CallVoiceState voiceState;
public CallUser(Client client, Call call) {
super(client);
this.call = call;
}
@Override
public ICall getCall() {
return call;
}
@Override
public ICallVoiceState getVoiceState() {
return voiceState;
}
public void setVoiceState(VoiceState voiceState) {
this.voiceState = new CallVoiceState(getClient(), this, voiceState);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof CallUser)) return false;
if (!super.equals(o)) return false;
CallUser user = (CallUser) o;
if (call != null ? !call.equals(user.call) : user.call != null) return false;
return voiceState.equals(user.voiceState);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (call != null ? call.hashCode() : 0);
result = 31 * result + voiceState.hashCode();
return result;
}
@Override
public String toString() {
return "CallUser{" +
"call=" + call +
", voiceState=" + voiceState +
'}';
}
}
|
package com.aws.codestar.projecttemplates.handler;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.SNSEvent;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.CannedAccessControlList;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.S3ObjectInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
/**
* Handler for requests to Lambda function.
*/
public class ExtractMetadata implements RequestHandler<SNSEvent, Object> {
private static final AmazonS3 s3 = new AmazonS3Client(new DefaultAWSCredentialsProviderChain());
private static FileOutputStream fop = null;
public String handleRequest(final SNSEvent event, final Context context) {
LambdaLogger logger = context.getLogger();
String message = event.getRecords().get(0).getSNS().getMessage();
String bucketName = "serverless-video-transcoded-p";
String sourceKey = "";
try {
sourceKey = URLDecoder.decode(message.replace("/\\+/g", " "), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
logger.log("Source key: " + sourceKey);
saveFileToFilesystem(bucketName, sourceKey);
return "ok";
}
private void saveFileToFilesystem(String sourceBucket, String sourceKey) {
String localFileName = sourceKey.split("/")[0];
File file;
file = new File("/tmp/" + localFileName);
try {
fop = new FileOutputStream(file);
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
GetObjectRequest objectRequest =new GetObjectRequest(sourceBucket,sourceKey);
S3ObjectInputStream inputStream =s3.getObject(objectRequest).getObjectContent();
// get the content in bytess
int curr = -1;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((curr = inputStream.read()) != -1) {
baos.write(curr);
}
fop.write(baos.toByteArray());
fop.flush();
fop.close();
extractMetadata(sourceBucket,sourceKey , localFileName);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fop != null) {
fop.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
private void extractMetadata(String sourceBucket, String sourceKey, String localFilename) {
try{
System.out.println("start excution......");
String[] command = {"/tmp/ffprobe -v quiet -print_format json -show_format /tmp/" + localFilename} ;
ProcessBuilder p = new ProcessBuilder(command);
Process p2 = p.start();
InputStream inputStream = p2.getInputStream();
String metadataKey = sourceKey.split("/.")[0] + ".json";
saveMetadataToS3(inputStream,sourceBucket , metadataKey);
}
catch(Exception e)
{
e.printStackTrace();
}
}
private void saveMetadataToS3(InputStream inputStream, String sourceBucket, String metadataKey) {
ObjectMetadata objectMetadata = new ObjectMetadata();
PutObjectRequest request = new PutObjectRequest(sourceBucket, metadataKey,inputStream,objectMetadata);
request.setCannedAcl(CannedAccessControlList.PublicRead);
s3.putObject(request);
}
}
|
class Solution {
public String countAndSay(int n) {
String start = "1";
String result="";
if(n==0)
return result;
if(n==1)
return start;
for(int i=0;i<n-1;i++){
char digit=start.charAt(start.length()-1);
char digitnext;
int count=1;
for(int j=String.valueOf(start).length()-2;j>=0 ;j--){
digitnext = start.charAt(j);
if(digitnext == digit ){
count++;
}
else{
result = Integer.toString(count)+Character.toString(digit )+result;
digit=digitnext;
count=1;
}
}
result = Integer.toString(count)+Character.toString(digit )+result;
start = result;
result="";
}
return start;
}
}
|
package de.mufl.sandbox.osm.routing.openrouteservice;
import java.io.IOException;
import de.mufl.sandbox.osm.routing.NegativeRequestException;
import de.mufl.sandbox.osm.routing.RoutingException;
public interface Routing {
RoutingResult start(RoutingRequest opt)
throws RoutingException, NegativeRequestException, IOException;
}
|
package umm3601.todos;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import io.javalin.core.validation.Validator;
import io.javalin.http.BadRequestResponse;
import io.javalin.http.Context;
import io.javalin.http.NotFoundResponse;
import umm3601.Server;
/**
* Tests the logic of the TodosController
*
* @throws IOException
*/
public class TodosControllerSpec {
private Context ctx = mock(Context.class);
private TodosController TodosController;
private static TodosDatabase db;
@BeforeEach
public void setUp() throws IOException {
ctx.clearCookieStore();
db = new TodosDatabase(Server.TODOS_DATA_FILE);
TodosController = new TodosController(db);
}
@Test
public void GET_to_request_all_todos() throws IOException {
// Call the method on the mock controller
TodosController.getTodos(ctx);
// Confirm that `json` was called with all the todos.
ArgumentCaptor<Todos[]> argument = ArgumentCaptor.forClass(Todos[].class);
verify(ctx).json(argument.capture());
assertEquals(db.size(), argument.getValue().length);
//test
}
@Test
public void GET_to_request_limit_10_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("limit", Arrays.asList(new String[] { "10" }));
when(ctx.queryParamMap()).thenReturn(queryParams);
TodosController.getTodos(ctx);
// Confirm that there were only 10 todos passed to `json`
ArgumentCaptor<Todos[]> argument = ArgumentCaptor.forClass(Todos[].class);
verify(ctx).json(argument.capture());
assertEquals(10, argument.getValue().length);
}
/**
* Test that if the todos sends a request with an illegal value in
* the limit field (i.e., something that can't be parsed to a number)
* we get a reasonable error code back.
*/
@Test
public void GET_to_request_todos_with_illegal_limit() {
// We'll set the requested "limit" to be a string ("banana")
// that can't be parsed to a number.
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("limit", Arrays.asList(new String[] { "banana" }));
when(ctx.queryParamMap()).thenReturn(queryParams);
// This should now throw a `BadRequestResponse` exception because
// our request has an limit that can't be parsed to a number.
Assertions.assertThrows(BadRequestResponse.class, () -> {
TodosController.getTodos(ctx);
});
}
@Test
public void GET_to_request_status_complete_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("status", Arrays.asList(new String[] { "complete" }));
when(ctx.queryParamMap()).thenReturn(queryParams);
TodosController.getTodos(ctx);
// Confirm that all the todos passed to `json` have a completed status.
ArgumentCaptor<Todos[]> argument = ArgumentCaptor.forClass(Todos[].class);
verify(ctx).json(argument.capture());
for (Todos todos : argument.getValue()) {
assertEquals(true, todos.status);
}
}
@Test
public void GET_to_request_status_incomplete_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("status", Arrays.asList(new String[] { "incomplete" }));
when(ctx.queryParamMap()).thenReturn(queryParams);
TodosController.getTodos(ctx);
// Confirm that all the todos passed to `json` have a incomplete status.
ArgumentCaptor<Todos[]> argument = ArgumentCaptor.forClass(Todos[].class);
verify(ctx).json(argument.capture());
for (Todos todos : argument.getValue()) {
assertEquals(false, todos.status);
}
}
@Test
public void GET_to_request_body_contains_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("contains", Arrays.asList(new String[] { "cillum" }));
when(ctx.queryParamMap()).thenReturn(queryParams);
TodosController.getTodos(ctx);
// Confirm that all the todos passed to `json` have a body that contains "cillum"
ArgumentCaptor<Todos[]> argument = ArgumentCaptor.forClass(Todos[].class);
verify(ctx).json(argument.capture());
for (Todos todos : argument.getValue()) {
assertEquals(true, todos.body.contains("cillum"));
}
}
@Test
public void GET_to_request_owner_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("owner", Arrays.asList(new String[] { "Fry" }));
when(ctx.queryParamMap()).thenReturn(queryParams);
TodosController.getTodos(ctx);
// Confirm that all the todos passed to `json` have the owner "Fry"
ArgumentCaptor<Todos[]> argument = ArgumentCaptor.forClass(Todos[].class);
verify(ctx).json(argument.capture());
for (Todos todos : argument.getValue()) {
assertEquals(true, todos.owner.equals("Fry"));
}
}
@Test
public void GET_to_request_category_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("category", Arrays.asList(new String[] { "groceries" }));
when(ctx.queryParamMap()).thenReturn(queryParams);
TodosController.getTodos(ctx);
// Confirm that all the todos passed to `json` have the category "groceries"
ArgumentCaptor<Todos[]> argument = ArgumentCaptor.forClass(Todos[].class);
verify(ctx).json(argument.capture());
for (Todos todos : argument.getValue()) {
assertEquals(true, todos.category.equals("groceries"));
}
}
@Test
public void GET_to_request_sort_body_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("orderBy", Arrays.asList(new String[] { "body" }));
Todos[] sortedTodos = db.listTodos(queryParams);
//Confirm that the todos are sorted alphabetically by their body
for(int i = 0; i < db.size() - 1; i++){
assertEquals(true, sortedTodos[i].body.compareTo(sortedTodos[i+1].body) < 0);
}
}
@Test
public void GET_to_request_sort_owner_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("orderBy", Arrays.asList(new String[] { "owner" }));
Todos[] sortedTodos = db.listTodos(queryParams);
//Confirm that the todos are sorted alphabetically by their owner
for(int i = 0; i < db.size() - 1; i++){
assertEquals(true, sortedTodos[i].owner.compareTo(sortedTodos[i+1].owner) <= 0);
}
}
@Test
public void GET_to_request_sort_status_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("orderBy", Arrays.asList(new String[] { "status" }));
Todos[] sortedTodos = db.listTodos(queryParams);
for(int i = 0; i < db.size() - 1; i++){
Boolean statusT1 = sortedTodos[i].status;
String stringStatT1 = statusT1.toString();
Boolean statusT2 = sortedTodos[i+1].status;
String stringStatT2 = statusT2.toString();
//Confirm that the todos are sorted alphabetically by their status
assertEquals(true, stringStatT1.compareTo(stringStatT2) <= 0);
}
}
@Test
public void GET_to_request_sort_category_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("orderBy", Arrays.asList(new String[] { "category" }));
Todos[] sortedTodos = db.listTodos(queryParams);
//Confirm that the todos are sorted alphabetically by their category
for(int i = 0; i < db.size() - 1; i++){
assertEquals(true, sortedTodos[i].category.compareTo(sortedTodos[i+1].category) <= 0);
}
}
@Test
public void GET_to_sort_body_filter_owner_category_status_contains_limit_todos() throws IOException {
Map<String, List<String>> queryParams = new HashMap<>();
queryParams.put("orderBy", Arrays.asList(new String[] { "body" }));
queryParams.put("owner", Arrays.asList(new String[] { "Fry" }));
queryParams.put("category", Arrays.asList(new String[] { "video games" }));
queryParams.put("status", Arrays.asList(new String[] { "complete" }));
queryParams.put("contains", Arrays.asList(new String[] { "nulla" }));
queryParams.put("limit", Arrays.asList(new String[] { "3" }));
Todos[] sortedTodos = db.listTodos(queryParams);
//Confirm that the todos are sorted alphabetically by their body, have the owner Fry, are completed, and that there are only 3 todos
for(int i = 0; i < sortedTodos.length - 1; i++){
assertEquals(true, sortedTodos[i].body.compareTo(sortedTodos[i+1].body) < 0);
assertEquals(true, sortedTodos[i].owner.equals("Fry"));
assertEquals(true, sortedTodos[i].category.equals("video games"));
assertEquals(true, sortedTodos[i].status);
assertEquals(true, sortedTodos[i].category.equals("video games"));
assertEquals(true, sortedTodos.length == 3);
}
}
@Test
public void GET_to_request_todo_with_existent_id() throws IOException {
when(ctx.pathParam("id", String.class)).thenReturn(new Validator<String>("58895985a22c04e761776d54", "", "id"));
TodosController.getTodo(ctx);
verify(ctx).status(201);
}
@Test
public void GET_to_request_todo_with_nonexistent_id() throws IOException {
when(ctx.pathParam("id", String.class)).thenReturn(new Validator<String>("nonexistent", "", "id"));
Assertions.assertThrows(NotFoundResponse.class, () -> {
TodosController.getTodo(ctx);
});
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.restrictions.validator;
import static de.hybris.platform.cms2.model.restrictions.CMSTimeRestrictionModel.ACTIVEFROM;
import static de.hybris.platform.cms2.model.restrictions.CMSTimeRestrictionModel.ACTIVEUNTIL;
import static de.hybris.platform.cmsfacades.constants.CmsfacadesConstants.FIELD_REQUIRED;
import static de.hybris.platform.cmsfacades.constants.CmsfacadesConstants.INVALID_DATE_RANGE;
import de.hybris.platform.cms2.common.annotations.HybrisDeprecation;
import de.hybris.platform.cmsfacades.data.TimeRestrictionData;
import java.util.Objects;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
/**
* Validate fields of {@link TimeRestrictionData} for create operation
*
* @deprecated since 6.6
*/
@HybrisDeprecation(sinceVersion = "6.6")
@Deprecated
public class CreateTimeRestrictionValidator implements Validator
{
@Override
public boolean supports(final Class<?> clazz)
{
return TimeRestrictionData.class.isAssignableFrom(clazz);
}
@Override
public void validate(final Object obj, final Errors errors)
{
final TimeRestrictionData target = (TimeRestrictionData) obj;
ValidationUtils.rejectIfEmpty(errors, ACTIVEFROM, FIELD_REQUIRED);
ValidationUtils.rejectIfEmpty(errors, ACTIVEUNTIL, FIELD_REQUIRED);
if (Objects.nonNull(target.getActiveFrom()) && Objects.nonNull(target.getActiveUntil())
&& (target.getActiveUntil().before(target.getActiveFrom()) //
|| target.getActiveUntil().equals(target.getActiveFrom())))
{
errors.rejectValue(ACTIVEUNTIL, INVALID_DATE_RANGE);
}
}
}
|
package WB.java;
import java.util.Scanner;
public class Homework_0519_2 {
public static void main(String[] args) {
Scanner scanfn = new Scanner(System.in);
Scanner scanma = new Scanner(System.in);
Scanner scansn = new Scanner(System.in);
int FirstNumber;
String math;
int SecondNumber;
System.out.println("피연산자 입력 : ");
FirstNumber = scanfn.nextInt();
// System.out.println(FirstNumber);
System.out.println("연산자 입력 : ");
math = scanma.nextLine();
// System.out.println(math);
System.out.println("마지막 피연산자 입력 : ");
SecondNumber = scansn.nextInt();
// System.out.println(SecondNumber);
switch(math) {
case "+" :
System.out.println("결과 : " + (FirstNumber+SecondNumber));
break;
case "-" :
System.out.println("결과 : " + (FirstNumber-SecondNumber));
break;
case "*" :
System.out.println("결과 : " + (FirstNumber*SecondNumber));
break;
case "/" :
System.out.println("결과 : " + (FirstNumber/SecondNumber ));
break;
}
// System.out.println("결과 = " + (FirstNumber + math + SecondNumber));
}
}
|
/*
* The MIT License
*
* Copyright 2020 tibo.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package be.cylab.mark.core;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author tibo
*/
public class AbstractAgentProfile {
/**
* Name of the class to instantiate.
*/
private String class_name;
/**
* The label for the data that will be added to the datastore.
*/
private String label;
/**
* Additional parameters to pass to the agent (e.g time range).
*/
private Map<String, String> parameters = new HashMap<>();
/**
*
* @return
*/
public final String getClassName() {
return class_name;
}
/**
*
* @param class_name
*/
public final void setClassName(final String class_name) {
this.class_name = class_name;
}
/**
*
* @return
*/
public final String getLabel() {
return label;
}
/**
*
* @param label
*/
public final void setLabel(final String label) {
this.label = label;
}
/**
*
* @return
*/
public final Map<String, String> getParameters() {
return parameters;
}
/**
*
* @param parameters
*/
public final void setParameters(final Map<String, String> parameters) {
this.parameters = parameters;
}
/**
* Set a single parameter.
* @param key
* @param value
*/
public final void setParameter(final String key, final String value) {
this.parameters.put(key, value);
}
/**
*
* @param name
* @return
*/
public final String getParameter(final String name) {
return parameters.get(name);
}
/**
* Get the value of this parameter, of return default_value if not set.
* @param name
* @param default_value
* @return
*/
public final String getParameterOrDefault(
final String name, final String default_value) {
return parameters.getOrDefault(name, default_value);
}
/**
*
* @param name
* @param default_value
* @return
*/
public final int getParameterInt(
final String name, final int default_value) {
if (this.getParameter(name) == null) {
return default_value;
}
try {
return Integer.valueOf(this.getParameter(name));
} catch (NumberFormatException ex) {
return default_value;
}
}
/**
*
* @param name
* @param default_value
* @return
*/
public final double getParameterDouble(
final String name, final double default_value) {
if (this.getParameter(name) == null) {
return default_value;
}
try {
return Double.valueOf(this.getParameter(name));
} catch (NumberFormatException ex) {
return default_value;
}
}
}
|
import java.io.IOException;
import java.util.Scanner;
public class R2 {
public static void main(String[] args)throws IOException
{
Scanner nya = new Scanner(System.in);
System.out.println(-nya.nextInt() + nya.nextInt()*2);
}
}
|
package com.mimi.mimigroup.api;
import android.location.Location;
import android.os.AsyncTask;
import android.util.Log;
import com.mimi.mimigroup.model.DM_Customer_Distance;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class SyncFindCustomer extends AsyncTask<Void, Integer, List<DM_Customer_Distance>> {
private SyncFindCustomerCallback mSyncCallBack;
private Exception mException;
private List<DM_Customer_Distance> mLstCus;
private Double CLongitude;
private Double CLatitude;
private Float Scope;
private int ReturnListSize;
private float CalDistance(Double Lng1,Double Lat1, Double CusLng,Double CusLat){
try{
if (CusLat>0 && CusLng>0 && Lng1>0 && Lat1>0){
Location locationA = new Location("A");
locationA.setLatitude(Lat1);
locationA.setLongitude(Lng1);
Location locationB = new Location("B");
locationB.setLatitude(CusLat);
locationB.setLongitude(CusLng);
return (int)locationA.distanceTo(locationB);
}
return 0;
}catch (Exception ex){return 0;}
}
public SyncFindCustomer(SyncFindCustomerCallback SynCallB,List<DM_Customer_Distance> lstMCus,Double CLongitude,Double CLatitude,Float Scope,int ReturnListSize){
this.mSyncCallBack=SynCallB;
this.mLstCus=lstMCus;
this.CLongitude=CLongitude;
this.CLatitude=CLatitude;
this.Scope=Scope;
this.ReturnListSize=ReturnListSize;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
if(mSyncCallBack!=null){
mSyncCallBack.onSyncStart();
}
}
@Override
protected List<DM_Customer_Distance> doInBackground(Void... arg0) {
try {
List<DM_Customer_Distance> lstCusSel = new ArrayList<DM_Customer_Distance>();
for (DM_Customer_Distance oC:mLstCus){
oC.setDistance(CalDistance(CLongitude,CLatitude,oC.getLongititude(),oC.getLatitude()));
}
Collections.sort(mLstCus);
//Collections.reverse(lstCus);
//Metter
int iSqno=0;
if(this.Scope>0){
for (DM_Customer_Distance oCusSel:mLstCus){
if(oCusSel.getDistance()<=Scope){
lstCusSel.add(oCusSel);
//iSqno+=1;
//if(iSqno>=ReturnListSize){break;}
}
if(iSqno>=ReturnListSize){break;}
iSqno+=1;
}
}else{
for (DM_Customer_Distance oCusSel:mLstCus){
lstCusSel.add(oCusSel);
if(iSqno>=ReturnListSize){break;}
iSqno+=1;
}
}
return lstCusSel;
} catch (Exception e) {
mException=e;
e.printStackTrace();
}
return null;
}
@Override
protected void onProgressUpdate(Integer...values){}
@Override
protected void onPostExecute(List<DM_Customer_Distance> result) {
super.onPostExecute(result);
//Call HttpCallBack
Log.d("SYNC_RESULT",result.toArray().toString());
if(mSyncCallBack!=null){
if(mException==null){
mSyncCallBack.onSyncSuccess(result);
}else{
mSyncCallBack.onSyncFailer(mException);
}
}
}
}
|
package com.tencent.mm.plugin.account.friend.a;
public interface i$a {
void notifyDataSetChanged();
}
|
package team;
import rescuecore2.messages.Command;
import rescuecore2.worldmodel.ChangeSet;
import java.util.Collection;
public abstract class AbstractCommunicationStrategy {
/**
* This function is called to broadcast observation
*/
public abstract void communicateChanges(ChangeSet changed);
/**
* This function is called with all the messages that are received by the agent
*/
public abstract void handleMessages(Collection<Command> heard);
}
|
package com.smxknife.java2.thread.semaphore.demo02;
import java.util.concurrent.Semaphore;
/**
* @author smxknife
* 2018-12-21
*/
public class Service {
/**
* permits 许可,同一时间,最多允许多少个线程同时执行acquire和release之间的代码
*/
private Semaphore semaphore = new Semaphore(10);
public void testMethod() {
try {
semaphore.acquire(2);
System.out.println(Thread.currentThread().getName() + " begin time : " + System.currentTimeMillis());
Thread.sleep(2000);
System.out.println(Thread.currentThread().getName() + " end time : " + System.currentTimeMillis());
semaphore.release(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
package com.tencent.mm.plugin.game.gamewebview.jsapi.biz;
import android.content.Context;
import com.tencent.mm.ab.b;
import com.tencent.mm.ipcinvoker.wx_extension.b.a;
import com.tencent.mm.plugin.game.gamewebview.jsapi.a$a;
import com.tencent.mm.protocal.c.aoy;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.x;
import java.util.HashMap;
import java.util.LinkedList;
class aa$1 implements a {
final /* synthetic */ String bAj;
final /* synthetic */ a$a jGK;
final /* synthetic */ aa jHh;
final /* synthetic */ Context val$context;
aa$1(aa aaVar, a$a a_a, Context context, String str) {
this.jHh = aaVar;
this.jGK = a_a;
this.val$context = context;
this.bAj = str;
}
public final void a(int i, int i2, String str, b bVar) {
x.i("MicroMsg.GameJsApiLogin", "errType = %d, errCode = %d ,errMsg = %s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str});
if (i == 0 && i2 == 0) {
aoy aoy = (aoy) bVar.dIE.dIL;
if (aoy == null || aoy.rRd == null) {
this.jGK.tp(com.tencent.mm.plugin.game.gamewebview.jsapi.a.f("loginfail", null));
return;
}
int i3 = aoy.rRd.bMH;
String str2 = aoy.rRd.bMI;
String str3 = aoy.rRf;
x.i("MicroMsg.GameJsApiLogin", "NetSceneJSLogin jsErrcode %d", new Object[]{Integer.valueOf(i3)});
if (i3 == -12000) {
LinkedList linkedList = aoy.rEI;
x.d("MicroMsg.GameJsApiLogin", "appName %s, appIconUrl %s", new Object[]{aoy.jSv, aoy.rbh});
ah.A(new 1(this, str3, linkedList, r4, r5));
return;
} else if (i3 == 0) {
new HashMap().put("code", aoy.rRg);
x.d("MicroMsg.GameJsApiLogin", "resp data code [%s]", new Object[]{r0});
this.jGK.tp(com.tencent.mm.plugin.game.gamewebview.jsapi.a.f("loginok", null));
return;
} else {
x.e("MicroMsg.GameJsApiLogin", "onSceneEnd NetSceneJSLogin %s", new Object[]{str2});
this.jGK.tp(com.tencent.mm.plugin.game.gamewebview.jsapi.a.f("loginfail", null));
return;
}
}
this.jGK.tp(com.tencent.mm.plugin.game.gamewebview.jsapi.a.f("loginfail", null));
}
}
|
package com.ctac.jpmc.game.conway;
import static org.junit.Assert.*;
import org.junit.Test;
import com.ctac.jpmc.game.IGrid;
import com.ctac.jpmc.game.IGridCell;
public class ConwayGame3DTest {
@Test
public void testFewerThan2LiveNeighborsDies() {
boolean[][][] gridArray = {
{{false,false,false}},
{{false,true,false}},
{{false,true,false}},
};
Game3D game = new Game3D (gridArray);
IGrid grid = game.getCurrentStage();
IGridCell cell = grid.getCell(1,0,1);
assertEquals("Current state error ", true, cell.getState());
grid = game.getNextStage();
assertEquals("Fewer Than 2 Live Neighbors Dies error ", false, cell.getState());
}
@Test
public void testMoreThan3LiveNeighborsDies() {
boolean[][][] gridArray = {
{{false,false,true}},
{{true,true,true}},
{{false,true,false}},
};
Game3D game = new Game3D (gridArray);
IGrid grid = game.getCurrentStage();
IGridCell cell = grid.getCell(1,0,1);
assertEquals("Current state error ", true, cell.getState());
grid = game.getNextStage();
assertEquals("More Than 3 Live Neighbors Dies error ", false, cell.getState());
}
@Test
public void test2LiveNeighborsLives() {
boolean[][][] gridArray = {
{{false,false,true}},
{{true,true,false}},
{{false,false,false}},
};
Game3D game = new Game3D (gridArray);
IGrid grid = game.getCurrentStage();
IGridCell cell = grid.getCell(1,0,1);
assertEquals("Current state error ", true, cell.getState());
grid = game.getNextStage();
assertEquals("2 Live Neighbors Lives error ", true, cell.getState());
}
@Test
public void test3LiveNeighborsLives() {
boolean[][][] gridArray = {
{{false,false,true}},
{{true,true,true}},
{{false,false,false}},
};
Game3D game = new Game3D (gridArray);
IGrid grid = game.getCurrentStage();
IGridCell cell = grid.getCell(1,0,1);
assertEquals("Current state error ", true, cell.getState());
grid = game.getNextStage();
assertEquals("3 Live Neighbors Lives error ", true, cell.getState());
}
@Test
public void testExactly3LiveNeighborsBecomesLive() {
boolean[][][] gridArray = {
{{false,false,true}},
{{true,false,true}},
{{false,false,false}},
};
Game3D game = new Game3D (gridArray);
IGrid grid = game.getCurrentStage();
IGridCell cell = grid.getCell(1,0,1);
assertEquals("Current state error ", false, cell.getState());
grid = game.getNextStage();
assertEquals("Exactly 3 Live Neighbors Becomes Live error ", true, cell.getState());
}
}
|
package com.sdl.webapp.common.api.model;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* <p>PageModel interface.</p>
*/
public interface PageModel extends ViewModel {
/**
* <p>getId.</p>
*
* @return a {@link java.lang.String} object.
*/
String getId();
/**
* <p>setId.</p>
*
* @param Id a {@link java.lang.String} object.
*/
void setId(String Id);
/**
* <p>getName.</p>
*
* @return a {@link java.lang.String} object.
*/
String getName();
/**
* <p>setName.</p>
*
* @param name a {@link java.lang.String} object.
*/
void setName(String name);
/**
* <p>getTitle.</p>
*
* @return a {@link java.lang.String} object.
*/
String getTitle();
/**
* <p>setTitle.</p>
*
* @param name a {@link java.lang.String} object.
*/
void setTitle(String name);
/**
* <p>getMeta.</p>
*
* @return a {@link java.util.Map} object.
*/
Map<String, String> getMeta();
/**
* <p>setMeta.</p>
*
* @param pageMeta a {@link java.util.Map} object.
*/
void setMeta(Map<String, String> pageMeta);
/**
* <p>getRegions.</p>
*
* @return a {@link com.sdl.webapp.common.api.model.RegionModelSet} object.
*/
RegionModelSet getRegions();
/**
* <p>setRegions.</p>
*
* @param regions a {@link com.sdl.webapp.common.api.model.RegionModelSet} object.
*/
void setRegions(RegionModelSet regions);
/**
* <p>containsRegion.</p>
*
* @param regionName a {@link java.lang.String} object.
* @return a boolean.
*/
boolean containsRegion(String regionName);
/**
* <p>setMvcData.</p>
*
* @param pageMvcData a {@link com.sdl.webapp.common.api.model.MvcData} object.
*/
void setMvcData(MvcData pageMvcData);
/**
* <p>setXpmMetadata.</p>
*
* @param xpmMetaData a {@link java.util.Map} object.
*/
void setXpmMetadata(Map<String, Object> xpmMetaData);
/**
* <p>Implementors of this interface may want to save some data in a servlet response.</p>
* <p>It is a workaround that might be removed in a future in case the better solution is found. So preferably
* the good idea if <i>not to use it.</i></p>
*/
interface WithResponseData extends PageModel {
/**
* Passes the servlet response in order to allow page to modify it.
*
* @param servletResponse the current servlet response
* @return true if the response was modified, false otherwise
*/
boolean setResponseData(HttpServletResponse servletResponse);
}
}
|
package server;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
@SuppressWarnings("rawtypes")
public class WebApp {
private static ServeletContext context;
static {
context = new ServeletContext();
Map<String, String> mapping = context.getMapping();
mapping.put("/login", "login");
mapping.put("/log", "login");
mapping.put("/reg", "register");
mapping.put("/index", "index");
Map<String, String> servelet = context.getServelet();
SAXParser parser = null;
try {
parser = SAXParserFactory.newInstance().newSAXParser();
} catch (ParserConfigurationException | SAXException e) {
e.printStackTrace();
}
SaxParse parseXml = new SaxParse();
//加载资源文件 转化为一个输入流
InputStream stream = SaxParse.class.getClassLoader().getResourceAsStream("server.xml");
//调用parse()方法
try {
parser.parse(stream, parseXml);
} catch (SAXException | IOException e) {
e.printStackTrace();
}
//遍历结果
List<ServeletMapping> list = parseXml.getList();
for (ServeletMapping serverItem : list) {
servelet.put(serverItem.getUrl(), serverItem.getName());
}
// servelet.put("login", "server.LoginServer");
// servelet.put("register", "server.Register");
// servelet.put("index", "server.IndexServer");
}
public static Servelet getServelet(String url) throws InstantiationException,
IllegalAccessException, ClassNotFoundException {
if (null == url || (url = url.trim()).equals("")) {
return null;
}
String name = context.getServelet().get(context.getMapping().get(url));
return (Servelet) Class.forName(name).newInstance();
// return context.getServelet().get(context.getMapping().get(url));
}
}
|
package com.example.test.main;
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.ListView;
import com.example.test.R;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private CollapsingToolbarLayoutState state;
private CollapsingToolbarLayout collapsingToolbar;
private Toolbar toolbar;
private enum CollapsingToolbarLayoutState {
EXPANDED,
COLLAPSED,
INTERNEDIATE
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("主页面");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ListView listView2 = (ListView) findViewById(R.id.listView);
ArrayList<String> arrayList2 = new ArrayList<>();
for (int i = 0; i < 50; i++) {
arrayList2.add("item2 " + i);
}
listView2.setAdapter(new StringAdapter(arrayList2, this));
collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle("Title");
// collapsingToolbar.setTitleEnabled(false);//设置title不会动
//通过CollapsingToolbarLayout修改字体颜色
collapsingToolbar.setExpandedTitleColor(Color.parseColor("#888888"));//设置还没收缩时状态下字体颜色
collapsingToolbar.setCollapsedTitleTextColor(getResources().getColor(R.color.colorAccent));//设置收缩后Toolbar上字体的颜色
AppBarLayout app_bar=(AppBarLayout)findViewById(R.id.appbar);
toolbar.getBackground().setAlpha(0);
app_bar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (verticalOffset == 0) {
if (state != CollapsingToolbarLayoutState.EXPANDED) {
state = CollapsingToolbarLayoutState.EXPANDED;//修改状态标记为展开
}
} else if (Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()) {
if (state != CollapsingToolbarLayoutState.COLLAPSED) {
state = CollapsingToolbarLayoutState.COLLAPSED;//修改状态标记为折叠
}
} else {
if (state != CollapsingToolbarLayoutState.INTERNEDIATE) {
if(state == CollapsingToolbarLayoutState.COLLAPSED){
}
state = CollapsingToolbarLayoutState.INTERNEDIATE;//修改状态标记为中间
}
float v = Math.abs((float) verticalOffset) / appBarLayout.getTotalScrollRange();
if (v < 1) {
v = 0;
}
//动态改变标题栏透明度
toolbar.getBackground().setAlpha((int) (255*v));
}
}
});
}
}
|
package fController;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import mainP.Student;
import utilities.sqliteConnection;
import javax.swing.*;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.ResourceBundle;
public class marksFaculty implements Initializable {
public String std_id,course_id,cour_id;
@FXML
private ComboBox comboType;
@FXML
private Label courseLabel;
@FXML
private TableView<modelFaculty> table;
@FXML
private TableColumn<modelFaculty,String> col_sId;
@FXML
private TableColumn<modelFaculty,String> col_fName;
@FXML
private TableColumn<modelFaculty,String> col_lName;
@FXML
private TableColumn<modelFaculty,String> col_cId;
@FXML
private TextField marksField;
@FXML
private TextField totalMarks;
@FXML
private TextField Id;
public Connection con;
ObservableList<modelFaculty> obList = FXCollections.observableArrayList();
ObservableList<String> comboList = FXCollections.observableArrayList("quiz","assignment","sessional","final","project");
@Override
public void initialize(URL location, ResourceBundle resources){
cour_id = courseLabel.getText();
comboType.setItems(comboList);
try {
con = sqliteConnection.dbConnector();
ResultSet rs = con.createStatement().executeQuery("SELECT usr.id , FName, LName,cID FROM users as usr, registration as c, courses as c2 WHERE c.sID = usr.id AND c2.code LIKE '"+cour_id+"' AND c.id = c2.id;");
while (rs.next()){
obList.add(new modelFaculty(rs.getString("id"),rs.getString("FName"),rs.getString("LName"),rs.getString("cID")));
}
}
catch (Exception e){
e.printStackTrace();
}
col_sId.setCellValueFactory(new PropertyValueFactory<>("std_id"));
col_fName.setCellValueFactory(new PropertyValueFactory<>("FName"));
col_lName.setCellValueFactory(new PropertyValueFactory<>("LName"));
col_cId.setCellValueFactory(new PropertyValueFactory<>("course_id"));
table.setItems(obList);
table.setOnMouseClicked((MouseEvent event) -> {
if (event.getClickCount() >= 1) {
if (table.getSelectionModel().getSelectedItem() != null) {
modelFaculty selectedPerson = table.getSelectionModel().getSelectedItem();
std_id = selectedPerson.getStd_id();
course_id = selectedPerson.getCourse_id();
}
}
});
}
@FXML
void attendence(MouseEvent event) throws IOException{
String courseId = cour_id;
final FXMLLoader fxmlLoader;
if(courseId == null) {
JOptionPane.showMessageDialog(null,"Please select your course id..:/)");
}
else{
fxmlLoader = new FXMLLoader(getClass().getResource("/fView/attendenceFaculty.fxml"));
fxmlLoader.getNamespace().put("courseText", courseId);
Parent root = fxmlLoader.load();
Node node = (Node) event.getSource();
Stage stage = (Stage) node.getScene().getWindow();
stage.setScene(new Scene(root));
}
}
@FXML
void logout(MouseEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/mainP/login.fxml"));
Node node = (Node) event.getSource();
Stage stage = (Stage) node.getScene().getWindow();
stage.setScene(new Scene(root));
}
@FXML
void FacultyDashboard(MouseEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/fView/homeFaculty.fxml"));
Node node = (Node) event.getSource();
Stage stage = (Stage) node.getScene().getWindow();
stage.setScene(new Scene(root));
}
@FXML
void saveMarks(){
String t_marks,marks, id, option;
option = (String) comboType.getValue();
id = Id.getText();
marks =marksField.getText();
t_marks = totalMarks.getText();
String query = "INSERT INTO "+option+" VALUES('"+id+"','"+std_id+"','"+course_id+"','"+marks+"','"+t_marks+"');";
// String query = "INSERT INTO marks VALUES('"+std_id+"','"+course_id+"','"+marks+"');";
try {
con = sqliteConnection.dbConnector();
con.createStatement().executeUpdate(query);
marksField.setText("");
JOptionPane.showMessageDialog(null, "Marks Saved Successfully!!");
}
catch (Exception e){
JOptionPane.showMessageDialog(null, "Marks Saved Failed");
e.printStackTrace();
}
}
}
|
package ar.edu.ArqSoft.rentService.Service.dto;
import ar.edu.ArqSoft.rentService.Common.dto.*;
public class AlquilerRequestDto implements DtoEntity{
private Long peliculaId;
private Long socioId;
public Long getPeliculaId() {
return peliculaId;
}
public void setPeliculaId(Long peliculaId) {
this.peliculaId = peliculaId;
}
public Long getSocioId() {
return socioId;
}
public void setSocioId(Long socioId) {
this.socioId = socioId;
}
}
|
/* Copyright 2018-2019, Senjo Org. Denis Rezvyakov aka Dinya Feony Senjo.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*/
package org.senjo.support;
import static org.senjo.basis.Helper.*;
import static org.senjo.support.Log.Level.*;
import org.senjo.annotation.*;
import org.senjo.data.APhrase;
/** Абстрактный интерфейс журнала. Реализуется пользователем в удобном для него виде,
* используется ядром системы для записей в журнал пользователя.
*
* @author Denis Rezvyakov aka Dinya Feony Senjo
* @version create 2018-01-20, change 2019-03-05, fix 2019-03-14 */
public abstract class Log {
/** Предел задаётся жёстко в самом начале и должен помочь интерпретатору выбрасывать
* часть кода, которая из-за этой константы никогда не будет выполняться. */
private final int limit;
/** Текущий режим работы указывает, какие уровни журналирования ожидаются в настоящий
* момент. В любой момент пользователь может изменить уровень журналирования. */
private int mode = 99;
protected Log() { this(99, 99); }
protected Log(int mode, int limit) { this.mode = mode; this.limit = limit; }
/* 10 9 8 7 5 4
* SEVERE |WARNIN|INFO|CONFIG|FINE | FINER
* FATAL, Fault, Error, Warn, info, hint, trace, debug, easy.
* 10 9 8 7 5 4 1
* 15 14 13-12 11-10 9-7 6
*
*
* 1000÷... SEVERE
* 900÷1000 WARNING 11100÷11111 -> 896÷992 -> 992 WARNING
* 800÷ 900 INFO 11001÷11100 -> 800÷896 -> 800 INFO
* 700÷ 800 CONFIG 10101÷11001 -> 672÷800 ->
*
* 1000÷... SEVERE
* 900÷1000 WARNING 1110÷1111 -> 896÷960 -> 960 WARNING
* 800÷ 900 INFO 1100÷1110 -> 768÷896 -> 896 INFO
* 700÷ 800 CONFIG 1010÷1100 -> 640÷768 -> 768 CONFIG */
/**
* @param level — уровень данной записи в журнале;
* @param point — точка кода, из которой ведётся запись;
* @param message — полезное сообщение записываемое в журнал;
* @param ex — выброс, содержит исключение или просто {@link Stack} для трассировки. */
protected abstract void log( @NotNull Level level, @NotNull StackTraceElement point,
@Nullable String message, @Nullable Throwable ex );
public final void log(Level level, int depth, String message, Throwable error) {
if (!need(level)) return;
log(level, secret.getStackTraceElement(new Throwable(), depth+1), message, error); }
public final void log(Level level, int depth, String message, boolean trace) {
if (!need(level)) return;
Throwable ex = trace ? new Stack(depth+1) : new Throwable();
log(level, secret.getStackTraceElement(ex, depth+1), message, trace ? ex : null); }
public final boolean need(Level level) {
final int rate = level.ordinal(); return rate <= limit && rate <= mode; }
public final boolean isInfo () { return need(Info ); }
public final boolean isTrace() { return need(Trace); }
public final boolean isDebug() { return need(Debug); }
public final void fatal(String message) { log(Fatal, 1, message, null); }
public final void fault(String message) { log(Fault, 1, message, null); }
public final void error(String message) { log(Error, 1, message, null); }
// public final void alert(String message) { log(Alert, 1, message, null); }
public final void warn (String message) { log(Warn , 1, message, null); }
public final void info (String message) { log(Info , 1, message, null); }
public final void hint (String message) { log(Hint , 1, message, null); }
public final void trace(String message) { log(Trace, 1, message, null); }
public final void debug(String message) { log(Debug, 1, message, null); }
public final void log(Level level, String message) { log(level, 1, message, null); }
public final void fatal(String message, Throwable ex) { log(Fatal, 1, message, ex); }
public final void fault(String message, Throwable ex) { log(Fault, 1, message, ex); }
public final void error(String message, Throwable ex) { log(Error, 1, message, ex); }
public final void warn (String message, Throwable ex) { log(Warn , 1, message, ex); }
public final void info (String message, Throwable ex) { log(Info , 1, message, ex); }
public final void hint (String message, Throwable ex) { log(Hint , 1, message, ex); }
public final void trace(String message, Throwable ex) { log(Trace, 1, message, ex); }
public final void debug(String message, Throwable ex) { log(Debug, 1, message, ex); }
public final void log(Level level, String message, Throwable ex) {
log(level, 1, message, ex); }
public final void fatal(String message, boolean trace) { log(Fatal, 1, message, trace);}
public final void fault(String message, boolean trace) { log(Fault, 1, message, trace);}
public final void error(String message, boolean trace) { log(Error, 1, message, trace);}
public final void warn (String message, boolean trace) { log(Warn , 1, message, trace);}
public final void info (String message, boolean trace) { log(Info , 1, message, trace);}
public final void hint (String message, boolean trace) { log(Hint , 1, message, trace);}
public final void trace(String message, boolean trace) { log(Trace, 1, message, trace);}
public final void debug(String message, boolean trace) { log(Debug, 1, message, trace);}
public final void log(Level level, String message, boolean trace) {
log(level, 1, message, trace); }
public Buffer fatalEx( ) { return new Buffer(Fatal, 1); }
public Buffer fatalEx(String prefix) { return new Buffer(Fatal, 1).add(prefix); }
public Buffer fatalEx(Throwable ex ) { return new Buffer(Fatal, 1, ex); }
public Buffer faultEx( ) { return new Buffer(Fault, 1); }
public Buffer faultEx(String prefix) { return new Buffer(Fault, 1).add(prefix); }
public Buffer warnEx ( ) { return new Buffer(Warn , 1); }
public Buffer warnEx (String prefix) { return new Buffer(Warn , 1).add(prefix); }
public Buffer infoEx ( ) { return new Buffer(Info , 1); }
public Buffer infoEx (String prefix) { return new Buffer(Info , 1).add(prefix); }
public Buffer hintEx ( ) { return new Buffer(Hint , 1); }
public Buffer hintEx (String prefix) { return new Buffer(Hint , 1).add(prefix); }
public Buffer traceEx( ) { return new Buffer(Trace, 1); }
public Buffer traceEx(String prefix) { return new Buffer(Trace, 1).add(prefix); }
public Buffer debugEx( ) { return new Buffer(Debug, 1); }
public Buffer debugEx(String prefix) { return new Buffer(Debug, 1).add(prefix); }
public Buffer logEx(Level level) { return new Buffer(level, 1); }
public Buffer logEx(Level level, String prefix) {
return new Buffer(level, 1).add(prefix); }
static final Log hollow = new Log(-1, -1) {
@Override public void log( Level level, StackTraceElement point, String message,
Throwable ex) { }
};
static final Log console = new Log(99, 99) {
@Override public void log( Level level, StackTraceElement point, String message,
Throwable ex ) {
System.out.println(level.text + ": " + message);
if (ex != null) ex.printStackTrace(System.err); }
};
public final class Buffer extends APhrase<Buffer, Void> {
private final Level level;
private StackTraceElement point;
private Throwable ex;
Buffer(Level level, int depth ) { this(level, depth, false, null); }
Buffer(Level level, int depth, boolean trace) { this(level, depth, trace, null); }
Buffer(Level level, int depth, Throwable ex ) { this(level, depth, false, ex ); }
private Buffer(Level level, int depth, boolean trace, Throwable ex) { super(64);
this.level = level;
this.ex = trace ? new Stack(depth+2) : ex;
this.point = secret.getStackTraceElement(trace ? ex : new Throwable(), depth+2);
}
@Override protected Void apply(CharSequence data) {
if (!need(level)) return null;
log(level, point, data.toString(), ex); return null; }
public Buffer trace ( ) { this.ex = new Stack(1); return this; }
public Buffer thrown(Throwable ex) { this.ex = ex; return this; }
}
public enum Level {
/** Фатальный сбой, который нарушает работу всей системы вообще */ Fatal("FATAL"),
/** Программный сбой из-за ошибок в алгоритме программы */ Fault("FAULT"),
/** Ошибка не в коде: сбой данных, настроек, доступов и т.п. */ Error("Error"),
/** Предупреждение о штатном допустимом сбое: нет сигнала и т.п. */ Warn (" Warn"),
/** Информативное полезное сообщение в процессе работы системы */ Info (" info"),
/** Расширенная вспомогательная информация о настройках и данных */ Hint (" hint"),
/** Подробное отслеживание процесса изменения и анализа данных */ Trace("trace"),
/** Детальная информация о внутренних процессах для отладки кода */ Debug("debug"),
/** Прочая избыточная информация */ Easy (" easy");
public final String text;
private Level(String text) { this.text = text; }
}
static @NotNull Log instance = Log.console;
public static @NotNull Log instance() { return instance; }
protected static void initialize(Log mainLog) {
Log.instance = mainLog != null ? mainLog : hollow; }
protected static final class Stack extends Throwable {
private static final long serialVersionUID = 1L;
public final int cutDepth;
private StackTraceElement[] stack;
Stack(int cutDepth) { this.cutDepth = cutDepth; }
@Override public StackTraceElement[] getStackTrace() {
if (stack != null) return stack;
int depth = secret.getStackTraceDepth(this);
StackTraceElement[] result = new StackTraceElement[depth - cutDepth];
for (int index = cutDepth; index != depth; ++index)
result[index-cutDepth] = secret.getStackTraceElement(this, index);
return this.stack = result; }
@Override public void setStackTrace(StackTraceElement[] stack) {
this.stack = stack; }
public void printStack(StringBuilder out) {
int depth = secret.getStackTraceDepth(this);
out.append("trace:");
for (int index = cutDepth; index != depth; ++index) out.append("\tat ")
.append(secret.getStackTraceElement(this, index)).append('\n');
}
}
}
|
import java.util.Scanner;
public class Table
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("표를 인쇄합니다." + "\n");
System.out.print("행을 몇 개 만들까요? ");
int row = input.nextInt();
System.out.print("열을 몇 개 만들까요? ");
int column = input.nextInt();
for (int i = 0; i < row; i++)
{
for(int j = 0; j < column; j++)
{
System.out.print("(" + i + ", " + j + ")" + "\t");
}
System.out.println();
}
}
}
|
package com.shsy.tubebaby.activity;
import android.graphics.Color;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.jaeger.library.StatusBarUtil;
public class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StatusBarUtil.setColor(this, Color.argb(0,245,245,245));
}
}
|
package com.tencent.mm.plugin.game.d;
import com.tencent.mm.bk.a;
public final class cy extends a {
public String jOX;
public String jPd;
public String jTm;
public String jTn;
public String jTo;
public boolean jTp;
public boolean jTq;
protected final int a(int i, Object... objArr) {
int h;
if (i == 0) {
f.a.a.c.a aVar = (f.a.a.c.a) objArr[0];
if (this.jPd != null) {
aVar.g(1, this.jPd);
}
if (this.jTm != null) {
aVar.g(2, this.jTm);
}
if (this.jTn != null) {
aVar.g(3, this.jTn);
}
if (this.jTo != null) {
aVar.g(4, this.jTo);
}
if (this.jOX != null) {
aVar.g(5, this.jOX);
}
aVar.av(6, this.jTp);
aVar.av(7, this.jTq);
return 0;
} else if (i == 1) {
if (this.jPd != null) {
h = f.a.a.b.b.a.h(1, this.jPd) + 0;
} else {
h = 0;
}
if (this.jTm != null) {
h += f.a.a.b.b.a.h(2, this.jTm);
}
if (this.jTn != null) {
h += f.a.a.b.b.a.h(3, this.jTn);
}
if (this.jTo != null) {
h += f.a.a.b.b.a.h(4, this.jTo);
}
if (this.jOX != null) {
h += f.a.a.b.b.a.h(5, this.jOX);
}
return (h + (f.a.a.b.b.a.ec(6) + 1)) + (f.a.a.b.b.a.ec(7) + 1);
} else if (i == 2) {
f.a.a.a.a aVar2 = new f.a.a.a.a((byte[]) objArr[0], unknownTagHandler);
for (h = a.a(aVar2); h > 0; h = a.a(aVar2)) {
if (!super.a(aVar2, this, h)) {
aVar2.cJS();
}
}
return 0;
} else if (i != 3) {
return -1;
} else {
f.a.a.a.a aVar3 = (f.a.a.a.a) objArr[0];
cy cyVar = (cy) objArr[1];
switch (((Integer) objArr[2]).intValue()) {
case 1:
cyVar.jPd = aVar3.vHC.readString();
return 0;
case 2:
cyVar.jTm = aVar3.vHC.readString();
return 0;
case 3:
cyVar.jTn = aVar3.vHC.readString();
return 0;
case 4:
cyVar.jTo = aVar3.vHC.readString();
return 0;
case 5:
cyVar.jOX = aVar3.vHC.readString();
return 0;
case 6:
cyVar.jTp = aVar3.cJQ();
return 0;
case 7:
cyVar.jTq = aVar3.cJQ();
return 0;
default:
return -1;
}
}
}
}
|
package com.example.instagram.fragments.addPhoto;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.example.instagram.R;
public class AddPhotoFragment extends Fragment {
private ImageView addPhotoImage;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
addPhotoImage = view.findViewById(R.id.add_photo);
addPhotoImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_add_photo, container, false);
}
}
|
package capitulo07;
import java.util.Scanner;
public class Exercicio716 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.printf("Digite os números a serem somados ou -1 para terminar: %n");
double array [] = new double [100];
for (int i = 0; input.hasNext(); i++) {
array[i] = input.nextDouble();
if (array[i] == -1)
System.out.printf("A soma equivale a %f%n", sum(array) + 1);
System.out.printf("Soma atual %f%n",sum(array));
}
sum(array);
}
public static double sum(double... numbers) {
double total = 0.0;
for (double d : numbers) {
total += d;
}
return total;
}
}
|
package com.tencent.mm.plugin.fts.ui.widget;
import android.view.View;
import android.view.View.OnClickListener;
class FTSEditTextView$4 implements OnClickListener {
final /* synthetic */ FTSEditTextView jzA;
FTSEditTextView$4(FTSEditTextView fTSEditTextView) {
this.jzA = fTSEditTextView;
}
public final void onClick(View view) {
this.jzA.clearText();
if (FTSEditTextView.h(this.jzA) != null) {
FTSEditTextView.h(this.jzA).onClickClearTextBtn(view);
}
}
}
|
package org.inftel.socialwind.client.desktop.view;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import org.inftel.socialwind.client.desktop.model.SurferPreferences;
import org.jdesktop.beansbinding.AutoBinding;
import org.jdesktop.beansbinding.AutoBinding.UpdateStrategy;
import org.jdesktop.beansbinding.BeanProperty;
import org.jdesktop.beansbinding.BindingGroup;
import org.jdesktop.beansbinding.Bindings;
@SuppressWarnings("serial")
public class SurferPreferencesWindow extends JFrame {
private BindingGroup m_bindingGroup;
private JPanel m_contentPane;
private SurferPreferences surferPreferencesModel;
private JTextField displayNameJTextField;
private JTextField fullNameJTextField;
private JPasswordField passwordJPasswordField;
private JCheckBox savePasswordJCheckBox;
private JTextField userNameJTextField;
private JButton btnConnect;
private JLabel fullNameLabel;
private JLabel lblStatus;
private JLabel lblTitle;
private JButton btnExit;
private JPanel panel;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SurferPreferencesWindow frame = new SurferPreferencesWindow(
new SurferPreferences());
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public SurferPreferencesWindow(SurferPreferences surferPreferencesModel) {
setFont(null);
setResizable(false);
setIconImage(Toolkit.getDefaultToolkit().getImage(
SurferPreferencesWindow.class.getResource("socialwind-success.png")));
setTitle(Messages.getString("appTitle")); //$NON-NLS-1$
this.surferPreferencesModel = surferPreferencesModel;
setBounds(100, 100, 320, 314);
m_contentPane = new JPanel();
m_contentPane.setAlignmentY(0.0f);
m_contentPane.setAlignmentX(0.0f);
setContentPane(m_contentPane);
m_contentPane.setLayout(null);
JLabel userNameLabel = new JLabel(Messages.getString("userName")); //$NON-NLS-1$
userNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
userNameLabel.setBounds(10, 53, 88, 14);
m_contentPane.add(userNameLabel);
userNameJTextField = new JTextField();
userNameJTextField.setBounds(107, 49, 197, 20);
m_contentPane.add(userNameJTextField);
userNameJTextField.setColumns(10);
JLabel passwordLabel = new JLabel(Messages.getString("password")); //$NON-NLS-1$
passwordLabel.setHorizontalAlignment(SwingConstants.RIGHT);
passwordLabel.setBounds(10, 84, 88, 14);
m_contentPane.add(passwordLabel);
passwordJPasswordField = new JPasswordField();
passwordJPasswordField.setBounds(107, 80, 197, 20);
m_contentPane.add(passwordJPasswordField);
JLabel savePasswordLabel = new JLabel(Messages.getString("savePassword")); //$NON-NLS-1$
savePasswordLabel.setHorizontalAlignment(SwingConstants.RIGHT);
savePasswordLabel.setBounds(10, 116, 88, 14);
m_contentPane.add(savePasswordLabel);
btnConnect = new JButton(Messages.getString("connect")); //$NON-NLS-1$
btnConnect.setBounds(219, 109, 85, 23);
m_contentPane.add(btnConnect);
fullNameLabel = new JLabel(Messages.getString("fullName")); //$NON-NLS-1$
fullNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
fullNameLabel.setBounds(10, 149, 88, 14);
m_contentPane.add(fullNameLabel);
fullNameJTextField = new JTextField();
fullNameJTextField.setBounds(107, 143, 197, 20);
m_contentPane.add(fullNameJTextField);
JLabel displayNameLabel = new JLabel(Messages.getString("displayName")); //$NON-NLS-1$
displayNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
displayNameLabel.setBounds(10, 180, 88, 14);
m_contentPane.add(displayNameLabel);
displayNameJTextField = new JTextField();
displayNameJTextField.setBounds(107, 174, 197, 20);
m_contentPane.add(displayNameJTextField);
panel = new JPanel();
panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
Messages.getString("conectionStatus"), TitledBorder.LEADING, TitledBorder.TOP, null,
new Color(0, 0, 0)));
panel.setBounds(10, 205, 294, 38);
m_contentPane.add(panel);
panel.setLayout(null);
lblStatus = new JLabel(Messages.getString("status")); //$NON-NLS-1$
lblStatus.setVerticalAlignment(SwingConstants.BOTTOM);
lblStatus.setBounds(10, 11, 274, 20);
panel.add(lblStatus);
lblTitle = new JLabel(Messages.getString("SurferPreferencesWindow.lblTitle.text")); //$NON-NLS-1$
lblTitle.setAlignmentY(0.0f);
lblTitle.setOpaque(true);
lblTitle.setBackground(Color.WHITE);
lblTitle.setIcon(new ImageIcon(SurferPreferencesWindow.class.getResource("header.png")));
lblTitle.setBounds(0, 0, 320, 38);
m_contentPane.add(lblTitle);
savePasswordJCheckBox = new JCheckBox();
savePasswordJCheckBox.setBounds(107, 107, 21, 27);
m_contentPane.add(savePasswordJCheckBox);
btnExit = new JButton(Messages.getString("exit")); //$NON-NLS-1$
btnExit.setBounds(215, 254, 89, 23);
m_contentPane.add(btnExit);
if (surferPreferencesModel != null) {
m_bindingGroup = initDataBindings();
}
}
public SurferPreferences getSurferPreferencesModel() {
return surferPreferencesModel;
}
public void setSurferPreferencesModel(SurferPreferences newSurferPreferencesModel) {
setSurferPreferencesModel(newSurferPreferencesModel, true);
}
public void setSurferPreferencesModel(SurferPreferences newSurferPreferencesModel,
boolean update) {
surferPreferencesModel = newSurferPreferencesModel;
if (update) {
if (m_bindingGroup != null) {
m_bindingGroup.unbind();
m_bindingGroup = null;
}
if (surferPreferencesModel != null) {
m_bindingGroup = initDataBindings();
}
}
}
protected BindingGroup initDataBindings() {
BeanProperty<SurferPreferences, String> displayNameProperty = BeanProperty
.create("displayName");
BeanProperty<JTextField, String> textProperty = BeanProperty.create("text");
AutoBinding<SurferPreferences, String, JTextField, String> autoBinding = Bindings
.createAutoBinding(UpdateStrategy.READ_WRITE, surferPreferencesModel,
displayNameProperty, displayNameJTextField, textProperty);
autoBinding.bind();
//
BeanProperty<SurferPreferences, String> fullNameProperty = BeanProperty.create("fullName");
BeanProperty<JTextField, String> textProperty_1 = BeanProperty.create("text");
AutoBinding<SurferPreferences, String, JTextField, String> autoBinding_1 = Bindings
.createAutoBinding(UpdateStrategy.READ_WRITE, surferPreferencesModel,
fullNameProperty, fullNameJTextField, textProperty_1);
autoBinding_1.bind();
//
BeanProperty<SurferPreferences, String> passwordProperty = BeanProperty.create("password");
BeanProperty<JPasswordField, String> textProperty_2 = BeanProperty.create("text");
AutoBinding<SurferPreferences, String, JPasswordField, String> autoBinding_2 = Bindings
.createAutoBinding(UpdateStrategy.READ_WRITE, surferPreferencesModel,
passwordProperty, passwordJPasswordField, textProperty_2);
autoBinding_2.bind();
//
BeanProperty<SurferPreferences, Boolean> savePasswordProperty = BeanProperty
.create("savePassword");
BeanProperty<JCheckBox, Boolean> selectedProperty = BeanProperty.create("selected");
AutoBinding<SurferPreferences, Boolean, JCheckBox, Boolean> autoBinding_3 = Bindings
.createAutoBinding(UpdateStrategy.READ_WRITE, surferPreferencesModel,
savePasswordProperty, savePasswordJCheckBox, selectedProperty);
autoBinding_3.bind();
//
BeanProperty<SurferPreferences, String> userNameProperty = BeanProperty.create("userName");
BeanProperty<JTextField, String> textProperty_3 = BeanProperty.create("text");
AutoBinding<SurferPreferences, String, JTextField, String> autoBinding_4 = Bindings
.createAutoBinding(UpdateStrategy.READ_WRITE, surferPreferencesModel,
userNameProperty, userNameJTextField, textProperty_3);
autoBinding_4.bind();
//
BeanProperty<SurferPreferences, Boolean> surferPreferencesModelBeanProperty = BeanProperty
.create("connected");
BeanProperty<JTextField, Boolean> jTextFieldBeanProperty = BeanProperty.create("enabled");
AutoBinding<SurferPreferences, Boolean, JTextField, Boolean> autoBinding_5 = Bindings
.createAutoBinding(UpdateStrategy.READ, surferPreferencesModel,
surferPreferencesModelBeanProperty, fullNameJTextField,
jTextFieldBeanProperty);
autoBinding_5.bind();
//
AutoBinding<SurferPreferences, Boolean, JTextField, Boolean> autoBinding_6 = Bindings
.createAutoBinding(UpdateStrategy.READ, surferPreferencesModel,
surferPreferencesModelBeanProperty, displayNameJTextField,
jTextFieldBeanProperty);
autoBinding_6.bind();
//
BeanProperty<SurferPreferences, String> surferPreferencesBeanProperty = BeanProperty
.create("status");
BeanProperty<JLabel, String> jLabelBeanProperty = BeanProperty.create("text");
AutoBinding<SurferPreferences, String, JLabel, String> autoBinding_7 = Bindings
.createAutoBinding(UpdateStrategy.READ_WRITE, surferPreferencesModel,
surferPreferencesBeanProperty, lblStatus, jLabelBeanProperty);
autoBinding_7.bind();
//
BindingGroup bindingGroup = new BindingGroup();
//
bindingGroup.addBinding(autoBinding);
bindingGroup.addBinding(autoBinding_1);
bindingGroup.addBinding(autoBinding_2);
bindingGroup.addBinding(autoBinding_3);
bindingGroup.addBinding(autoBinding_4);
bindingGroup.addBinding(autoBinding_5);
bindingGroup.addBinding(autoBinding_6);
bindingGroup.addBinding(autoBinding_7);
return bindingGroup;
}
public JButton getBtnConnect() {
return btnConnect;
}
public JButton getBtnExit() {
return btnExit;
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.netcracker.financeapp.dao;
import com.netcracker.financeapp.mapping.Type;
import java.util.ArrayList;
import org.apache.ibatis.annotations.Param;
public interface TypeMapper {
Type getTypeById(int idIncome);
Type getParentTypeByChildId(int idType);
Type getTypeByName(String typeName);
Type getParentTypeByChildName(String typeName);
ArrayList<String> getIncomeTypeNames();
ArrayList<String> getSpendingTypeNames();
int insertIncomeType(String typeName);
int insertSpendingType(String typeName);
int deleteTypeByName(@Param("typeName") String typeName);
}
|
package com.tencent.mm.plugin.webview.ui.tools;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
class QRCodeIntroductionWebViewUI$2 implements OnMenuItemClickListener {
final /* synthetic */ QRCodeIntroductionWebViewUI pWm;
QRCodeIntroductionWebViewUI$2(QRCodeIntroductionWebViewUI qRCodeIntroductionWebViewUI) {
this.pWm = qRCodeIntroductionWebViewUI;
}
public final boolean onMenuItemClick(MenuItem menuItem) {
this.pWm.finish();
return true;
}
}
|
package com.sudipatcp.linkedlist;
import java.util.ArrayList;
import static com.sudipatcp.linkedlist.LinkedListUtilites.createLinkedList;
public class UniqueLinkedList {
public static ListNode deleteDuplicates(ListNode A) {
ListNode dummy = new ListNode(0);
dummy.next = A;
ListNode prev = dummy;
ListNode current = A;
while (current != null)
{
while (current.next != null && prev.next.val == current.next.val)
current = current.next;
if (prev.next == current)
prev = prev.next;
else
prev.next = current.next;
current = current.next;
}
A = dummy.next;
return A;
}
public static void main(String[] args) {
int a[] = {2,2,2,2,2,2,3,5,6,20,20};
ArrayList<Integer> list1 = new ArrayList<>();
for(int v : a){
list1.add(v);
}
ListNode ln1 = createLinkedList(list1);
//System.out.println(lPalin(ln1));
deleteDuplicates(ln1);
}
}
|
package lk.cb006789.eea.mercstore.repo;
import lk.cb006789.eea.mercstore.models.UserroleModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserroleRepository extends JpaRepository<UserroleModel,String> {
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*/
package com.cnk.travelogix.operations.facades.impl;
import de.hybris.platform.commercefacades.storesession.StoreSessionFacade;
import de.hybris.platform.commercefacades.storesession.data.CurrencyData;
import de.hybris.platform.commercefacades.user.UserFacade;
import de.hybris.platform.core.model.user.EmployeeModel;
import de.hybris.platform.core.model.user.UserModel;
import de.hybris.platform.servicelayer.dto.converter.Converter;
import de.hybris.platform.servicelayer.user.UserService;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import com.cnk.travelogix.operations.employee.data.EmployeeData;
import com.cnk.travelogix.operations.facades.EmployeeFacade;
import com.cnk.travelogix.operations.services.OperationUserService;
/**
*
*/
public class DefaultEmployeeFacade implements EmployeeFacade
{
private UserService userService;
private Converter<UserModel, EmployeeData> employeeConverter;
private StoreSessionFacade storeSessionFacade;
private UserFacade userFacade;
private OperationUserService operationUserService;
@Override
public EmployeeData getCurrentEmployee()
{
if (getCurrentUser() instanceof EmployeeModel)
{
return getEmployeeConverter().convert(getCurrentUser());
}
return new EmployeeData();
}
private UserModel getCurrentUser()
{
return getUserService().getCurrentUser();
}
@Override
public void loginSuccess()
{
final EmployeeData userData = getCurrentEmployee();
// Update the session currency (which might change the cart currency)
if (!updateSessionCurrency(userData.getCurrency(), getStoreSessionFacade().getDefaultCurrency()))
{
// Update the user
getUserFacade().syncSessionCurrency();
}
// Update the user
getUserFacade().syncSessionLanguage();
}
@Override
public String getCurrentEmployeeUid()
{
return getCurrentUser().getUid();
}
protected boolean updateSessionCurrency(final CurrencyData preferredCurrency, final CurrencyData defaultCurrency)
{
if (preferredCurrency != null)
{
final String currencyIsoCode = preferredCurrency.getIsocode();
// Get the available currencies and check if the currency iso code is supported
final Collection<CurrencyData> currencies = getStoreSessionFacade().getAllCurrencies();
for (final CurrencyData currency : currencies)
{
if (StringUtils.equals(currency.getIsocode(), currencyIsoCode))
{
// Set the current currency
getStoreSessionFacade().setCurrentCurrency(currencyIsoCode);
return true;
}
}
}
// Fallback to the default
getStoreSessionFacade().setCurrentCurrency(defaultCurrency.getIsocode());
return false;
}
/**
* @return the userService
*/
public UserService getUserService()
{
return userService;
}
/**
* @param userService
* the userService to set
*/
public void setUserService(final UserService userService)
{
this.userService = userService;
}
/**
* @return the employeeConverter
*/
public Converter<UserModel, EmployeeData> getEmployeeConverter()
{
return employeeConverter;
}
/**
* @param employeeConverter
* the employeeConverter to set
*/
public void setEmployeeConverter(final Converter<UserModel, EmployeeData> employeeConverter)
{
this.employeeConverter = employeeConverter;
}
/**
* @return the storeSessionFacade
*/
public StoreSessionFacade getStoreSessionFacade()
{
return storeSessionFacade;
}
/**
* @param storeSessionFacade
* the storeSessionFacade to set
*/
public void setStoreSessionFacade(final StoreSessionFacade storeSessionFacade)
{
this.storeSessionFacade = storeSessionFacade;
}
/**
* @return the userFacade
*/
public UserFacade getUserFacade()
{
return userFacade;
}
/**
* @param userFacade
* the userFacade to set
*/
public void setUserFacade(final UserFacade userFacade)
{
this.userFacade = userFacade;
}
@Override
public EmployeeData viewEmployeedata(final String uid)
{
final EmployeeModel employeeModel = (EmployeeModel) getUserService().getUserForUID(uid);
return employeeConverter.convert(employeeModel);
}
@Override
public List<EmployeeData> getGroupMembers(final String group)
{
return getEmployeeConverter().convertAll(getOperationUserService().getGroupMembers(group));
}
/**
* @return the operationUserService
*/
public OperationUserService getOperationUserService()
{
return operationUserService;
}
/**
* @param operationUserService
* the operationUserService to set
*/
public void setOperationUserService(final OperationUserService operationUserService)
{
this.operationUserService = operationUserService;
}
}
|
package baekjoon.numbertheory_combinatorics;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Test_2981 {
//검문
//공약수를 구하는 문제인데 나머지가 같다는 것에 초점을 맞추어 앞 뒤 값을 뺀 수 끼리 공약수를 구하면 되는 문제
//생각을 하지 못하였기에 검색해서 해결..
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int[] numbers = new int[N];
for (int i = 0; i < N; i++) {
numbers[i] = Integer.parseInt(br.readLine());
}
Arrays.sort(numbers);
int gcdValue = numbers[1] - numbers[0];
for (int i = 2; i < N; i++) {
gcdValue = getGCDValue(gcdValue, numbers[i] - numbers[i-1]);
}
for (int i = 2; i <= gcdValue; i++) {
if (gcdValue % i == 0) {
System.out.print(i + " ");
}
}
}
static int getGCDValue(int first, int second) {
while (second != 0) {
int remainder = first % second;
first = second;
second = remainder;
}
return first;
}
}
|
package little.dark.age;
import java.util.ArrayList;
import java.util.Scanner;
public class LittleDarkAge {
public static void main(String[] args) {
ArrayList<String> name = new ArrayList<>();
ArrayList<String> uf = new ArrayList<>();
ArrayList<String> popu = new ArrayList<>();
Scanner scanner = new Scanner(System.in);
String answer = "";
{
do {
System.out.println("O nome de uma cidade:");
name.add(scanner.next());
System.out.println("Seu UF: ");
uf.add(scanner.next());
System.out.println("Sua População: ");
popu.add(scanner.next());
System.out.println("Deseja adicionar mais cidades?(sim/não)");
answer = scanner.next();
} while (answer.equals("sim"));
if (answer.equals("sim"));
else {
System.out.println("Sua lista de cidades é:");
for (int i = 0; i < name.size(); i++) {
System.out.print(name.get(i)+"\t");
System.out.print(uf.get(i)+"\t");
System.out.print(popu.get(i));
System.out.println("");
}
}
}
}
}
|
package com.cms.service;
import java.awt.Label;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import net.sf.json.JSONArray;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import com.cms.common.dao.impl.JdbcDaoImpl;
import com.cms.common.form.RequestDataForm;
import com.cms.common.form.ResponseDataForm;
import com.cms.common.service.IService;
import com.cms.common.utils.DateUtil;
import com.cms.controller.DatatablesController;
@Service("indexDataService")
public class IndexDataService implements IService{
protected static Logger logger = Logger.getLogger(DatatablesController.class);
@Resource
private JdbcDaoImpl jdbcDao;
@Override
public ResponseDataForm service(RequestDataForm requestDataForm)
throws Exception {
ResponseDataForm rdf = new ResponseDataForm();
logger.debug("----------------- start indexDataService --------------------");
Map<String , Object> map = new HashMap<String, Object>();
String roomCnt = jdbcDao.queryForString("select count(1) from sys_room_tab where is_del = 'N'",null);
map.put("roomCnt", roomCnt);
String moveInCnt = jdbcDao.queryForString("select count(1) from sys_user_tab where is_move_in = 1 and is_move_out = 0 and is_del = 'N'", null);
map.put("moveInCnt", moveInCnt);
StringBuffer mSql = new StringBuffer();
mSql.append("SELECT ");
mSql.append(" SUM(spt.total_price) monthFee ");
mSql.append("FROM ");
mSql.append(" sys_pay_tab spt ");
mSql.append("WHERE ");
mSql.append(" 1 = 1 ");
mSql.append("AND spt.pay_date >= ? ");
mSql.append("AND spt.pay_date <= ? ");
String firstDayOfCurrentMonth = DateUtil.getMonthFirstDayStr() + " 00:00:00";
String lastDayOfCurrentMonth = DateUtil.getMonthLastDayStr() + " 24:59:59";
String mPay = jdbcDao.queryForString(mSql.toString(), new Object[]{firstDayOfCurrentMonth,lastDayOfCurrentMonth},"0");
map.put("mPay", mPay);
String firstDayOfYear = DateUtil.getCurrentYear() + "-01-01 00:00:00";
String lastDayOfYear = DateUtil.getCurrentYear() + "-12-31 24:59:59";
String yPay = jdbcDao.queryForString(mSql.toString(), new Object[]{firstDayOfYear,lastDayOfYear},"0");
map.put("yPay", yPay);
map.put("RoomLegendData",getRoomStateItem()); // 获取小区住房情况饼图数据项
map.put("RoomSeriesData", getRoomStateData()); // 获取小区住房使用情况饼图数据
map.put("PayLegendData", getPayStateItem()); // 获取小区当月缴费情况饼图数据项
map.put("PaySeriesData", getPayStateData()); // 获取小区当月缴费情况饼图数据
System.out.println(map.toString());
rdf.setResult(ResponseDataForm.SESSFUL);
rdf.setResultObj(map);
logger.debug("----------------- end indexDataService --------------------");
return rdf;
}
/**
* 获取小区住房情况饼图数据项
* @author lxh
* @date 2016 下午2:48:29
* @return String
*/
public String getRoomStateItem(){
StringBuffer legendData = new StringBuffer();
legendData.append("SELECT ");
legendData.append(" dc.text name ");
legendData.append("FROM ");
legendData.append(" sys_room_tab srt ");
legendData.append("LEFT JOIN dict_common dc ON dc.`code` = srt.room_state ");
legendData.append("AND dc.type = 'ROOM_STATE' ");
legendData.append("GROUP BY ");
legendData.append(" srt.room_state ");
return getLegendData(legendData.toString());
}
/**
* 获取小区住房使用情况饼图数据
* @author lxh
* @date 2016 下午2:48:40
* @return String
*/
public String getRoomStateData(){
StringBuffer seriesData = new StringBuffer();
seriesData.append("SELECT ");
seriesData.append(" COUNT(srt.room_state) value, ");
seriesData.append(" dc.text name ");
seriesData.append("FROM ");
seriesData.append(" sys_room_tab srt ");
seriesData.append("LEFT JOIN dict_common dc ON dc.`code` = srt.room_state ");
seriesData.append("AND dc.type = 'ROOM_STATE' ");
seriesData.append("WHERE srt.is_del = 'N' ");
seriesData.append("GROUP BY ");
seriesData.append(" srt.room_state ");
return getSeriesData(seriesData.toString());
}
/**
* 获取小区缴费情况数据项
* @author lxh
* @date 2016 下午2:48:45
* @return String
*/
public String getPayStateItem(){
String sql = "SELECT spt.fee_name name FROM sys_pay_tab spt where spt.pay_date >= ? and spt.pay_date <= ? AND spt.is_del = 'N' GROUP BY spt.fee_name";
String firstDayOfCurrentMonth = DateUtil.getMonthFirstDayStr() + " 00:00:00";
String lastDayOfCurrentMonth = DateUtil.getMonthLastDayStr() + " 24:59:59";
return getLegendData(sql,new Object[]{firstDayOfCurrentMonth,lastDayOfCurrentMonth});
}
public String getPayStateData(){
StringBuffer sb = new StringBuffer();
sb.append("SELECT ");
sb.append(" spt.fee_name name, ");
sb.append(" SUM(spt.total_price) value ");
sb.append("FROM ");
sb.append(" sys_pay_tab spt ");
sb.append("WHERE ");
sb.append(" 1 = 1 ");
sb.append("AND spt.pay_date >= ? ");
sb.append("AND spt.pay_date <= ? ");
sb.append("AND spt.is_del = 'N' ");
sb.append("GROUP BY ");
sb.append(" spt.fee_name ");
String firstDayOfCurrentMonth = DateUtil.getMonthFirstDayStr() + " 00:00:00";
String lastDayOfCurrentMonth = DateUtil.getMonthLastDayStr() + " 24:59:59";
return getSeriesData(sb.toString(),new Object[]{firstDayOfCurrentMonth,lastDayOfCurrentMonth});
}
/**
* 获取饼图数据项
* @author lxh
* @date 2016 下午2:48:53
* @param sql
* @return String
*/
public String getLegendData(String sql){
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
list = jdbcDao.queryForList(sql, null);
JSONArray j = JSONArray.fromObject(list);
return j.toString();
}
/**
* 获取饼图数据项
* @author lxh
* @date 2016 下午11:35:44
* @param sql 查询语句
* @param o 参数 object[]{}
* @return String
*/
public String getLegendData(String sql,Object[] o){
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
list = jdbcDao.queryForList(sql, o);
JSONArray j = JSONArray.fromObject(list);
return j.toString();
}
/**
* 获取饼图数据
* @author lxh
* @date 2016 下午2:48:58
* @param sql 查询语句
* @return String
*/
public String getSeriesData(String sql){
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
list = jdbcDao.queryForList(sql, null);
JSONArray j = JSONArray.fromObject(list);
return j.toString();
}
/**
* 获取饼图数据
* @author lxh
* @date 2016 下午11:34:42
* @param sql 查询语句
* @param o 参数 object[]{}
* @return String
*/
public String getSeriesData(String sql,Object[] o){
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
list = jdbcDao.queryForList(sql, o);
JSONArray j = JSONArray.fromObject(list);
return j.toString();
}
}
|
package cn.bs.zjzc.model.bean;
import java.util.Map;
/**
* Created by yiming on 2016/6/20.
*/
public class RegisterOrderTakerRequestBody {
public String address;
public String my_real_name;
public String ID_card_number;
public Map<String, UploadFileBody> photoMap;
public RegisterOrderTakerRequestBody(String address, String my_real_name, String ID_card_number, Map<String, UploadFileBody> photoMap) {
this.address = address;
this.my_real_name = my_real_name;
this.ID_card_number = ID_card_number;
this.photoMap = photoMap;
}
}
|
package com.example.disastermanagement.Fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.disastermanagement.Files.AndroidVersion;
import com.example.disastermanagement.Files.DataAdapter;
import com.example.disastermanagement.Files.Feed;
import com.example.disastermanagement.R;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import org.json.JSONObject;
import java.util.ArrayList;
public class FeedFragment extends android.support.v4.app.Fragment {
private DatabaseReference databaseReference;
private FirebaseAuth firebaseAuth;
private String description,area,image,dateTime,category;
ArrayList<Feed> feedArrayList;
private RecyclerView recyclerView;
private final String android_version_names[] = {
"Donut",
"Eclair",
"Froyo",
"Gingerbread",
"Honeycomb",
"Ice Cream Sandwich",
"Jelly Bean",
"KitKat",
"Lollipop",
"Marshmallow"
};
private final String android_image_urls[] = {
"https://firebasestorage.googleapis.com/v0/b/sih2018-11ae3.appspot.com/o/Photos%2F1522407330?alt=media&token=c61c92bf-d5c0-4d63-b518-a4be62d489cb",
"https://firebasestorage.googleapis.com/v0/b/sih2018-11ae3.appspot.com/o/Photos%2F1522407330?alt=media&token=c61c92bf-d5c0-4d63-b518-a4be62d489cb",
"https://firebasestorage.googleapis.com/v0/b/sih2018-11ae3.appspot.com/o/Photos%2F1522407330?alt=media&token=c61c92bf-d5c0-4d63-b518-a4be62d489cb",
"https://firebasestorage.googleapis.com/v0/b/sih2018-11ae3.appspot.com/o/Photos%2F1522407330?alt=media&token=c61c92bf-d5c0-4d63-b518-a4be62d489cb",
"https://firebasestorage.googleapis.com/v0/b/sih2018-11ae3.appspot.com/o/Photos%2F1522407330?alt=media&token=c61c92bf-d5c0-4d63-b518-a4be62d489cb",
"https://firebasestorage.googleapis.com/v0/b/sih2018-11ae3.appspot.com/o/Photos%2F1522407330?alt=media&token=c61c92bf-d5c0-4d63-b518-a4be62d489cb"
};
private final String cat[]=new String[1000];
private int ctr=0;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_feed, container, false);
recyclerView = (RecyclerView)view.findViewById(R.id.card_recycler_view);
feedArrayList=new ArrayList<Feed>();
firebaseAuth=FirebaseAuth.getInstance();
databaseReference=FirebaseDatabase.getInstance().getReference("Data");
databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot usersnapshot:dataSnapshot.getChildren()){
System.out.println("outer");
//
for(DataSnapshot entry:usersnapshot.getChildren()){
System.out.println("2nd loop");
Feed feed = entry.getValue(Feed.class);
feedArrayList.add(feed);
/*category = feed.category;
System.out.println(category);
cat[ctr] = category;
ctr++;*/
}
}
initViews();
}
@Override
public void onCancelled(DatabaseError databaseError) {
System.out.println("error"+databaseError.getMessage());
}
});
return view;
}
private void initViews(){
recyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
//prepareData();
DataAdapter adapter = new DataAdapter(getContext(),feedArrayList);
recyclerView.setAdapter(adapter);
}
private void prepareData(){
for (Feed c:feedArrayList){
if (c.getImage()==""){
c.setImage("https://firebasestorage.googleapis.com/v0/b/sih2018-11ae3.appspot.com/o/Photos%2F1024px-No_image_available.png?alt=media&token=adf11caa-adf6-4b98-a86c-876bbe9ef8de");
}
}
/*ArrayList android_version = new ArrayList<>();
for(int i=0;i<cat.length;i++){
AndroidVersion androidVersion = new AndroidVersion();
androidVersion.setAndroid_version_name(cat[i]);
androidVersion.setAndroid_image_url(android_image_urls[i]);
android_version.add(androidVersion);
}
return android_version;*/
}
}
|
package com.mysql.cj.protocol;
import com.mysql.cj.MessageBuilder;
import com.mysql.cj.Session;
import com.mysql.cj.TransactionEventHandler;
import com.mysql.cj.conf.PropertySet;
import com.mysql.cj.exceptions.ExceptionInterceptor;
import java.io.IOException;
import java.io.InputStream;
public interface Protocol<M extends Message> {
void init(Session paramSession, SocketConnection paramSocketConnection, PropertySet paramPropertySet, TransactionEventHandler paramTransactionEventHandler);
PropertySet getPropertySet();
void setPropertySet(PropertySet paramPropertySet);
MessageBuilder<M> getMessageBuilder();
ServerCapabilities readServerCapabilities();
ServerSession getServerSession();
SocketConnection getSocketConnection();
AuthenticationProvider<M> getAuthenticationProvider();
ExceptionInterceptor getExceptionInterceptor();
PacketSentTimeHolder getPacketSentTimeHolder();
void setPacketSentTimeHolder(PacketSentTimeHolder paramPacketSentTimeHolder);
PacketReceivedTimeHolder getPacketReceivedTimeHolder();
void setPacketReceivedTimeHolder(PacketReceivedTimeHolder paramPacketReceivedTimeHolder);
void connect(String paramString1, String paramString2, String paramString3);
void negotiateSSLConnection(int paramInt);
void beforeHandshake();
void afterHandshake();
void changeDatabase(String paramString);
void changeUser(String paramString1, String paramString2, String paramString3);
String getPasswordCharacterEncoding();
boolean versionMeetsMinimum(int paramInt1, int paramInt2, int paramInt3);
M readMessage(M paramM);
M checkErrorMessage();
void send(Message paramMessage, int paramInt);
ColumnDefinition readMetadata();
M sendCommand(Message paramMessage, boolean paramBoolean, int paramInt);
<T extends ProtocolEntity> T read(Class<T> paramClass, ProtocolEntityFactory<T, M> paramProtocolEntityFactory) throws IOException;
<T extends ProtocolEntity> T read(Class<Resultset> paramClass, int paramInt, boolean paramBoolean1, M paramM, boolean paramBoolean2, ColumnDefinition paramColumnDefinition, ProtocolEntityFactory<T, M> paramProtocolEntityFactory) throws IOException;
void setLocalInfileInputStream(InputStream paramInputStream);
InputStream getLocalInfileInputStream();
String getQueryComment();
void setQueryComment(String paramString);
<T extends com.mysql.cj.QueryResult> T readQueryResult(ResultBuilder<T> paramResultBuilder);
void close() throws IOException;
void configureTimezone();
void initServerSession();
void reset();
String getQueryTimingUnits();
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\com\mysql\cj\protocol\Protocol.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
|
package com.theIronYard.servlet;
import com.theIronYard.entity.Animal;
import com.theIronYard.entity.AnimalBreed;
import com.theIronYard.entity.AnimalType;
import com.theIronYard.service.AnimalService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
/**
* Created by jeffreydorney on 9/15/16.
*/
@WebServlet("")
public class AnimalListServlet extends AbstractServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
String name = getParameterAsString(req, "name");
req.setAttribute("name", name);
Integer typeId = getParameterAsInt(req, "typeId");
req.setAttribute("typeId", typeId);
Integer breedId = getParameterAsInt(req, "breedId");
req.setAttribute("breedId", breedId);
Integer id = getParameterAsInt(req, "id");
req.setAttribute("id", id);
// need to make sure listTypes is the correct method to call
List<AnimalType> types = animalService.listTypes();
req.setAttribute("types", types);
// need to make sure listTypes is the correct method to call
List<AnimalBreed> breeds = animalService.listBreeds();
req.setAttribute("breeds", breeds);
// need to make sure listAnimals is the correct method to call
List<Animal> animals = animalService.listAnimals();
req.setAttribute("animals", animals);
} catch (SQLException e) {
throw new ServletException("Sorry! Something went wrong!", e);
}
// forward req and resp to JSP
req.getRequestDispatcher("WEB-INF/animalList.jsp").forward(req, resp);
}
}
|
package com.pkjiao.friends.mm.activity;
import com.pkjiao.friends.mm.R;
import com.pkjiao.friends.mm.common.CommonDataStructure;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
public class AboutUsActivity extends Activity implements OnClickListener {
private RelativeLayout mReturnBtn;
private WebView mWebViewBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.about_us_layout);
mReturnBtn = (RelativeLayout) findViewById(R.id.about_us_return);
mWebViewBtn = (WebView) findViewById(R.id.about_us_url);
mReturnBtn.setOnClickListener(this);
WebSettings webSettings = mWebViewBtn.getSettings();
// 设置WebView属性,能够执行Javascript脚本
webSettings.setJavaScriptEnabled(true);
// 设置可以访问文件
webSettings.setAllowFileAccess(true);
// 设置支持缩放
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
// 加载需要显示的网页
// mWebViewBtn.loadUrl("http://123.57.136.5");
mWebViewBtn.loadUrl(CommonDataStructure.ABOUT_US_PATH);
// 设置Web视图
mWebViewBtn.setWebViewClient(new MyWebViewClient());
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.about_us_return: {
this.finish();
break;
}
default:
break;
}
}
// Web视图
private class MyWebViewClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}
|
package parking;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.FetchOptions;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.appengine.labs.repackaged.org.json.JSONException;
import com.google.appengine.labs.repackaged.org.json.JSONObject;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
public class RegisterSpotServlet extends HttpServlet {
private DatastoreService datastore;
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user == null) return;
// Get values
String address = req.getParameter("address_value");
String longitude_str = req.getParameter("longitude");
String latitude_str = req.getParameter("latitude");
double longitude = Double.parseDouble(longitude_str );
double latitude = Double.parseDouble(latitude_str);
int hourly_rate = Integer.parseInt(req.getParameter("hourly_rate"));
String master_key = latitude_str + "_" + longitude_str;
datastore = DatastoreServiceFactory.getDatastoreService();
Key parkingSpotKey = KeyFactory.createKey("parkingspot", master_key);
JSONObject resultJson = new JSONObject();
boolean success = false;
// Insert into data store if non-duplicate
if(isDuplicateParkingSpot(parkingSpotKey) == false)
{
Entity parkingSpot = new Entity("parkingspot", parkingSpotKey);
parkingSpot.setProperty("owner", user);
parkingSpot.setProperty("address", address);
parkingSpot.setProperty("longitude", longitude);
parkingSpot.setProperty("latitude", latitude);
parkingSpot.setProperty("hourly_rate", hourly_rate);
datastore.put(parkingSpot);
success = true;
}
try {
resultJson.put("status", success);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resp.setContentType("json");
resp.getWriter().println(resultJson);
}
private boolean isDuplicateParkingSpot(Key parkingSpotKey)
{
Query query = new Query("parkingspot", parkingSpotKey);
List<Entity> parkingSpot = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(1));
if(parkingSpot.size() == 1)
System.out.println("Duplicate ParkingSpot.");
return parkingSpot.size() == 1;
}
}
|
package com.hebe.controller;
import com.hebe.service.TodoService;
import com.hebe.vo.CalendarDTO;
import com.hebe.vo.TodoDTO;
import com.hebe.vo.TodoDTOList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api")
public class TodoController {
@Autowired
private TodoService TodoService;
// 접속유저의 전체 todolist 조회
// RequestBody는 post형식으로 json 받을 때 사용
@PostMapping("/todo")
public List<TodoDTO> selTodoList(TodoDTO param) {
List<TodoDTO> list = TodoService.selTodoList(param);
System.out.println("TodoList select : " + list);
return list;
}
// 접속유저의 날짜별 todolist 조회
@GetMapping("/todo")
public List<TodoDTO> dayTodoList(TodoDTO param) {
List<TodoDTO> list = TodoService.dayTodoList(param);
System.out.println("day : " + param.getRegdt());
for(int i = 0; i < list.toArray().length; i++) {
if (param.getRegdt().equals(list.get(i).getRegdt())) {
System.out.println("iuser : " + param.getIuser());
System.out.println(param.getRegdt() + " : " + list.get(i));
} else {
list.remove(i);
}
}
System.out.println(param.getRegdt() + "[list] : "+ list);
return list;
}
@PostMapping("/todo/regdt")
public List<CalendarDTO> monthData(CalendarDTO param) {
System.out.println(param.getMonth());
return TodoService.monthData(param);
}
// @PostMapping("/todo/cal") // 안쓰는ㄷ...듯?
// public String[] calAllList(TodoDTO param){
// List<TodoDTO> list = TodoService.calAllList(param);
// String[] strArr = new String[20];
// for(int i=0; i < TodoService.calAllList(param).toArray().length; i++){
// strArr[i] = list.get(i).getRegdt();
// System.out.println(list.get(i).getRegdt());
// };
// return strArr;
// }
// 접속유저의 todoList 작성
@PostMapping("/todo/insert")
public void insTodoList(@RequestBody TodoDTOList param) {
System.out.println(param);
TodoService.insTodoList(param);
}
// 접속유저의 todoList 수정
@PostMapping("/todo/update")
public void update(@RequestBody TodoDTO param) {
TodoService.updTodoList(param);
}
// 접속유저의 todoList 삭제
@PostMapping("/todo/delete")
public void delTodoList(@RequestBody TodoDTOList param) {
TodoService.delTodoList(param);
}
}
|
package com.mears.repositories;
import java.util.List;
import com.mears.entities.DriverSchedule;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
public interface DriverScheduleRepository extends MongoRepository<DriverSchedule, String>{
@Query("{driverNum : ?0}")
List<DriverSchedule> findByDriverNum(String driverNum);
}
|
package com.seu.care.bed.service;
import com.github.pagehelper.PageInfo;
import com.seu.care.bed.model.Bed;
import java.util.List;
public interface BedService {
PageInfo<Bed> listAll(Integer currPage,Bed bed);
Bed selById(Integer id);
void add(Bed bed);
void del(Integer id);
void update(Bed bed);
List<Bed> queryAll(Bed bed);
}
|
package com.github.rahmnathan.movie.info.api;
import com.github.rahmnathan.movie.info.data.MovieInfo;
@FunctionalInterface
public interface IMovieInfoProvider {
MovieInfo loadMovieInfo(String title);
}
|
package org.example;
import java.util.List;
import java.util.Objects;
public class SpellCheckerSingleton {
private final Lexicon dictionary = new OxfordDictionary();
private SpellCheckerSingleton() {
}
//basic singleton
public static SpellCheckerSingleton INSTANCE = new SpellCheckerSingleton();
public List<String> suggestions(String typo) {
return null;
}
}
|
package com.tencent.mm.plugin.sight.encode.ui;
import android.annotation.TargetApi;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.graphics.Bitmap.CompressFormat;
import android.media.MediaPlayer;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.RelativeLayout;
import com.tencent.mm.R;
import com.tencent.mm.a.e;
import com.tencent.mm.a.g;
import com.tencent.mm.compatible.b.j;
import com.tencent.mm.plugin.game.gamewebview.jsapi.biz.aq;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.plugin.sight.base.d;
import com.tencent.mm.plugin.sight.encode.a.b;
import com.tencent.mm.plugin.sight.encode.a.b.3;
import com.tencent.mm.sdk.b.a;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.MMFragmentActivity;
import java.util.List;
public class MainSightForwardContainerView extends RelativeLayout implements OnItemClickListener, a {
public View kWn;
private int mDuration;
private boolean mIsPause;
private boolean mIsPlaying;
public String nfA;
private boolean nfB;
public String nfC;
public float nfD;
private b nfE;
private boolean nfF;
public MMFragmentActivity nfG;
private boolean nfH;
private c nfI;
private boolean nfJ;
private MediaPlayer nfK;
public MainSightSelectContactView nfs;
public SightCameraView nft;
private b nfu;
public View nfv;
public View nfw;
public View nfx;
private Dialog nfy;
private boolean nfz;
public MainSightForwardContainerView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.nfy = null;
this.mIsPlaying = false;
this.nfz = true;
this.nfA = "";
this.nfB = false;
this.nfC = "";
this.mDuration = 1;
this.nfD = 1.0f;
this.mIsPause = false;
this.nfE = new b();
this.nfF = false;
this.nfH = false;
this.nfI = new 5(this);
this.nfJ = false;
}
public MainSightForwardContainerView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public final void aEI() {
a.sFg.c(this.nfI);
}
public final void bwn() {
boolean z = true;
x.i("MicroMsg.MainSightContainerView", "toggle play video, path %s, mute %B, playing %B", new Object[]{this.nfC, Boolean.valueOf(this.nfz), Boolean.valueOf(this.mIsPlaying)});
if (!this.nft.isPlaying()) {
this.nfz = true;
}
this.nft.aP(this.nfC, this.nfz);
if (this.nfz) {
hP(true);
} else {
hP(false);
}
this.mIsPlaying = true;
if (this.nfz) {
z = false;
}
this.nfz = z;
}
public final boolean BD() {
return !this.nfz;
}
public void setIsMute(boolean z) {
if (this.nft != null) {
this.nft.setIsMute(z);
}
}
public final void hO(boolean z) {
if (!this.nfB) {
this.nfB = true;
bi.hideVKB(this);
this.mIsPlaying = false;
this.nfz = true;
x.d("MicroMsg.MainSightContainerView", "dismiss sight view");
this.nfH = false;
this.nft.bwy();
if (this.nfu != null && z) {
this.nfu.bwp();
}
if (this.nfs != null) {
MainSightSelectContactView mainSightSelectContactView = this.nfs;
mainSightSelectContactView.nfB = true;
bi.hideVKB(mainSightSelectContactView);
mainSightSelectContactView.ngg.bwt();
mainSightSelectContactView.ngq.clear();
mainSightSelectContactView.ngp.clear();
mainSightSelectContactView.CU.setAdapter(null);
mainSightSelectContactView.CU.clearAnimation();
mainSightSelectContactView.setVisibility(8);
}
setCameraShadowAlpha(0.85f);
bwo();
hP(false);
this.nfA = "";
aEI();
}
}
public final void hP(boolean z) {
if (this.nfF != z) {
this.nfF = z;
if (!z) {
this.nfw.setVisibility(8);
this.kWn.setVisibility(8);
} else if (this.nfw.getVisibility() != 0) {
this.nft.postDelayed(new 4(this), 100);
}
}
}
public void setIMainSightViewCallback(b bVar) {
this.nfu = bVar;
}
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
int i2 = i - 1;
if (MainSightSelectContactView.wg(i2) && this.mIsPlaying) {
bwn();
} else if (c.Ls(this.nfs.jd(i2))) {
this.nfs.ngg.bws();
} else if (!c.Lr(this.nfs.jd(i2))) {
x.d("MicroMsg.MainSightContainerView", "on item click Item : %d", new Object[]{Integer.valueOf(i2)});
MainSightSelectContactView mainSightSelectContactView = this.nfs;
if (i2 >= 0 && i2 <= mainSightSelectContactView.ngi.getCount()) {
com.tencent.mm.ui.contact.a.a FM = mainSightSelectContactView.ngi.FM(i2);
if (FM != null) {
if (mainSightSelectContactView.ngq.contains(FM.guS.field_username)) {
mainSightSelectContactView.ngq.remove(FM.guS.field_username);
} else {
mainSightSelectContactView.ngq.add(FM.guS.field_username);
}
c.nfQ = mainSightSelectContactView.ngq.isEmpty();
c.nfR = !mainSightSelectContactView.ngq.isEmpty();
}
}
mainSightSelectContactView = this.nfs;
if (mainSightSelectContactView.ngi != null) {
mainSightSelectContactView.ngi.notifyDataSetChanged();
}
if (!BD()) {
bwn();
} else if (this.nfs.bwx()) {
if (this.kWn.getVisibility() == 0) {
this.kWn.setVisibility(8);
this.kWn.startAnimation(AnimationUtils.loadAnimation(this.nfG, R.a.fast_faded_out));
}
} else if (this.kWn.getVisibility() != 0) {
this.kWn.setVisibility(0);
this.kWn.startAnimation(AnimationUtils.loadAnimation(this.nfG, R.a.fast_faded_in));
}
if (this.nfs.ngg.bwr()) {
mainSightSelectContactView = this.nfs;
boolean contains = mainSightSelectContactView.ngi.FM(i2) == null ? false : mainSightSelectContactView.ngi.FM(i2).guS == null ? false : mainSightSelectContactView.ngq.contains(mainSightSelectContactView.ngi.FM(i2).guS.field_username);
if (contains) {
this.nfs.ngg.bws();
}
}
} else if (c.nfQ) {
this.nfH = true;
this.nft.bwy();
MMFragmentActivity mMFragmentActivity = this.nfG;
String Ll = d.Ll(this.nfC);
String str = this.nfC;
String str2 = this.nfA;
x.i("MicroMsg.SightRecorderHelper", "share video path %s, thumb path %s", new Object[]{str, Ll});
if (!e.cn(Ll)) {
try {
com.tencent.mm.sdk.platformtools.c.a(d.ad(str, 320, aq.CTRL_BYTE), 60, CompressFormat.JPEG, Ll, true);
} catch (Throwable e) {
x.printErrStackTrace("MicroMsg.SightRecorderHelper", e, "", new Object[0]);
x.e("MicroMsg.SightRecorderHelper", "save bitmap to image error");
}
}
Intent intent = new Intent();
intent.putExtra("KSightPath", str);
intent.putExtra("KSightThumbPath", Ll);
intent.putExtra("sight_md5", str2);
intent.putExtra("KSightDraftEntrance", false);
intent.putExtra("Ksnsupload_source", 0);
intent.putExtra("KSnsPostManu", true);
intent.putExtra("KTouchCameraTime", bi.VE());
com.tencent.mm.bg.d.b(mMFragmentActivity, "sns", ".ui.SightUploadUI", intent, 5985);
if (this.nfJ) {
h.mEJ.h(11442, new Object[]{Integer.valueOf(3), Integer.valueOf(3)});
} else {
h.mEJ.h(11442, new Object[]{Integer.valueOf(1), Integer.valueOf(3)});
}
}
}
public final void aTi() {
String str = "MicroMsg.MainSightContainerView";
String str2 = "do send to friend, loadingDialog null %B";
Object[] objArr = new Object[1];
objArr[0] = Boolean.valueOf(this.nfy == null);
x.i(str, str2, objArr);
if (!bi.oW(this.nfC) && !this.nfs.bwx()) {
String str3;
boolean z;
List<String> selectedContact = this.nfs.getSelectedContact();
h.mEJ.h(11443, new Object[]{Integer.valueOf(1), Integer.valueOf(3), Integer.valueOf(selectedContact.size())});
6 6 = new 6(this, selectedContact);
if (selectedContact.size() == 1) {
b bVar = this.nfE;
String str4 = this.nfC;
int i = this.mDuration;
str3 = this.nfA;
str2 = (String) selectedContact.get(0);
if (bi.oW(str4)) {
x.w("MicroMsg.SightRecorderHelper", "remux and send sight error: in path is null");
b.a(6, -1);
} else if (bi.oW(str2)) {
x.w("MicroMsg.SightRecorderHelper", "remux and send sight error: toUser null");
b.a(6, -1);
} else if (!e.cn(str4) || e.cm(str4) <= 0) {
x.w("MicroMsg.SightRecorderHelper", "file not exist or file size error");
com.tencent.mm.ui.base.h.bA(ad.getContext(), ad.getContext().getString(com.tencent.mm.plugin.ak.a.h.short_video_input_file_error));
} else {
x.i("MicroMsg.SightRecorderHelper", "do share to friends, check md5 target[%s] current[%s]", new Object[]{str3, g.cu(str4)});
if (bi.aG(str3, "").equals(g.cu(str4))) {
com.tencent.mm.kernel.g.Ek();
if (com.tencent.mm.kernel.g.Em().H(new 3(bVar, str2, 6, str4, i)) < 0) {
x.e("MicroMsg.SightRecorderHelper", "post short video encoder error");
b.a(6, -1);
}
} else {
x.e("MicroMsg.SightRecorderHelper", "error md5, return");
b.a(6, -1);
}
}
} else {
b bVar2 = this.nfE;
String str5 = this.nfC;
int i2 = this.mDuration;
String str6 = this.nfA;
if (bi.oW(str5)) {
x.w("MicroMsg.SightRecorderHelper", "remux and send sight error: in path is null");
b.a(6, -1);
} else if (selectedContact == null || selectedContact.isEmpty()) {
x.w("MicroMsg.SightRecorderHelper", "remux and send sight error: toUser list empty");
b.a(6, -1);
} else if (!e.cn(str5) || e.cm(str5) <= 0) {
x.w("MicroMsg.SightRecorderHelper", "file not exist or file size error");
com.tencent.mm.ui.base.h.bA(ad.getContext(), ad.getContext().getString(com.tencent.mm.plugin.ak.a.h.short_video_input_file_error));
} else {
x.i("MicroMsg.SightRecorderHelper", "do share to friends, check md5 target[%s] current[%s]", new Object[]{str6, g.cu(str5)});
if (bi.aG(str6, "").equals(g.cu(str5))) {
com.tencent.mm.kernel.g.Ek();
if (com.tencent.mm.kernel.g.Em().H(new b$4(bVar2, str5, selectedContact, str6, 6, i2)) < 0) {
x.e("MicroMsg.SightRecorderHelper", "post short video encoder error");
b.a(6, -1);
}
} else {
x.e("MicroMsg.SightRecorderHelper", "error md5, return");
b.a(6, -1);
}
}
}
if (this.nfs.getSelectedContact().size() > 1 || this.nfu == null) {
z = true;
} else {
this.nfu.Lq((String) this.nfs.getSelectedContact().get(0));
z = false;
}
if (this.nfG != null) {
try {
AssetFileDescriptor openFd = this.nfG.getAssets().openFd("sight_send_song.wav");
this.nfK = new j();
this.nfK.setDataSource(openFd.getFileDescriptor(), openFd.getStartOffset(), openFd.getLength());
openFd.close();
this.nfK.setOnCompletionListener(new 7(this));
this.nfK.setLooping(false);
this.nfK.prepare();
this.nfK.start();
} catch (Throwable e) {
x.printErrStackTrace("MicroMsg.MainSightContainerView", e, "", new Object[0]);
}
}
hO(z);
for (String str32 : selectedContact) {
if (str32.toLowerCase().endsWith("@chatroom")) {
h.mEJ.h(11442, new Object[]{Integer.valueOf(1), Integer.valueOf(2)});
} else {
h.mEJ.h(11442, new Object[]{Integer.valueOf(1), Integer.valueOf(1)});
}
}
}
}
public final void onPause() {
if (!this.nfH) {
this.nft.setVisibility(0);
hP(false);
this.nft.bwy();
this.mIsPause = true;
}
}
public final void onResume() {
if (!this.nfB) {
a.sFg.c(this.nfI);
a.sFg.b(this.nfI);
} else {
aEI();
}
if (this.mIsPause) {
bwn();
this.mIsPause = false;
}
}
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
if (z && !this.nfB && this.nfs != null) {
x.d("MicroMsg.MainSightContainerView", "change size l: %d, t: %d, r: %d, b: %d", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4)});
this.nfs.bww();
}
}
public void setIsForSns(boolean z) {
this.nfJ = z;
}
@TargetApi(11)
public void setCameraShadowAlpha(float f) {
float min = Math.min(1.0f, Math.max(0.0f, f));
if (com.tencent.mm.compatible.util.d.fR(11)) {
this.nfv.setAlpha(min);
} else {
Animation alphaAnimation = new AlphaAnimation(min, min);
alphaAnimation.setDuration(0);
alphaAnimation.setFillAfter(true);
this.nfv.startAnimation(alphaAnimation);
}
x.d("MicroMsg.MainSightContainerView", "set alpha: %f", new Object[]{Float.valueOf(min)});
if (min <= 0.0f) {
this.nfv.setVisibility(8);
Animation alphaAnimation2 = new AlphaAnimation(1.0f, 0.0f);
alphaAnimation2.setDuration(500);
this.nfv.startAnimation(alphaAnimation2);
return;
}
this.nfv.setVisibility(0);
}
public final void bwo() {
this.nfx.setVisibility(8);
}
public final void hN(boolean z) {
if (z) {
this.nfx.setVisibility(0);
setIsMute(true);
return;
}
bwo();
setIsMute(BD());
}
public final void bwl() {
this.nft.setVisibility(0);
hP(true);
}
public final void bwm() {
this.nft.setVisibility(4);
hP(false);
}
public int getViewHeight() {
int height = getHeight();
if (height <= 0) {
return getResources().getDisplayMetrics().heightPixels;
}
return height;
}
}
|
package strategy2.step5.modularization;
//Sonata차 : 중급엔진(EngineMid). 연비 15Km/l(Km15). 휘발유(FuelGasoline)
import strategy2.step5.component.*;
public class Sonata extends Car_same_part {
public Sonata() {
// engine = new EngineHigh();
setEngine(new EngineMid()); // i=10; == setI(10);
setKm(new Km15());
setFuel(new FuelGasoline());
}
@Override
public void shape() {
System.out.println("Sonata의 차모양은 door, sheet, handle로 이루어져 있습니다.");
}
}
|
package swm11.jdk.jobtreaming.back.config.security;
import io.jsonwebtoken.Claims;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.servlet.HandlerInterceptor;
import swm11.jdk.jobtreaming.back.app.user.model.MyUserDetails;
import swm11.jdk.jobtreaming.back.constants.AuthConstants;
import swm11.jdk.jobtreaming.back.utils.TokenUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Optional;
import static swm11.jdk.jobtreaming.back.constants.AuthConstants.CLAIMS_EMAIL;
import static swm11.jdk.jobtreaming.back.constants.AuthConstants.CLAIMS_ROLE;
@Log4j2
public class JwtInterceptor implements HandlerInterceptor {
@Resource(name = "userDetailsService")
private UserDetailsService userDetailsService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
String header = request.getHeader(AuthConstants.AUTH_HEADER);
if (header != null) {
header = header.split(" ")[1];
Optional<Claims> optional = TokenUtils.isValidToken(header);
if (optional.isPresent()) {
Claims claims = optional.get();
MyUserDetails myUserDetails = (MyUserDetails) userDetailsService.loadUserByUsername(TokenUtils.getEmailFromClaims(claims));
Authentication authentication = new UsernamePasswordAuthenticationToken(myUserDetails, "", myUserDetails.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(authentication);
return true;
}
}
response.sendRedirect("/error/unauthorized");
return false;
}
}
|
package com.tencent.mm.protocal;
import android.support.design.a$i;
public class c$jt extends c$g {
public c$jt() {
super("uploadImage", "uploadImage", a$i.AppCompatTheme_radioButtonStyle, true);
}
}
|
package com.company;
public interface Szuperhos {
public boolean legyoziE(Szuperhos d);
public double mekkoraAzEreje();
}
|
package gameClient;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class Frame extends JFrame
{
public Panel panel;
/**
* constructor to the enter frame of the game
* @param height
* @param width
* @throws IOException
*/
Frame(int height,int width) throws IOException
{
this.setSize(width,height);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.panel= new Panel(this.getWidth(), this.getHeight());
this.add(panel);
this.setVisible(false);
}
@Override
public void paint(Graphics g)
{
super.paint(g);
}
public static class Panel extends JPanel implements MouseListener
{
public int num;
public int id;
public TextField t,t2;
public Button b;
public boolean flag=false;
public static int pai=0;
public BufferedImage image;
/**
* constructor to the panel of the frame,
* this method sets the text fields for the level and the id, the "enter" button
* and set the background(pikachu image)
* @param width
* @param height
* @throws IOException
*/
public Panel(int width,int height) throws IOException {
this.image= ImageIO.read(new File("doc/background.png"));
this.num=-1000;
this.id=0;
this.setSize(width,height);
this.setVisible(false);
this.t=new TextField();
t.setText("please enter level num");
this.t2=new TextField();
t2.setText("please enter id");
this.b=new Button("enter");
b.addMouseListener(this);
this.add(t2);
this.add(b);
this.add(this.t);
}
/**
* this method set the location of the graphics object and paint them
* @param g
*/
@Override
public void paint(Graphics g)
{
super.paint(g);
g.drawImage(image,0,0,getWidth(),getHeight(),null);
t.setLocation((int)(getWidth()/2.5),(int)(getHeight()/1.9));
t2.setLocation((int)(getWidth()/2.5),t.getY()+20);
b.setLocation((int)(getWidth()/2.5),(int)(getHeight()/1.72));
g.setFont(new Font("welcome",1,40));
g.setColor(Color.BLACK);
g.drawString("welcome to pokemons game!",(int)(getWidth()/4),(int)(getHeight()/5.2));
}
@Override
public void mouseClicked(MouseEvent e)
{
}
/**
* this two next methods response to listen to the enter button and react to mouse opperations
* according the current texts of the text fields
* @param e
*/
@Override
public void mousePressed(MouseEvent e)
{
String s1=t.getText();
int numb=Integer.parseInt(s1);
String s2=t2.getText();
this.num=numb;
this.id=Integer.parseInt(s2);
this.flag=true;
}
@Override
public void mouseReleased(MouseEvent e)
{
String s1=t.getText();
int numb=Integer.parseInt(s1);
String s2=t2.getText();
this.num=numb;
this.id=Integer.parseInt(s2);
this.flag=true;
}
@Override
public void mouseEntered(MouseEvent e)
{
}
@Override
public void mouseExited(MouseEvent e)
{
}
public boolean getFlag()
{
return this.flag;
}
}
}
|
package com.test.basics;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
/**
* Created by srikanth on 29/1/17.
*/
public class MultipleWebElements {
String baseUrl = "http://getbootstrap.com/";
WebDriver driver;
@BeforeClass
public void testSetup(){
System.setProperty("webdriver.chrome.driver", "/home/srikanth/Downloads/softwares/drivers/chromedriver");
//open browser
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get(baseUrl);
}
@Test(enabled = false)
public void verifyMenuItems() throws InterruptedException {
WebElement leftNavBar = driver.findElement(
By.cssSelector("nav.collapse.navbar-collapse > ul:nth-child(1)"));
List<WebElement> liItems = leftNavBar.findElements(By.tagName("li"));
System.out.println("List items available = "+liItems.size());
int noOfItems = liItems.size();
/*
for(int i=0;i<noOfItems;i++){
WebElement leftNavBar2 = driver.findElement(
By.cssSelector("nav.collapse.navbar-collapse > ul:nth-child(1)"));
List<WebElement> liItems2 = leftNavBar2.findElements(By.tagName("li"));
//click on the element
liItems2.get(i).click();
//navigate back to home page
driver.navigate().back();
Thread.sleep(1000);
}
*/
List<String> links = new ArrayList<String>();
//get all the links
for(int i=0; i<liItems.size(); i++){
WebElement element = liItems.get(i);
String link = element.findElement(By.tagName("a")).getAttribute("href");
links.add(link);
}
System.out.println("Total links available = "+links.size());
//iterate over the arrays
for (int j=0; j<links.size(); j++){
System.out.println("Opening link "+links.get(j));
driver.get(links.get(j));
driver.navigate().back();
Thread.sleep(1000);
}
}
@Test
public void verifyImages() throws InterruptedException {
List<WebElement> images = driver.findElements(By.tagName("img"));
List<String> imageLinks = new ArrayList<String>();
for(int i=0;i<images.size();i++){
imageLinks.add(images.get(i).getAttribute("src"));
}
for(int j=0;j<imageLinks.size();j++){
driver.get(imageLinks.get(j));
Thread.sleep(2000);
driver.navigate().back();
Thread.sleep(1000);
}
}
}
|
package com.tencent.mm.plugin.gallery.view;
import com.tencent.mm.plugin.gallery.view.MultiGestureImageView.g;
class MultiGestureImageView$g$1 implements Runnable {
final /* synthetic */ g jFo;
MultiGestureImageView$g$1(g gVar) {
this.jFo = gVar;
}
public final void run() {
this.jFo.jFl.getImageMatrix().getValues(this.jFo.jFk);
float f = this.jFo.jFk[2];
float scale = this.jFo.jFl.getScale() * ((float) this.jFo.jFl.getImageWidth());
if (scale < ((float) MultiGestureImageView.g(this.jFo.jFj))) {
scale = (((float) MultiGestureImageView.g(this.jFo.jFj)) / 2.0f) - (scale / 2.0f);
} else {
scale = 0.0f;
}
scale -= f;
if (scale >= 0.0f) {
this.jFo.bwt = true;
} else if (Math.abs(scale) <= 5.0f) {
this.jFo.bwt = true;
} else {
scale = (-((float) (((double) Math.abs(scale)) - Math.pow(Math.sqrt((double) Math.abs(scale)) - 1.0d, 2.0d)))) * 2.0f;
}
this.jFo.jFl.V(scale, 0.0f);
}
}
|
package oOPSConceptPart1;
public class CallByValueAndCallByReference {
int p;
int q;
public static void main(String[] args) {
CallByValueAndCallByReference obj = new CallByValueAndCallByReference();
int x = 10;
int y = 20;
int d = obj.testSum(x, y); //this is called - call by value or pass by value
System.out.println(d);
obj.p=30;
obj.q=40;
// before swap
System.out.println(obj.p);
System.out.println(obj.q);
obj.swap(obj); // passed the object reference - obj
// after swap
System.out.println(obj.p);
System.out.println(obj.q);
}
public int testSum(int a , int b){
int c = a+b;
return c;
}
public void swap(CallByValueAndCallByReference t){ // this is called - call by reference or pass by reference
int temp;
temp = t.p; // temp will be 30
t.p = t.q; // t.p will be 40
t.q = temp; // t.q will be 30
}
}
|
package com.lti.classwork;
import org.testng.annotations.Test;
public class GroupingTestCases
{
@Test(groups= {"Smoke Testing","Regression Testing"})
public void TestCase1()
{
System.out.println("TestCase1");
}
@Test(groups= {"Smoke Testing","Regression Testing"})
public void TestCase2()
{
System.out.println("TestCase2");
}
@Test(groups= {"Functional Testing","Sanity Testing"})
public void TestCase3()
{
System.out.println("TestCase3");
}
}
|
/**
@author Chazwarp923
*/
package tech.chazwarp923.unifieditems.item;
public class UIItemGem extends UIItem {
protected UIItemGem(String unlocalizedName) {
super(unlocalizedName);
}
}
|
package com.measuring.equipment.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class LaboratoryDTO {
private Long id;
private String laboratoryName;
private String address;
private String contactNumber;
private String emailId;
private String calibrationScope;
private String scopeCopy;
private String certificationDetails;
private String certificationNo;
private String certificationCopy;
private String certificattionDate;
private String expiryDate;
private String note;
private String reminderOneMonthBeforeExpiryDate;
}
|
/**
* ファイル名 : MVsmMemPhonNoMapper.java
* 作成者 : luantx
* 作成日時 : 2018/05/31
* Copyright © 2017-2018 TAU Corporation. All Rights Reserved.
*/
package jp.co.tau.web7.admin.supplier.mappers;
import org.apache.ibatis.annotations.Mapper;
import jp.co.tau.web7.admin.supplier.entity.MVsmMemPhonNoEntity;
import jp.co.tau.web7.admin.supplier.mappers.common.BaseMapper;
/**
* <p>
* クラス名 : MVsmMemPhonNoMapper
* </p>
* <p>
* 説明 : 会員企業情報メンテナンス
* </p>
*
* @author luantx
* @since 2018/05/31
*/
@Mapper
public interface MVsmMemPhonNoMapper extends BaseMapper<MVsmMemPhonNoEntity> {
/**
* <p>
* 説明 :FIXME: update MVsmMemPhonNoEntity
* </p>
* @author Luantx
* @since 2018/05/31
* @param MVsmMemPhonNoEntity mVsmMemPhonNoEntity
* @return int
*/
public int updateMVsmMemPhonNo(MVsmMemPhonNoEntity mVsmMemPhonNoEntity);
}
|
import java.util.List;
import java.util.ArrayList;
public class UserNode{
private UserInfo userInfo;
private List<UserNode> child;
public UserNode(UserEntry userEntry){
userInfo = new UserInfo(userEntry);
//child = new ArrayList<Node>();
}
public boolean contains(ActivityEntry activityEntry){
return userInfo.contains(activityEntry);
}
public UserNode find_son(ActivityEntry activityEntry){
for(int i = 0; i < child.size(); i++) {
if(child.get(i).contains(activityEntry)){
return child.get(i);
}
}
return null;
}
public void show(){
userInfo.show();
}
public void addEntry(ActivityEntry activityEntry){
//child.add(new Node(activityEntry));
}
}
|
package com.chengfu.android.fuplayer.demo;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.ExpandableListView;
import com.chengfu.android.fuplayer.demo.bean.Media;
import com.chengfu.android.fuplayer.demo.bean.MediaGroup;
import com.chengfu.android.fuplayer.demo.ui.GroupListAdapter;
import com.chengfu.android.fuplayer.demo.ui.MediaListAdapter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private MediaGroupListAdapter mediaGroupListAdapter;
private List<MediaGroup> mediaGroupList;
RecyclerView recyclerView;
List<MediaGroup> dataList;
GroupListAdapter listAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
dataList = getMediaGroupList();
listAdapter = new GroupListAdapter();
listAdapter.submitList(dataList);
recyclerView.setAdapter(listAdapter);
}
private List<MediaGroup> getMediaGroupList() {
List<MediaGroup> mediaGroups = new ArrayList<>();
JSONArray ja = null;
try {
ja = new JSONArray(getMediaGroupListString());
} catch (JSONException e) {
e.printStackTrace();
}
if (ja != null) {
for (int i = 0; i < ja.length(); i++) {
try {
mediaGroups.add(parsedMediaGroup(ja.getJSONObject(i)));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
return mediaGroups;
}
private MediaGroup parsedMediaGroup(JSONObject jo) {
MediaGroup mediaGroup = null;
if (jo != null) {
mediaGroup = new MediaGroup();
mediaGroup.setName(jo.optString("name"));
mediaGroup.setMediaList(parsedMediaList(jo.optJSONArray("media_list")));
}
return mediaGroup;
}
private ArrayList<Media> parsedMediaList(JSONArray ja) {
ArrayList<Media> mediaList = null;
if (ja != null) {
mediaList = new ArrayList<>();
for (int i = 0; i < ja.length(); i++) {
try {
mediaList.add(parsedMedia(ja.getJSONObject(i)));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
return mediaList;
}
private Media parsedMedia(JSONObject jo) {
Media media = null;
if (jo != null) {
media = new Media();
media.setName(jo.optString("name"));
media.setPath(jo.optString("path"));
media.setType(jo.optString("type"));
media.setTag(jo.optString("tag"));
}
return media;
}
private String getMediaGroupListString() {
InputStream inputStream = null;
String media_list = null;
try {
inputStream = getAssets().open("media_list.json");
byte[] bytes = new byte[inputStream.available()];
inputStream.read(bytes);
media_list = new String(bytes);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return media_list;
}
}
|
package cn.canlnac.onlinecourse.presentation.internal.di.modules;
import java.util.Map;
import cn.canlnac.onlinecourse.domain.executor.PostExecutionThread;
import cn.canlnac.onlinecourse.domain.executor.ThreadExecutor;
import cn.canlnac.onlinecourse.domain.interactor.CreateDocumentInCatalogUseCase;
import cn.canlnac.onlinecourse.domain.interactor.UseCase;
import cn.canlnac.onlinecourse.domain.repository.CatalogRepository;
import cn.canlnac.onlinecourse.presentation.internal.di.PerActivity;
import dagger.Module;
import dagger.Provides;
/**
* 注入模块.
*/
@Module
public class CreateDocumentInCatalogModule {
private final int catalogId;
private final Map<String,Object> document;
public CreateDocumentInCatalogModule(
int catalogId,
Map<String,Object> document
) {
this.catalogId = catalogId;
this.document = document;
}
@Provides
@PerActivity
UseCase provideCreateDocumentInCatalogUseCase(CatalogRepository catalogRepository, ThreadExecutor threadExecutor,
PostExecutionThread postExecutionThread){
return new CreateDocumentInCatalogUseCase(catalogId, document, catalogRepository, threadExecutor, postExecutionThread);
}
}
|
package com.tencent.mm.plugin.appbrand.k;
import com.tencent.mm.sdk.platformtools.x;
import java.security.KeyStore;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
public final class l implements X509TrustManager {
private LinkedList<X509TrustManager> glv = new LinkedList();
private LinkedList<X509TrustManager> glw = new LinkedList();
KeyStore glx;
private X509Certificate[] gly;
public l() {
try {
this.glx = KeyStore.getInstance(KeyStore.getDefaultType());
this.glx.load(null, null);
} catch (Exception e) {
x.e("MicroMsg.AppBrandX509TrustManager", "Local KeyStore init failed");
}
}
public final void init() {
try {
TrustManagerFactory instance = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
instance.init(null);
TrustManager[] trustManagers = instance.getTrustManagers();
int i = 0;
while (trustManagers != null && i < trustManagers.length) {
this.glv.add((X509TrustManager) trustManagers[i]);
i++;
}
} catch (Exception e) {
x.e("MicroMsg.AppBrandX509TrustManager", "init SystemTrustManager: " + e);
}
alA();
alB();
}
public final void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) {
throw new CertificateException("Client Certification not supported");
}
public final void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) {
Object obj;
Iterator it = this.glv.iterator();
while (it.hasNext()) {
try {
((X509TrustManager) it.next()).checkServerTrusted(x509CertificateArr, str);
obj = 1;
break;
} catch (CertificateException e) {
}
}
obj = null;
if (obj == null) {
it = this.glw.iterator();
while (it.hasNext()) {
try {
((X509TrustManager) it.next()).checkServerTrusted(x509CertificateArr, str);
obj = 1;
break;
} catch (CertificateException e2) {
}
}
obj = null;
if (obj == null) {
throw new CertificateException("Server Certificate not trusted");
}
}
}
public final X509Certificate[] getAcceptedIssuers() {
return this.gly;
}
private void alA() {
if (this.glx != null) {
try {
TrustManagerFactory instance = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
instance.init(this.glx);
TrustManager[] trustManagers = instance.getTrustManagers();
int i = 0;
while (trustManagers != null && i < trustManagers.length) {
this.glw.add((X509TrustManager) trustManagers[i]);
i++;
}
} catch (Exception e) {
x.e("MicroMsg.AppBrandX509TrustManager", "initLocalTrustManager: " + e);
}
}
}
private void alB() {
X509Certificate[] acceptedIssuers;
ArrayList arrayList = new ArrayList();
long currentTimeMillis = System.currentTimeMillis();
Iterator it = this.glv.iterator();
while (it.hasNext()) {
acceptedIssuers = ((X509TrustManager) it.next()).getAcceptedIssuers();
if (acceptedIssuers != null) {
arrayList.addAll(Arrays.asList(acceptedIssuers));
}
}
long currentTimeMillis2 = System.currentTimeMillis();
Iterator it2 = this.glw.iterator();
while (it2.hasNext()) {
acceptedIssuers = ((X509TrustManager) it2.next()).getAcceptedIssuers();
if (acceptedIssuers != null) {
arrayList.addAll(Arrays.asList(acceptedIssuers));
}
}
long currentTimeMillis3 = System.currentTimeMillis();
this.gly = new X509Certificate[arrayList.size()];
this.gly = (X509Certificate[]) arrayList.toArray(this.gly);
long currentTimeMillis4 = System.currentTimeMillis();
x.i("MicroMsg.AppBrandX509TrustManager", "initAcceptedIssuers: %d, %d, %d", new Object[]{Long.valueOf(currentTimeMillis2 - currentTimeMillis), Long.valueOf(currentTimeMillis3 - currentTimeMillis2), Long.valueOf(currentTimeMillis4 - currentTimeMillis3)});
}
}
|
package com.conglomerate.dev.repositories;
import com.conglomerate.dev.models.Grouping;
import com.conglomerate.dev.models.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository // extends JpaRepository<Group, Integer> means it's a repository of Groups, and the ids are Integers
public interface GroupingRepository extends JpaRepository<Grouping, Integer> {
List<Grouping> findByMembersContains(User user);
List<Grouping> findByOwner(User user);
Optional<Grouping> findById(Integer id);
}
|
package services;
import database.MySQLConnection;
import java.security.SecureRandom;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Base64;
public class TokenService {
private static final String INSERT = "insert into tokens (user_id,token) values(?,?)";
private static final String UPDATE = "update tokens " +
"set token = ? " +
"where user_id = ?";
private static final SecureRandom secureRandom = new SecureRandom(); //threadsafe
private static final Base64.Encoder base64Encoder = Base64.getUrlEncoder(); //threadsafe
public String generateNewToken() {
byte[] randomBytes = new byte[24];
secureRandom.nextBytes(randomBytes);
return base64Encoder.encodeToString(randomBytes);
}
public void setToken(int user_id, String token) throws SQLException, ClassNotFoundException {
Connection connection = MySQLConnection.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("select 1 from tokens where user_id = ?");
preparedStatement.setInt(1, user_id);
if (preparedStatement.executeQuery().next()){
preparedStatement = connection.prepareStatement(UPDATE);
preparedStatement.setString(1, token);
preparedStatement.setInt(2, user_id);
} else {
preparedStatement = connection.prepareStatement(INSERT);
preparedStatement.setInt(1, user_id);
preparedStatement.setString(2, token);
}
preparedStatement.executeUpdate();
connection.close();
}
}
|
package org.example.Command;
import org.example.Command.Commands.Command;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CommandHistory {
private Stack<Command> history=new Stack<>();
public void push(Command c){
history.push(c);
}
public Command pop(){
return history.pop();
}
}
|
package polytechnice.tobeortohave.main;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import it.moondroid.coverflow.components.ui.containers.FeatureCoverFlow;
import polytechnice.tobeortohave.Article;
import polytechnice.tobeortohave.R;
/**
* Created by Pierre on 12/05/2017.
*/
public class CarouselFragment extends Fragment{
private FeatureCoverFlow coverFlow;
private CarouselAdapter adapter;
private ArrayList<Article> articles;
private TextView title;
public static CarouselFragment newInstance(){
CarouselFragment fragment = new CarouselFragment();
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.new_carousel,container,false);
rootView.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorMain));
return rootView;
}
@Override
public void onActivityCreated(Bundle bundle){
super.onActivityCreated(bundle);
coverFlow = (FeatureCoverFlow) getView().findViewById(R.id.coverflow);
settingDummyData();
adapter = new CarouselAdapter(this, articles);
coverFlow.setAdapter(adapter);
coverFlow.setReflectionOpacity(0);
title = (TextView)getView().findViewById(R.id.carouseltitle);
title.setText("Produits du moment");
title.setTypeface(null, Typeface.BOLD);
title.setTextColor(ContextCompat.getColor(getContext(),R.color.colorNextToWhite));
}
private void settingDummyData() {
articles = new ArrayList<>();
articles.add(new Article(R.drawable.bonnet,"Bonnet Carhortt: 20€","Bonnet en laine naturelle, fabrication française"));
articles.add(new Article(R.drawable.teeshirt,"Tee Shirt Licoste: 35€","Teeshirt en coton synthétique, fabrication allemande"));
articles.add(new Article(R.drawable.chaussures,"Chaussures Adadas 55€","Chaussures en toile synthétique, fabrication chinoise"));
}
}
|
package com.goodhealth.design.advanced.BusinessAndScene.ationChain.action;
import com.goodhealth.design.advanced.BusinessAndScene.ActionEnum;
import com.goodhealth.design.advanced.BusinessAndScene.command.Command;
import com.goodhealth.design.advanced.BusinessAndScene.command.group.AfternoonCommandGroup;
import org.springframework.stereotype.Component;
/**
* @ClassName AfternoonAction
* @Description TODO
* @Author WDH
* @Date 2019/8/20 21:10
* @Version 1.0
**/
@Component
public class AfternoonAction extends AbstractAction {
@Override
public ActionEnum getActionEnum() {
return ActionEnum.AFTERNOON;
}
@Override
public Command getCommandGroup() {
return new AfternoonCommandGroup();
}
}
|
package co.uniqueid.authentication.client.login.github;
import co.uniqueid.authentication.client.login.LoginService;
import co.uniqueid.authentication.client.login.LoginServiceAsync;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class GithubLoginVerifyer {
public static void authenticate(final String authenticationCode) {
final LoginServiceAsync loginService = GWT.create(LoginService.class);
if (!(authenticationCode == null || "".equals(authenticationCode))) {
loginService.githubLogin(authenticationCode,
new AsyncCallback<String>() {
public void onFailure(final Throwable caught) {
System.out.println(caught);
}
public void onSuccess(final String jsonResults) {
SetLoggedIn.authenticated(jsonResults);
}
});
}
}
}
|
package com.lhf.ssm.controller;
import com.lhf.ssm.bean.TUser;
import com.lhf.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author shkstart
* @create 2018-09-03 8:58
*/
@RestController
public class UserController {
@Autowired
UserService userService;
@RequestMapping(value = "/user")
public List<TUser> getUser(){
List<TUser> users = userService.getUsers();
return users;
}
}
|
package EleMe.dao;
import EleMe.domain.Business;
import java.util.List;
public interface BusinessDao {
//查询商家
List<Business> businessFind(String businessName,String businessAddress);
//增加商家
int businessAdd(String businessName);
//删除商家
void businessDelete(int id);
//商家登录
Business businessByNameByPassword(String businessId, String password);
}
|
package com.cimcssc.chaojilanling.activity.user;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.cimcssc.chaojilanling.R;
import com.cimcssc.chaojilanling.action.UserAction;
import com.cimcssc.chaojilanling.util.Constants;
import com.cimcssc.chaojilanling.ui.CustomProgressDialog;
import com.cimcssc.chaojilanling.util.ShowToast;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import java.util.ArrayList;
import java.util.List;
public class SettingActivity extends AppCompatActivity implements View.OnClickListener {
private Handler uiHandler = null;
private final int HIDE_PROGRESS = 1001;
private final int SHOW_PROGRESS = 1002;
private final int INIT_VIEW = 1003;
private UserAction action;
private String isOutLogin;
private SharedPreferences sp;
private String username;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
initHandler();
getXmlView();
}
private void getUserInfo() {
if (sp.getString("user_name", "") != "") {
username = sp.getString("user_name", "");
}
}
private void getXmlView() {
action = new UserAction(this);
sp = this.getSharedPreferences(Constants.KEY_LOGIN_AUTO, MODE_PRIVATE);
this.findViewById(R.id.update_phone_layout).setOnClickListener(this);
this.findViewById(R.id.update_pwd_layout).setOnClickListener(this);
this.findViewById(R.id.back).setOnClickListener(this);
this.findViewById(R.id.ok_button).setOnClickListener(this);
getUserInfo();
}
class outLoginThread implements Runnable {
private Thread rthread = null;// 监听线程.
@Override
public void run() {
NameValuePair username_app = new BasicNameValuePair("userName", username);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(username_app);
isOutLogin = action.getUserOutLoginAction(params);
uiHandler.sendEmptyMessage(INIT_VIEW);
}
public void startThread() {
if (rthread == null) {
rthread = new Thread(this);
rthread.start();
}
}
}
private void initHandler() {
uiHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case SHOW_PROGRESS:// 显示加载中....
CustomProgressDialog.showProgressDialog(SettingActivity.this, "正在登录...");
break;
case HIDE_PROGRESS:// 关闭加载....
CustomProgressDialog.hideProgressDialog();
break;
case INIT_VIEW:
if (isOutLogin.equals("true")) {
Constants.workersId = "";
Constants.isLogin = false;
Constants.userId = "";
finish();
ShowToast.show(SettingActivity.this, "退出成功");
} else
ShowToast.show(SettingActivity.this, "请求失败");
uiHandler.sendEmptyMessage(HIDE_PROGRESS);
break;
}
}
};
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.update_phone_layout:
startActivity(new Intent(SettingActivity.this, UpdatePhoneActivity.class));
break;
case R.id.update_pwd_layout:
startActivity(new Intent(SettingActivity.this, UpdatePasswordActivity.class));
break;
case R.id.back:
finish();
break;
case R.id.ok_button:
uiHandler.sendEmptyMessage(SHOW_PROGRESS);
new outLoginThread().startThread();
break;
}
}
}
|
package com.api.mapper;
import java.util.List;
import com.api.parameter.DataParameter;
public interface DataMapper {
public List getList(DataParameter dp);
public void addAll(DataParameter dp);
public void delAll(DataParameter dp);
public void updAll(DataParameter dp);
}
|
package net.mk786110.wisdomthoughts.WisdomThoughts;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import net.mk786110.wisdomthoughts.PersianHadiths.BaKhodaBudanActivity;
import net.mk786110.wisdomthoughts.PersianHadiths.BarKhordBaMardomActivity;
import net.mk786110.wisdomthoughts.R;
public class PersianActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_persian);
}
public void onClickBarKhordBaMardom(View view) {
Toast.makeText(PersianActivity.this, "there", Toast.LENGTH_SHORT).show();
Intent mintent = new Intent(PersianActivity.this, BarKhordBaMardomActivity.class);
startActivity(mintent);
}
public void onClickBaKhodaBudan(View view) {
Toast.makeText(PersianActivity.this, "there", Toast.LENGTH_SHORT).show();
Intent mintent = new Intent(PersianActivity.this, BaKhodaBudanActivity.class);
startActivity(mintent);
}
}
|
package com.espendwise.manta.model.view;
// Generated by Hibernate Tools
import com.espendwise.manta.model.ValueObject;
/**
* DomainView generated by hbm2java
*/
public class DomainView extends ValueObject implements java.io.Serializable {
private static final long serialVersionUID = -1;
public static final String DOMAIN_ID = "domainId";
public static final String STORE_ID = "storeId";
public static final String DOMAIN_NAME = "domainName";
private Long domainId;
private Long storeId;
private String domainName;
public DomainView() {
}
public DomainView(Long domainId) {
this.setDomainId(domainId);
}
public DomainView(Long domainId, Long storeId, String domainName) {
this.setDomainId(domainId);
this.setStoreId(storeId);
this.setDomainName(domainName);
}
public Long getDomainId() {
return this.domainId;
}
public void setDomainId(Long domainId) {
this.domainId = domainId;
setDirty(true);
}
public Long getStoreId() {
return this.storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
setDirty(true);
}
public String getDomainName() {
return this.domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
setDirty(true);
}
}
|
package com.etar.purifier.modules.statistics.wechat.controller;
import com.etar.purifier.modules.statistics.wechat.service.WxUserStaticService;
import com.etar.purifier.modules.users.service.UserService;
import com.etar.purifier.utils.DateUtil;
import entity.common.entity.DataResult;
import entity.common.entity.Result;
import entity.wxuserstatic.WxUserStatic;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* WxUserStaticController层
*
* @author hzh
* @since 2019-05-22
*/
@RestController
@RequestMapping(value = "/statics")
public class WxUserStaticController {
private static Logger log = LoggerFactory.getLogger(WxUserStaticController.class);
private final WxUserStaticService wxUserStaticService;
private final UserService userService;
@Autowired
public WxUserStaticController(WxUserStaticService wxUserStaticService, UserService userService) {
this.wxUserStaticService = wxUserStaticService;
this.userService = userService;
}
@GetMapping(value = "/user/totals")
// @RequiresPermissions("sys:wechat:static")
public Result countWxUserTotalNum() {
DataResult result = new DataResult();
long userTotal = userService.count();
Date endTime = new Date();
Date startTime = DateUtil.getDayStartTime(endTime);
long registerTotal = userService.countTodayRegisterUser(startTime, endTime);
Map<String, Long> map = new HashMap<>(2);
map.put("userTotal", userTotal);
map.put("regTotal", registerTotal);
result.setDatas(map);
result.ok();
log.info("获取微信用户总数:{}和新增注册用户数:{}", userTotal, registerTotal);
return result;
}
@GetMapping(value = "/user/days")
// @RequiresPermissions("sys:wechat:static")
public Result countWxUserDateNum(@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime) {
DataResult result = new DataResult();
Date start = DateUtil.getDayEndTime(DateUtil.strToDate(startTime, DateUtil.DEFAULT_DAY_FORMAT));
Date end = DateUtil.getDayEndTime(DateUtil.strToDate(endTime, DateUtil.DEFAULT_DAY_FORMAT));
List<WxUserStatic> userStaticList = wxUserStaticService.findByCountTimeBetween(start, end);
result.setDatas(userStaticList);
result.ok();
return result;
}
}
|
package com.top.demo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.top.demo.modules.mapper.RolePermissionMapper;
import com.top.demo.modules.pojo.RolePermissionDO;
import com.top.demo.modules.service.RolePermissionService;
import com.top.demo.modules.service.RoleService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @author lth
* @date 2019年10月17日 19:57
*/
public class UnitTest {
@Autowired
RolePermissionService rolePermissionService;
@Autowired
RolePermissionMapper rolePermissionMapper;
@Autowired
RoleService roleService;
@Test
public void test(){
// List<String> strings =
// rolePermissionService.listByRoleId(1);
// System.out.println(strings);
QueryWrapper<RolePermissionDO> query = new QueryWrapper<>();
query.eq("role_id",1);
List<RolePermissionDO> list = rolePermissionMapper.selectList(query);
}
}
|
package com.walkerwang.algorithm.swordoffer;
public class TreeIsisSymmetrical {
public static void main(String[] args) {
TreeNode node1 = new TreeNode(1);
TreeNode node2 = new TreeNode(2);
TreeNode node3 = new TreeNode(2);
TreeNode node4 = new TreeNode(1);
TreeNode node5 = new TreeNode(1);
TreeNode node6 = new TreeNode(1);
TreeNode node7 = new TreeNode(1);
node1.left = node2;
node1.right = node3;
node2.left = node4;
node2.right = node5;
node3.left = node6;
node3.right = node7;
node4.left = node4.right = null;
node5.left = node5.right = null;
node6.left = node6.right = null;
node7.left = node7.right = null;
System.out.println("ԭ����");
TreePrint.PrintFromTopToBottom(node1);
System.out.println();
boolean flag = isSymmetrical(node1);
System.out.println(flag);
}
/**
* ����ʱ�䣺30ms
ռ���ڴ棺629k
*/
static boolean isSymmetrical(TreeNode pRoot) {
// ������
TreeNode root = getMirror(pRoot);
System.out.println("��������");
TreePrint.PrintFromTopToBottom(root);
System.out.println();
return isSymmetrical(pRoot, root);
}
// �ж�ԭ���;������Dz���һ����
public static boolean isSymmetrical(TreeNode pRoot, TreeNode root) {
if (pRoot == null && root == null) {
return true;
}
if (pRoot == null || root == null) {
return false;
}
if (pRoot.val == root.val) {
return (isSymmetrical(pRoot.left, root.left) && isSymmetrical(pRoot.right, root.right));
}
return false;
}
// ��ԭ���ľ�����(���õݹ飬��ѭ������ʵ��������
// root��һ�á��¡�������Ҫ���¸��������ڴ档
//ԭ�������ṹ���䣬���¹�����һ����
public static TreeNode getMirror(TreeNode pRoot) {
if (pRoot == null) {
return null;
}
TreeNode root = new TreeNode(pRoot.val);
root.left = getMirror(pRoot.right);
root.right = getMirror(pRoot.left);
return root;
}
//������2
//ֱ����ԭ�������ϲ������ı���ԭ�������Ľṹ
public void Mirror(TreeNode root) {
if(root == null || (root.left == null && root.right == null))
return;
TreeNode tmp = null;
tmp = root.left;
root.left = root.right;
root.right = tmp;
if(root.left!=null)
Mirror(root.left);
if(root.right != null)
Mirror(root.right);
}
}
|
package com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.builder;
import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.HeissTransportType;
import java.io.StringWriter;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
public class HeissTransportTypeBuilder
{
public static String marshal(HeissTransportType heissTransportType)
throws JAXBException
{
JAXBElement<HeissTransportType> jaxbElement = new JAXBElement<>(new QName("TESTING"), HeissTransportType.class , heissTransportType);
StringWriter stringWriter = new StringWriter();
return stringWriter.toString();
}
private Double versandTemperatur;
private String haubenNr;
public HeissTransportTypeBuilder setVersandTemperatur(Double value)
{
this.versandTemperatur = value;
return this;
}
public HeissTransportTypeBuilder setHaubenNr(String value)
{
this.haubenNr = value;
return this;
}
public HeissTransportType build()
{
HeissTransportType result = new HeissTransportType();
result.setVersandTemperatur(versandTemperatur);
result.setHaubenNr(haubenNr);
return result;
}
}
|
package br.com.automationpractice.page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
public class LoginPage {
final WebDriver driver;
@FindBy(how = How.XPATH, using = "//*[@id=\"header\"]/div[2]/div/div/nav/div[1]/a")
public WebElement buttonHomePage;
@FindBy(how = How.ID, using = "email")
private WebElement elementWriteEmail;;
@FindBy(how = How.ID, using = "passwd")
private WebElement elementWritePassword;
@FindBy(how = How.ID, using = "SubmitLogin")
private WebElement buttonLogin;
public LoginPage(WebDriver driver) {
this.driver = driver;
}
public void clicaNoBotaoEntrarDaHomePage() {
buttonHomePage.click();
}
public void digitaEmail(String email) {
elementWriteEmail.sendKeys(email);
}
public void digitaSenha(String passwd) {
elementWritePassword.sendKeys(passwd);
}
public void clicaNoBotaoEntrarDaPaginaDeLogin() {
buttonLogin.click();
}
public void permanesseNaPaginaDeLogin () {
driver.getCurrentUrl().equals("http://automationpractice.com/index.php?controller=authentication");
}
public CadastroPage navegarParaPaginaDeCadastro() {
return new CadastroPage(driver);
}
}
|
package com.xiaoma.dd.mapper;
import com.xiaoma.dd.pojo.CompanyStaff;
import com.xiaoma.dd.pojo.CompanyStaffExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface CompanyStaffMapper {
long countByExample(CompanyStaffExample example);
int deleteByExample(CompanyStaffExample example);
int deleteByPrimaryKey(Integer id);
int insert(CompanyStaff record);
int insertSelective(CompanyStaff record);
List<CompanyStaff> selectByExample(CompanyStaffExample example);
CompanyStaff selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") CompanyStaff record, @Param("example") CompanyStaffExample example);
int updateByExample(@Param("record") CompanyStaff record, @Param("example") CompanyStaffExample example);
int updateByPrimaryKeySelective(CompanyStaff record);
int updateByPrimaryKey(CompanyStaff record);
}
|
package com.countout.portal.redisCache;
import redis.clients.jedis.JedisPubSub;
/**
* 负责监听redis中的key是否到达失效时间, 到达失效时间时调用方法
*
* @author Mr.tang
*/
public class KeyExpiredListener extends JedisPubSub {
// @Autowired
// private MessageReadLogService messageReadLogService;
/**
* redis的key失效时执行的方法
* 但是此方法需要订阅者
* JedisPool pool = new JedisPool(new JedisPoolConfig(), "localhost");
* Jedis jedis = pool.getResource();
* jedis.psubscribe(new KeyExpiredListener(), "__key*__:*");
*/
@Override
public void onPMessage(String pattern, String channel, String message) {
System.out.println("1111111");
System.out.println("监控的redis库" + pattern + "通道" + channel + "失效的key" + message);
}
/**
* 订阅是执行
*/
@Override
public void onPSubscribe(String pattern, int subscribedChannels) {
System.out.println("订阅时执行 " + pattern + " " + subscribedChannels);
}
@Override
public void onMessage(String channel, String message) {
System.out.println("onMessage");
System.out.println(message);
}
}
|
package com.aries.orion.constants;
public enum SystemStatus {
SUCCESS(1000, "成功生效"),
NOT_CHANGED(1001, "成功但无变化"),
WRONG_ANSWER(1002, "答案错误"),
PARAM_ERROR(2000, "未知参数错误"),
PARAM_ILLEGAL(2001, "参数非法(参数不全,参数格式错误等)"),
PARAM_NULL(2002, "参数为null"),
SYSTEM_ERROR(3000, "系统内部未知异常"),
OTHERS_SYSTEM_ERROR(3001, "调用其他系统异常"),
PERMISSION_FAIL(3002, "权限异常"),
DATABASE_ERROR(3003, "数据库错误"),
HOPE_RETRY(4001, "希望调用方重试");
private Integer code;
private String message;
SystemStatus(Integer code, String message) {
this.code = code;
this.message = message;
}
}
|
package gr.james.influence.game;
import gr.james.influence.algorithms.generators.basic.CycleGenerator;
import gr.james.influence.api.Graph;
import org.junit.Assert;
import org.junit.Test;
public class LessisTest {
@Test
public void lessisTest() {
Graph g = new CycleGenerator(3).generate();
Move m1 = new Move();
m1.putVertex(g.getVertexFromIndex(0), 1.5);
m1.putVertex(g.getVertexFromIndex(1), 1.5);
Move m2 = new Move();
m2.putVertex(g.getVertexFromIndex(0), 0.5);
m2.putVertex(g.getVertexFromIndex(1), 0.5);
m2.putVertex(g.getVertexFromIndex(2), 2.0);
GameResult r = Game.runMoves(g, new GameDefinition(3, 3.0, 50000L, 0.0), m1, m2);
Assert.assertEquals("lessisTest", 0, r.score);
}
}
|
package mg.egg.eggc.compiler.egg.java;
import mg.egg.eggc.runtime.libjava.*;
import mg.egg.eggc.compiler.libegg.base.*;
import mg.egg.eggc.compiler.libegg.java.*;
import mg.egg.eggc.compiler.libegg.egg.*;
import mg.egg.eggc.compiler.libegg.mig.*;
import mg.egg.eggc.compiler.libegg.latex.*;
import mg.egg.eggc.compiler.libegg.type.*;
import mg.egg.eggc.runtime.libjava.lex.*;
import java.util.*;
import mg.egg.eggc.runtime.libjava.lex.*;
import mg.egg.eggc.runtime.libjava.*;
import mg.egg.eggc.runtime.libjava.messages.*;
import mg.egg.eggc.runtime.libjava.problem.IProblem;
import java.util.Vector;
import java.util.List;
import java.util.ArrayList;
public class S_EXTS_EGG implements IDstNode {
LEX_EGG scanner;
S_EXTS_EGG() {
}
S_EXTS_EGG(LEX_EGG scanner, boolean eval) {
this.scanner = scanner;
this.att_eval = eval;
offset = 0;
length = 0;
this.att_scanner = scanner;
}
int [] sync= new int[0];
boolean att_eval;
TDS att_table;
LEX_EGG att_scanner;
IVisiteurEgg att_vis;
private void regle33() throws Exception {
//declaration
T_EGG x_2 = new T_EGG(scanner ) ;
T_EGG x_3 = new T_EGG(scanner ) ;
T_EGG x_4 = new T_EGG(scanner ) ;
S_EXTS_EGG x_6 = new S_EXTS_EGG(scanner,att_eval) ;
//appel
if (att_eval) action_auto_inh_33(x_3, x_6);
x_2.analyser(LEX_EGG.token_t_external);
addChild(x_2);
x_3.analyser(LEX_EGG.token_t_ident);
addChild(x_3);
x_4.analyser(LEX_EGG.token_t_pointvirgule);
addChild(x_4);
if (att_eval) action_gen_33(x_3, x_6);
x_6.analyser() ;
addChild(x_6);
offset =x_2.getOffset();
length =x_6.getOffset() + x_6.getLength() - offset;
}
private void regle32() throws Exception {
//declaration
//appel
length = 0; offset = scanner.getPreviousOffset()+ scanner.getPreviousLength(); }
private void action_gen_33(T_EGG x_3, S_EXTS_EGG x_6) throws Exception {
try {
// instructions
SYMBOLE loc_symbole;
NON_TERMINAL loc_nt;
ATTRIBUT loc_attribut;
EGG loc_compiler;
loc_nt=null;
loc_symbole=(this.att_table).chercher(x_3.att_txt);
if ((loc_symbole!=null)){
if (loc_symbole instanceof NON_TERMINAL ){
loc_nt=((NON_TERMINAL)loc_symbole);
}
else {
att_scanner._interrompre(IProblem.Semantic, att_scanner.getBeginLine(), IEGGMessages.id_EGG_not_a_non_terminal, EGGMessages.EGG_not_a_non_terminal,new Object[]{""+x_3.att_txt});
}
}
else {
loc_nt= new NON_TERMINAL(x_3.att_txt);
(this.att_table).inserer(loc_nt);
(this.att_vis).ex_entete(loc_nt);
loc_attribut=(this.att_table).attribut("scanner");
(loc_nt).add_attribut(loc_attribut);
(this.att_vis).nt_attribut(loc_nt, loc_attribut);
loc_attribut=(this.att_table).attribut("eval");
(loc_nt).add_attribut(loc_attribut);
(this.att_vis).nt_attribut(loc_nt, loc_attribut);
}
(loc_nt).setExterne();
}catch(RuntimeException e) { att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "EGG", "#gen","EXTS -> t_external t_ident t_pointvirgule #gen EXTS1 ;"});
}
}
private void action_auto_inh_33(T_EGG x_3, S_EXTS_EGG x_6) throws Exception {
try {
// instructions
x_6.att_table=this.att_table;
x_6.att_vis=this.att_vis;
}catch(RuntimeException e) { att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "EGG", "#auto_inh","EXTS -> t_external t_ident t_pointvirgule #gen EXTS1 ;"});
}
}
public void analyser () throws Exception {
scanner.lit ( 1 ) ;
switch ( scanner.fenetre[0].code ) {
case LEX_EGG.token_t_ident : // 61
regle32 () ;
break ;
case LEX_EGG.token_t_external : // 49
regle33 () ;
break ;
default :
scanner._interrompre(IProblem.Syntax, scanner.getBeginLine(), IEGGMessages.id_EGG_unexpected_token,EGGMessages.EGG_unexpected_token,new String[]{scanner.fenetre[0].getNom()});
}
}
private IDstNode parent;
public void setParent( IDstNode p){parent = p;}
public IDstNode getParent(){return parent;}
private List<IDstNode> children = null ;
public void addChild(IDstNode node){
if (children == null) {
children = new ArrayList<IDstNode>() ;}
children.add(node);
node.setParent(this);
}
public List<IDstNode> getChildren(){return children;}
public boolean isLeaf(){return children == null;}
public void accept(IDstVisitor visitor) {
boolean visitChildren = visitor.visit(this);
if (visitChildren && children != null){
for(IDstNode node : children){
node.accept(visitor);
}
}
visitor.endVisit(this);
}
private int offset;
private int length;
public int getOffset(){return offset;}
public void setOffset(int o){offset = o;}
public int getLength(){return length;}
public void setLength(int l){length = l;}
private boolean malformed = false;
public void setMalformed(){malformed = true;}
public boolean isMalformed(){return malformed;}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.