blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f842370f08f26ed39108f24141c14770212ba44 | 6ed1954d5b350454512fb671f48bad05092c19e4 | /game/herphone/src/main/java/com/globalgame/auto/json/EveryDayVideo_Json.java | 4d98d1e4dc22f10a7a663f51bc041bb86792fbdf | [] | no_license | yuzelong620/Buzhayan | 5eb9eb81b7a2f500905c9a1ce7b78f2ad809e1af | 04de6ebfd90ff0763e694a2fb3d8b95486fc81b0 | refs/heads/master | 2022-12-01T04:01:04.197792 | 2019-12-20T09:30:29 | 2019-12-20T09:30:29 | 229,233,912 | 1 | 1 | null | 2022-11-24T06:27:26 | 2019-12-20T09:31:54 | Java | UTF-8 | Java | false | false | 1,084 | java | package com.globalgame.auto.json;
import java.util.List;
import com.mind.core.util.StringIntTuple;
import com.mind.core.util.IntDoubleTuple;
import com.mind.core.util.IntTuple;
import com.mind.core.util.ThreeTuple;
import com.mind.core.util.StringFloatTuple;
/**
*自动生成类
*/
public class EveryDayVideo_Json{
/** 编号::*/
private Integer id;
/** 第几天::*/
private Integer day;
/** 视频地址::*/
private String videoUrl;
/** 图片::*/
private String pictrue;
/** 编号::*/
public Integer getId(){
return this.id;
}
/** 第几天::*/
public Integer getDay(){
return this.day;
}
/** 视频地址::*/
public String getVideoUrl(){
return this.videoUrl;
}
/** 图片::*/
public String getPictrue(){
return this.pictrue;
}
/**编号::*/
public void setId(Integer id){
this.id = id;
}
/**第几天::*/
public void setDay(Integer day){
this.day = day;
}
/**视频地址::*/
public void setVideoUrl(String videoUrl){
this.videoUrl = videoUrl;
}
/**图片::*/
public void setPictrue(String pictrue){
this.pictrue = pictrue;
}
} | [
"382981935@qq.com"
] | 382981935@qq.com |
7524fc036caf90eff191d3e02f50bd52bccaa854 | 8cc45b7ea89d8152b8c0f82f3cb97c8e1860d405 | /src/test/java/com/searchmodule/tests/SearchTest.java | cd0bb4ab59aa036c7f63928e9f0d2e3702459eba | [] | no_license | wajslicd/selenium-docker | d7673973353b7ba09ce75aa0ea13da5bab8442ef | 98f57dce084872ad8f332485be2e361b64375919 | refs/heads/master | 2020-05-23T21:43:59.570547 | 2019-05-21T04:51:05 | 2019-05-21T04:51:05 | 186,960,705 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package com.searchmodule.tests;
import org.testng.Assert;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.searchmodules.pages.SearchPage;
import com.tests.BaseTest;
public class SearchTest extends BaseTest{
@Test
@Parameters({"keyword"})
public void search(String keyword) {
SearchPage searchPage = new SearchPage(driver);
searchPage.goTo();
searchPage.doSearch(keyword);
searchPage.goToVideos();
int size = searchPage.getResult();
Assert.assertTrue(size > 0);
}
}
| [
"99waj99@gmail.com"
] | 99waj99@gmail.com |
1a2ef3fd6ccbdd5ffdeec3f1de9a41cc98f4c29e | 7d5c871f8c9ccd85aaf60eed4b120a367a825bab | /src/DSRSNetwork.java | abfef19c4f3fa544703deaea64ebc8624a3e84f9 | [] | no_license | David-Xia0/DroneNetworkPathFinder | def5e475d3418987b99354a118d53fff6ec7e247 | cf00d06656d04cce368c36ed617b7525b9950c63 | refs/heads/master | 2022-12-02T18:00:54.018626 | 2020-08-22T01:57:18 | 2020-08-22T01:57:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,617 | java | import java.io.*;
import java.util.*;
import java.net.*;
public class DSRSNetwork {
//Name of this drone
private static final String name = "Relay1";
private static final int localPort = 10120;
public static void main(String args[]) {
System.out.println("Starting ping process #1");
List<String[]> clients = readCSV();
System.out.println("Reading client list: starting");
System.out.format("Reading client list: finished - %d clients read%n", clients.size());
System.out.println("Pinging all clients: starting");
List<Integer> pingData = pingDrones(clients);
System.out.println("Pinging all clients: finished - "+pingData.size()+" clients pinged");
writeCSV(pingData,clients);
System.out.println("Writing client list: started");
System.out.println("Writing client list: finished - "+pingData.size()+" clients written");
System.out.println("Ping Process #1 finished");
socketListen();
}
public static void sendUpdate(String[] changes, List<String[]> clients) {
if(changes==null) {
System.out.println("Skipping DV update send");
return;
}
System.out.println("Sending updated DVs");
//goes through all neighbors and checks if they are relays
for(String[] client : clients) {
if(client[1].equals("Relay") && !client[3].equals("-1")) {
try {
System.out.print("- Sending to "+client[0]);
String[] ipAddress = client[2].split(":");
Socket socket = new Socket(ipAddress[0], Integer.parseInt(ipAddress[1]));
DataInputStream dataIn = new DataInputStream(socket.getInputStream());
DataOutputStream dataOut = new DataOutputStream(socket.getOutputStream());
dataOut.writeUTF("UPDATE:"+name+":"+changes[0]+":"+changes[1]+"\n");
dataOut.flush();
String msg = "";
while(!msg.equals("ACK\n")){
msg = dataIn.readUTF();
if(msg.equals("NAK\n")){
System.out.println("...could not ping");
break;
}
}
dataOut.close();
dataIn.close();
socket.close();
System.out.println("...done");
} catch (IOException e) {
System.out.println("...could not ping");
}
}
}
}
/**
*
* @param socket
* @return
* @throws IOException
*/
public static String[] handleUpdateRecieve(Socket socket) throws IOException {
DataInputStream dataIn = new DataInputStream(socket.getInputStream());
DataOutputStream dataOut = new DataOutputStream(socket.getOutputStream());
String[] msg = new String[0];
while (msg.length!=4) {
msg = dataIn.readUTF().split(":");
if(msg.length==4) {
if(msg[0].equals("UPDATE")) {
dataOut.writeUTF("ACK\n");
dataOut.flush();
}else {
dataIn.close();
dataOut.close();
socket.close();
return new String[0];
}
}
}
dataIn.close();
dataOut.close();
socket.close();
return msg;
}
/**
*
*/
public static void socketListen() {
List<String[]> clients = readCSV();
ForwardingTable ft = new ForwardingTable(clients);
while(true) {
try {
ServerSocket serverSocket = new ServerSocket(localPort);
Socket socket = serverSocket.accept();
System.out.println("New DVs received");
String[] update = handleUpdateRecieve(socket);
//ft.insertDvUpdate(update);
//ft.fullUpdate(); //Full Dijkstra's implementation
ft.newUpdate(ft.insertDvUpdate(update), update[1]);
//ft.printTable(); //used for testing
ft.writeTable();
sendUpdate(ft.getUpdate(), clients);
System.out.println("DV update calculation finished");
socket.close();
serverSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/** This method writes all data into a CSV file "clients-[name].csv"
*
* @param pingData contains time taken for each response ACK ping
* @param clients contains previous data about each drone
*/
public static void writeCSV(List<Integer> pingData, List<String[]> clients ) {
File file = new File("clients-"+name+".csv");
try {
PrintWriter pw = new PrintWriter(file);
Iterator<Integer> data = pingData.iterator();
//prints each set of client drone data into a line seperated by commas
for(String[] client : clients) {
pw.println(client[0]+","+client[1]+","+client[2]+","+data.next());
}
pw.close();
}catch(FileNotFoundException e) {
}
}
//MAYBE CONVERT TO HASHTABLE
/** Reads CSV file "clients-[name].csv", data is return as a List<String[]>
*
* @return
*/
public static List<String[]> readCSV(){
try {
BufferedReader br = new BufferedReader(new FileReader("clients-"+name+".csv"));
String line;
List<String[]> clients = new ArrayList<String[]>();
while((line = br.readLine()) != null){
String[] data = line.split(",");
if(!data[0].equals(name)) {
clients.add(data);
}
}
br.close();
return clients;
}catch(IOException e) {
e.printStackTrace();
}
return null;
}
/** Pings ip addresses read from file
*
* @param clients file containing all address information of drones
* @return
*/
public static List<Integer> pingDrones(List<String[]> clients){
String ping = "PING\n";
List<Integer> pingCount = new ArrayList<Integer>();
for(String[] client : clients){
System.out.print("- Pinging " + client[0] + "...");
try {
String msg = "";
String[] ipAddress = client[2].split(":");
Socket socket = new Socket(ipAddress[0], Integer.parseInt(ipAddress[1]));
DataInputStream dataIn = new DataInputStream(socket.getInputStream());
DataOutputStream dataOut = new DataOutputStream(socket.getOutputStream());
long startTime = System.currentTimeMillis();
boolean connected = true;
dataOut.writeUTF(ping);
dataOut.flush();
//this loop waits until acknowledgement message is recieved
while(!msg.equals("ACK\n")){
msg = dataIn.readUTF();
if(msg.equals("NAK\n")){
connected=false;
System.out.println("could not ping");
pingCount.add(-1);
break;
/*
}else if(System.currentTimeMillis()-startTime > 5000) {
connected=false;
System.out.println("connection Timed out after 5s");
pingCount.add(-1);
break;
*/
}
}
if(connected) {
//times how long it took to recieve acknowledgement message
long endTime = System.currentTimeMillis();
int time = (int)(endTime-startTime)/1000;
System.out.println("ping received after "+time+"s");
pingCount.add(time);
}
socket.close();
}catch(IOException e) {
System.out.println("could not ping");
pingCount.add(-1);
}
}
return pingCount;
}
}
| [
"davidjinxiao@hotmail.com"
] | davidjinxiao@hotmail.com |
7b4f5deee34ce76c51ca28be61cee7a68a4dd5dd | ae558ed9d842e64660db8b4d85adad03a42a3f38 | /exercises/src/main/java/ch/diso/ex06_String_Processing/Shirt.java | 5df08f1e0a0b5096864ab235c5110b840e97182e | [] | no_license | albertoesteva2288/OCP | 7c3f0d7c494fc940c8770dbe1c5180987e56a2ac | f62ac6c6016981f2242c2c9a901f6125a4ec3094 | refs/heads/master | 2020-03-23T15:25:28.184017 | 2016-11-30T05:26:51 | 2016-11-30T05:26:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,051 | java | package ch.diso.ex06_String_Processing;
public class Shirt {
private String id = "";
private String description = "";
private String color = "";
private String size = "";
public Shirt(String id, String description, String color, String size) {
this.id = id;
this.description = description;
this.color = color;
this.size = size;
}
public String getId() {
return this.id;
}
public String getDescription() {
return description;
}
public String getColor() {
return color;
}
public String getSize() {
return size;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(256);
sb.append("Shirt ID: ").append(this.getId()).append("\n");
sb.append("Description: ").append(this.getDescription()).append("\n");
sb.append("Color: ").append(this.getColor()).append("\n");
sb.append("Size: ").append(this.getSize()).append("\n");
return sb.toString();
}
} | [
"dsenften@diso.ch"
] | dsenften@diso.ch |
0603c6c42d80e494e3ecc905af174921e920451d | 3822efd9117b0c107f59add27bd843439898d481 | /src/main/java/com/gmail/mosoft521/jcpcmf/ch10/p160LinkedBlockingDeque/test/pop_2.java | 53ae00c785dfe47838bc5e8d7c3fde202c6fff75 | [] | no_license | mosoft521/JCPCMF | 27e06778982703ec272db8e4188a2ff38ee74682 | 5d3493a08049c0771961eb6619f3bf556658d567 | refs/heads/master | 2020-06-15T14:17:57.028105 | 2017-08-23T01:03:33 | 2017-08-23T01:03:33 | 75,286,460 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package com.gmail.mosoft521.jcpcmf.ch10.p160LinkedBlockingDeque.test;
import java.util.concurrent.LinkedBlockingDeque;
public class pop_2 {
public static void main(String[] args) {
LinkedBlockingDeque deque = new LinkedBlockingDeque(3);
System.out.println(deque.pop());
}
}
/*
Exception in thread "main" java.util.NoSuchElementException
at java.util.concurrent.LinkedBlockingDeque.removeFirst(LinkedBlockingDeque.java:453)
at java.util.concurrent.LinkedBlockingDeque.pop(LinkedBlockingDeque.java:777)
at com.gmail.mosoft521.jcpcmf.ch10.p160LinkedBlockingDeque.test.pop_2.main(pop_2.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Process finished with exit code 1
*/ | [
"mosoft521@gmail.com"
] | mosoft521@gmail.com |
5f3c4a70ca43004b48cd4c88864e7dfff9ae43ca | 195e95b85d09d48d10ff32313410ab04b3d20b0b | /lib_common/src/main/java/com/kjq/common/utils/network/DHIRData.java | 1546c2c7015f06d39a250707602cf145586872b7 | [] | no_license | kangjianqun/Exclusive | 16858366e6fb203dd9a8fe8fb5149765b75a0255 | a96d72bb35e9db321dd7bc7b1b41b7fa4e429073 | refs/heads/master | 2022-06-07T09:25:41.284200 | 2020-04-29T05:13:25 | 2020-04-29T05:13:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,886 | java | package com.kjq.common.utils.network;
import com.kjq.common.utils.annotation.KeyValue;
import org.json.JSONArray;
public class DHIRData {
@KeyValue(majorKey = "ir_hostAddress")
public String BindHostAddress ;
@KeyValue(majorKey = "ir_rFAddress")
public String RFAddress ;
@KeyValue(majorKey = "ir_order")
private String mS_order;
@KeyValue(majorKey = "ir_len")
private int mI_len;
@KeyValue(majorKey = "irOrder")
private JSONArray mZJAL_int_data;
public DHIRData(String s_order, int i_len, JSONArray JALint_data){
setS_order(s_order);
setI_len(i_len);
setZJAL_int_data(JALint_data);
}
public DHIRData(String bindHostAddress, String RFAddress, String s_order, int i_len, JSONArray ZJAL_int_data) {
BindHostAddress = bindHostAddress;
this.RFAddress = RFAddress;
mS_order = s_order;
mI_len = i_len;
mZJAL_int_data = ZJAL_int_data;
}
private DHIRData(){
}
public static DHIRData getNullInstance(){
return new DHIRData();
}
public String getBindHostAddress() {
return BindHostAddress;
}
public void setBindHostAddress(String bindHostAddress) {
BindHostAddress = bindHostAddress;
}
public String getRFAddress() {
return RFAddress;
}
public void setRFAddress(String RFAddress) {
this.RFAddress = RFAddress;
}
public String getS_order() {
return mS_order;
}
public void setS_order(String s_order) {
mS_order = s_order;
}
public int getI_len() {
return mI_len;
}
public void setI_len(int i_len) {
mI_len = i_len;
}
public JSONArray getZJAL_int_data() {
return mZJAL_int_data;
}
public void setZJAL_int_data(JSONArray ZJAL_int_data) {
mZJAL_int_data = ZJAL_int_data;
}
}
| [
"kang_1994@outlook.com"
] | kang_1994@outlook.com |
fb6454919b69f4c77ff0e403e58640adc630e98b | bbae0a3e2713c9406d88f86423d7e142226b4d39 | /commons-httpclient-3.1-rc1/src/contrib/org/apache/commons/httpclient/contrib/methods/multipart/ContentTypeFilePart.java | c7ef044f9bd70de2b074e88d7a79fa850b9516f3 | [
"Apache-2.0"
] | permissive | rgosdin/rrg | eedfe42f657f4a9ed5043eae59f7d868b84fbbdc | 618f2b0d81c2e93f863be1f9016b6f901f5bdd45 | refs/heads/master | 2021-07-14T11:58:26.270243 | 2019-10-29T09:06:14 | 2019-10-29T09:06:14 | 209,430,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,628 | java | /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/contrib/org/apache/commons/httpclient/contrib/methods/multipart/ContentTypeFilePart.java,v 1.2 2004/02/22 18:08:45 olegk Exp $
* $Revision: 480424 $
* $Date: 2006-11-29 05:56:49 +0000 (Wed, 29 Nov 2006) $
*
* ====================================================================
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.commons.httpclient.contrib.methods.multipart;
import java.io.File;
import java.io.FileNotFoundException;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.PartSource;
/** A simple extension to {@link FilePart} that automatically determines the content type
* of the file.
*
* @author <a href="mailto:adrian@intencha.com">Adrian Sutton</a>
* @version $Revision $
*
* DISCLAIMER: HttpClient developers DO NOT actively support this component.
* The component is provided as a reference material, which may be inappropriate
* to be used without additional customization.
*/
public class ContentTypeFilePart extends FilePart {
/**
* ContentTypeFilePart constructor.
*
* @param name the name of the part
* @param partSource the source for this part
* @param charset the charset encoding for this part.
*/
public ContentTypeFilePart(String name, PartSource partSource, String charset) {
super(name, partSource, ContentType.get(partSource.getFileName()), charset);
}
/**
* ContentTypeFilePart constructor.
*
* @param name the name of the part
* @param partSource the source for this part
*/
public ContentTypeFilePart(String name, PartSource partSource) {
this(name, partSource, null);
}
/**
* ContentTypeFilePart constructor.
*
* @param name the name of the part
* @param file the file to post
* @throws FileNotFoundException if the file does not exist
*/
public ContentTypeFilePart(String name, File file) throws FileNotFoundException {
this(name, file, null);
}
/**
* ContentTypeFilePart constructor.
*
* @param name the name of the part
* @param file the file to post
* @param charset the charset encoding for the file
* @throws FileNotFoundException
*/
public ContentTypeFilePart(String name, File file, String charset)
throws FileNotFoundException {
super(name, file, ContentType.get(file), charset);
}
/**
* ContentTypeFilePart constructor.
*
* @param name the name of the part
* @param fileName the file name
* @param file the file to post
* @throws FileNotFoundException if the file does not exist
*/
public ContentTypeFilePart(String name, String fileName, File file)
throws FileNotFoundException {
super(name, fileName, file, ContentType.get(fileName), null);
}
/**
* ContentTypeFilePart constructor.
*
* @param name the name of the part
* @param fileName the file name
* @param file the file to post
* @param charset the charset encoding for the file
* @throws FileNotFoundException if the file does not exist
*/
public ContentTypeFilePart(String name, String fileName, File file,
String charset) throws FileNotFoundException {
super(name, fileName, file, ContentType.get(file), charset);
}
}
| [
"rgosdin@github.com"
] | rgosdin@github.com |
73a13acac30a32a05d799bfb11252894da600be1 | bf3670c3a7a4bce95aa0038f5016777f6e07220b | /processor/src/main/java/com/kish/cloudstream/supplier/ProcessorApplication.java | 89c5c0970f3d799912194fb2a03c179f4ffc735c | [] | no_license | ThejKishore/boot-kafka | 0c9c8f646379118000a9114171e95433821f34d2 | fa344437dbd65610cf8c11e030b44ae8f3e9c915 | refs/heads/master | 2022-11-05T21:57:57.879596 | 2020-06-22T03:46:37 | 2020-06-22T03:46:37 | 273,991,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package com.kish.cloudstream.supplier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import java.util.function.Function;
@SpringBootApplication
public class ProcessorApplication {
public static void main(String[] args) {
SpringApplication.run(ProcessorApplication.class, args);
}
@Bean
public Function<String,String> test(){
return String::toUpperCase;
}
}
| [
"kishores1984@gmail.com"
] | kishores1984@gmail.com |
7b92f7ffaf54a87e0f7ed68bcc2e668ba9c04884 | dd76d0b680549acb07278b2ecd387cb05ec84d64 | /divestory-Fernflower/com/google/android/gms/internal/drive/zzbf.java | dbef5c4988df4406e5e02a12d846db461b19af01 | [] | no_license | ryangardner/excursion-decompiling | 43c99a799ce75a417e636da85bddd5d1d9a9109c | 4b6d11d6f118cdab31328c877c268f3d56b95c58 | refs/heads/master | 2023-07-02T13:32:30.872241 | 2021-08-09T19:33:37 | 2021-08-09T19:33:37 | 299,657,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package com.google.android.gms.internal.drive;
import android.content.IntentSender;
import android.os.RemoteException;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.internal.TaskApiCall;
import com.google.android.gms.drive.OpenFileActivityOptions;
import com.google.android.gms.tasks.TaskCompletionSource;
final class zzbf extends TaskApiCall<zzaw, IntentSender> {
// $FF: synthetic field
private final OpenFileActivityOptions zzeq;
zzbf(zzbb var1, OpenFileActivityOptions var2) {
this.zzeq = var2;
}
// $FF: synthetic method
protected final void doExecute(Api.AnyClient var1, TaskCompletionSource var2) throws RemoteException {
var2.setResult(((zzeo)((zzaw)var1).getService()).zza(new zzgm(this.zzeq.zzba, this.zzeq.zzbb, this.zzeq.zzbd, this.zzeq.zzbe)));
}
}
| [
"ryan.gardner@coxautoinc.com"
] | ryan.gardner@coxautoinc.com |
ad3902b148495f610d6ad4055f69e260e2b85e96 | 4ed388e3d90f9267f6bbdf8cb06dbc62b58f2fb7 | /src/test/java/BaseTest.java | ba06cd71cecfa987b7c002977a0575360a97fda5 | [] | no_license | IndiraMB/SeleniumPOM | 5c86dd8bb2932154ced9d29f740b79b31a89c3dc | c3d7ab62d80ca8a6a3f1e105c2256a6a6583c936 | refs/heads/master | 2022-12-31T08:19:31.237964 | 2020-10-23T20:16:20 | 2020-10-23T20:16:20 | 306,424,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | import Utilities.ConfigFileReader;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
public class BaseTest extends ConfigFileReader {
ConfigFileReader configFileReader = new ConfigFileReader();
public static WebDriver webDriver = new ChromeDriver();
@BeforeSuite
public void browserDriver(){
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+configFileReader.getDriverPath());
}
@BeforeTest
public void browserLoad(){
webDriver.get(configFileReader.getApplicationURL());
}
@AfterTest
public void driverClose(){
webDriver.quit();
}
}
| [
"indira.mb@paytmmoney.com"
] | indira.mb@paytmmoney.com |
61184c229ce18742ef5369d06f9bd29b0a189e56 | f01e6ad8fec23ec9c96153706b48250c05d82b7e | /src/main/java/com/statera/cloudsort/entity/ImageFile.java | 692bf42415bd5b9b62f35b8d809c704cfdf3fb5d | [] | no_license | fiomolv/cloudsort | eb8b73c90e733f2e64f6031f469812cb61cb2752 | 260c7145e479a341d7002d11994ee7cbc1ceb4a8 | refs/heads/master | 2021-01-10T11:31:46.804699 | 2009-12-11T03:25:14 | 2009-12-11T03:25:14 | 51,680,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | java | package com.statera.cloudsort.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
@Entity
public class ImageFile implements Serializable
{
private static final long serialVersionUID = 5736455873645418556L;
private Integer id;
private String filename;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Integer getId()
{
return id;
}
protected void setId(Integer id)
{
this.id = id;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public boolean equals(Object obj)
{
return EqualsBuilder.reflectionEquals(this, obj);
}
public int hashCode()
{
return HashCodeBuilder.reflectionHashCode(this);
}
public String toString()
{
return ToStringBuilder.reflectionToString(this);
}
}
| [
"knoernschild@3c72c6fc-d3a7-11de-a505-35228575a32e"
] | knoernschild@3c72c6fc-d3a7-11de-a505-35228575a32e |
ddf27789ab3e3f80f053a83f06df908010ec793c | 918595e3b4f1db7c9588684924988a3f319e4607 | /bit-java01/src/main/java/step11/ex3/Test03.java | 1254e5255bea4d6fb1ec7ca1628d6da7ab1c21f0 | [] | no_license | eomjinyoung/bigdata3 | d849c4a8634a48ae3d30ce5f5ff1ad839195aff9 | ef90e729ec42177b8384af06f6b947cc6e117307 | refs/heads/master | 2021-07-12T22:11:20.989729 | 2018-01-18T00:45:08 | 2018-01-18T00:45:08 | 95,863,374 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 785 | java | package step11.ex3;
public class Test03 {
public static void main(String[] args) {
// 1) Calculator3 설계도에 따라 메모리를 준비한다.
Calculator3 calc = new Calculator3();
// 2) Calculator3 설계도에 정의된 연산자를 사용하여
// Calculator3 설계도에 따라 만든 메모리를 다룬다.
calc.plus(10); // 수퍼 클래스 Calculator.plus()
calc.plus(20); // 수퍼 클래스 Calculator.plus()
calc.minus(7); // 수퍼 클래스 Calculator.minus()
calc.multiple(2); // 수퍼 클래스 Calculator2.multiple()
calc.divide(3); // 수퍼 클래스 Calculator2.divide()
calc.mod(12); // 자신의 메서드 Calculator3.mod()
System.out.println(calc.result);
}
}
| [
"jinyoung.eom@gmail.com"
] | jinyoung.eom@gmail.com |
34fa2ce2e9bdb97d7f14d4f93b6b8295670160e6 | 8cd6d92e8f62a951cdf0333bf08e8b50e3f9c24f | /src/main/java/com/example/demo/Movie.java | badd67f75d5852e2f402e1d34a2cda61ec504d0e | [] | no_license | MalikMbaye/Springboot_14 | becd37317c786f4cc30ba6883a314649e748d699 | 2918ad89f853b684a69ad1b29b10cf04e0772f46 | refs/heads/master | 2021-08-14T19:56:36.891945 | 2017-11-16T16:05:48 | 2017-11-16T16:05:48 | 110,992,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package com.example.demo;
import javax.persistence.*;
@Entity
public class Movie {
@Id
@GeneratedValue( strategy = GenerationType.AUTO)
private long id;
private String title;
private long year;
private String description;
@ManyToOne (fetch = FetchType.EAGER)
@JoinColumn(name = "director_id")
private Director director;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public long getYear() {
return year;
}
public void setYear(long year) {
this.year = year;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Director getDirector() {
return director;
}
public void setDirector(Director director) {
this.director = director;
}
}
| [
"Malik@Malik-Mbayes-MacBook-Pro.local"
] | Malik@Malik-Mbayes-MacBook-Pro.local |
2a6991b2776e45e95edbfbde9db5cc62ac27302f | cf29ccb4411a2652e95f1b2496c435a0850f3540 | /main/java/marlon/minecraftai/build/reverse/ReverseBuildField.java | 6a98cc4aa52e91aa55badb26c5e7810c6c338571 | [] | no_license | marloncalleja/MC-Experiment-AI | 0799cbad4f7f75f5d7c010fb3debd4cf63302048 | 95d5019dac85353b11d176a838fc265ddcb83eab | refs/heads/master | 2022-07-21T04:10:44.333081 | 2022-07-10T10:13:24 | 2022-07-10T10:13:24 | 93,537,809 | 4 | 1 | null | 2018-10-01T09:44:24 | 2017-06-06T16:05:36 | Java | UTF-8 | Java | false | false | 1,636 | java | /*******************************************************************************
* This file is part of Minebot.
*
* Minebot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Minebot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Minebot. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package marlon.minecraftai.build.reverse;
import net.minecraft.block.Block;
import net.minecraft.util.BlockPos;
/**
* A field where all tasks from the build reverser are stored.
*
*
*/
public class ReverseBuildField {
private final Block[][][] buildBlocks;
private final TaskDescription[][][] buildNames;
public ReverseBuildField(int lx, int ly, int lz) {
buildBlocks = new Block[lx][ly][lz];
buildNames = new TaskDescription[lx][ly][lz];
}
public void setBlockAt(BlockPos relativePos, Block block,
TaskDescription taskString) {
buildBlocks[relativePos.getX()][relativePos.getY()][relativePos.getZ()] = block;
buildNames[relativePos.getX()][relativePos.getY()][relativePos.getZ()] = taskString;
}
public Block getBlock(int x, int y, int z) {
return buildBlocks[x][y][z];
}
}
| [
"marlon.calleja1994@gmail.com"
] | marlon.calleja1994@gmail.com |
1ad6f4b6502a267e5b94e38bc6955c9711567181 | 4f1672a187707b1a1a6ca8a10d1f932118ec5e77 | /src/commands/UpdateIdCommand.java | f779c7322db3797b9f59c1941b9898657fc8b020 | [] | no_license | NikitaOrelskiy/laba5 | fb2226ce447e6b353d008329a4890273a620800e | 768f7a3a4d3df6fcf27b9ef252abbe6f0655691e | refs/heads/master | 2023-08-09T11:25:29.499409 | 2021-09-14T17:52:02 | 2021-09-14T17:52:02 | 406,469,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 947 | java | package commands;
import com.company.CityStorage;
import com.company.Climate;
import com.company.Coordinates;
import com.company.Human;
import managers.ConsoleDataManager;
import java.util.Date;
import java.util.List;
public class UpdateIdCommand extends AbstractCommand{
private ConsoleDataManager consoleDataManager = new ConsoleDataManager();
public UpdateIdCommand(CityStorage storage, List<String> args) {
super(storage, args);
}
@Override
public void execute() {
if (this.args.size() == 0) {
throw new RuntimeException("no such arguments");
}
Long id;
try {
id = Long.valueOf(this.args.get(0));
} catch (Exception e) {
throw new RuntimeException("invalid argument");
}
String cityName = consoleDataManager.getCityName();
storage.updateByKey(
id,
cityName
);
}
}
| [
"nikita.orelskiy@gmail.com"
] | nikita.orelskiy@gmail.com |
b88951553e66428ed1f4c1c4e407bc99aec19d2d | 46bff083316478fca1ff6b7149deb64b5880733b | /src/main/java/com/oyo/pattern_23/pattern02/factory02/Main.java | f0ffc79c9d6c2b2eb7ea1627702bdb082d99e40d | [] | no_license | alterui/smartboot | 182ad8a177f3cb9dd3e30ff23ffdee5c8fd4ba0e | 9ffbe40ae7f2b45b668f6ee0a610e8f24f6201c0 | refs/heads/master | 2022-11-20T15:37:19.740323 | 2019-09-19T07:34:44 | 2019-09-19T07:34:44 | 204,700,498 | 0 | 0 | null | 2022-11-15T23:49:42 | 2019-08-27T12:40:35 | Java | UTF-8 | Java | false | false | 820 | java | package com.oyo.pattern_23.pattern02.factory02;
/**
* @author liurui
* @date 2019/9/19 14:24
*/
public class Main {
public static void main(String[] args) {
//android
AndroidFactory androidFactory = new AndroidFactory();
OperationController androidOperationController = androidFactory.createOperationController();
UIController androidUiController = androidFactory.createUIController();
androidOperationController.control();
androidUiController.display();
//ios
IOSFactory iosFactory = new IOSFactory();
OperationController iosFactoryOperation = iosFactory.createOperationController();
UIController iosUiController = iosFactory.createUIController();
iosFactoryOperation.control();
iosUiController.display();
}
}
| [
"liu.rui@oyohotels.cn"
] | liu.rui@oyohotels.cn |
d4bb4ef16f39503ca22979a9c3f9451541f745a4 | e46d8e8fd1848a93472d9b8a50335cfc422a87c6 | /src/main/java/com/netsuite/webservices/platform/common_2018_1/ChargeSearchBasic.java | e6777fea9d8af1edde781d50f29f434d51f9a119 | [] | no_license | djXplosivo/suitetalk-webservices | 6d0f1737c52c566fde07eb6e008603b3c271d8d1 | bff927f0acb45e772a5944272d0f7d55b87caf2a | refs/heads/master | 2020-03-28T02:56:52.772003 | 2018-09-06T02:52:57 | 2018-09-06T02:52:57 | 147,608,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,401 | java |
package com.netsuite.webservices.platform.common_2018_1;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import com.netsuite.webservices.platform.common_2018_1.types.PostingPeriodDate;
import com.netsuite.webservices.platform.core_2018_1.RecordRef;
import com.netsuite.webservices.platform.core_2018_1.SearchCustomFieldList;
import com.netsuite.webservices.platform.core_2018_1.SearchDateField;
import com.netsuite.webservices.platform.core_2018_1.SearchDoubleField;
import com.netsuite.webservices.platform.core_2018_1.SearchEnumMultiSelectField;
import com.netsuite.webservices.platform.core_2018_1.SearchLongField;
import com.netsuite.webservices.platform.core_2018_1.SearchMultiSelectField;
import com.netsuite.webservices.platform.core_2018_1.SearchRecordBasic;
import com.netsuite.webservices.platform.core_2018_1.SearchStringField;
/**
* <p>Java class for ChargeSearchBasic complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ChargeSearchBasic">
* <complexContent>
* <extension base="{urn:core_2018_1.platform.webservices.netsuite.com}SearchRecordBasic">
* <sequence>
* <element name="amount" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchDoubleField" minOccurs="0"/>
* <element name="billingAccount" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="billingItem" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="billTo" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="chargeDate" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchDateField" minOccurs="0"/>
* <element name="class" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="chargeType" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="createdDate" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchDateField" minOccurs="0"/>
* <element name="currency" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="department" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="externalId" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="externalIdString" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchStringField" minOccurs="0"/>
* <element name="internalId" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="internalIdNumber" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchLongField" minOccurs="0"/>
* <element name="location" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="modifiedDate" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchDateField" minOccurs="0"/>
* <element name="postingPeriod" type="{urn:core_2018_1.platform.webservices.netsuite.com}RecordRef" minOccurs="0"/>
* <element name="postingPeriodRelative" type="{urn:types.common_2018_1.platform.webservices.netsuite.com}PostingPeriodDate" minOccurs="0"/>
* <element name="quantity" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchDoubleField" minOccurs="0"/>
* <element name="rate" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchDoubleField" minOccurs="0"/>
* <element name="rule" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="runId" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchStringField" minOccurs="0"/>
* <element name="salesOrder" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchLongField" minOccurs="0"/>
* <element name="stage" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchEnumMultiSelectField" minOccurs="0"/>
* <element name="subscriptionLine" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchMultiSelectField" minOccurs="0"/>
* <element name="use" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchEnumMultiSelectField" minOccurs="0"/>
* <element name="customFieldList" type="{urn:core_2018_1.platform.webservices.netsuite.com}SearchCustomFieldList" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ChargeSearchBasic", propOrder = {
"amount",
"billingAccount",
"billingItem",
"billTo",
"chargeDate",
"clazz",
"chargeType",
"createdDate",
"currency",
"department",
"externalId",
"externalIdString",
"internalId",
"internalIdNumber",
"location",
"modifiedDate",
"postingPeriod",
"postingPeriodRelative",
"quantity",
"rate",
"rule",
"runId",
"salesOrder",
"stage",
"subscriptionLine",
"use",
"customFieldList"
})
public class ChargeSearchBasic
extends SearchRecordBasic
{
protected SearchDoubleField amount;
protected SearchMultiSelectField billingAccount;
protected SearchMultiSelectField billingItem;
protected SearchMultiSelectField billTo;
protected SearchDateField chargeDate;
@XmlElement(name = "class")
protected SearchMultiSelectField clazz;
protected SearchMultiSelectField chargeType;
protected SearchDateField createdDate;
protected SearchMultiSelectField currency;
protected SearchMultiSelectField department;
protected SearchMultiSelectField externalId;
protected SearchStringField externalIdString;
protected SearchMultiSelectField internalId;
protected SearchLongField internalIdNumber;
protected SearchMultiSelectField location;
protected SearchDateField modifiedDate;
protected RecordRef postingPeriod;
@XmlSchemaType(name = "string")
protected PostingPeriodDate postingPeriodRelative;
protected SearchDoubleField quantity;
protected SearchDoubleField rate;
protected SearchMultiSelectField rule;
protected SearchStringField runId;
protected SearchLongField salesOrder;
protected SearchEnumMultiSelectField stage;
protected SearchMultiSelectField subscriptionLine;
protected SearchEnumMultiSelectField use;
protected SearchCustomFieldList customFieldList;
/**
* Gets the value of the amount property.
*
* @return
* possible object is
* {@link SearchDoubleField }
*
*/
public SearchDoubleField getAmount() {
return amount;
}
/**
* Sets the value of the amount property.
*
* @param value
* allowed object is
* {@link SearchDoubleField }
*
*/
public void setAmount(SearchDoubleField value) {
this.amount = value;
}
/**
* Gets the value of the billingAccount property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getBillingAccount() {
return billingAccount;
}
/**
* Sets the value of the billingAccount property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setBillingAccount(SearchMultiSelectField value) {
this.billingAccount = value;
}
/**
* Gets the value of the billingItem property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getBillingItem() {
return billingItem;
}
/**
* Sets the value of the billingItem property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setBillingItem(SearchMultiSelectField value) {
this.billingItem = value;
}
/**
* Gets the value of the billTo property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getBillTo() {
return billTo;
}
/**
* Sets the value of the billTo property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setBillTo(SearchMultiSelectField value) {
this.billTo = value;
}
/**
* Gets the value of the chargeDate property.
*
* @return
* possible object is
* {@link SearchDateField }
*
*/
public SearchDateField getChargeDate() {
return chargeDate;
}
/**
* Sets the value of the chargeDate property.
*
* @param value
* allowed object is
* {@link SearchDateField }
*
*/
public void setChargeDate(SearchDateField value) {
this.chargeDate = value;
}
/**
* Gets the value of the clazz property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getClazz() {
return clazz;
}
/**
* Sets the value of the clazz property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setClazz(SearchMultiSelectField value) {
this.clazz = value;
}
/**
* Gets the value of the chargeType property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getChargeType() {
return chargeType;
}
/**
* Sets the value of the chargeType property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setChargeType(SearchMultiSelectField value) {
this.chargeType = value;
}
/**
* Gets the value of the createdDate property.
*
* @return
* possible object is
* {@link SearchDateField }
*
*/
public SearchDateField getCreatedDate() {
return createdDate;
}
/**
* Sets the value of the createdDate property.
*
* @param value
* allowed object is
* {@link SearchDateField }
*
*/
public void setCreatedDate(SearchDateField value) {
this.createdDate = value;
}
/**
* Gets the value of the currency property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getCurrency() {
return currency;
}
/**
* Sets the value of the currency property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setCurrency(SearchMultiSelectField value) {
this.currency = value;
}
/**
* Gets the value of the department property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getDepartment() {
return department;
}
/**
* Sets the value of the department property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setDepartment(SearchMultiSelectField value) {
this.department = value;
}
/**
* Gets the value of the externalId property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getExternalId() {
return externalId;
}
/**
* Sets the value of the externalId property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setExternalId(SearchMultiSelectField value) {
this.externalId = value;
}
/**
* Gets the value of the externalIdString property.
*
* @return
* possible object is
* {@link SearchStringField }
*
*/
public SearchStringField getExternalIdString() {
return externalIdString;
}
/**
* Sets the value of the externalIdString property.
*
* @param value
* allowed object is
* {@link SearchStringField }
*
*/
public void setExternalIdString(SearchStringField value) {
this.externalIdString = value;
}
/**
* Gets the value of the internalId property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getInternalId() {
return internalId;
}
/**
* Sets the value of the internalId property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setInternalId(SearchMultiSelectField value) {
this.internalId = value;
}
/**
* Gets the value of the internalIdNumber property.
*
* @return
* possible object is
* {@link SearchLongField }
*
*/
public SearchLongField getInternalIdNumber() {
return internalIdNumber;
}
/**
* Sets the value of the internalIdNumber property.
*
* @param value
* allowed object is
* {@link SearchLongField }
*
*/
public void setInternalIdNumber(SearchLongField value) {
this.internalIdNumber = value;
}
/**
* Gets the value of the location property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getLocation() {
return location;
}
/**
* Sets the value of the location property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setLocation(SearchMultiSelectField value) {
this.location = value;
}
/**
* Gets the value of the modifiedDate property.
*
* @return
* possible object is
* {@link SearchDateField }
*
*/
public SearchDateField getModifiedDate() {
return modifiedDate;
}
/**
* Sets the value of the modifiedDate property.
*
* @param value
* allowed object is
* {@link SearchDateField }
*
*/
public void setModifiedDate(SearchDateField value) {
this.modifiedDate = value;
}
/**
* Gets the value of the postingPeriod property.
*
* @return
* possible object is
* {@link RecordRef }
*
*/
public RecordRef getPostingPeriod() {
return postingPeriod;
}
/**
* Sets the value of the postingPeriod property.
*
* @param value
* allowed object is
* {@link RecordRef }
*
*/
public void setPostingPeriod(RecordRef value) {
this.postingPeriod = value;
}
/**
* Gets the value of the postingPeriodRelative property.
*
* @return
* possible object is
* {@link PostingPeriodDate }
*
*/
public PostingPeriodDate getPostingPeriodRelative() {
return postingPeriodRelative;
}
/**
* Sets the value of the postingPeriodRelative property.
*
* @param value
* allowed object is
* {@link PostingPeriodDate }
*
*/
public void setPostingPeriodRelative(PostingPeriodDate value) {
this.postingPeriodRelative = value;
}
/**
* Gets the value of the quantity property.
*
* @return
* possible object is
* {@link SearchDoubleField }
*
*/
public SearchDoubleField getQuantity() {
return quantity;
}
/**
* Sets the value of the quantity property.
*
* @param value
* allowed object is
* {@link SearchDoubleField }
*
*/
public void setQuantity(SearchDoubleField value) {
this.quantity = value;
}
/**
* Gets the value of the rate property.
*
* @return
* possible object is
* {@link SearchDoubleField }
*
*/
public SearchDoubleField getRate() {
return rate;
}
/**
* Sets the value of the rate property.
*
* @param value
* allowed object is
* {@link SearchDoubleField }
*
*/
public void setRate(SearchDoubleField value) {
this.rate = value;
}
/**
* Gets the value of the rule property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getRule() {
return rule;
}
/**
* Sets the value of the rule property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setRule(SearchMultiSelectField value) {
this.rule = value;
}
/**
* Gets the value of the runId property.
*
* @return
* possible object is
* {@link SearchStringField }
*
*/
public SearchStringField getRunId() {
return runId;
}
/**
* Sets the value of the runId property.
*
* @param value
* allowed object is
* {@link SearchStringField }
*
*/
public void setRunId(SearchStringField value) {
this.runId = value;
}
/**
* Gets the value of the salesOrder property.
*
* @return
* possible object is
* {@link SearchLongField }
*
*/
public SearchLongField getSalesOrder() {
return salesOrder;
}
/**
* Sets the value of the salesOrder property.
*
* @param value
* allowed object is
* {@link SearchLongField }
*
*/
public void setSalesOrder(SearchLongField value) {
this.salesOrder = value;
}
/**
* Gets the value of the stage property.
*
* @return
* possible object is
* {@link SearchEnumMultiSelectField }
*
*/
public SearchEnumMultiSelectField getStage() {
return stage;
}
/**
* Sets the value of the stage property.
*
* @param value
* allowed object is
* {@link SearchEnumMultiSelectField }
*
*/
public void setStage(SearchEnumMultiSelectField value) {
this.stage = value;
}
/**
* Gets the value of the subscriptionLine property.
*
* @return
* possible object is
* {@link SearchMultiSelectField }
*
*/
public SearchMultiSelectField getSubscriptionLine() {
return subscriptionLine;
}
/**
* Sets the value of the subscriptionLine property.
*
* @param value
* allowed object is
* {@link SearchMultiSelectField }
*
*/
public void setSubscriptionLine(SearchMultiSelectField value) {
this.subscriptionLine = value;
}
/**
* Gets the value of the use property.
*
* @return
* possible object is
* {@link SearchEnumMultiSelectField }
*
*/
public SearchEnumMultiSelectField getUse() {
return use;
}
/**
* Sets the value of the use property.
*
* @param value
* allowed object is
* {@link SearchEnumMultiSelectField }
*
*/
public void setUse(SearchEnumMultiSelectField value) {
this.use = value;
}
/**
* Gets the value of the customFieldList property.
*
* @return
* possible object is
* {@link SearchCustomFieldList }
*
*/
public SearchCustomFieldList getCustomFieldList() {
return customFieldList;
}
/**
* Sets the value of the customFieldList property.
*
* @param value
* allowed object is
* {@link SearchCustomFieldList }
*
*/
public void setCustomFieldList(SearchCustomFieldList value) {
this.customFieldList = value;
}
}
| [
"ccolon@git.eandjmedia.com"
] | ccolon@git.eandjmedia.com |
9216ddd9c0a758c31b6a7746a77045b9deb7cfc2 | 44641b8aded524b7b203dd1f487cd43774269e3c | /sd-lector-events/src/main/java/ed/cracken/code/servlets/PushHandler.java | ee168913015736f38e3759dd4504f556eeab1f83 | [] | no_license | eliudiaz/StripesTest | 788c3423dffbefcb186223ca23b947c355175dc4 | 430f747fa98f3c841528b95917a7f329c6481c97 | refs/heads/master | 2021-01-11T05:24:28.760802 | 2017-01-06T14:40:05 | 2017-01-06T14:40:05 | 71,803,736 | 0 | 1 | null | 2016-11-02T07:17:02 | 2016-10-24T15:35:02 | Java | UTF-8 | Java | false | false | 3,586 | java | /*
* 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 ed.cracken.code.servlets;
import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
import ed.cracken.code.managers.IDsManager;
import ed.cracken.code.servlets.dto.Persona;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author eliud
*/
@WebServlet(name = "PushProcessor", urlPatterns = {"/push"})
public class PushHandler extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json");
BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream(), "UTF-8"));
String json = "";
StringBuilder sb = new StringBuilder();
while ((json = br.readLine()) != null) {
sb.append(json);
}
br.close();
System.out.println(">> " + sb.toString());
JsonReader reader = new JsonReader(new StringReader(sb.toString()));
reader.setLenient(true);
Persona persona = new Gson().fromJson(reader, Persona.class);
IDsManager idsManager;
if ((idsManager = (IDsManager) request.getServletContext().getAttribute("idsmanager")) == null) {
idsManager = new IDsManager();
request.getServletContext().setAttribute("idsmanager", idsManager);
}
idsManager.getIds().put(persona.getSession(), persona);
response.setStatus(HttpServletResponse.SC_ACCEPTED);
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"eliudiaz@gmail.com"
] | eliudiaz@gmail.com |
b5c44a8b092cfbccbdf10a265995a40da62c853c | 7bf7d3a0b09671ce9f9aaef6d3bd7597a5dcf5b1 | /app/src/main/java/com/cognizant/flymanager/activity/MainActivity.java | c19a9581531d9a377c6c9ad0a4600a48cd4da979 | [] | no_license | dipanjanBot/FlightManager | fae6766d6eacc4a7d8517450ad2ec56283e1379c | 8529d96eb8788369952748007a67ca697ec2d119 | refs/heads/master | 2021-04-06T08:55:41.932314 | 2018-03-19T11:45:46 | 2018-03-19T11:45:46 | 124,369,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,842 | java | package com.cognizant.flymanager.activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import com.cognizant.flymanager.R;
import com.cognizant.flymanager.adapter.DrawerItemCustomAdapter;
import com.cognizant.flymanager.fragment.BookingFragment;
import com.cognizant.flymanager.fragment.FixturesFragment;
import com.cognizant.flymanager.fragment.HomePageFragment;
import com.cognizant.flymanager.model.DataModel;
public class MainActivity extends AppCompatActivity {
Toolbar toolbar;
android.support.v7.app.ActionBarDrawerToggle mDrawerToggle;
private String[] mNavigationDrawerItemTitles;
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private CharSequence mDrawerTitle;
private CharSequence mTitle;
private FragmentManager defaultfragmentManager;
private Fragment baseFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTitle = mDrawerTitle = getTitle();
mNavigationDrawerItemTitles= getResources().getStringArray(R.array.navigation_drawer_items_array);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
setupToolbar();
DataModel[] drawerItem = new DataModel[3];
drawerItem[0] = new DataModel(R.drawable.connect, "Home");
drawerItem[1] = new DataModel(R.drawable.fixtures, "Book a flight");
drawerItem[2] = new DataModel(R.drawable.table, "Flight Status");
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setHomeButtonEnabled(true);
DrawerItemCustomAdapter adapter = new DrawerItemCustomAdapter(this, R.layout.drawer_list_view_item_row, drawerItem);
mDrawerList.setAdapter(adapter);
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerLayout.setDrawerListener(mDrawerToggle);
setupDrawerToggle();
defaultfragmentManager = getSupportFragmentManager();
baseFragment = new HomePageFragment();
defaultfragmentManager.beginTransaction().replace(R.id.content_frame, baseFragment).commit();
}
private void selectItem(int position) {
Fragment fragment = null;
switch (position) {
case 0:
fragment = new HomePageFragment();
break;
case 1:
fragment = new BookingFragment();
break;
case 2:
fragment = new FixturesFragment();
break;
default:
break;
}
if (fragment != null) {
defaultfragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
setTitle(mNavigationDrawerItemTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
} else {
Log.e("MainActivity", "Error in creating fragment");
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void setTitle(CharSequence title) {
mTitle = title;
getSupportActionBar().setTitle(mTitle);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
void setupToolbar(){
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
void setupDrawerToggle(){
mDrawerToggle = new android.support.v7.app.ActionBarDrawerToggle(this,mDrawerLayout,toolbar,R.string.app_name, R.string.app_name);
//This is necessary to change the icon of the Drawer Toggle upon state change.
mDrawerToggle.syncState();
}
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
}
}
}
| [
"dipanjan.dutta@cognizant.com"
] | dipanjan.dutta@cognizant.com |
fb35656d0e082eda21e9f1f0a423a6826500220e | c49d17bc0ea18308455dfa19e0f9560d87d0954f | /thor-communication/src/main/java/com/mob/thor/communication/core/delegation/rmi/RmiCommunicationConnection.java | 1bce1319953fb050483597a55f18b118645a4203 | [
"Apache-2.0"
] | permissive | MOBX/Thor | 4b6ed58ba167bde1a8e4148de4a05268314e86d4 | 68b650d7ee05efe67dc1fca8dd0194a47d683f72 | refs/heads/master | 2020-12-31T02:49:31.603273 | 2016-01-30T12:49:39 | 2016-01-30T12:49:39 | 48,224,631 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | /*
* Copyright 2015-2020 uuzu.com All right reserved.
*/
package com.mob.thor.communication.core.delegation.rmi;
import com.mob.thor.communication.core.CommunicationEndpoint;
import com.mob.thor.communication.core.delegation.connection.CommunicationConnection;
import com.mob.thor.communication.core.exception.CommunicationException;
import com.mob.thor.communication.core.model.CommunicationParam;
import com.mob.thor.communication.core.model.Event;
/**
* 对应rmi的connection实现
*
* @author zxc Dec 24, 2015 4:41:14 PM
*/
public class RmiCommunicationConnection implements CommunicationConnection {
private CommunicationEndpoint endpoint;
private CommunicationParam params;
public RmiCommunicationConnection(CommunicationParam params, CommunicationEndpoint endpoint) {
this.params = params;
this.endpoint = endpoint;
}
public void close() throws CommunicationException {
// do nothing
}
public Object call(Event event) {
// 调用rmi传递数据到目标server上
return endpoint.acceptEvent(event);
}
@Override
public CommunicationParam getParams() {
return params;
}
}
| [
"zhangxiongcai337@gmail.com"
] | zhangxiongcai337@gmail.com |
c2e8f31e69b29f67e2bfd46c2411f978f61b7df2 | 573b9c497f644aeefd5c05def17315f497bd9536 | /src/main/java/com/alipay/api/response/AlipayOfflineProviderEquipmentAuthRemoveResponse.java | 48fd1e612838099fe361c093ecc4f233e3151490 | [
"Apache-2.0"
] | permissive | zzzyw-work/alipay-sdk-java-all | 44d72874f95cd70ca42083b927a31a277694b672 | 294cc314cd40f5446a0f7f10acbb5e9740c9cce4 | refs/heads/master | 2022-04-15T21:17:33.204840 | 2020-04-14T12:17:20 | 2020-04-14T12:17:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.offline.provider.equipment.auth.remove response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class AlipayOfflineProviderEquipmentAuthRemoveResponse extends AlipayResponse {
private static final long serialVersionUID = 4253334365277128614L;
/**
* 被解绑的机具编号
*/
@ApiField("device_id")
private String deviceId;
/**
* 机具厂商PID
*/
@ApiField("merchant_pid")
private String merchantPid;
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceId( ) {
return this.deviceId;
}
public void setMerchantPid(String merchantPid) {
this.merchantPid = merchantPid;
}
public String getMerchantPid( ) {
return this.merchantPid;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
79a8d2ffa5e53a69e2e510b287fac2851f49e865 | cd686241381e0babae7b440b9564d191c80c1c39 | /app/src/main/java/com/example/wellington/lolguide/model/spell/SummonerSpellDto.java | eb4f3a6ca50e7abbc4d290affa6917bfc4f040ea | [] | no_license | wellyogui/LolGuide | 39e0667ae8d1e68a5c0ef8d3a9e7ef0b4ba02e22 | a0238011d7e6e19c58b353f63653ec87ba45c052 | refs/heads/master | 2021-01-13T02:48:31.890627 | 2017-05-17T14:15:10 | 2017-05-17T14:15:10 | 77,160,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,863 | java |
package com.example.wellington.lolguide.model.spell;
import java.util.List;
import com.example.wellington.lolguide.model.Image;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class SummonerSpellDto {
@SerializedName("name")
@Expose
public String name;
@SerializedName("description")
@Expose
public String description;
@SerializedName("sanitizedDescription")
@Expose
public String sanitizedDescription;
@SerializedName("tooltip")
@Expose
public String tooltip;
@SerializedName("sanitizedTooltip")
@Expose
public String sanitizedTooltip;
@SerializedName("image")
@Expose
public Image image;
@SerializedName("resource")
@Expose
public String resource;
@SerializedName("maxrank")
@Expose
public Integer maxrank;
@SerializedName("cost")
@Expose
public List<Integer> cost = null;
@SerializedName("costType")
@Expose
public String costType;
@SerializedName("costBurn")
@Expose
public String costBurn;
@SerializedName("cooldown")
@Expose
public List<Integer> cooldown = null;
@SerializedName("cooldownBurn")
@Expose
public String cooldownBurn;
@SerializedName("effect")
@Expose
public List<Object> effect = null;
@SerializedName("effectBurn")
@Expose
public List<String> effectBurn = null;
@SerializedName("range")
@Expose
public List<Integer> range = null;
@SerializedName("rangeBurn")
@Expose
public String rangeBurn;
@SerializedName("summonerLevel")
@Expose
public Integer summonerLevel;
@SerializedName("id")
@Expose
public Integer id;
@SerializedName("key")
@Expose
public String key;
@SerializedName("modes")
@Expose
public List<String> modes = null;
}
| [
"well_yogui@hotmail.com"
] | well_yogui@hotmail.com |
fdade604b12e4d8982a19e9dd7167a2d21ffe820 | 369270a14e669687b5b506b35895ef385dad11ab | /jdk.internal.vm.compiler/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/optimize/SignExtendShort.java | 8a3a4fc87a49c6bdf55c54e19b2df9e1fc9825ff | [] | no_license | zcc888/Java9Source | 39254262bd6751203c2002d9fc020da533f78731 | 7776908d8053678b0b987101a50d68995c65b431 | refs/heads/master | 2021-09-10T05:49:56.469417 | 2018-03-20T06:26:03 | 2018-03-20T06:26:03 | 125,970,208 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,078 | java | /*
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.graalvm.compiler.jtt.optimize;
import org.junit.Test;
import org.graalvm.compiler.jtt.JTTTest;
/*
*/
public class SignExtendShort extends JTTTest {
public static int val;
public static boolean test(short[] b) {
val = b[2];
int x = 0;
return val >= x;
}
@Test
public void run0() throws Throwable {
runTest("test", new short[]{0, 0, 0});
}
@Test
public void run1() throws Throwable {
runTest("test", new short[]{0, 0, 1});
}
@Test
public void run2() throws Throwable {
runTest("test", new short[]{0, 0, -1});
}
@Test
public void run3() throws Throwable {
runTest("test", new short[]{0, 0, Short.MAX_VALUE});
}
@Test
public void run4() throws Throwable {
runTest("test", new short[]{0, 0, Short.MIN_VALUE});
}
}
| [
"841617433@qq.com"
] | 841617433@qq.com |
89f486b8184e5556bdcc8d6ec33ef41a95b8575f | b4347feddc232095e8b043f4eaed2c04c6d35eff | /app/src/main/java/com/likeit/as51scholarship/model/Messageabean.java | 8ef0202fd2d4c460de1f1144639953d2a2876f14 | [] | no_license | 13512780735/51 | f7b17c06f852965d76ec2789cd610f3faef32420 | c3bc87993a933f040e5cb5b1fad0a7d795eba3c9 | refs/heads/master | 2021-09-12T19:28:49.386555 | 2017-12-14T12:26:31 | 2017-12-14T12:26:31 | 112,406,078 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package com.likeit.as51scholarship.model;
/**
* Created by Administrator on 2017/9/29.
*/
public class Messageabean {
/**
* id : 1
* title : test公告
* content : test公告test公告test公告test公告test公告test公告test公告test公告test公告test公告
* link : http://www.wbteam.cn
* create_time : 2017-09-29 16:13:41
*/
private String id;
private String title;
private String content;
private String link;
private String create_time;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
}
| [
"931317632@qq.com"
] | 931317632@qq.com |
d32472b9ea7c4d4f78afd1a5a82c0462907ba23a | 4c70538fb305fb80abe27990b8bf508cf920b297 | /app/src/main/java/com/walasys/conductor/Utiles/General.java | ce13e60afd87c3b204f0ebe356009ee6e423f18c | [] | no_license | wdariasm/TrlTransportador | eb032a491da1545c9578c7bed18ade77abf70a7d | 14853197e16acf740cc48e6adaf09ef5056df9a3 | refs/heads/master | 2021-03-19T18:40:40.136379 | 2018-10-03T04:31:11 | 2018-10-03T04:31:11 | 118,202,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,036 | java | package com.walasys.conductor.Utiles;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.location.Criteria;
import android.location.LocationManager;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.Window;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.walasys.conductor.Modulos.Configuracion.Configuracion;
import com.walasys.conductor.Modulos.Inicial.Login;
import com.walasys.conductor.Modulos.Servicios.Historial;
import com.walasys.conductor.Modulos.Servicios.Pagos;
import com.walasys.conductor.Modulos.Servicios.Principal;
import com.walasys.conductor.R;
import com.walasys.conductor.Servicios.webServicesConductor;
import com.walasys.conductor.Servicios.webServicesLogin;
import com.walasys.conductor.Utiles.Modelos.Conductor;
import com.walasys.conductor.Utiles.Modelos.ConfiguracionApp;
import com.google.android.gms.maps.model.LatLng;
import org.json.JSONObject;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* Created by Gilmar Ocampo Nieves on 24/11/2016.
*/
public class General {
public static Activity mActivity;
private Activity context;
private ProgressDialog dialogCargando;
AlertDialog al;
boolean banMenu = true;
public General(Activity context,View v){
this.context = context;
if(v != null){
}
}
public void menuPrincipal(View view,final View mRevealView){
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
int cx = (mRevealView.getLeft() + mRevealView.getRight());
int cy = (view.getTop());
int startradius=0;
int endradius = Math.max(mRevealView.getWidth(), mRevealView.getHeight());
Animator animator = ViewAnimationUtils.createCircularReveal(mRevealView,cx, cy, startradius, endradius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(300);
int reverse_startradius = Math.max(mRevealView.getWidth(),mRevealView.getHeight());
int reverse_endradius=0;
Animator animate = ViewAnimationUtils.createCircularReveal(mRevealView,cx,cy,reverse_startradius,reverse_endradius);
if(banMenu){
mRevealView.setVisibility(View.VISIBLE);
animator.start();
banMenu = false;
}else{
mRevealView.setVisibility(View.VISIBLE);
// to hide layout on animation end
animate.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mRevealView.setVisibility(View.INVISIBLE);
banMenu = true;
}
});
animate.start();
}
}else{
final Dialog dialog1 = new Dialog(context);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.getWindow().setBackgroundDrawable(new ColorDrawable(Color.argb(0, 0, 0, 0)));
dialog1.setContentView(R.layout.layout_menu_principal);
LinearLayout div_servicios = (LinearLayout) dialog1.findViewById(R.id.div_servicios);
LinearLayout div_historial = (LinearLayout) dialog1.findViewById(R.id.div_historial);
LinearLayout div_pagos = (LinearLayout) dialog1.findViewById(R.id.div_pagos);
LinearLayout div_ajustes = (LinearLayout) dialog1.findViewById(R.id.div_ajustes);
LinearLayout div_salir = (LinearLayout) dialog1.findViewById(R.id.div_salir);
TextView lblConductor = (TextView) dialog1.findViewById(R.id.lblConductor);
TextView lblPlaca = (TextView) dialog1.findViewById(R.id.lblPlaca);
Conductor con = cargarConductor();
lblConductor.setText(con.Nombre);
lblPlaca.setText(con.CdPlaca);
div_servicios.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
irMenuItem(view);
dialog1.dismiss();
}
});
div_historial.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
irMenuItem(view);
dialog1.dismiss();
}
});
div_pagos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
irMenuItem(view);
dialog1.dismiss();
}
});
div_ajustes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
irMenuItem(view);
dialog1.dismiss();
}
});
div_salir.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
irMenuItem(view);
dialog1.dismiss();
}
});
dialog1.show();
}
}
public void irMenuItem(View v){
Intent i;
switch (v.getId()){
case R.id.div_servicios:
i = new Intent(context,Principal.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
break;
case R.id.div_historial:
i = new Intent(context,Historial.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
break;
case R.id.div_ajustes:
i = new Intent(context,Configuracion.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
break;
case R.id.div_pagos:
i = new Intent(context,Pagos.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
break;
case R.id.div_salir:
ConfiguracionApp configApp = cargarConfiguracion();
if(configApp.cuadroConfirmacion){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
alertDialog.setTitle("Aviso");
alertDialog.setMessage("Desea realizar la acción?");
alertDialog.setCancelable(false);
alertDialog.setPositiveButton("Continuar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
cerrarSesion();
}
});
alertDialog.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog al = alertDialog.create();
al.show();
}else{
cerrarSesion();
}
break;
}
}
public void cerrarSesion(){
initCargando("Cerrando sesión...");
new Thread(new Runnable() {
@Override
public void run() {
final webServicesLogin sc = new webServicesLogin(context);
Conductor con = cargarConductor();
final JSONObject j = sc.cerrarSesion(con.idConductor,con.token);
context.runOnUiThread(new Runnable() {
@Override
public void run() {
try{
finishCargando();
quitarCuenta();
Intent i = new Intent(context,Login.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
try {
Intent in = new Intent(context,ServicioGPS.class);
context.stopService(in);
}catch(Exception ex){}
}catch(Exception ex){}
}
});
}
}).start();
}
public void mostrarDialog(String titulo,String mensaje,boolean cancelable){
AlertDialog.Builder b = new AlertDialog.Builder(context);
b.setTitle(titulo);
b.setMessage(mensaje);
b.setCancelable(cancelable);
b.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog al = b.create();
al.show();
}
public void initCargando(String mensaje){
dialogCargando = new ProgressDialog(context);
dialogCargando.setMessage(mensaje);
dialogCargando.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialogCargando.setCancelable(true);
dialogCargando.show();
}
public void finishCargando(){
dialogCargando.dismiss();
}
public boolean validarGPSActivo(){
boolean ban = true;
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, false);
if (provider != null && !provider.equals("")) {
Boolean isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!isGPSEnabled) {
mostarAlertDeConfiguracion();
ban = false;
}else
ban = true;
}else
ban = false;
return ban;
}
public List<LatLng> decodePoly(String encoded) {
List<LatLng> poly = new ArrayList<LatLng>();
int index = 0, len = encoded.length();
int lat = 0, lng = 0;
while (index < len) {
int b, shift = 0, result = 0;
do {
b = encoded.charAt(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lat += dlat;
shift = 0;
result = 0;
do {
b = encoded.charAt(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lng += dlng;
LatLng p = new LatLng((((double) lat / 1E5)),
(((double) lng / 1E5)));
poly.add(p);
}
return poly;
}
private void mostarAlertDeConfiguracion() {
if(al == null){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
alertDialog.setTitle("Configuración del GPS");
alertDialog.setMessage("Debes activar el GPS para continuar.");
alertDialog.setCancelable(false);
alertDialog.setPositiveButton("Configurar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
context.startActivity(intent);
}
});
al = alertDialog.create();
al.show();
}
}
public void actualizarServidor(String servidor){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("rutaServidor", servidor);
editor.commit();
}
public String cargarServidor(){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
return prefs.getString("rutaServidor", "http://192.168.0.22/TrlTaxi/public/api");
//return prefs.getString("rutaServidor", "http://app.trl.com.co/public/api");
}
public static String cargarServidor(Context context){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
return prefs.getString("rutaServidor", "http://192.168.0.22/TrlTaxi/public/api");
//return prefs.getString("rutaServidor", "http://app.trl.com.co/public/api");
}
public void guardarConfiguracion(ConfiguracionApp con){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("cfg_cuadroConfirm", con.cuadroConfirmacion);
editor.commit();
}
public ConfiguracionApp cargarConfiguracion(){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
ConfiguracionApp c = new ConfiguracionApp();
c.cuadroConfirmacion = prefs.getBoolean("cfg_cuadroConfirm", true);
return c;
}
public void guardarConductor(Conductor con){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("token", con.token);
editor.putString("usuario", con.usuario);
editor.putString("idUsuario", con.idUsuario);
editor.putString("pass", con.pass);
editor.putString("permisos", con.Permisos);
editor.putString("idConductor", con.idConductor);
editor.putString("email", con.Email);
editor.putString("Nombre", con.Nombre);
editor.putString("placa", con.CdPlaca);
editor.putBoolean("cuenta", true);
editor.commit();
}
public Conductor cargarConductor(){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
Conductor c = new Conductor();
c.token = prefs.getString("token", null);
c.usuario = prefs.getString("usuario", null);
c.idUsuario = prefs.getString("idUsuario", null);
c.pass = prefs.getString("pass", null);
c.Permisos = prefs.getString("permisos", null);
c.idConductor = prefs.getString("idConductor", null);
c.Email = prefs.getString("Email", null);
c.Nombre = prefs.getString("Nombre", null);
c.CdPlaca = prefs.getString("placa", null);
return c;
}
public boolean sesion(){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
return prefs.getBoolean("cuenta", false);
}
public void quitarCuenta(){
SharedPreferences prefs = context.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("token", null);
editor.putString("usuario", null);
editor.putString("pass", null);
editor.putString("placa", null);
editor.putBoolean("cuenta", false);
editor.putBoolean("cfg_cuadroConfirm", true);
editor.commit();
}
public static String getToken(Context con){
SharedPreferences prefs = con.getSharedPreferences("tlrConductor", Context.MODE_PRIVATE);
return prefs.getString("token", null);
}
public String getIMEI(){
TelephonyManager mngr = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE);
return mngr.getDeviceId();
}
public Drawable getDrawable(Activity context, int id){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return context.getResources().getDrawable(id, context.getTheme());
} else {
return context.getDrawable(id);
}
}
public void determinarBotonActualizar(String estadoActual, TextView btnConfirmar, TextView btnCancelar){
btnCancelar.setText("Cancelar");
if(estadoActual.compareTo("ASIGNADO") == 0){
btnConfirmar.setText("Confirmar");
btnCancelar.setText("Rechazar");
}else{
if(estadoActual.compareTo("CONFIRMADO") == 0){
btnConfirmar.setText("Desplazandome");
}else{
if(estadoActual.compareTo("DESPLAZAMIENTO A SITIO") == 0){
btnConfirmar.setText("En sitio");
}else{
if(estadoActual.compareTo("EN SITIO") == 0){
btnConfirmar.setText("En ruta");
}else{
if(estadoActual.compareTo("EN RUTA") == 0){
btnConfirmar.setText("Finalizar");
btnCancelar.setVisibility(View.GONE);
}else{
btnConfirmar.setText("Finalizar");
btnCancelar.setVisibility(View.GONE);
}
}
}
}
}
}
public String determinarEstadoServicio(String estadoActual){
String nuevoEstado = "CONFIRMADO";
if(estadoActual.compareTo("ASIGNADO") == 0){
nuevoEstado = "CONFIRMADO";
}else{
if(estadoActual.compareTo("CONFIRMADO") == 0){
nuevoEstado = "DESPLAZAMIENTO A SITIO";
}else{
if(estadoActual.compareTo("DESPLAZAMIENTO A SITIO") == 0){
nuevoEstado = "EN SITIO";
}else{
if(estadoActual.compareTo("EN SITIO") == 0){
nuevoEstado = "EN RUTA";
}else{
if(estadoActual.compareTo("EN RUTA") == 0){
nuevoEstado = "FINALIZADO";
}else
nuevoEstado = "FINALIZADO";
}
}
}
}
return nuevoEstado;
}
public void getDatosConductor(final TextView lblConductor,final TextView lblPlaca){
final Conductor con = cargarConductor();
if(con.CdPlaca == null) {
new Thread(new Runnable() {
@Override
public void run() {
final webServicesConductor sc = new webServicesConductor(context);
final JSONObject obj = sc.getDatosConductor(con.idConductor, con.token);
context.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
if (obj != null) {
con.CdPlaca = obj.getString("CdPlaca");
guardarConductor(con);
lblConductor.setText(con.Nombre);
lblPlaca.setText(con.CdPlaca);
}
} catch (Exception ex) {
}
}
});
}
}).start();
}else{
lblConductor.setText(con.Nombre);
lblPlaca.setText(con.CdPlaca);
}
}
public String fechaActual(){
final Calendar c= Calendar.getInstance();
String fecha = "";
int anio = c.get(Calendar.YEAR);
int mes = c.get(Calendar.MONTH);
int dia = c.get(Calendar.DAY_OF_MONTH);
String me = String.valueOf((mes + 1));
String di = String.valueOf(dia);
if((mes + 1) < 10){
me = "0" + String.valueOf((mes + 1));
}
if((dia + 1) < 10){
di = "0" + String.valueOf(dia);
}
fecha = anio + "-" + me + "-" + di;
return fecha;
}
public String formatearFecha(String fecha,String formatoViejo,String formatoNuevo){
try {
Date date = new SimpleDateFormat(formatoViejo).parse(fecha);
return new SimpleDateFormat(formatoNuevo).format(date);
}catch(Exception ec){
return null;
}
}
public String formatearNumero(Double numero){
DecimalFormat formatea = new DecimalFormat("###,###.##");
return formatea.format(numero);
}
public String formatearHora(String fe){
try {
Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(fe);
return new SimpleDateFormat("hh:mm a").format(date);
}catch(Exception ex){}
return null;
}
}
| [
"wdarias@unicesar.edu.co"
] | wdarias@unicesar.edu.co |
961cd8fa355a62ef1ae328cb0cdb3b34d6fceab5 | bbffb2bdacdf1de236ffb4c799a49ab97beda31e | /src/main/java/br/com/service/exception/ErroAutenticacaoException.java | 4f10c6ca37e9a62e86986e9846cf4957ed300eef | [] | no_license | JhonisAnjos/minhas-financas-backend | 9d8bb37ee7ed26a8101497624a6817ff9951100b | 7e7f0c0a649f570b841c50f4e96445e1daa3f5d1 | refs/heads/main | 2023-01-24T21:12:21.551948 | 2020-11-26T13:44:31 | 2020-11-26T13:44:31 | 315,403,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package br.com.service.exception;
public class ErroAutenticacaoException extends RuntimeException {
public ErroAutenticacaoException(String message) {
super(message);
}
}
| [
"jhonis_10@hotmail.com.br"
] | jhonis_10@hotmail.com.br |
a8f191f20d3271cea236bb0228e26f84bd11532a | 9a8a1303f0bd99080097c637b8e6ca5e3eb9c70f | /src/main/java/com/hq/secondhand_book/entity/PlaceTransaction.java | 8c1c29a62892ba0b24cbfd851fbb863e4053e33f | [] | no_license | zifan612301/study | 65f1cee6237fe22a1db88e653558a1699d2a82e0 | 36a82c3e547bd376d6283468e4220d4997a5ab95 | refs/heads/master | 2023-05-22T08:56:41.968348 | 2021-06-05T09:54:24 | 2021-06-05T09:54:24 | 308,547,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package com.hq.secondhand_book.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
/**
* @auther 黄琦
* @create 2019 04 02
*/
@Entity
@Data
@Table( name = "place_transaction")
public class PlaceTransaction {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY)
private Integer id; //交易地点编号
@Column(name = "place_name")
private String placeName; //交易地点名称
@Column(name = "place_father_id")
private Integer placeFatherId; //交易地点父类编号
@Column(name = "place_level")
private Integer placeLevel; //地点级别
@Column(name = "is_usable")
private Integer usable; //是否可用:0-否 1-是
@Column(name = "cst_create")
private Date cstCreate; //数据的创建时间
@Column(name = "cst_modify")
private Date cstModify; //数据的修改时间
}
| [
"1779490625@qq.com"
] | 1779490625@qq.com |
cd1feb4cab7f02e401a2a84299316f7768917e8f | 320b7e4ab10a1f7cf58147a6e8a0951ba4b3dcd0 | /comehome-socket/src/main/java/com/ac/comehome/config/WebSocketConfig.java | aab6439b6422508d1511f69696af01ae91251b51 | [] | no_license | ErfengV/comehome | f769c8a895d6218c523e8dbfc0885e6ae9c67a09 | dc3e6e6488b0d13d5ceac7cd2b1cc9c5fdb7f564 | refs/heads/main | 2023-08-27T18:17:29.096164 | 2021-10-26T05:24:26 | 2021-10-26T05:24:26 | 367,632,032 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package com.ak.chess.dao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* 配置类
* 功能:开启WebSocket支持
* */
@Configuration
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
} | [
"3208027182@qq.com"
] | 3208027182@qq.com |
938e0df47fe6bc2cee28e165be57269642f34f23 | 0454f1ca2465b7c87595478f91b573480aa79736 | /AdvanceJava/21 JSP Basics/JSP Action Elements/javabean/Test.java | a076e12847c1b476e9f40a6f2c84b02507176928 | [] | no_license | maheshp1987/JAVA-Programming | 273dabeb51454be8ebf0c17e99efc3c71952a1c4 | 41349b28882ddc79dbc6ef544b016659bd1082f7 | refs/heads/master | 2021-01-17T17:51:05.529257 | 2018-03-26T04:42:29 | 2018-03-26T04:42:29 | 60,851,554 | 4 | 4 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package com.javabean;
public class Test{
public static void main(String args[]){
Employee e=new Employee();//object is created
e.setName("OM");//setting value to the object
System.out.println(e.getName());
}} | [
"mahesh.pavaskar@gslab.com"
] | mahesh.pavaskar@gslab.com |
2b26749f0c075ffc7eb49c60574d6eead2040fab | 6b8b39cb613f1382ddfcba13965614cdbad2ba66 | /src/test/java/com/example/aruna/MovieRatingsServiceNewApplicationTests.java | 210c4e28ce50806a976c6e4aa5eda28b4e57c5db | [] | no_license | arunasilva86/movie-ratings-service-new | 8862e568fd93220fffc1b6e731c682d695b9d342 | e7677b32f5fca87342f4d1067b29dac9cc45a524 | refs/heads/master | 2020-08-01T02:02:51.730734 | 2019-09-25T10:52:52 | 2019-09-25T10:53:04 | 210,821,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | package com.example.aruna;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MovieRatingsServiceNewApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"aruna@intervest.lk"
] | aruna@intervest.lk |
978b4f885a0942a3cee3871d947db6918cf9fc30 | 78a5af6d7778847e93385d1e00ad8f773f1d0fba | /SystemsForDesignAndImplementation/SDIProjectModular/web/src/main/java/web/controller/ClientWebController.java | 053295e17bf48960ab3485f5f594b989c472d2e4 | [] | no_license | vladvlad23/UBBComputerScienceBachelor | 099596a139c8aa5460c705b6d51fb86608015687 | d99a26dbcd9b629f5b3f38ff814cab42837365ed | refs/heads/master | 2023-05-08T23:49:32.737144 | 2021-05-27T19:06:56 | 2021-05-27T19:06:56 | 280,646,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,476 | java | package web.controller;
import core.controller.interfaces.ClientServiceInterface;
import core.exceptions.ControllerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import web.converter.ClientConverter;
import web.dto.ClientDto;
import java.util.ArrayList;
import java.util.List;
@RestController
public class ClientWebController {
public static final Logger log= LoggerFactory.getLogger(ClientWebController.class);
@Autowired
private ClientServiceInterface clientService;
@Autowired
private ClientConverter clientConverter;
@RequestMapping(value = "/clients", method = RequestMethod.GET)
List<ClientDto> getClients() {
log.trace("getClients: method entered");
log.trace("getClients: method exit");
return new ArrayList<>(clientConverter
.convertModelsToDtos(clientService.getAll()));
}
@RequestMapping(value = "/clients", method = RequestMethod.POST)
ClientDto saveClient(@RequestBody ClientDto clientDto) throws ControllerException {
log.trace("saveClient: method entered: clientDto = {}",clientDto);
ClientDto returnValue = clientConverter.convertModelToDto(
clientService.add(clientConverter.convertDtoToModel(clientDto)));
log.trace("saveClient: method exit: returnValue={}",returnValue);
return returnValue;
}
@RequestMapping(value = "/clients/{id}", method = RequestMethod.PUT)
ClientDto updateClient(@PathVariable Long id,
@RequestBody ClientDto clientDto) {
log.trace("updateClient: method entered: clientDto={}",clientDto);
ClientDto returnValue = clientConverter.convertModelToDto(
clientService.update(clientConverter.convertDtoToModel(clientDto)));
log.trace("updateClient: method exit: returnValue={}",returnValue);
return returnValue;
}
@RequestMapping(value = "/clients/{id}", method = RequestMethod.DELETE)
ResponseEntity<?> deleteClient(@PathVariable Long id) throws ControllerException {
log.trace("deleteClient: entered method: id={}",id);
clientService.remove(id);
log.trace("deleteClient: exit method");
return new ResponseEntity<>(HttpStatus.OK);
}
}
| [
"ungureanu.vlad1@gmail.com"
] | ungureanu.vlad1@gmail.com |
524d982d58778c1eb18e0cd6b524f25410d0be8c | d148a22ba57c797ef78b4ae72ae7ae6ef1c8e1f4 | /EcoMottoHouse-Web/src/main/java/org/apache/EcoMotto/web/component/IPersonService.java | a8b45ba7b85feba9f78d3866d3af6e75714c339c | [] | no_license | mrchenjunjie/EcoMottoHouse-Web | 8b6c2ea61591ae938f467cd59d41f7b7db28e529 | 8d083c1eaa432472857da7c45ec1f267075e5172 | refs/heads/master | 2021-01-23T12:33:37.856060 | 2015-06-01T05:16:31 | 2015-06-01T05:16:31 | 34,977,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 114 | java | package org.apache.EcoMotto.web.component;
public interface IPersonService {
public String getPersonName();
}
| [
"chenjunjie.net@gmail.com"
] | chenjunjie.net@gmail.com |
de5c1f139cd08fb50332dbbbc8ed3413da8aac51 | 042fc648173712141566349ccd9be2cfdff3d628 | /app/src/main/java/com/ky/kyandroid/adapter/EventEntityListAdapter.java | 84458d173fda30f20751285592e0828889b75e60 | [] | no_license | kyAndroid/KyAndroid-1 | 00a6f4dd8603528b2d507b51c9e3e744f8a8b1b6 | 19a5178e0558112c4b1fea8a26e02b555358057b | refs/heads/master | 2021-01-21T14:53:20.741496 | 2017-06-25T09:49:23 | 2017-06-25T09:49:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,513 | java | package com.ky.kyandroid.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.ky.kyandroid.R;
import com.ky.kyandroid.entity.TFtSjEntity;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class EventEntityListAdapter extends BaseAdapter {
public List<TFtSjEntity> list;
public Context context;
public EventEntityListAdapter(Context context) {
super();
list = new ArrayList<TFtSjEntity>();
this.context = context;
}
public EventEntityListAdapter(List<TFtSjEntity> list, Context context) {
super();
this.list = list;
this.context = context;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = View.inflate(context, R.layout.activity_evententry_item, null);
holder = new ViewHolder(convertView);
convertView.setTag(holder);// 绑定ViewHolder对象
} else {
holder = (ViewHolder) convertView.getTag();// 取出ViewHolder对象
}
holder.thingName.setText(list.get(position).getSjmc());
holder.thingAddress.setText(list.get(position).getFsdd());
holder.thingTime.setText(list.get(position).getFssj());
if("1".equals(list.get(position).getZt())){
holder.thingStatus.setText("未上报");
}else{
holder.thingStatus.setText(list.get(position).getZtname());
}
return convertView;
}
/**
* 存放控件
*/
class ViewHolder {
@BindView(R.id.thing_name)
TextView thingName;
@BindView(R.id.thing_status)
TextView thingStatus;
@BindView(R.id.thing_address)
TextView thingAddress;
@BindView(R.id.thing_time)
TextView thingTime;
ViewHolder(View view) {
ButterKnife.bind(this, view);
}
}
public void notifyDataSetChanged(List<TFtSjEntity> list) {
this.list = list;
super.notifyDataSetChanged();
}
}
| [
"969516253@qq.com"
] | 969516253@qq.com |
a954f352653e105e00afb8bc71a3b21c34124442 | 9739485a54700d5efb38b38af9db010ae49617ed | /C_Arrays/src/eindimensional/Niederschlagsmengen.java | 2e75c56edfd2bffb56119bda24ba6d097840dfee | [] | no_license | sly1018/Java-Aufbau | c52fe61fb6262682b9014f71e556f18a7abcec3b | 971355d6750f2e812f36e121b1016fa7cf26848e | refs/heads/master | 2023-04-30T07:55:31.652668 | 2021-05-28T14:31:19 | 2021-05-28T14:31:19 | 354,025,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,407 | java | package eindimensional;
import java.util.Arrays;
import java.util.Random;
public class Niederschlagsmengen {
public static void main(String[] args) {
// Niederschlagswerte in ein Array pro Monat
double[] werte = new double[12];
Random random = new Random();
// int tmp = random.nextInt(45); // liefer Werte zwischen 0 und 45
// an jedem Index einen Wert setzen
for (int i = 0; i < werte.length; i++) {
// Zufallswert holen
double wert = random.nextDouble() * 100;
// und im Array eintragen
werte[i] = wert;
}
// alle Werte anzeigen
for (double wert : werte) {
System.out.printf("%.1f", wert);
}
System.out.println();
// Monat mit dem wenigsten Niederschlag suchen
int iMin = 0;
// Wenn der neue aktuelle Wert kleiner ist -> neues Minumun merken
for (int i = 0; i < werte.length; i++) {
if (werte[i] < werte[iMin]) {
iMin = i;
if (werte[i] == 0) {
break;
}
}
}
System.out.printf("Das Minimum war im Monat %d mit %.1f mm\n", iMin + 1, werte[iMin]);
String[] monatsNamen = { "Jänner", "Februar", "März", "April", "Juni", "Juli", "August", "September", "Oktober",
"November", "Dezember" };
System.out.printf("Das Minimum war im %s mit %.1f mm\n", monatsNamen[iMin], werte[iMin]);
// Hilfsklasse für Arrays
// das Array sortieren
Arrays.sort(werte);
System.out.println(Arrays.toString(werte));
}
}
| [
"s.khawar@chello.at"
] | s.khawar@chello.at |
1436eeec5505bc74d6667eb9adef558cd8366f5f | 8d0cd47ed68bee4f5de3819e4404dcd85866b174 | /app/src/main/java/com/example/jatin/AddressLocator/MainActivity.java | 426764fe5a58074ee3d77601f812d891f4426b5a | [] | no_license | jatingupta896/Addresslocator | 40643cbf702635469b95685ef992aa9812cbfc40 | 862bdf3bac076e0acf2258c6092b79d68f3541a1 | refs/heads/master | 2020-07-23T18:47:58.562234 | 2017-06-14T17:37:15 | 2017-06-14T17:37:15 | 94,357,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,346 | java | package com.example.jatin.AddressLocator;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class MainActivity extends AppCompatActivity {
private EditText room;
private EditText locality;
private EditText zipCode;
private EditText city;
private EditText state;
private EditText country;
private ProgressDialog progressDialog;
private DatabaseReference databaseReference;
private Button submitButton;
private String location;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
progressDialog = new ProgressDialog(this);
databaseReference = FirebaseDatabase.getInstance().getReference().child("Address");
submitButton = (Button) findViewById(R.id.submit);
room = (EditText) findViewById(R.id.room_no);
locality = (EditText) findViewById(R.id.locality);
city = (EditText) findViewById(R.id.city);
state = (EditText) findViewById(R.id.state);
country = (EditText) findViewById(R.id.country);
zipCode = (EditText) findViewById(R.id.pincode);
SharedPreferences sharedPreferences=getSharedPreferences("DemoFile",0);
String sr=sharedPreferences.getString("STATUS1",null);
room.setText(sr);
String sl=sharedPreferences.getString("STATUS2",null);
locality.setText(sl);
String sc=sharedPreferences.getString("STATUS3",null);
city.setText(sc);
String ss=sharedPreferences.getString("STATUS4",null);
state.setText(ss);
String sco=sharedPreferences.getString("STATUS5",null);
country.setText(sco);
String sz=sharedPreferences.getString("STATUS6",null);
zipCode.setText(sz);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
progressDialog.setMessage("Loading...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
if(room.length()>6 || locality.length()>20 || zipCode.length()!=6 )
{
Toast.makeText(MainActivity.this,"Room No field is having more than 6 character or Locality field is having more than 20 character or Zipcode is not correct ", Toast.LENGTH_SHORT).show();
}
else
{
String Room = room.getText().toString().trim();
String Locality=locality.getText().toString().trim();
String City = city.getText().toString().trim();
String State = state.getText().toString().trim();
String Country = country.getText().toString().trim();
String Zipcode = zipCode.getText().toString().trim();
if(!TextUtils.isEmpty(Room)&&!TextUtils.isEmpty(Locality)&&!TextUtils.isEmpty(City)&&!TextUtils.isEmpty(State)&&!TextUtils.isEmpty(Country)&&!TextUtils.isEmpty(Zipcode))
{
progressDialog.show();
DatabaseReference post=databaseReference.push();
post.child("RoomNo").setValue(Room);
post.child("Locality").setValue(Locality);
post.child("City").setValue(City);
post.child("State").setValue(State);
post.child("Country").setValue(Country);
post.child("Zipcode").setValue(Zipcode);
progressDialog.dismiss();
// room.setText(null);
// locality.setText(null);
// country.setText(null);
// city.setText(null);
// state.setText(null);
// zipCode.setText(null);
location= Room+", "+Locality+", "+City+", "+State+", "+Country+", "+ Zipcode;
Intent intent= new Intent(MainActivity.this,MapsActivity.class);
intent.putExtra("Location", location);
startActivityForResult(intent,7777);
}
}
}
});
}
@Override
protected void onStop()
{
super.onStop();
SharedPreferences sharedPreferences=getSharedPreferences("DemoFile",0);
SharedPreferences.Editor editor=sharedPreferences.edit();
editor.putString("STATUS1",room.getText().toString());
editor.putString("STATUS2",locality.getText().toString());
editor.putString("STATUS3",city.getText().toString());
editor.putString("STATUS4",state.getText().toString());
editor.putString("STATUS5",country.getText().toString());
editor.putString("STATUS6",zipCode.getText().toString());
editor.commit();
}
}
| [
"jatingupta896@gmail.com"
] | jatingupta896@gmail.com |
b6efdcca3e46fd2f6dae116a195341a0cd924963 | 35ffc86799e2e38ef0493c1a44a1bab3de9d7c93 | /Exercise_05/Exercise_05_46/Exercise_05_46.java | 30eec41ef1e5a19df91d4375a378e05da0758f04 | [
"MIT"
] | permissive | yashi-jain02/Intro-to-Java-Programming | 858dc5df8384543540ebd904cbee874f147b3249 | b0b3c0994e272433e07650289c7b657dc43d96f0 | refs/heads/master | 2020-07-17T22:55:42.110826 | 2019-09-03T18:25:56 | 2019-09-03T18:25:56 | 206,118,169 | 1 | 0 | MIT | 2019-09-03T16:05:48 | 2019-09-03T16:05:48 | null | UTF-8 | Java | false | false | 620 | java | /*
(Reverse a string) Write a program that prompts the user to enter a string and
displays the string in reverse order.
*/
import java.util.Scanner;
public class Exercise_05_46 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Prompt the user to enter a string
System.out.print("Enter a string: ");
String string = input.nextLine();
// Reverse the string
String reverse = "";
for (int i = string.length() - 1; i >= 0; i--) {
reverse += string.charAt(i);
}
// Display the string in reverse order
System.out.println("The reversed string is " + reverse);
}
} | [
"jabarimail@gmail.com"
] | jabarimail@gmail.com |
34e76edcc00939fb2517bb26351fa7b40fff8979 | 4aba3e932838919f3ef6f2ee033fbb563a0cf865 | /Wable/src/com/thx/bizcat/adapter/SearchElement.java | a039a9ec10b07030cd953d4426b358e2a8cc9788 | [] | no_license | WableMaker/wableAndroid | 1a692bf77c0313373ab9add4cc643b39b286a413 | 799f987272567a9e0e64ca018f3852f8a9235954 | refs/heads/master | 2021-01-01T10:13:58.732157 | 2013-04-13T05:59:01 | 2013-04-13T05:59:01 | 3,549,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package com.thx.bizcat.adapter;
import android.graphics.Bitmap;
public class SearchElement {
private Bitmap bitmap;
private String title;
private String contents;
private String price;
private String idx;
public Bitmap getBitmap() {
return bitmap;
}
public SearchElement setBitmap(Bitmap bitmap) {
this.bitmap = bitmap;
return this;
}
public String getTitle() {
return title;
}
public SearchElement setTitle(String title) {
this.title = title;
return this;
}
public String getContents() {
return contents;
}
public SearchElement setContents(String contents) {
this.contents = contents;
return this;
}
public String getPrice() {
return price;
}
public SearchElement setPrice(String price) {
this.price = price;
return this;
}
public String getIdx() {
return idx;
}
public SearchElement setIdx(String idx) {
this.idx = idx;
return this;
}
}
| [
"who@are.you"
] | who@are.you |
4d91409262c2f45a66cf991eb2dabf36db188510 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-f4004.java | e758551777a3d516934a99acf15487954a3f3077 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
7191748887152 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
db052c1b8aa9e64f989bda1492ae41146553f5d1 | 15b260ccada93e20bb696ae19b14ec62e78ed023 | /v2/src/main/java/com/alipay/api/response/AlipayDigitalmgmtAppAppreportQueryResponse.java | ac4f17d1913a16c384bd73a37fddff6112779a5f | [
"Apache-2.0"
] | permissive | alipay/alipay-sdk-java-all | df461d00ead2be06d834c37ab1befa110736b5ab | 8cd1750da98ce62dbc931ed437f6101684fbb66a | refs/heads/master | 2023-08-27T03:59:06.566567 | 2023-08-22T14:54:57 | 2023-08-22T14:54:57 | 132,569,986 | 470 | 207 | Apache-2.0 | 2022-12-25T07:37:40 | 2018-05-08T07:19:22 | Java | UTF-8 | Java | false | false | 888 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.domain.ApmobileAppDetectResultDTO;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.digitalmgmt.app.appreport.query response.
*
* @author auto create
* @since 1.0, 2023-08-11 17:51:40
*/
public class AlipayDigitalmgmtAppAppreportQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 3311649585663478897L;
/**
* 检测结果
*/
@ApiField("apmobile_app_detect_result_dto")
private ApmobileAppDetectResultDTO apmobileAppDetectResultDto;
public void setApmobileAppDetectResultDto(ApmobileAppDetectResultDTO apmobileAppDetectResultDto) {
this.apmobileAppDetectResultDto = apmobileAppDetectResultDto;
}
public ApmobileAppDetectResultDTO getApmobileAppDetectResultDto( ) {
return this.apmobileAppDetectResultDto;
}
}
| [
"auto-publish"
] | auto-publish |
b620a169ca923a941d0d300f501acc908993bb22 | cd3c70241c04b3adc943950802abd4f564fc2734 | /taotao_manager/taotao_manager_mapper/src/main/java/com/ithk/manager/mapper/TestMapper.java | fac79c0704eeee3893be3a924299f31e673007df | [] | no_license | IThekun/kaixintaotao | 88a31c8ddba1ba2c5b62022f3ab9d33ad1f70157 | d88df77b0b8239ffd2530572fb6e5f24ab663461 | refs/heads/master | 2021-09-09T01:46:10.583289 | 2018-03-12T02:33:50 | 2018-03-12T02:34:32 | 125,008,896 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package com.ithk.manager.mapper;
public interface TestMapper {
String queryDate();
}
| [
"ithekun@163.com"
] | ithekun@163.com |
bae1e69c7d449c920aaa9d32befe4dbb96eacf18 | 1661886bc7ec4e827acdd0ed7e4287758a4ccc54 | /srv_unip_pub/src/main/java/com/sa/unip/app/ywsp/ctrlhandler/OA_BGYPSQGridViewSearchFormHandler.java | f0cc5f1353091fb7435fa70f4084c8f456c8f0d8 | [
"MIT"
] | permissive | zhanght86/iBizSys_unip | baafb4a96920e8321ac6a1b68735bef376b50946 | a22b15ebb069c6a7432e3401bdd500a3ca37250e | refs/heads/master | 2020-04-25T21:20:23.830300 | 2018-01-26T06:08:28 | 2018-01-26T06:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,257 | java | /**
* iBizSys 5.0 机器人生产代码(不要直接修改当前代码)
* http://www.ibizsys.net
*/
package com.sa.unip.app.ywsp.ctrlhandler;
import java.util.ArrayList;
import java.util.List;
import net.ibizsys.paas.util.StringHelper;
import net.ibizsys.paas.web.WebContext;
import net.ibizsys.paas.demodel.DEModelGlobal;
import net.ibizsys.paas.demodel.IDataEntityModel;
import net.ibizsys.paas.service.IService;
import net.ibizsys.paas.service.ServiceGlobal;
import com.sa.unip.app.srv.ywsp.ctrlmodel.OA_BGYPSQDefaultSearchFormModel;
import com.sa.unip.srv.ywsp.demodel.OA_BGYPSQDEModel;
import com.sa.unip.srv.ywsp.service.OA_BGYPSQService;
import com.sa.unip.srv.ywsp.dao.OA_BGYPSQDAO;
import com.sa.unip.srv.ywsp.entity.OA_BGYPSQ;
import net.ibizsys.paas.ctrlmodel.ISearchFormModel;
import net.ibizsys.paas.data.DataObject;
import net.ibizsys.paas.data.IDataObject;
import net.ibizsys.paas.web.AjaxActionResult;
import net.ibizsys.paas.web.SDAjaxActionResult;
import net.ibizsys.paas.sysmodel.ISystemRuntime;
import net.ibizsys.paas.ctrlhandler.IFormItemHandler;
import net.ibizsys.paas.ctrlhandler.IFormItemUpdateHandler;
public class OA_BGYPSQGridViewSearchFormHandler extends net.ibizsys.paas.ctrlhandler.SearchFormHandlerBase {
protected OA_BGYPSQDefaultSearchFormModel searchformModel = null;
public OA_BGYPSQGridViewSearchFormHandler() {
super();
}
@Override
protected void onInit() throws Exception {
searchformModel = (OA_BGYPSQDefaultSearchFormModel)this.getViewController().getCtrlModel("searchform");
super.onInit();
}
@Override
protected ISearchFormModel getSearchFormModel() {
return this.getRealSearchFormModel();
}
protected OA_BGYPSQDefaultSearchFormModel getRealSearchFormModel() {
return this.searchformModel ;
}
protected OA_BGYPSQService getRealService() {
return (OA_BGYPSQService)this.getViewController().getService();
}
/**
* 准备部件成员处理对象
* @throws Exception
*/
@Override
protected void prepareCtrlItemHandlers()throws Exception {
super.prepareCtrlItemHandlers();
ISystemRuntime iSystemRuntime = (ISystemRuntime)this.getSystemModel();
}
} | [
"dev@ibizsys.net"
] | dev@ibizsys.net |
5988d3d665141c12462452e7563de2ce445e74a8 | b309bb07a25b7c429abdf1327c7db154851cac7e | /src/main/java/com/example/wenda/controller/SettingController.java | 8f413f94c1ae73889e69f4b170239d1e844d03e4 | [] | no_license | YimengL/Q-A-Website | 8c3095712d49db840cff4f3e3152ebee6f8d94c3 | b6293526d6fd922871cdc19cc08e5024846895d4 | refs/heads/master | 2020-03-20T19:09:27.084741 | 2018-08-04T23:42:48 | 2018-08-04T23:42:48 | 137,624,176 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package com.example.wenda.controller;
import com.example.wenda.service.WendaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
@Controller
public class SettingController {
@Autowired
WendaService wendaService;
@RequestMapping(path = {"/setting"}, method = {RequestMethod.GET})
@ResponseBody
public String setting(HttpSession httpSession) {
return "Setting OK. " + wendaService.getMessage(1);
}
}
| [
"liyimengru@gmail.com"
] | liyimengru@gmail.com |
cbbce622bcebbae9f299a7f715cdcc735b44d2c5 | e90c160723af90a8f75bf556d0c81de1f789fb03 | /src/Pikachu.java | 6e5347cf42f7f4bade3818c159a86ff1f8ab4f05 | [] | no_license | mymindd/pokemongame | 9dac5d828db97af5144dfb37ec7035bdf734b281 | fa678bbf41dbd8a063d4718f8692b19403fa1780 | refs/heads/master | 2021-04-27T19:20:49.081533 | 2018-05-13T18:07:51 | 2018-05-13T18:07:51 | 122,355,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java |
class Pikachu extends Pokemon{
public Pikachu(String name, double weight, double damage){
super(name, weight, damage, 0.7, new String[] {"Electric"});
}
}
| [
"mypspgood@gmail.com"
] | mypspgood@gmail.com |
6d7f17cf1974184849f08c76da9f710010ebc732 | 2da87d8ef7afa718de7efa72e16848799c73029f | /ikep4-support/src/main/java/com/lgcns/ikep4/support/user/group/dao/GroupDao.java | 25f96d42d90d35cd927235d5d0d95552fd29ce2d | [] | no_license | haifeiforwork/ehr-moo | d3ee29e2cae688f343164384958f3560255e52b2 | 921ff597b316a9a0111ed4db1d5b63b88838d331 | refs/heads/master | 2020-05-03T02:34:00.078388 | 2018-04-05T00:54:04 | 2018-04-05T00:54:04 | 178,373,434 | 0 | 1 | null | 2019-03-29T09:21:01 | 2019-03-29T09:21:01 | null | UTF-8 | Java | false | false | 9,075 | java | /*
* Copyright (C) 2011 LG CNS Inc.
* All rights reserved.
*
* 모든 권한은 LG CNS(http://www.lgcns.com)에 있으며,
* LG CNS의 허락없이 소스 및 이진형식으로 재배포, 사용하는 행위를 금지합니다.
*/
package com.lgcns.ikep4.support.user.group.dao;
import java.util.List;
import java.util.Map;
import com.lgcns.ikep4.framework.core.dao.GenericDao;
import com.lgcns.ikep4.support.user.group.model.Group;
import com.lgcns.ikep4.support.user.member.model.User;
import com.lgcns.ikep4.support.user.member.model.UserSearchCondition;
import com.lgcns.ikep4.util.model.GroupDetail;
/**
* 그룹 관리 DAO 정의
*
* @author 양새로훈(yang.sae@gmail.com)
* @version $Id: GroupDao.java 18238 2012-04-24 05:36:54Z yu_hs $
*/
public interface GroupDao extends GenericDao<Group, String> {
/**
* 트리를 그리기 위해 조직도에서 그룹 목록 그룹타입별로 조회
*
* @param group 조회조건이 있는 그룹 객체
* @return
*/
public List<Group> selectOrgGroupByGroupTypeId(Group group);
/**
* 그룹에 속해 있는 사용자 목록을 조회
*
* @param id 조회할 그룹의 ID
* @return
*/
@SuppressWarnings("rawtypes")
public List selectUserInGroup(String groupId);
/**
* 사용자를 그룹에 매핑
*
* @param user 그룹에 추가할 사용자 객체
*/
public void addUserToGroup(User user);
/**
* 그룹 수정 후에 USER_GROUP 테이블 업데이트
*
* @param user 업데이트할 사용자 객체
*/
public void updateUserGroup(User user);
/**
* USER_GROUP 테이블에서 해당 그룹-사용자 매핑 정보 삭제
*
* @param groupId 매핑정보를 삭제할 그룹 ID
*/
public void removeGroupFromUserGroup(String groupId);
/**
* ROLE_GROUP 테이블에서 해당 역할-사용자 매핑 정보 삭제
*
* @param groupId 매핑정보를 삭제할 그룹 ID
*/
public void deleteGroupFromRole(String groupId);
/**
* GROUP_SYS_PERMISSION 테이블에서 관련 매핑 정보 삭제
*
* @param groupId 매핑정보를 삭제할 그룹 ID
*/
public void deleteGroupFromSysPermission(String groupId);
/**
* GROUP_CON_PERMISSION 테이블에서 관련 매핑 정보 삭제
*
* @param groupId 매핑정보를 삭제할 그룹 ID
*/
public void deleteGroupFromConPermission(String groupId);
/**
* USER_GROUP 테이블에서 사용자 정보를 상위그룹으로 이동(그룹 삭제시)
*
* @param user 이동할 사용자 정보
*/
public void moveUserToParentGroup(User user);
/**
* 그룹 삭제시에 자식 그룹들을 이동하는 데에 필요함(현재는 자식이 있는 그룹은 삭제 못함)
*
* @param groupId 부모 그룹 ID
* @return
*/
public List<Group> selectChild(String groupId);
/**
* 그룹 삭제 후에 하위 그룹 업데이트
*
* @param groupId 부모 그룹 ID
*/
public void removeChild(String groupId);
/**
* 그룹 타입별로 그룹목록을 가져옴
*
* @param group 부모 그룹 ID
* @return
*/
public List<Group> selectGroupByGroupType(Group group);
/**
* 해당 그룹의 자식그룹 카운트를 업데이트함
*
* @param parentGroupId 부모 그룹 ID
* @param plusMinusFlag 카운트를 증가/감소 시키기 위한 플래그
*/
public void updateChildGroupCount(String parentGroupId, String plusMinusFlag);
/**
* 정렬순서 최대값 가져오기
*
* @return
*/
public String getMaxSortOrder();
/**
* 그룹 이동 후에 그룹 정보를 업데이트함(ParentGroup, childCount 등)
*
* @param group 업데이트할 그룹 객체
*/
public void updateMove(Group group);
/**
* 그룹 이동 후에 sortOrder 업데이트
*
* @param group 업데이트할 그룹 객체
*/
public void updateSortOrder(String prevSortOrder);
/**
* 그룹을 한단계 위로 이동(같은 레벨)
*
* @param map 이동 조건
* @return
*/
public Group goUp(Map<String, String> map);
/**
* 그룹을 한단계 아래로 이동(같은 레벨)
*
* @param map 이동 조건
* @return
*/
public Group goDown(Map<String, String> map);
/**
* 해당 사용자가 속한 최상위 그룹 조회
*
* @param map 검색 조건
* @return
*/
public Group selectUserRootGroup(Map<String, Object> map);
/**
* 해당 사용자가 속한 그룹 조회 (최상위 그룹 제외)
*
* @param map 검색 조건
* @return
*/
public List<Group> selectUserGroupWithHierarchy(Map<String, Object> map);
/**
* 해당 사용자가 속한 그룹 조회 (그룹ID, 그룹명만 가져옴)
*
* @param map
* @return
*/
public List<Group> selectUserGroup(Map<String, Object> map);
/**
* 그룹 목록을 그룹타입별로 가져옴
*
* @param groupTypeId
* @return
*/
public List<Group> selectAll(String groupTypeId);
/**
* 그룹 생성시에 그룹에 매핑되는 사용자의 Teamname을 업데이트
*
* @param user
*/
public void updateTeamName(User user);
/**
* 해당 그룹의 부모 그룹을 가져옴
*
* @param id
* @return
*/
public String selectParentGroupId(String groupId);
/* ===== 새로 추가하시는 경우 아래에 삽입하시기 바랍니다. ===== */
/**
* 조직도에서 그룹 목록 가져오기 : 지정된 그룹에 대한 하위 그룹
*
* @param group
* @return
*/
public List<Group> selectOrgGroup(Group group);
public List<Group> selectOrgGroupSp(Group group);
/**
* Collaboration에서 그룹 목록 가져오기 : 지정된 그룹에 대한 하위 그룹
*
* @param groupId
* @return
*/
public List<Group> selectCollaborationGroup(String groupId);
/**
* Sns에서 그룹 목록 가져오기 : 지정된 그룹에 대한 하위 그룹
*
* @param groupId
* @return
*/
public List<Group> selectSnsGroup(String groupId);
/**
* 조직도 부터 SNS 까지 모든 통합 그룹 검색 : 그룹명 검색
*
* @param keyword
* @return
*/
public List<Group> selectGroupSearch(Map<String, Object> map);
/**
* 모든 그룹 정보를 불러옴
*
* @param searchCondition 검색 조건
* @return
*/
public List<Group> selectAll(UserSearchCondition searchCondition);
/**
* 모든 그룹 정보 갯수
*
* @param searchCondition 검색 조건
* @return
*/
Integer countBySearchCondition(UserSearchCondition searchCondition);
/**
* FullPath 업데이트
*
* @param group FullPath를 업데이트할 그룹 객체
*/
public void updateFullPath(Group group);
/**
* 해당 사용자가 속한 겸직 그룹 조회 (최상위 그룹 제외)
*
* @param map
* @return
*/
public List<Group> selectUserGroupOther(Map<String, Object> map);
/**
* 그룹 생성/수정시 Leader를 선택하는 경우 해당 User의 Leader flag 업데이트
*
* @param user
*/
public void updateLeaderInfo(User user);
/**
* 그룹명 변경시 User 정보의 teamName을 업데이트하기 위한 정보
*
* @param groupInfo 이전 그룹명과 변경된 그룹명을 가지고 있는 Map
*/
public void updateUserTeamName(Map<String, String> groupInfo);
/**
* 그룹명 변경시 User 정보의 대표그룹의 이름으로 teamName을 업데이트하기 위한 정보
*
* @param groupInfo 그룹아이디와 변경된 그룹명을 가지고 있는 Map
*/
public void updateUserRepresentTeamName(Map<String, String> groupInfo);
/**
* 그룹 정보 변경시 User 정보에서 대표그룹 정보가 웹에서 받아오는 UserList에 포함되어있지 않기 때문에 본 Dao를 통해
* 기존의 대표그룹 정보를 가져와 새로 받아온 UserList에 넣어준다.
*
* @param userInfo
*/
public User selectUserInfoInGroup(Map<String, String> userInfo);
/**
* 사용자 그룹의 전체 경로 조회
*
* @param userId
* @return groupFullPath
*/
public String selectGroupFullPath(Map<String, Object> userInfo);
/**
* 그룹의 전체 경로 조회
*
* @param userId
* @return groupFullPath
*/
public String selectGroupFullPathByGroup(Map<String, Object> groupInfo);
/**
* 설문대상 그룹 목록
* @param surveyId
* @return List<Group>
*/
public List<Group> getTargetGroup(String surveyId);
/**
* 그룹 루트 갯수 구하기
* @param map
* @return rootGroupCount
*/
public int getRootGroupCount(Map<String, String> map);
/**
* 해당 그룹의 leader id 조회
* @param groupId
* @return userId
*/
public String getLeaderForGroup(String groupId);
/**
* 해당 그룹의 리더 삭제
* @param group
*/
public void updateEmptyGroupLeader(Group group);
/**
* Sap 에서 수신한 조직정보를 저장한다.
* @param groupDetail
*/
public void updateSapGroup(GroupDetail groupDetail);
/**
* Sap에서 수신된 그룹 정보가 담긴 tmp 테이블에서 실 테이블로 전송한다
* @return 수행된 결과값
*/
public String updateEpTableFromTmpGroupTable();
public void deleteTmpGroup(String tmp);
}
| [
"haneul9@gmail.com"
] | haneul9@gmail.com |
8053fe249fb0201e4afff6e33b33c8dd0da8ebce | b6a991dfbc85d0051beb358ec13b13d3cd01548a | /src/com/controller/UserDetailsController.java | 60ba9725374de7c5b804c661ed951a8c3f4f2feb | [] | no_license | xiaoxie111/springmvc | af39189682d6063e97fce9841f20afe02800208f | c9737dca7e1fcd1e495f513ba813693f020991bf | refs/heads/master | 2022-03-27T13:30:42.969991 | 2019-12-26T06:34:15 | 2019-12-26T06:34:15 | 198,356,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | package com.controller;
import com.service.UserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 用户详情
*/
@Controller
@RequestMapping("userDetails")
public class UserDetailsController {
@Autowired
UserDetailsService userDetailsService;
/**
* 用户详情列表
*
* @param udId
* @param userId
* @param allname
* @param telephone
* @return
*/
@RequestMapping("getUserDetailsList")
@ResponseBody
public List<Map<String, Object>> getUserDetailsList(String udId, String userId, String allname, String telephone) {
return userDetailsService.getUserDetailsList(udId, userId, allname, telephone);
}
/**
* 修改详情信息
*
* @param udId
* @param telephone
* @param allname
* @return
*/
@RequestMapping("updateUserDetailsByUdId")
@ResponseBody
public String updateUserDetailsByUdId(String udId, String telephone, String allname) {
return userDetailsService.updateUserDetailsByUdId(udId, telephone, allname);
}
}
| [
"38757011+xiaoxie111@users.noreply.github.com"
] | 38757011+xiaoxie111@users.noreply.github.com |
e5143c587ffbda9ccaaf51bdcaf3056ce9fbc6f8 | 5648d74f6243e63e45a8888043b0d017bf49dd50 | /02NQueens/QueenBoard.java | 537b46b77770ea557d12a571624e7e9af51b5674 | [] | no_license | AntonDanylenko/MKS22X | a1eb7a36d2ef79e43dd378a84c1b675f8a1d083d | bfae3c84a343079dcfd1e39b23d55159b8252b50 | refs/heads/master | 2018-09-02T16:10:47.834472 | 2018-06-17T21:17:47 | 2018-06-17T21:17:47 | 120,021,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,744 | java | public class QueenBoard{
private int[][] board;
public QueenBoard(int size){
board = new int[size][size];
}
private boolean addQueen(int r, int c){
if (board[r][c]!=0){
return false;
}
for (int n=0; n<board.length; n++){
board[r][n]+=1;
}
for (int p=0; p<board.length; p++){
board[p][c]+=1;
}
for (int q=0; q<board.length; q++){
try{
board[r+q][c+q]+=1;
}
catch(ArrayIndexOutOfBoundsException e){
}
}
for (int s=0; s<board.length; s++){
try{
board[r-s][c+s]+=1;
}
catch(ArrayIndexOutOfBoundsException e){
}
}
board[r][c] = -1;
return true;
}
private boolean removeQueen(int r, int c){
if (board[r][c]!=-1){
return false;
}
for (int n=0; n<board.length; n++){
board[r][n]-=1;
}
for (int p=0; p<board.length; p++){
board[p][c]-=1;
}
for (int q=0; q<board.length; q++){
try{
board[r+q][c+q]-=1;
}
catch(ArrayIndexOutOfBoundsException e){
}
}
for (int s=0; s<board.length; s++){
try{
board[r-s][c+s]-=1;
}
catch(ArrayIndexOutOfBoundsException e){
}
}
board[r][c] = 0;
return true;
}
public String toString(){
String result = "";
for (int n=0; n<board.length; n++){
for (int r=0; r<board.length; r++){
if (board[r][n]!=-1){
result = result + "_ ";
}
else{
result = result + "Q ";
}
}
result += "\n";
}
return result;
}
public boolean solve(){
for (int n=0; n<board.length; n++){
for (int r=0; r<board.length; r++){
if(board[n][r]!=0){
throw new IllegalStateException();
}
}
}
return solveHelp(0);
}
private boolean solveHelp(int col){
if (col == board.length){
return true;
}
for (int n=0; n<board.length; n++){
if(addQueen(n, col)){
if (solveHelp(col+1)){
return true;
}
removeQueen(n, col);
}
}
return false;
}
public int countSolutions(){
for (int n=0; n<board.length; n++){
for (int r=0; r<board.length; r++){
if(board[n][r]!=0){
throw new IllegalStateException();
}
}
}
return countHelp(0, 0);
}
private int countHelp(int col, int sum){
if (col == board.length){
return 1;
}
for (int n=0; n<board.length; n++){
if(addQueen(n, col)){
int num = countHelp(col+1, 0);
if (num>0){
sum+=num;
}
removeQueen(n, col);
}
}
return sum;
}
/*public static void main(String[]args){
QueenBoard newBoard = new QueenBoard(4);
System.out.println(newBoard.solve());
System.out.println(newBoard);
}*/
}
| [
"adanylenko@stuy.edu"
] | adanylenko@stuy.edu |
7aae09d9b4939e07ffefe151d3485cd95e6efea2 | de586da57fbe60b5c1c8bcd7094ee06a0e6bf524 | /src/Cliente.java | 132bf941d3b8bb99c295487ad4ad12b461245e5f | [] | no_license | greisn/Cliente | 8129dace726ac592225ff2a5b5d902d18578f214 | cad99723a0125b601fdd2a9a20be59daccbae87c | refs/heads/main | 2023-04-19T13:39:37.206687 | 2021-05-13T22:18:04 | 2021-05-13T22:18:04 | 363,765,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | /*
* 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.
*/
/**
*
* @author Acer
*/
public abstract class Cliente {
protected String nome;
protected String endereco;
protected String telefone;
protected double quantidade;
public Cliente() { }
public Cliente(String nome, String endereco, String telefone) {
this.nome = nome;
this.endereco = endereco;
this.telefone = telefone;
}
/**
* @return the nome
*/
public String getNome() {
return nome;
}
/**
* @param nome the nome to set
*/
public void setNome(String nome) {
this.nome = nome;
}
/**
* @return the endereco
*/
public String getEndereco() {
return endereco;
}
/**
* @param endereco the endereco to set
*/
public void setEndereco(String endereco) {
this.endereco = endereco;
}
/**
* @return the telefone
*/
public String getTelefone() {
return telefone;
}
/**
* @param telefone the telefone to set
*/
public void setTelefone(String telefone) {
this.telefone = telefone;
}
//public abstract void cadastrar();
//public abstract void imprimir();
public String getInfo(){
return "{ 'nome': '" + nome
+ "' , 'endereco': " + endereco
+ " , 'telefone': " + telefone + " }";
}
public abstract void cadastrar();
public abstract void excluir();
protected abstract void zerarCadastro();
public double getQuantidade() {
return quantidade;
}
/**
* @param quantidade the quantidade to set
*/
public void setQuantidade(double quantidade) {
this.quantidade = quantidade;
}
}
| [
"greisn@hotmail.com"
] | greisn@hotmail.com |
704de8c054489405f176e80ffc3c98b7db4481f6 | 5114f9232912f5230ead72ed0325af2dd02c8785 | /DS CHAPTER 6/src/Tutorial6/Q2.java | 8f2548177362e53244702c854710a0c6d5b5627c | [] | no_license | YongMing11/Data-Structure | df40b2b924c265ccd41f710aea7a2d937734d556 | 26ec72f6a378cf9f2863e13e6a0fc4efec9c9ada | refs/heads/master | 2022-11-06T18:47:58.336374 | 2020-06-22T05:25:31 | 2020-06-22T05:25:31 | 263,070,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | /*
* 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 Tutorial6;
/**
*
* @author Forge-15 1650
*/
public class Q2 {
public static void main(String[] args) {
System.out.println("Queue Implementation using Array");
Queue<Character> a = new Queue<>();
System.out.println("Enqueue three nodes");
a.enqueue('B');
a.enqueue('M');
a.enqueue('W');
a.showQueue();
System.out.println("\nDequeue one node");
a.dequeue();
a.showQueue();
System.out.println("\nThe front node of the queue is " + a.peek());
System.out.println("The queue size is " + a.getSize());
}
}
| [
"yongming1124@gmail.com"
] | yongming1124@gmail.com |
61cc2274fe224814e3a960a20886e3030e40ba18 | 6a0f5e53eee5000285297996d575ffacad8fdc0a | /src/main/java/com/DevHacks/Config.java | 782c578348246dc52d1302f1bcf3641d0fb9a31c | [] | no_license | Tudor-Robert/DevHacks | 1fd01af1f3955fb1f3bc8d8ea9d5ddb648896141 | d18f88b5878a6f94f575fd5eb692c99dbe91342b | refs/heads/master | 2023-01-13T13:15:20.979108 | 2020-11-13T16:08:36 | 2020-11-13T16:08:36 | 312,622,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,975 | java | package com.DevHacks;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import java.util.List;
@Configuration
@ComponentScan({"com.DevHacks"})
@EnableWebMvc
public class Config implements WebMvcConfigurer {
@Bean
public InternalResourceViewResolver viewResolver(){
InternalResourceViewResolver vr = new InternalResourceViewResolver();
vr.setPrefix("/WEB-INF/");
vr.setSuffix(".jsp");
return vr;
}
@Override
public void addFormatters(FormatterRegistry formatterRegistry) {
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> list) {
}
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> list) {
}
@Override
public Validator getValidator() {
return null;
}
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer contentNegotiationConfigurer) {
}
@Override
public void configureAsyncSupport(AsyncSupportConfigurer asyncSupportConfigurer) {
}
@Override
public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) {
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> list) {
}
@Override
public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> list) {
}
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> list) {
}
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
}
@Override
public MessageCodesResolver getMessageCodesResolver() {
return null;
}
@Override
public void addViewControllers(ViewControllerRegistry viewControllerRegistry) {
}
@Override
public void configureViewResolvers(ViewResolverRegistry viewResolverRegistry) {
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry resourceHandlerRegistry) {
resourceHandlerRegistry
.addResourceHandler("/webjars/**")
.addResourceLocations("/webjars/");
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer defaultServletHandlerConfigurer) {
}
}
| [
"madalina.mariana11@yahoo.com"
] | madalina.mariana11@yahoo.com |
927814c641fe97ffd224bcd90903b99b609c0188 | bc27749db347e1d73b37f03b54ff4f946f054be5 | /qywx-spring-boot-model/src/main/java/com/github/shuaidd/dto/tool/Callee.java | 46d6d2b51a1683b7542cb78ca7f9bf6b8339004b | [
"Apache-2.0"
] | permissive | shuaidd/qywx | 163f50b72b8b260ec7ece0601274a1c6c6d4c918 | 816b49ad39311c58031154cf96b22d25b227e0e3 | refs/heads/master | 2023-08-08T14:56:13.989652 | 2022-12-28T01:33:56 | 2022-12-28T01:33:56 | 180,478,416 | 90 | 32 | Apache-2.0 | 2023-06-14T22:26:52 | 2019-04-10T01:37:07 | Java | UTF-8 | Java | false | false | 467 | java | package com.github.shuaidd.dto.tool;
/**
* 描述
*
* @author ddshuai
* date 2019-04-11 13:38
**/
public class Callee {
private String phone;
private Long duration;
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Long getDuration() {
return duration;
}
public void setDuration(Long duration) {
this.duration = duration;
}
}
| [
"ddshuai@shinyway.com.cn"
] | ddshuai@shinyway.com.cn |
e330b8157e7c9bed2ca01dbf3c588dad9dd33edd | da916cb0517ccb7e9e581086a32dbaffdeb67082 | /src/com/agiletec/apsadmin/portal/ShowletsViewerAction.java | 231e53887fae5539f0ef71341e716e819a6953cb | [] | no_license | zendasi/PortalExample | 4cfb24415bb191f1926d7023bdc614fdc6df8607 | 40a195c9fe1aadc2e1a9e3325b022421414754c7 | refs/heads/master | 2022-11-30T09:23:41.105250 | 2012-03-25T16:50:00 | 2012-03-25T16:50:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,926 | java | /*
*
* Copyright 2005 AgileTec s.r.l. (http://www.agiletec.it) All rights reserved.
*
* This file is part of jAPS software.
* jAPS is a free software;
* you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; version 2.
*
* See the file License for the specific language governing permissions
* and limitations under the License
*
*
*
* Copyright 2005 AgileTec s.r.l. (http://www.agiletec.it) All rights reserved.
*
*/
package com.agiletec.apsadmin.portal;
import java.util.List;
import com.agiletec.aps.system.ApsSystemUtils;
import com.agiletec.aps.system.services.page.IPage;
import com.agiletec.aps.system.services.showlettype.ShowletType;
/**
* @author E.Santoboni
*/
public class ShowletsViewerAction extends AbstractPortalAction implements IShowletsViewerAction {
@Override
public String viewShowlets() {
return SUCCESS;
}
public List<IPage> getShowletUtilizers(String showletTypeCode) {
List<IPage> utilizers = null;
try {
utilizers = this.getPageManager().getShowletUtilizers(showletTypeCode);
} catch (Throwable t) {
ApsSystemUtils.logThrowable(t, this, "getShowletUtilizers");
throw new RuntimeException("Error on extracting showletUtilizers : showlet type code " + showletTypeCode, t);
}
return utilizers;
}
@Override
public String viewShowletUtilizers() {
return SUCCESS;
}
public List<IPage> getShowletUtilizers() {
return this.getShowletUtilizers(this.getShowletTypeCode());
}
public ShowletType getShowletType(String typeCode) {
return this.getShowletTypeManager().getShowletType(typeCode);
}
public String getShowletTypeCode() {
return _showletTypeCode;
}
public void setShowletTypeCode(String showletTypeCode) {
this._showletTypeCode = showletTypeCode;
}
/**
* @uml.property name="_showletTypeCode"
*/
private String _showletTypeCode;
} | [
"joel2.718@gmail.com"
] | joel2.718@gmail.com |
cd2c5a194b418fdd3b323974e8f8eb3c5aef4221 | 900ec59a5ec390ffe369803f9729920280022a73 | /team_src/SOS/source/src/sos/search_v2/agentSearch/PoliceSearch.java | 2c08a096655b8b5790f143f535378a52e6a28e72 | [] | no_license | jpollo/rcrss | f6292648ef6c5e3195bf1b2974a16e1d7022d53a | f6ee0ce05fdc4a1ca427e604e812572df00fad21 | refs/heads/master | 2021-01-01T16:33:58.890486 | 2014-07-09T15:19:05 | 2014-07-09T15:19:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,722 | java | package sos.search_v2.agentSearch;
import sos.base.SOSAgent;
import sos.base.entities.PoliceForce;
import sos.base.entities.StandardEntity;
import sos.base.message.structure.blocks.DataArrayList;
import sos.base.message.structure.channel.Channel;
import sos.search_v2.tools.cluster.MapClusterType;
import sos.search_v2.tools.searchScore.PoliceSearchScore;
import sos.search_v2.worldModel.SearchWorldModel;
/**
* @author Yoosef Golshahi
* @param <E>
*/
public class PoliceSearch<E extends PoliceForce> extends AgentSearch<E> {
public PoliceSearch(SOSAgent<E> me, SearchWorldModel<E> searchWorld, MapClusterType<E> clusterType) {
super(me, searchWorld, clusterType, PoliceSearchScore.class);
}
@Override
public void hear(String header, DataArrayList data, StandardEntity sender, Channel channel) {
super.hear(header, data, sender, channel);
////////////////////////////////////////////////////////
}
@Override
public void initSearchOrder() {
if (strategyChooser.noCommunication.isNoCommunication()) {
searchTypes.add(strategyChooser.fireSearch);
searchTypes.add(strategyChooser.blockSearch);
searchTypes.add(strategyChooser.civilianSearch);
// searchTypes.add(strategyChooser.blockSearch);
// searchTypes.add(strategyChooser.civilianUpdateSearch);
searchTypes.add(strategyChooser.combinedSearch);
} else {
// searchTypes.add(strategyChooser.starSearch);
searchTypes.add(strategyChooser.fireSearch);
searchTypes.add(strategyChooser.blockSearch);
searchTypes.add(strategyChooser.civilianSearch);
searchTypes.add(strategyChooser.civilianUpdateSearch);
searchTypes.add(strategyChooser.combinedSearch);
}
searchTypes.add(strategyChooser.dummySearch);
}
}
| [
"jasonllinux@gmail.com"
] | jasonllinux@gmail.com |
0fe9616e83c15f556462f22a6987aeae346dfc59 | 410b6f3e01c1777f27299ca8fee8d874d69da28a | /bos_management/bos_management_domain/src/main/java/com/huying/bos/domain/system/User.java | 3a6f18f85f0abdefbd345343df9300d684c12f40 | [] | no_license | CoraYue/boss | c6e8476401ba9a3c180db7988fd11aeaf5e56b0e | fa7f5638ad51314a046897f314aec2c1ee6a679d | refs/heads/master | 2021-03-30T21:41:39.108120 | 2018-04-02T02:59:44 | 2018-04-02T02:59:44 | 124,731,669 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,020 | java | package com.huying.bos.domain.system;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
/**
* @description:后台用户
*/
@Entity
@Table(name = "T_USER")
public class User implements Serializable{
@Id
@GeneratedValue
@Column(name = "C_ID")
private Long id; // 主键
@Column(name = "C_BIRTHDAY")
private Date birthday; // 生日
@Column(name = "C_GENDER")
private String gender; // 性别
@Column(name = "C_PASSWORD")
private String password; // 密码
@Column(name = "C_REMARK")
private String remark; // 备注
@Column(name = "C_STATION")
private String station; // 状态
@Column(name = "C_TELEPHONE")
private String telephone; // 联系电话
@Column(name = "C_USERNAME", unique = true)
private String username; // 登陆用户名
@Column(name = "C_NICKNAME")
private String nickname; // 真实姓名
@ManyToMany
@JoinTable(name = "T_USER_ROLE",
joinColumns = {@JoinColumn(name = "C_USER_ID",
referencedColumnName = "C_ID")},
inverseJoinColumns = {@JoinColumn(name = "C_ROLE_ID",
referencedColumnName = "C_ID")})
private Set<Role> roles = new HashSet<Role>(0);
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getStation() {
return station;
}
public void setStation(String station) {
this.station = station;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public Set<Role> getRoles() {
return roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
}
| [
"18772328082@163.com"
] | 18772328082@163.com |
7f2dba7e4c3da7b5f90d6ae5af44e96550ae7223 | 8df83162dd1cec2016b319642cf99c39112ada42 | /IPSCResultServer/src/main/java/fi/ipscResultServer/repository/springJDBCRepository/impl/UserRepositoryImpl.java | 093a6c2082046a7a9033668555ab9e041a67a930 | [
"MIT"
] | permissive | jarnovirta/IPSCResultServer | a6b318f8c3642b827aab71551410e8b4f24fde3c | a958df08f754ae860e747b7cef34c7bc218bb77c | refs/heads/master | 2022-12-25T13:17:48.094606 | 2020-12-16T17:03:23 | 2020-12-16T17:03:23 | 115,795,341 | 0 | 0 | MIT | 2022-12-15T23:27:25 | 2017-12-30T12:27:21 | HTML | UTF-8 | Java | false | false | 4,220 | java | package fi.ipscResultServer.repository.springJDBCRepository.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import fi.ipscResultServer.domain.User;
import fi.ipscResultServer.repository.springJDBCRepository.UserRepository;
import fi.ipscResultServer.repository.springJDBCRepository.impl.mapper.UserMapper;
@Repository
public class UserRepositoryImpl implements UserRepository {
@Autowired
private DatabaseUtil dbUtil;
private JdbcTemplate jdbcTemplate;
@PostConstruct
public void init() {
jdbcTemplate = dbUtil.getJdbcTemplate();
}
public User getOne(Long id) {
try {
String query = "SELECT * FROM USER WHERE ID = ?";
return jdbcTemplate.queryForObject(query, new Object[] { id }, new UserMapper());
}
catch (EmptyResultDataAccessException e) {
return null;
}
}
@Transactional
public User save(User user) {
String sql = "INSERT INTO USER (EMAIL, ENABLED, FIRSTNAME, LASTNAME, PASSWORD, PHONE, ROLE, USERNAME)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sql, new String[] { "ID" });
if (user.getEmail() == null) ps.setNull(1, java.sql.Types.NULL);
else ps.setString(1, user.getEmail());
ps.setBoolean(2, user.isEnabled());
if (user.getFirstName() == null) ps.setNull(3, java.sql.Types.NULL);
else ps.setString(3, user.getFirstName());
if (user.getLastName() == null) ps.setNull(4, java.sql.Types.NULL);
else ps.setString(4, user.getLastName());
ps.setString(5, user.getPassword());
if (user.getPhone() == null) ps.setNull(5, java.sql.Types.NULL);
else ps.setString(6, user.getPhone());
ps.setString(7, user.getRole().toString());
ps.setString(8, user.getUsername());
return ps;
}
}, keyHolder);
user.setId(keyHolder.getKey().longValue());
return user;
}
@Transactional
public void updateUser(User user) {
String sql = "UPDATE USER SET EMAIL = ?, ENABLED = ?, FIRSTNAME = ?, LASTNAME = ?, "
+ "PASSWORD = ?, PHONE = ?, ROLE = ?, USERNAME = ? WHERE ID = ?";
jdbcTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(sql);
if (user.getEmail() == null) ps.setNull(1, java.sql.Types.NULL);
else ps.setString(1, user.getEmail());
ps.setBoolean(2, user.isEnabled());
if (user.getFirstName() == null) ps.setNull(3, java.sql.Types.NULL);
else ps.setString(3, user.getFirstName());
if (user.getLastName() == null) ps.setNull(4, java.sql.Types.NULL);
else ps.setString(4, user.getLastName());
ps.setString(5, user.getPassword());
if (user.getPhone() == null) ps.setNull(5, java.sql.Types.NULL);
else ps.setString(6, user.getPhone());
ps.setString(7, user.getRole().toString());
ps.setString(8, user.getUsername());
ps.setLong(9, user.getId());
return ps;
}
});
}
public List<User> findEnabledUsers() {
String sql = "SELECT * FROM USER WHERE ENABLED = 1";
return jdbcTemplate.query(sql, new UserMapper());
}
public User findByUsername(String username) {
String sql = "SELECT * FROM USER WHERE USERNAME = ?";
return jdbcTemplate.queryForObject(sql, new Object[] { username }, new UserMapper());
}
}
| [
"jarnovirta@users.noreply.github.com"
] | jarnovirta@users.noreply.github.com |
236109f77016fc45fe1ace45d54bda50df71c7cf | 3317daae321c1dda5f29a48ff90100e7113003aa | /src/cn/ljh/marshalling/SubReqClientHandler.java | f52c1273ff95f0454baf2942ef6821ecf08c25f9 | [] | no_license | 3013779515/nettytest | 95d28639f1e0f97ea210fb1af412bc6e407a5bb4 | bd4c14671712aa535cbc2ec838ec12a3d0ece2b2 | refs/heads/master | 2021-01-20T00:23:56.014742 | 2017-04-24T00:37:39 | 2017-04-24T00:37:39 | 89,125,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,402 | java | package cn.ljh.marshalling;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
public class SubReqClientHandler extends ChannelHandlerAdapter {
/**
* Creates a client-side handler.
*/
public SubReqClientHandler() {
}
@Override
public void channelActive(ChannelHandlerContext ctx) {
for (int i=0; i<10; i++) {
ctx.write(subReq(i));
}
ctx.flush();
}
private SubscribeReq subReq(int i) {
SubscribeReq req = new SubscribeReq();
req.setAddress("NanJing YuHuaTai");
req.setPhoneNumber("136xxxxxxxxx");
req.setProductName("Netty Book For Marshalling");
req.setSubReqID(i);
req.setUserName("Lilinfeng");
return req;
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
System.out.println("Receive server response : [" + msg + "]");
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
ctx.close();
}
} | [
"3013779515@qq.com"
] | 3013779515@qq.com |
f5dc648af1c74d9be2e5ebed59ecf45152d7ee42 | 86a1bd57d44c1b263944b9ff7abb1a4d1545b0cf | /CH3_test_p12/src/p12.java | 1d6e814f711863ce17420fb0b36d0aae2a0afa0d | [] | no_license | eddytsai/105360027_HW3 | 0afe57074b3a654c2130e75b5aae78bc2d9618aa | 959d443cee271990aa5e4c61473944cb90eb802d | refs/heads/master | 2020-04-02T00:28:38.407923 | 2018-10-19T16:40:18 | 2018-10-19T16:40:18 | 153,806,976 | 0 | 0 | null | null | null | null | BIG5 | Java | false | false | 391 | java |
public class p12 {
public static void main(String[] args) {
Car car1;
car1=new Car();
car1.num = 1234;
car1.gas = 20.5;
car1.showCar();
}
}
class Car{
int num;
double gas;
void show()
{
System.out.println("車號是"+num);
System.out.println("汽油量是"+gas);
}
void showCar()
{
System.out.println("開始顯示車子資料");
this.show();
}
} | [
"eddy0921717370@gmail.com"
] | eddy0921717370@gmail.com |
af98809a6f0072b3814b6514ad82431cf0e721c6 | 1b1538ec70ba90d4cc8b59ecdc37f426faef5513 | /old/src/main/java/org/ow2/easybeans/tests/messagedriven/beanmanaged/access/TestMDBBeanManagedListenerMethodAccess.java | 6e8afaec5757f3491a12b8ae76e6ac47dd41a74c | [] | no_license | EasyBeans/tests | d273c6329d137c8db1c7d2b120838209c93779a4 | fb75ad02de94674ce8a52e7c8b2d1a61335f96f3 | refs/heads/master | 2021-01-23T16:36:39.909001 | 2012-12-19T11:39:58 | 2012-12-19T11:39:58 | 3,289,951 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,950 | java | /**
* EasyBeans
* Copyright (C) 2006 Bull S.A.S.
* Contact: easybeans@ow2.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* --------------------------------------------------------------------------
* $Id: TestMDBBeanManagedListenerMethodAccess.java 5369 2010-02-24 14:58:19Z benoitf $
* --------------------------------------------------------------------------
*/
package org.ow2.easybeans.tests.messagedriven.beanmanaged.access;
import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.ON_MESSAGE;
import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.USER_TRANSACTION;
import org.ow2.easybeans.tests.common.ejbs.mdb.beanmanaged.access.MDBBeanManagedListenerMethodAccess;
import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.OperationChecker;
import org.ow2.easybeans.tests.common.jms.JMSManager;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* Verifies if a message listener method can perform the operations allowed by the specification(Table 3).
* @reference JSR 220-PROPOSED FINAL - Message-Driven Bean Component Contract
* @requirement Application Server must be running.<br>
* MDB:<li>org.ow2.easybeans.tests.common.ejbs.mdb.beanmanaged.access.MDBBeanManagedListenerMethodAccess</li>
* (Ant task: install.jar.tests.messagedriven.contract)
* @author Eduardo Studzinski Estima de Castro
* @author Gisele Pinheiro Souza
*/
public class TestMDBBeanManagedListenerMethodAccess {
/**
* JMS Manager.
*/
private JMSManager jmsQueue;
/**
* Log checker.
*/
private OperationChecker checker;
/**
* Creates the JMS manager.
* @throws Exception if there is a problem.
*/
@BeforeClass
public void startUp00() throws Exception {
jmsQueue = new JMSManager(JMSManager.DEFAULT_QUEUE_CONNECTION_FACTORY, JMSManager.DEFAULT_QUEUE);
checker = new OperationChecker();
}
/**
* Gets the bean logger instance and clears previous tests information.
* @throws Exception if there is a problem with the bean initialization.
*/
@BeforeMethod
public void startUp01() throws Exception {
checker.deleteAll();
}
/**
* Verifies if a message listener method can access the UserTransaction.
* @input a message
* @output a logged onMessage() event
* @throws Exception if a problem occurs.
*/
@Test
public void testUserTransaction() throws Exception {
jmsQueue.sendControlMessage(MDBBeanManagedListenerMethodAccess.MESSAGE_TYPE, USER_TRANSACTION);
checker.check(MDBBeanManagedListenerMethodAccess.class.getName(), ON_MESSAGE, USER_TRANSACTION);
}
/**
* Clears logs.
* @throws Exception if a problem occurs.
*/
@AfterMethod
public void tearDown() throws Exception {
checker.deleteAll();
}
/**
* Clears logs.
* @throws Exception if a problem occurs.
*/
@AfterClass
public void tearDownClass() throws Exception {
jmsQueue.close();
}
}
| [
"Florent.BENOIT@ow2.org"
] | Florent.BENOIT@ow2.org |
cf55de698590fdfc4a2269fb858ebe147cd98125 | 551306c208dbfc6f3fc51cabde4ab74478cc9834 | /question1/TrimClient.java | 1348cc2218d846ecfcbbf093f225229e2979d4fe | [] | no_license | liorshahverdi/java-client-server-demo | 088a2b6abe752899dbb14e7b430401dc1ccab463 | db5f27be3fe8a27fc0f09ea5a1608a4a285e2988 | refs/heads/master | 2016-09-10T22:25:08.558996 | 2014-12-03T22:37:59 | 2014-12-03T22:37:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,804 | java | /**
* TrimClient
* Reads strings and returns similar string with whitespace omitted.
*
* Invoke as: java TrimClient [-port=<number>] [server]
* Default port is 1200, if not specified
* Default host is localhost, if not specified
*
* @author (Lior Shahverdi)
* @version (Version 1.1 12/02/2014)
*/
import java.io.*;
import java.net.*;
public class TrimClient
{
public static void main (String [] args)
{
Socket s; //Client socket for connecting to the server
String server = "localhost"; //Use localhost by default
int serverPort = 1200; //Use port 1200 by default
InetAddress local, remote; //Local and remote addresses
int localPort, remotePort; //Local and remote ports
//For input and output
BufferedReader socketIn; //Socket input
PrintWriter socketOut; //Socket output
BufferedReader keyboardIn; //Keyboard input
String userInput, serverResult;
//Process command line arguments
//Error if more than two command line arguments
if (args.length > 2)
{
System.out.println("Usage: java TrimClient "
+ "[-port=<number>] [server]");
System.exit(-1);
}
//If two arguments, only one should start with '-'
if (args.length == 2)
{
if ((args[0].charAt(0) == '-' &&
args[1].charAt(0) == '-' ) ||
(args[0].charAt(0) != '-' &&
args[1].charAt(0) != '-' ))
{
System.out.println("Usage: "
+ "java TrimClient "
+ "[-port=<number>] [server]");
System.exit(-1);
}
}
//Set the server and server port suitably
for (int i = 0; i < args.length; i++)
{
if (args[i].charAt(0) != '-')
server = args[i];
if (args[i].startsWith("-port="))
serverPort = Integer.parseInt(args[i].substring(6));
}
//Set up keyboard input and print greeting
keyboardIn = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Hello, you have invoked a Trim Client");
System.out.println("You have requested a connection to " +
server + " at port " + serverPort);
System.out.println(); //Blank line
//Establish socket connection and communicate
try
{
//Establish connection
s = new Socket(server, serverPort);
//Report connection status
local = s.getLocalAddress(); remote = s.getInetAddress();
localPort = s.getLocalPort(); remotePort = s.getPort();
System.out.println ("Client side");
System.out.println (" " + local.getHostName()
+ "[" + local.getHostAddress() + "]"
+ " at port " + localPort);
System.out.println ("Server side");
System.out.println (" " + remote.getHostName()
+ "[" + remote.getHostAddress() + "]"
+ " at port " + remotePort);
System.out.println(); //Blank line
//TCP provides a full-duplex byte stream service
//For UNICODE and line support, we need BufferedReader
//and PrintWriter objects
socketIn = new BufferedReader(new InputStreamReader(s.getInputStream()));
socketOut = new PrintWriter(s.getOutputStream(), true);
//Interact with user
System.out.print("Enter a string (or bye to quit): ");
userInput = keyboardIn.readLine();
//Loop until user indicates termination
while (!userInput.equalsIgnoreCase("bye"))
{
//Send user input to server
socketOut.println(userInput);
//Get server response
serverResult = socketIn.readLine();
//Report server response
System.out.println(serverResult);
System.out.println(); //Blank line
//Get new string
System.out.print("Enter a string (or bye to quit): ");
userInput = keyboardIn.readLine();
}
//Signal the server to quit
socketOut.println(userInput);
//Close all streams and socket
keyboardIn.close();
socketIn.close();
socketOut.close();
s.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
| [
"liorshahverdi@gmail.com"
] | liorshahverdi@gmail.com |
149738378e086de582b0b446c3b4b0a1ee9e5b2b | 4a637d7ae79bc677d668c893c389c89f3a4a9685 | /application/src/test/java/com/hanfak/airport/usecase/LandPlaneUseCaseTest.java | aeabadf7061a8d85acd1dae9ea85f6ecb9400aa2 | [] | no_license | hanfak/airportv2-mvn-enterprise | 1e7cd0c41a5916dce096959fbf5ae034276ca0ac | 216e14156ac73a53244f8065429747420ffff4af | refs/heads/master | 2022-12-05T10:23:54.975715 | 2019-10-27T17:23:59 | 2019-10-27T17:23:59 | 171,629,334 | 0 | 0 | null | 2022-11-16T12:40:12 | 2019-02-20T08:12:01 | Java | UTF-8 | Java | false | false | 6,009 | java | package com.hanfak.airport.usecase;
import com.hanfak.airport.domain.plane.Plane;
import com.hanfak.airport.domain.planelandstatus.FailedPlaneLandStatus;
import com.hanfak.airport.domain.planelandstatus.PlaneLandStatus;
import com.hanfak.airport.domain.planelandstatus.SuccessfulPlaneLandStatus;
import org.assertj.core.api.WithAssertions;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.slf4j.Logger;
import static com.hanfak.airport.domain.AirportStatus.IN_AIRPORT;
import static com.hanfak.airport.domain.AirportStatus.NOT_IN_AIRPORT;
import static com.hanfak.airport.domain.plane.Plane.plane;
import static com.hanfak.airport.domain.plane.PlaneId.planeId;
import static com.hanfak.airport.domain.plane.PlaneStatus.FLYING;
import static com.hanfak.airport.domain.plane.PlaneStatus.LANDED;
import static com.hanfak.airport.domain.planelandstatus.FailedPlaneLandStatus.failedPlaneLandStatus;
import static com.hanfak.airport.domain.planelandstatus.LandFailureReason.PLANE_COULD_NOT_LAND;
import static com.hanfak.airport.domain.planelandstatus.LandFailureReason.PLANE_IS_LANDED;
import static com.hanfak.airport.domain.planelandstatus.LandFailureReason.WEATHER_IS_STORMY;
import static com.hanfak.airport.domain.planelandstatus.LandFailureReason.WEATHER_NOT_AVAILABLE;
import static com.hanfak.airport.domain.planelandstatus.SuccessfulPlaneLandStatus.successfulPlaneLandStatus;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class LandPlaneUseCaseTest implements WithAssertions {
@Test
public void airportInstructsPlaneToLand() {
PlaneLandStatus actionUnderTest = airport.instructPlaneToLand(flyingPlane);
verify(planeInventoryService).addPlane(landedPlane);
verify(logger).info(eq("Plane, 'A0001', has successfully landed at the airport"));
assertThat(actionUnderTest.successfulPlaneLandStatus).isEqualTo(expectedSuccessfulPlaneLandStatus);
}
@Test
public void cannotInstructPlaneToLandWhenPlaneIsNotFlying() {
PlaneLandStatus actionUnderTest = airport.instructPlaneToLand(landedPlane);
verify(planeInventoryService, never()).addPlane(landedPlane);
verify(logger).info("Plane, 'A0001', could not land at the airport as it's status is 'LANDED'");
assertThat(actionUnderTest.failedPlaneLandStatus).isEqualTo(expectedFailedPlaneLandStatusForLandedPlane);
}
@Test
public void cannotLandWhenWeatherIsStormy() {
when(weatherService.isStormy()).thenReturn(true);
PlaneLandStatus actionUnderTest = airport.instructPlaneToLand(flyingPlane);
verify(logger).info("Plane, 'A0001', could not land at the airport as it is stormy");
assertThat(actionUnderTest.failedPlaneLandStatus).isEqualTo(expectedFailedPlaneLandStatusForStormyWeather);
}
@Test
public void cannotLandWhenAccessToWeatherIsNotWorking() {
IllegalStateException cause = new IllegalStateException("Blah");
Mockito.doThrow(cause).when(weatherService).isStormy();
PlaneLandStatus actionUnderTest = airport.instructPlaneToLand(flyingPlane);
verify(logger).error("Something went wrong retrieving the weather at the airport", cause);
assertThat(actionUnderTest.failedPlaneLandStatus).isEqualTo(expectedFailedPlaneLandStatusForWeatherError);
}
@Test
public void cannotLandWhenIssueWithSystem() {
IllegalStateException cause = new IllegalStateException("Blah");
Mockito.doThrow(cause).when(planeInventoryService).addPlane(landedPlane);
PlaneLandStatus actionUnderTest = airport.instructPlaneToLand(flyingPlane);
verify(logger).error("Something went wrong storing the Plane, 'A0001', at the airport", cause);
assertThat(actionUnderTest.failedPlaneLandStatus).isEqualTo(expectedFailedPlaneLandStatusForSystemError);
}
@Test
public void cannotLandWhenSystemErrorForCheckingPlaneInAirport() {
IllegalStateException cause = new IllegalStateException("Blah");
Mockito.doThrow(cause).when(planeInventoryService).planeIsPresentInAirport(landedPlane);
PlaneLandStatus actionUnderTest = airport.instructPlaneToLand(flyingPlane);
verify(logger).error("Something went wrong storing the Plane, 'A0001', at the airport", cause);
assertThat(actionUnderTest.failedPlaneLandStatus).isEqualTo(expectedFailedPlaneLandStatusForSystemError);
}
@Before
public void setUp() {
// Not needed, as the method returns a primitive in WeatherService, which mockito automatically returns a default
// But for readability, better to show the priming
when(weatherService.isStormy()).thenReturn(false);
}
private final SuccessfulPlaneLandStatus expectedSuccessfulPlaneLandStatus = successfulPlaneLandStatus(planeId("A0001"), LANDED, IN_AIRPORT);
private final FailedPlaneLandStatus expectedFailedPlaneLandStatusForLandedPlane = failedPlaneLandStatus(planeId("A0001"), LANDED, NOT_IN_AIRPORT, PLANE_IS_LANDED);
private final FailedPlaneLandStatus expectedFailedPlaneLandStatusForSystemError = failedPlaneLandStatus(planeId("A0001"), FLYING, NOT_IN_AIRPORT, PLANE_COULD_NOT_LAND);
private final FailedPlaneLandStatus expectedFailedPlaneLandStatusForWeatherError = failedPlaneLandStatus(planeId("A0001"), FLYING, NOT_IN_AIRPORT, WEATHER_NOT_AVAILABLE);
private final FailedPlaneLandStatus expectedFailedPlaneLandStatusForStormyWeather = failedPlaneLandStatus(planeId("A0001"), FLYING, NOT_IN_AIRPORT, WEATHER_IS_STORMY);
private final PlaneInventoryService planeInventoryService = mock(PlaneInventoryService.class);
private final Logger logger = mock(Logger.class);
private final WeatherService weatherService = mock(WeatherService.class);
private final LandPlaneUseCase airport = new LandPlaneUseCase(planeInventoryService, logger, weatherService);
private final Plane flyingPlane = plane(planeId("A0001"), FLYING);
private final Plane landedPlane = plane(planeId("A0001"), LANDED);
} | [
"fakira.work@gmail.com"
] | fakira.work@gmail.com |
c14b9fc536e6aed86ca566cf3c86b6590401652f | dab5973e0ee3e8e617c7414d3fa7e387e2a21b23 | /src/test/java/pl/jpaspring/jpaspring/JpaManyToManyApplicationTests.java | 8f9d6c74987c6e020d9ec9d87c60eb765cb3adcf | [] | no_license | maju435/jpa-many-to-many | a667f4a2c373145a565b15083811eb75abaacd35 | 6edebf76984a13ef4e790b24c05202e95eb8bf35 | refs/heads/master | 2020-07-28T22:21:08.265567 | 2019-09-19T13:17:01 | 2019-09-19T13:17:01 | 209,558,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,252 | java | package pl.jpaspring.jpaspring;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import pl.jpaspring.jpaspring.entity.AutorEntity;
import pl.jpaspring.jpaspring.entity.BookEntity;
import pl.jpaspring.jpaspring.queries.AutorRepository;
import pl.jpaspring.jpaspring.queries.BookRepository;
import javax.persistence.EntityManager;
import java.awt.print.Book;
import java.util.Date;
@RunWith(SpringRunner.class)
@SpringBootTest
@Transactional
public class JpaManyToManyApplicationTests {
@Autowired
AutorRepository autorRepository;
@Autowired
BookRepository bookRepository;
@Before
public void setUp() throws Exception {
AutorEntity maciek = new AutorEntity("Maciek","Kopytko");
autorRepository.save(maciek);
maciek.getBooks().add(new BookEntity("Programowanie w PHP dla szalencow", new Date()));
}
@Test
public void getByLastName() {
assert autorRepository.findByLastName("Bauer").size() == 2;
}
}
| [
"admin@localhost.localdomain"
] | admin@localhost.localdomain |
80523a27092372319f52bb3de65644bc0555ca9c | 5e309ec1551901e0da258163b5ebb9defbe79e0f | /IDNP-CHAT-master/app/src/main/java/com/practica02/myapplication/Model/Persistencia/RestauranteDAO.java | 21d21c0d21fd7aef7a0c6e6ac66f4e0a423583ad | [] | no_license | rmanchego/IDNP-RESTOMATE | 30ecdc19b604f42aad7891b6af49f4b889caa609 | aea9aebb730491370e5c28a8f371431cbffacdab | refs/heads/master | 2022-12-01T07:07:08.047273 | 2020-08-11T07:47:31 | 2020-08-11T07:47:31 | 283,541,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,280 | java | package com.practica02.myapplication.Model.Persistencia;
import android.net.Uri;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
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 com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.practica02.myapplication.Model.Entidades.Firebase.Restaurante;
import com.practica02.myapplication.Model.Entidades.Logica.LRestaurante;
import com.practica02.myapplication.Model.Utilidades.Constantes;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
public class RestauranteDAO {
public interface IDevolverRestaurante{
public void devolverRestaurante(LRestaurante lRestaurante);
public void devolverError(String error);
}
public interface IDevolverURLFoto{
public void devolverUrlString(String url);
}
private static RestauranteDAO restauranteDAO;
private FirebaseDatabase database;
private FirebaseStorage storage;
private DatabaseReference referenceRestaurantes;
private StorageReference referenceFotoDePerfil;
public static RestauranteDAO getInstancia(){
if(restauranteDAO==null) restauranteDAO = new RestauranteDAO();
return restauranteDAO;
}
private RestauranteDAO(){
database = FirebaseDatabase.getInstance();
storage = FirebaseStorage.getInstance();
referenceRestaurantes = database.getReference(Constantes.NODO_DE_RESTAURANTES);
referenceFotoDePerfil = storage.getReference("Fotos/FotoPerfil/Restaurantes/" + getKeyRestaurante());
}
public String getKeyRestaurante(){
return FirebaseAuth.getInstance().getUid();
}
public boolean isRestauranteLogeado(){
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
return firebaseUser!=null;
}
public long fechaDeCreacionLong(){
return FirebaseAuth.getInstance().getCurrentUser().getMetadata().getCreationTimestamp();
}
public long fechaDeUltimaVezQueSeLogeoLong(){
return FirebaseAuth.getInstance().getCurrentUser().getMetadata().getLastSignInTimestamp();
}
public void obtenerInformacionDeRestaurantePorLlave(final String key, final RestauranteDAO.IDevolverRestaurante iDevolverRestaurante){
referenceRestaurantes.child(key).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Restaurante restaurante = dataSnapshot.getValue(Restaurante.class);
LRestaurante lRestaurante = new LRestaurante(key,restaurante);
iDevolverRestaurante.devolverRestaurante(lRestaurante);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError){
iDevolverRestaurante.devolverError(databaseError.getMessage());
}
}); //ejecuta una sola vez, no tiene listener por si ocurre cambio
}
public void añadirFotoDePerfilALosRestaurantesQueNoTienenFoto() {
referenceRestaurantes.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
List<LRestaurante> lRestaurantesLista = new ArrayList<>();
for(DataSnapshot childDataSnapshot : dataSnapshot.getChildren()){
Restaurante restaurante = childDataSnapshot.getValue(Restaurante.class);
LRestaurante lRestaurante = new LRestaurante(childDataSnapshot.getKey(),restaurante);
lRestaurantesLista.add(lRestaurante);
}
for(LRestaurante lRestaurante : lRestaurantesLista){
if(lRestaurante.getRestaurante().getFotoPerfilURL()==null){
referenceRestaurantes.child(lRestaurante.getKey()).child("fotoPerfilURL").setValue(Constantes.URL_FOTO_POR_DEFECTO_USUARIOS);
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
}); //Trae a todos los restaurantes solo una vez.
}
public void subirFotoUri(Uri uri, final RestauranteDAO.IDevolverURLFoto iDevolverURLFoto){ //Uri -> foto que se elige con el celular
String nombreFoto = "";
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("SSS.ss-mm-hh-dd-MM-yyyy", Locale.getDefault()); //Guardar en Firebase por fecha
nombreFoto = simpleDateFormat.format(date);
final StorageReference fotoReferencia = referenceFotoDePerfil.child(nombreFoto);
//Uri u = taskSnapshot.getDownloadUrl();
fotoReferencia.putFile(uri).continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
@Override
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
if(!task.isSuccessful()){
throw task.getException(); //throw -> llama a la excepcion
}
return fotoReferencia.getDownloadUrl(); //Si se eligio una foto y se subio a la BD, agarra la url del archivo
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() { //este metodo captura la url de la foto
@Override
public void onComplete(@NonNull Task<Uri> task) {
if(task.isSuccessful()){
Uri uri = task.getResult(); //url de la foto que se sube a la BS
iDevolverURLFoto.devolverUrlString(uri.toString());
}
}
});
}
}
| [
"rmanchegom@unsa.edu.pe"
] | rmanchegom@unsa.edu.pe |
8b94d972e1418e7b3f2d7fbae6879225c052c441 | 5f9c18f923fb90f2c8327416cbd079a3856dc89b | /spring-boot-quartz/src/main/java/com/wintig/quartz/job/QuartzJob.java | 0a18d43fc097291c9f54f2201b5b91c7c933643f | [] | no_license | SherlockJun/spring-boot-examples | cb3cf86089d6d5c26bd418d6a2ec738f30490a0c | cf84a699dbeb83e10cdc0692c2860e581b40f615 | refs/heads/master | 2020-06-18T03:20:08.658045 | 2018-11-01T08:38:19 | 2018-11-01T08:38:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package com.wintig.quartz.job;
import com.wintig.quartz.service.SendService;
import com.wintig.quartz.utils.DateUtils;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.Serializable;
import java.time.LocalTime;
/**
* @author shitian
* @create 2018-07-22 下午11:57
*/
@Component
public class QuartzJob implements Job, Serializable {
@Autowired
public SendService sendService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
sendService.send();
}
public static Trigger buildTrigger() {
Trigger trigger = TriggerBuilder.newTrigger().withIdentity("Send_Audit", "Send_Group")
.withSchedule(SimpleScheduleBuilder.simpleSchedule().withRepeatCount(20).withIntervalInSeconds(1))
.startAt(DateUtils.localTime2date(LocalTime.now().plusSeconds(2))) //延迟2秒发送
.build();
return trigger;
}
} | [
"840872473@qq.com"
] | 840872473@qq.com |
826255f560a14f3e684a53685c990427760035b3 | 6a9b474b2de2d11aebb2e1e64c297fdc72c14675 | /src/dao/QuestionDao.java | d6a35083e3717545079487caf40dac8ea6afa153 | [] | no_license | khushalishah/CampusTalk | b5c2548b1542d056aa53d65d08a78b097e837ab0 | cbfbd8f42623b0f2c66ba46852126cb88a12ad07 | refs/heads/master | 2021-08-31T08:12:24.827836 | 2017-12-20T18:37:52 | 2017-12-20T18:37:52 | 114,815,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,127 | java | package dao;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import vo.NoticeVo;
import vo.QuestionVo;
import db.Database;
public class QuestionDao extends CTDao {
@Override
public List<Object> view(long id) {
// TODO Auto-generated method stub
Database db = new Database();
Session session = db.getSession();
Transaction tx = null;
List<Object> que_ans = new ArrayList<>();
try {
tx = session.beginTransaction();
que_ans = session.createQuery("from QuestionVo order by question_date asc").list();
tx.commit();
} catch (Exception e) {
if (tx != null) {
tx.rollback();
}
System.out.println(e);
} finally {
db.closeSession(session);
}
return que_ans;
}
@Override
public void delete(Object id) {
// TODO Auto-generated method stub
// type-casting
int ID = (int) id;
Database db = new Database();
Session session = db.getSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
QuestionVo question = (QuestionVo) session.get(QuestionVo.class, ID);
session.delete(question);
tx.commit();
} catch (HibernateException e) {
if (tx != null)
tx.rollback();
e.printStackTrace();
} finally {
session.close();
}
}
@Override
public void edit(Object o) {
// TODO Auto-generated method stub
QuestionVo qv = (QuestionVo) o;
Database db = new Database();
Session session = db.getSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
QuestionVo question = (QuestionVo) session.get(QuestionVo.class, qv.getQuestion_id());
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String qDate = sdf.format(date);
question.setQuestion_date(qDate);
question.setQuestion_department(qv.getQuestion_department());
question.setQuestion_semester(qv.getQuestion_semester());
question.setQuestion_name(qv.getQuestion_name());
question.setQuestion_title(qv.getQuestion_title());
session.update(question);
tx.commit();
} catch (HibernateException e) {
if (tx != null)
tx.rollback();
e.printStackTrace();
} finally {
session.close();
}
}
public List<Object[]> viewAll(String search){
Database db = new Database();
Session session = db.getSession();
Transaction tx = null;
List<Object[]> que_ans = new ArrayList<>();
try {
tx = session.beginTransaction();
que_ans = session
.createQuery(
"SELECT q.question_id,q.question_title,q.question_date,c.ansID,c.answer,c.date,c.department,c.semester,c.name FROM QuestionVo AS q LEFT JOIN q.children c WHERE q.question_title LIKE '%"+search+"%' order by q.question_date desc")
.list();
// questions = session.createQuery("FROM QuestionVo where
// question_enrollment="+id).list();
tx.commit();
} catch (Exception e) {
if (tx != null) {
tx.rollback();
}
System.out.println(e);
} finally {
db.closeSession(session);
}
return que_ans;
}
}
| [
"shahkhushi.17@gmail.com"
] | shahkhushi.17@gmail.com |
75be71fe9dc9894296d7cd8a2d83bad6149cf1d5 | d959dda05e794a7382572ffe4cda83fc824088b5 | /app/src/androidTest/java/com/example/rizwansyed/menudemo/ExampleInstrumentedTest.java | 61ba1e462a6490b18536115c9f4d013a6e5b083b | [] | no_license | Rizwansyed9/MenuDemo | 47e37d39b31c4817d1c1576aa14be7f8ba68180d | 4bdc26b37640c0ea1a53097073a4533645358af7 | refs/heads/master | 2021-01-11T00:36:08.601909 | 2016-10-10T16:57:54 | 2016-10-10T16:57:54 | 70,509,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.example.rizwansyed.menudemo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.rizwansyed.menudemo", appContext.getPackageName());
}
}
| [
"rizwan9@outlook.com"
] | rizwan9@outlook.com |
809ab3967fc2095c17533682ee38814024ad1ffd | c104f6c85c7dd2e67967ac9a27ac199c7dd32c5d | /SpringInDepth/udemy-Step18/src/main/java/com/in28minutes/spring/basics/step18/Step18CdiApplication.java | dd925334122daa53e35027d69326848ad6daeeaf | [] | no_license | dario-boberek/udemyspring | 0cb5f03dd6b2a076bdd27c89f42b1f71f0ec3914 | 621c992f685b6474f5b67e4af1fe2def83dee8a6 | refs/heads/master | 2022-08-13T10:45:57.123339 | 2018-11-27T17:01:39 | 2018-11-27T17:01:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | java | package com.in28minutes.spring.basics.step18;
import com.in28minutes.spring.basics.step18.cdi.PaymentProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import com.in28minutes.spring.basics.step18.cdi.SomeCdiBusiness;
@SpringBootApplication
public class Step18CdiApplication {
private static Logger LOGGER = LoggerFactory.getLogger(Step18CdiApplication.class);
public static void main(String[] args) {
new Step18CdiApplication().doIt(args);
}
public void doIt(String[] args) {
ApplicationContext applicationContext = SpringApplication.run(Step18CdiApplication.class, args);
//i21c: testujemy czy uzywajac ustandaryzowanych adnotacji z java zadziała DEPENDANCY INJECTION.
SomeCdiBusiness business = applicationContext.getBean(SomeCdiBusiness.class);
LOGGER.info("{} dao-{}", business, business.getSomeCDIDAO());
//i21c: moje takie tam..
PaymentProcessor paymentProcessor = applicationContext.getBean(PaymentProcessor.class);
paymentProcessor.addMoney("1000000", "GBP");
}
} | [
"d.boberek@gmail.com"
] | d.boberek@gmail.com |
48d8ecc3ade6d231ca6172f94d8f30145615fce2 | f161bd84ec87c843da54c604efcadeb49bb91c79 | /Section16/src/com/samuelvazquez/optional/preview/FirstExample.java | 19e91f1d8b54e3b4ef6740b5f36de211bb975d78 | [] | no_license | samuelvazcal/Java-RelearningSessions-Exercises | dc86d58f21c0d3dbdc04f32c9aa29589dcd0fbf5 | 07190c1b1b9df86e3d7eaf19c654534db2f70960 | refs/heads/main | 2023-07-07T06:00:55.950805 | 2021-08-04T20:15:42 | 2021-08-04T20:15:42 | 358,030,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package src.com.samuelvazquez.optional.preview;
//String comparison with literals
public class FirstExample {
public static void main(String[] args) {
try {
String str1 = null;
if(str1.equals("sunday")) {
System.out.println("Same!");
} else {
System.out.println("Not same");
}
} catch (NullPointerException e) {
System.out.println("Caught: " + e);
}
}
}
| [
"samuelvazcal@hotmail.com"
] | samuelvazcal@hotmail.com |
27a9694e60bceb5efbc49498fe27293497cd3d4b | c1d5603c524da1ced7a6f479ec8098c4fc7e57c5 | /src/main/java/ro/uvt/mrbs/models/Detail.java | 7db98fe5e3b4c1267a742e2ccac791ab3c0d5f31 | [
"Apache-2.0"
] | permissive | ZbRoby/Meeting-Room-Booking-System | c1f8dbf70f1f8763c1c8ee501e22baae471f3470 | 5395ec160943dfda2443c3734ace1925ab5fb4a3 | refs/heads/master | 2021-09-04T09:01:14.225186 | 2018-01-17T14:30:52 | 2018-01-17T14:30:52 | 115,860,843 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package ro.uvt.mrbs.models;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @author Zbiera Alexandru-Robert
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Detail {
private String lastname;
private String firstname;
private String email;
private String phone;
private List<OutBoundBook> books;
}
| [
"robi1796@yahoo.com"
] | robi1796@yahoo.com |
eeb4dc02d3775a360ab737d37c301c3107b697e4 | cfbf8fc182dc2ca0c2fb7a3805f7095042ab256c | /tesla-java-client/src/main/java/org/oxbow/tesla/BaseService.java | f0b06c0fc0b4db5866a85b043e758ce9124ae2b3 | [] | no_license | eugener/tesla-java-api | 8487dc36e606de230805595419edc509c2ce4033 | afb45b34b83448eb2b1e97126d44051a487c168b | refs/heads/master | 2023-04-27T00:54:23.605449 | 2020-02-26T22:14:40 | 2020-02-26T22:14:40 | 152,005,539 | 0 | 1 | null | 2023-04-23T13:16:02 | 2018-10-08T02:09:33 | Java | UTF-8 | Java | false | false | 1,880 | java | package org.oxbow.tesla;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import retrofit2.Call;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.function.Function;
class BaseService {
private static final Gson GSON = new Gson();
<T> T asResponse(Call<Response<T>> call ) {
return executeCall(call).content;
}
<T> T asResult(Call<Response<Result<T>>> call ) {
return asResponse(call).result;
}
<T> T executeCall(Call<T> call ) {
return executeCall(call, RuntimeException::new, RuntimeException::new );
}
<T> T executeCall(Call<T> call,
Function<Throwable,RuntimeException> fromCause,
Function<String,RuntimeException> fromText) {
try {
retrofit2.Response<T> response = Objects.requireNonNull( call ).execute();
if ( response.isSuccessful() ) {
return response.body();
} else {
String errorJson = new String( Objects.requireNonNull(response.errorBody()).bytes(), StandardCharsets.UTF_8);
Error error = GSON.fromJson(errorJson, Error.class );
throw produceException( fromText, error.message);
}
} catch (IOException e) {
throw produceException( fromCause, e);
}
}
private <T> RuntimeException produceException(Function<T,RuntimeException> producer, T value ) {
return producer != null ? producer.apply(value) : new RuntimeException("Exception producer is null");
}
}
class Response<T> {
@SerializedName("response")
final T content = null;
}
class Result<T> {
@SerializedName("result")
final T result = null;
}
class Error {
@SerializedName("error")
final String message = null;
}
| [
"eryzhikov@gmail.com"
] | eryzhikov@gmail.com |
4fe9a0077a27359fbdb7f9cb348c2414d48aae8b | 865193e72ce3f81293e5006814b465f607b44416 | /core/folioxml/src/folioxml/export/ExportingNodeListProcessor.java | 27491becc6d3d28df72faae5853ebf9c8d40eb43 | [
"Apache-2.0"
] | permissive | imazen/folioxml | f2a0ce3498134d843527fd6f8220b980723db487 | de441f7bf464db5575c8e571c17639a257092b27 | refs/heads/master | 2022-12-17T05:48:25.059236 | 2022-10-18T05:17:20 | 2022-10-18T05:17:20 | 25,088,312 | 11 | 7 | Apache-2.0 | 2018-05-16T19:33:27 | 2014-10-11T17:31:49 | Java | UTF-8 | Java | false | false | 325 | java | package folioxml.export;
import folioxml.config.ExportLocations;
/**
* Created by nathanael on 6/25/15.
*/
public interface ExportingNodeListProcessor extends NodeListProcessor {
void setFileNode(FileNode fn);
void setLogProvider(LogStreamProvider provider);
void setExportLocations(ExportLocations el);
}
| [
"nathanael.jones@gmail.com"
] | nathanael.jones@gmail.com |
7167a306e67c959c08629fdeedbcd742d88eb977 | e4ef2c13308bb89888cab43097b02a3299a63e7f | /app/src/main/java/com/ngliaxl/encrypt/util/FileComparator.java | eeb5ebc2d1016af7a79b8a02f50e7cbc1bac26b8 | [] | no_license | ngLiaXL/FileEncryptor | 14a478237d8d7d81fe76e31b3c6bc744719fb737 | 8e8d8a5a492c27fbf220f5a3d3b7dbf7c0518cc4 | refs/heads/master | 2021-01-23T01:52:31.438861 | 2017-06-02T05:46:07 | 2017-06-02T05:46:07 | 92,899,050 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package com.ngliaxl.encrypt.util;
import java.io.File;
import java.util.Comparator;
/**
* Created by Dimorinny on 24.10.15.
*/
public class FileComparator implements Comparator<File> {
@Override
public int compare(File f1, File f2) {
if (f1 == f2) {
return 0;
}
if (f1.isDirectory() && f2.isFile()) {
// Show directories above files
return -1;
}
if (f1.isFile() && f2.isDirectory()) {
// Show files below directories
return 1;
}
// Sort the directories alphabetically
return f1.getName().compareToIgnoreCase(f2.getName());
}
}
| [
"344212231@qq.com"
] | 344212231@qq.com |
31a9f898d8d885fb861c9a07c5e57228c4362019 | d2d6189b2ffb66ab70c68b51fa5a67d5991a4718 | /src/main/java/br/execute/ecommerce/web/rest/PedidoResource.java | c2a75789c562c9c9197443cebda02d155713cd3a | [] | no_license | ingridfr/ecommerce-simples | 67a254a14c1fb3c826e1aecba38c02ffbcbde363 | 40d492e074787015286407abbb7e779eec32818e | refs/heads/main | 2023-07-08T02:31:57.472362 | 2021-08-10T19:38:35 | 2021-08-10T19:38:35 | 394,738,110 | 0 | 0 | null | 2021-08-10T19:38:36 | 2021-08-10T17:59:11 | Java | UTF-8 | Java | false | false | 8,863 | java | package br.execute.ecommerce.web.rest;
import br.execute.ecommerce.repository.PedidoRepository;
import br.execute.ecommerce.service.PedidoQueryService;
import br.execute.ecommerce.service.PedidoService;
import br.execute.ecommerce.service.criteria.PedidoCriteria;
import br.execute.ecommerce.service.dto.PedidoDTO;
import br.execute.ecommerce.web.rest.errors.BadRequestAlertException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import tech.jhipster.web.util.HeaderUtil;
import tech.jhipster.web.util.PaginationUtil;
import tech.jhipster.web.util.ResponseUtil;
/**
* REST controller for managing {@link br.execute.ecommerce.domain.Pedido}.
*/
@RestController
@RequestMapping("/api")
public class PedidoResource {
private final Logger log = LoggerFactory.getLogger(PedidoResource.class);
private static final String ENTITY_NAME = "pedido";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final PedidoService pedidoService;
private final PedidoRepository pedidoRepository;
private final PedidoQueryService pedidoQueryService;
public PedidoResource(PedidoService pedidoService, PedidoRepository pedidoRepository, PedidoQueryService pedidoQueryService) {
this.pedidoService = pedidoService;
this.pedidoRepository = pedidoRepository;
this.pedidoQueryService = pedidoQueryService;
}
/**
* {@code POST /pedidos} : Create a new pedido.
*
* @param pedidoDTO the pedidoDTO to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new pedidoDTO, or with status {@code 400 (Bad Request)} if the pedido has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/pedidos")
public ResponseEntity<PedidoDTO> createPedido(@RequestBody PedidoDTO pedidoDTO) throws URISyntaxException {
log.debug("REST request to save Pedido : {}", pedidoDTO);
if (pedidoDTO.getId() != null) {
throw new BadRequestAlertException("A new pedido cannot already have an ID", ENTITY_NAME, "idexists");
}
PedidoDTO result = pedidoService.save(pedidoDTO);
return ResponseEntity
.created(new URI("/api/pedidos/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /pedidos/:id} : Updates an existing pedido.
*
* @param id the id of the pedidoDTO to save.
* @param pedidoDTO the pedidoDTO to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated pedidoDTO,
* or with status {@code 400 (Bad Request)} if the pedidoDTO is not valid,
* or with status {@code 500 (Internal Server Error)} if the pedidoDTO couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/pedidos/{id}")
public ResponseEntity<PedidoDTO> updatePedido(
@PathVariable(value = "id", required = false) final Long id,
@RequestBody PedidoDTO pedidoDTO
) throws URISyntaxException {
log.debug("REST request to update Pedido : {}, {}", id, pedidoDTO);
if (pedidoDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, pedidoDTO.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!pedidoRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
PedidoDTO result = pedidoService.save(pedidoDTO);
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, pedidoDTO.getId().toString()))
.body(result);
}
/**
* {@code PATCH /pedidos/:id} : Partial updates given fields of an existing pedido, field will ignore if it is null
*
* @param id the id of the pedidoDTO to save.
* @param pedidoDTO the pedidoDTO to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated pedidoDTO,
* or with status {@code 400 (Bad Request)} if the pedidoDTO is not valid,
* or with status {@code 404 (Not Found)} if the pedidoDTO is not found,
* or with status {@code 500 (Internal Server Error)} if the pedidoDTO couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PatchMapping(value = "/pedidos/{id}", consumes = "application/merge-patch+json")
public ResponseEntity<PedidoDTO> partialUpdatePedido(
@PathVariable(value = "id", required = false) final Long id,
@RequestBody PedidoDTO pedidoDTO
) throws URISyntaxException {
log.debug("REST request to partial update Pedido partially : {}, {}", id, pedidoDTO);
if (pedidoDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, pedidoDTO.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!pedidoRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
Optional<PedidoDTO> result = pedidoService.partialUpdate(pedidoDTO);
return ResponseUtil.wrapOrNotFound(
result,
HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, pedidoDTO.getId().toString())
);
}
/**
* {@code GET /pedidos} : get all the pedidos.
*
* @param pageable the pagination information.
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of pedidos in body.
*/
@GetMapping("/pedidos")
public ResponseEntity<List<PedidoDTO>> getAllPedidos(PedidoCriteria criteria, Pageable pageable) {
log.debug("REST request to get Pedidos by criteria: {}", criteria);
Page<PedidoDTO> page = pedidoQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* {@code GET /pedidos/count} : count all the pedidos.
*
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body.
*/
@GetMapping("/pedidos/count")
public ResponseEntity<Long> countPedidos(PedidoCriteria criteria) {
log.debug("REST request to count Pedidos by criteria: {}", criteria);
return ResponseEntity.ok().body(pedidoQueryService.countByCriteria(criteria));
}
/**
* {@code GET /pedidos/:id} : get the "id" pedido.
*
* @param id the id of the pedidoDTO to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the pedidoDTO, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/pedidos/{id}")
public ResponseEntity<PedidoDTO> getPedido(@PathVariable Long id) {
log.debug("REST request to get Pedido : {}", id);
Optional<PedidoDTO> pedidoDTO = pedidoService.findOne(id);
return ResponseUtil.wrapOrNotFound(pedidoDTO);
}
/**
* {@code DELETE /pedidos/:id} : delete the "id" pedido.
*
* @param id the id of the pedidoDTO to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/pedidos/{id}")
public ResponseEntity<Void> deletePedido(@PathVariable Long id) {
log.debug("REST request to delete Pedido : {}", id);
pedidoService.delete(id);
return ResponseEntity
.noContent()
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
.build();
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
3b3329a38a56ffc8c26c84d045c9f41c92d9cac1 | 9f6ac42289f6c9b84c4104905df58bf2587270a8 | /example/page/Page.java | 8e876d383c83736607969c2c26e236f5868a3db7 | [] | no_license | yunpyy/java-code | fc6c324b78f55a12814c2f49251ebaf806093985 | 074ce1070e39f862b26a594011673f4a49af14dc | refs/heads/master | 2021-01-23T12:21:25.254859 | 2014-10-08T07:24:19 | 2014-10-08T07:24:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,363 | java | package example.page;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
/**
* @author 管进峰
*
*/
public class Page<T> {
private int pageTotal; //总页数
private int pageSize=30; //每页条数
private int currentPage=1; //当前页
private int total; //总条数
private int pageShowSize=5; //分页编号显示个数
public int getPageShowSize() {
return pageShowSize;
}
public void setPageShowSize(int pageShowSize) {
this.pageShowSize = pageShowSize;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public void setPageTotal(int pageTotal) {
this.pageTotal = pageTotal;
}
public int getPageTotal() {
return total%pageSize==0?(total/pageSize):(total/pageSize)+1;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
/**
* @param args
*/
/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException, IOException {
Page<User> page=new Page<User>();
List<User> users=page.init();
System.out.println("欢迎进入控制台分页。。");
System.out.println("=======================================");
// System.out.println("第一页:");
// System.out.println("page.getPageTotal():"+page.getPageTotal());
// for(User uu_:page.frist(users,page)){
// System.out.println("编号:"+uu_.getId()+" 名称:"+uu_.getName());
// }
// System.out.println("最后页:");
// for(User uu_1:page.last(users,page)){
// System.out.println("编号:"+uu_1.getId()+" 名称:"+uu_1.getName());
// }
System.out.println("请设置每页显示条数");
page.setTotal(users.size()); //总记录数
BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
int tiaoshu=Integer.parseInt(strin.readLine());
page.setPageSize(tiaoshu);
System.out.println("=======================================");
boolean flag=true;
do {
int pageZongshu=page.getPageTotal();
System.out.println("page.getPageTotal():"+page.getPageTotal());
for(int i=1;i<=pageZongshu;i++){
System.out.print(i+" ");
}
System.out.println("\n当前要前往那一页");
BufferedReader strin1=new BufferedReader(new InputStreamReader(System.in));
int toPage=Integer.parseInt(strin1.readLine());
page.setCurrentPage(toPage); //当前页
List<User> showUser=page.showUser(page, users);
for(User u:showUser){
System.out.println("编号:"+u.getId()+" 名称:"+u.getName());
}
System.out.println("==============================================");
System.out.println("page.getCurrentPage():"+page.getCurrentPage());
List<Integer> ids=page.nearPageNum(page);
for(int k=0;k<ids.size();k++){
System.out.print(ids.get(k)+" ");
}
if(ids.get(ids.size()-1)<page.getPageTotal()){
System.out.print(" ..."+page.getPageTotal());
}
System.out.println("\n==============================================");
System.out.println("是否继续?(Y/N)");
BufferedReader strin2=new BufferedReader(new InputStreamReader(System.in));
String con=String.valueOf(strin2.readLine());
if(con.toUpperCase().equals("N")){
flag=false;
}
} while (flag);
}
public List<User> showUser(Page page,List<User> users){
List<User> users_=new ArrayList<User>();
int startNum=(page.currentPage-1)*page.getPageSize();
int endNum=page.currentPage*page.getPageSize()>page.total?page.total:page.currentPage*page.getPageSize();
for(int i=startNum;i<endNum;i++){
User u=users.get(i);
users_.add(u);
}
return users_;
}
public List<T> frist(List<T> users,Page page){
List<T> tt=new ArrayList<T>();
for(int i=0;i<page.pageSize;i++){
tt.add(users.get(i));
}
return tt;
}
public List<T> last(List<T> users,Page page){
List<T> tt=new ArrayList<T>();
int start=(page.getPageTotal()-1)*page.getPageSize();
int end=page.getPageTotal()*page.getPageSize()>page.getTotal()?page.getTotal():page.getPageTotal()*page.getPageSize();
for(int i=start;i<end;i++){
tt.add(users.get(i));
}
return tt;
}
public List<User> init(){
List<User> users=new ArrayList<User>();
for(int i=1;i<100;i++){
users.add(new User(i,"八戒"+i));
}
return users;
}
public List<Integer> nearPageNum(Page page){
List<Integer> pageIds=new ArrayList<Integer>();
int num=page.getCurrentPage();
int total=page.getPageTotal();
int showSize=page.getPageShowSize();
if(total==num){
if(total<showSize){
pageIds.clear();
for(int i=1;i<=total;i++){
pageIds.add(i);
}
}else{
pageIds.clear();
for(int i=total-showSize+1;i<=total;i++){
pageIds.add(i);
}
}
}else if(total>num){
pageIds.clear();
if(num<showSize){
for(int i=1;i<=showSize;i++){
pageIds.add(i);
}
}else{
for(int i=num-2;i<=num+2;i++){
pageIds.add(i);
}
}
}
return pageIds;
}
} | [
"yunpyy@qq.com"
] | yunpyy@qq.com |
1d34044f9f42a4c60dafbfb45459d319f348cc9f | a322d862e170704b4008a8f70bd358d900ae6fa0 | /huaweicloud-dis-flink-connector_2.11/src/main/java/org/apache/flink/streaming/connectors/dis/internals/DisPartitionDiscoverer.java | 684e30571c25ade4d7ef4b781b85361fcff87fc6 | [
"Apache-2.0"
] | permissive | huaweicloud/flink-dis-plugin | 134b09b3f693edc4a43c753ef7f8e3683f105399 | 63325802db7d076d0778b17dc1218b512c28b5f0 | refs/heads/master | 2023-08-28T20:56:52.374235 | 2022-07-08T08:39:23 | 2022-07-08T08:39:23 | 199,606,177 | 3 | 7 | Apache-2.0 | 2022-07-08T08:39:24 | 2019-07-30T08:11:02 | Java | UTF-8 | Java | false | false | 4,509 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.apache.flink.streaming.connectors.dis.internals;
import com.huaweicloud.dis.adapter.kafka.clients.consumer.Consumer;
import com.huaweicloud.dis.adapter.kafka.clients.consumer.ConsumerRebalanceListener;
import com.huaweicloud.dis.adapter.kafka.clients.consumer.DISKafkaConsumer;
import com.huaweicloud.dis.adapter.kafka.common.PartitionInfo;
import com.huaweicloud.dis.adapter.kafka.common.TopicPartition;
import org.apache.flink.annotation.Internal;
import java.util.*;
import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* A partition discoverer that can be used to discover topics and partitions metadata
* from DIS using DIS Kafka Adapter.
*/
@Internal
public class DisPartitionDiscoverer extends AbstractPartitionDiscoverer {
private final Properties kafkaProperties;
private final DisStreamsDescriptor topicsDescriptor;
private Consumer<?, ?> kafkaConsumer;
public DisPartitionDiscoverer(
DisStreamsDescriptor topicsDescriptor,
int indexOfThisSubtask,
int numParallelSubtasks,
Properties kafkaProperties) {
super(topicsDescriptor, indexOfThisSubtask, numParallelSubtasks);
this.topicsDescriptor = topicsDescriptor;
this.kafkaProperties = checkNotNull(kafkaProperties);
}
@Override
protected void initializeConnections() {
this.kafkaConsumer = new DISKafkaConsumer<>(kafkaProperties);
ConsumerRebalanceListener consumerRebalanceListener = new ConsumerRebalanceListener() {
@Override
public void onPartitionsRevoked(Collection<TopicPartition> collection) {
}
@Override
public void onPartitionsAssigned(Collection<TopicPartition> collection) {
kafkaConsumer.pause(collection);
}
};
if (this.topicsDescriptor.isFixedTopics()) {
this.kafkaConsumer.subscribe(topicsDescriptor.getFixedTopics(), consumerRebalanceListener);
} else if (this.topicsDescriptor.isTopicPattern()) {
this.kafkaConsumer.subscribe(this.topicsDescriptor.getTopicPattern(), consumerRebalanceListener);
} else {
throw new IllegalArgumentException("Illegal " + topicsDescriptor.toString());
}
}
@Override
protected List<String> getAllTopics() throws WakeupException {
return new ArrayList<>(kafkaConsumer.listTopics().keySet());
}
@Override
protected List<DisStreamPartition> getAllPartitionsForTopics(List<String> topics) throws WakeupException {
List<DisStreamPartition> partitions = new LinkedList<>();
for (String topic : topics) {
final List<PartitionInfo> kafkaPartitions = kafkaConsumer.partitionsFor(topic);
if (kafkaPartitions == null) {
throw new RuntimeException(
String.format(
"Could not fetch partitions for %s. Make sure that the stream exists.",
topic));
}
for (PartitionInfo partitionInfo : kafkaPartitions) {
partitions.add(new DisStreamPartition(partitionInfo.topic(), partitionInfo.partition()));
}
}
return partitions;
}
@Override
protected void wakeupConnections() {
if (this.kafkaConsumer != null) {
this.kafkaConsumer.wakeup();
}
}
@Override
protected void closeConnections() throws Exception {
if (this.kafkaConsumer != null) {
this.kafkaConsumer.close();
// de-reference the consumer to avoid closing multiple times
this.kafkaConsumer = null;
}
}
}
| [
"tenjishen@gmail.com"
] | tenjishen@gmail.com |
46c2a9f2f015c28246b174639a68dd691564c819 | 26d9db01850c2566ed26172850c6877fd1612af1 | /day-6/src/main/java/com/duckelekuuk/aoc/DaySixPartOne.java | 1452738b64859d4974ec4332d497595adfc2041a | [] | no_license | Duckelekuuk/AdventOfCode2020 | fdeffcfbc4c3e0a3726bab4f889848529004c3b6 | cf1dd73080f189866c78cae52b812d00a9b645a9 | refs/heads/master | 2023-01-28T16:18:19.251552 | 2020-12-12T15:50:18 | 2020-12-12T15:50:18 | 317,651,488 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,269 | java | package com.duckelekuuk.aoc;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class DaySixPartOne {
public static void main(String[] args) {
int count = 0;
Set<String> characterGroup = new HashSet<>();
for (String line : getInput("input.txt").collect(Collectors.toList())) {
if (line.isEmpty()) {
count += characterGroup.size();
characterGroup.clear();
continue;
}
characterGroup.addAll(Arrays.asList(line.split("")));
}
count += characterGroup.size();
System.out.println("Count: " + count);
}
public static Stream<String> getInput(String resourceName) {
InputStream inputStream = ClassLoader.getSystemClassLoader().getResourceAsStream(resourceName);
if (inputStream == null) {
throw new IllegalArgumentException("Resource not found");
}
BufferedReader reader = new BufferedReader(new BufferedReader(new InputStreamReader(inputStream)));
return reader.lines();
}
}
| [
"duckelekuuk@gmail.com"
] | duckelekuuk@gmail.com |
e8cc58214d07572b65ceab0262af255d01f9c7a1 | 0b4761f05abd931823a3dfc32f855b533e8e0411 | /src/tasks/interceptors/AutenticadorInterceptor.java | 18c1e3fc9b560232ff47d9e272075b7660347388 | [] | no_license | Joneswc/javaspring | 40f93bc8c5a3655807b4aa27f42c9c5b0256ecc2 | 6acb24b86bf1b1d94d9cb3ee04b5eedc3bbd7d66 | refs/heads/master | 2020-05-30T13:33:09.188523 | 2019-06-20T22:06:33 | 2019-06-20T22:06:33 | 189,764,045 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 876 | java | package tasks.interceptors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class AutenticadorInterceptor extends HandlerInterceptorAdapter {
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object controller) throws Exception {
String uri = request.getRequestURI(); // endereço da requisição daquele recurso
if (uri.endsWith("formlogin") || uri.endsWith("getlogin") || uri.contains("resources")) {
return true;
}
// se a lógica de login verificou que aquele login e senha, existem no banco, foi adicionado um 'usuário logado na sessão'
if (request.getSession().getAttribute("usuariologado") != null ) {
return true;
}
response.sendRedirect("formlogin");
return false;
}
}
| [
"36118482018.2@senacrjedu.local"
] | 36118482018.2@senacrjedu.local |
0cb35409e0775f5603f3728609d41dac4e6af774 | 632c52b66bcddf212c3ea18903b5d0a2accf25d2 | /src/academy/belhard/entity/Planes.java | 8b32224119bf81e274d0f799a087e9d6af066724 | [] | no_license | Dzmitry20/Airport_project | 6a477d3e4260656a2ab258b4b7582f059db48585 | e97b9145d673ce182f5d566c2bd1838916464ad9 | refs/heads/main | 2023-02-04T01:03:59.049301 | 2020-12-22T08:34:24 | 2020-12-22T08:34:24 | 320,518,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,461 | java | package academy.belhard.entity;
public class Planes {
private int id;
private String mark;
private String model;
private int capacity;
private String board_number;
public Planes(int id, String mark, String model, int capacity, String board_number) {
this.id = id;
this.mark = mark;
this.model = model;
this.capacity = capacity;
this.board_number = board_number;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public String getBoard_number() {
return board_number;
}
public void setBoard_number(String board_number) {
this.board_number = board_number;
}
@Override
public String toString() {
return "Planes{" +
"id=" + id +
", marka='" + mark + '\'' +
", model='" + model + '\'' +
", capacity=" + capacity +
", board_number='" + board_number + '\'' +
'}';
}
}
| [
"zhdv27@mail.ru"
] | zhdv27@mail.ru |
f6ca3f150462be12c126591bf34bef55e820f1e5 | 5e6eac37384fb8928b53b457ae359fd89b84d3da | /Euges-1.0/ihm/PageAccueilIHM.java | 0bc3a4498a1c9d41b5a1a8309f3853edc772cefd | [] | no_license | BackupTheBerlios/eugesproject | c1e572b1313077d67360489ace848118671c7ae9 | be6992a22174a5f053d5ee98782c3d8b4d9e6134 | refs/heads/master | 2020-06-03T05:59:38.118461 | 2005-03-25T08:28:09 | 2005-03-25T08:28:09 | 40,045,087 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,304 | java | /*
* Created on 27 nov. 2003
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package ihm;
import java.util.ResourceBundle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import configuration.Config;
/**
* @author will
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class PageAccueilIHM extends PageAssistantIHM{
private ResourceBundle message = ResourceBundle.getBundle(Config.config.getProperty("cheminTraduction") + "." + Config.locale.getLanguage() + getClass().getName().substring(getClass().getName().lastIndexOf('.')), Config.locale);
//definition des boutons activés pour l'assistant
final boolean[] tab={false,false,true,false,true};
public PageAccueilIHM(final Shell shell) {
//appel du constructeur de la classe composite
super(shell);
//mise en place du layout
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns=1;
this.setLayout(gridLayout);
//titre
Font font = new Font(getDisplay(), "Arial", 15, 15);
Label titre = new Label(this, SWT.NONE);
titre.setFont(font);
titre.setText(message.getString("pageAccueilIHM.titre"));
titre.pack();
//champ texte
Text presentation = new Text(this, SWT.BORDER | SWT.WRAP | SWT.MULTI);
presentation.setText(message.getString("pageAccueilIHM.texte"));
presentation.setEnabled(false);
//titre
GridData gridData1 = new GridData();
titre.setLayoutData(gridData1);
//champ texte
gridData1 = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
presentation.setLayoutData(gridData1);
//activation des boutons
set_activeBoutons(tab);
}
/* (non-Javadoc)
* @see ihm.PageAssistantIHM#verifDonnees()
*/
public boolean verifDonnees() {
return true;
}
/* (non-Javadoc)
* @see ihm.PageAssistantIHM#loadData()
*/
public void loadData() {
// TODO Auto-generated method stub
}
}
| [
"euges8"
] | euges8 |
b73d7ab7ccd267e54ecd4afb7a4276ba6c56b5a9 | e85ffdc21ce39468fd3a3e4a1eafa6aaf5cc855a | /src/attack/special/Hurricane.java | cd1907f2e357cd9288ccf7858675b79a0ea55549 | [] | no_license | Nanachi07/SumerIntenseLabWork2 | 9c02381b5d12f73b91a93be3645922afa056761b | 4898c6f0c0121ad1f6c5b245937601ad7da94912 | refs/heads/master | 2022-12-03T09:15:34.717376 | 2020-07-29T15:41:35 | 2020-07-29T15:41:35 | 282,186,306 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package attack.special;
import ru.ifmo.se.pokemon.*;
public class Hurricane extends PhysicalMove {
public Hurricane() {
super(Type.FLYING, 110, 70);
}
public static void confuse(Pokemon p) {
Effect effect = new Effect().chance(0.3);
if (effect.success())
System.out.println(true);
confuse(p);
}
protected String describe() {
return "CONFUSE WITH HURRICANE!";
}
} | [
"lis.logovo@mail.ru"
] | lis.logovo@mail.ru |
e43d977452b9fe1fa421692ab189aab8604abe60 | 9daed01d61bb9dea18d3cc6fa97ded5a13b28d53 | /app/src/main/java/pratice/asia/nextop/tabsmaterial/MyApplication.java | 6a8bac8f2d0272d7b77915f12605e4b1d3d77f65 | [] | no_license | RohidanTiger/TabsMaterial | 38d5c7c5fe1ebb0624a5fcfca67c5f65b79624c2 | 3565361a012c00fecca4e3d50731b42eba7a60f6 | refs/heads/master | 2021-01-19T12:04:46.843869 | 2017-06-30T08:52:03 | 2017-06-30T08:52:03 | 88,017,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,732 | java | package pratice.asia.nextop.tabsmaterial;
import android.app.Application;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import nextop.asia.pratise.util.LruBitmapCache;
/**
* Created by billymobile on 11/18/15.
*/
public class MyApplication extends Application{
public static final String TAG = MyApplication.class
.getSimpleName();
private RequestQueue mRequestQueue;
private ImageLoader mImageLoader;
private static MyApplication mInstance;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized MyApplication getInstance() {
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public ImageLoader getImageLoader() {
getRequestQueue();
if (mImageLoader == null) {
mImageLoader = new ImageLoader(this.mRequestQueue,
new LruBitmapCache());
}
return this.mImageLoader;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}
| [
"quy.dinh.van@sofiamedix.vn"
] | quy.dinh.van@sofiamedix.vn |
c7343bdc9deaa700f0b3394b4044ddf89647cf3c | 7a4d5fad2cca674f66c3f6d22bf8abda75b8b67c | /src/main/java/org/teststompwebsocket/util/AuthenticationMsg.java | 77a8883073cd86665c3d484bba8845e1563df26a | [] | no_license | desertfoxzhou/teststompwebsocket | ae8f7508c4b5fce481bd9d81c8b7af7d845c2ae5 | 1fe208f421baa135accc15693140d77cfb9de9ef | refs/heads/master | 2021-01-11T02:03:02.320556 | 2016-06-13T21:05:06 | 2016-06-13T21:05:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 975 | java | package org.teststompwebsocket.util;
import java.io.Serializable;
import java.util.Map;
/**
* Authentication Message.
*
* @author Sergey Stotskiy
*
*/
@SuppressWarnings("serial")
public class AuthenticationMsg implements Serializable {
private String type;
private String sequence_id;
private Map<String, String> data;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSequence_id() {
return sequence_id;
}
public void setSequence_id(String sequence_id) {
this.sequence_id = sequence_id;
}
public Map<String, String> getData() {
return data;
}
public void setData(Map<String, String> data) {
this.data = data;
}
@Override
public String toString() {
return "AuthenticationMsg [type=" + type + ", sequence_id=" + sequence_id
+ ", data=" + data + "]";
}
}
| [
"storikshutski@mail.ru"
] | storikshutski@mail.ru |
454bfd1aa3f6c4d7e4de9753cf5c6c54d518d5da | 1968a8cbb561158105ab17a82212fbad7c774863 | /nabook/src/main/java/com/nabook/constants/Constant.java | 57d20aee84166b525a8df5841cac32ef19aeac3e | [] | no_license | phantoan/liferay7 | e2dddb4586edb40c2eeb8d9418ccb400a2bff66f | 8b01586297cd70100134145bfb4e5f3915296fea | refs/heads/master | 2021-06-13T03:38:31.141804 | 2017-02-20T00:28:46 | 2017-02-20T00:28:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 156 | java | /**
*
*/
package com.nabook.constants;
/**
* @author Phan Toan
*
*/
public class Constant {
public static final String abc= "asdads";
}
| [
"phanductoan2005@gmail.com"
] | phanductoan2005@gmail.com |
f9964991db9b667501adee920e09275e71dad37e | 99c02e8c0429ffbae9bce95decbf8f3befb09d12 | /myResource/src/main/java/com/longe/myresource/view/AndroidBug5497Workaround.java | 6624107dc51dabc80c2a7645ef46324c200a0c34 | [] | no_license | zuoguiqing/BottomNavDemo | d281c4e9a37a9d20db9e4fef126e34c5d59dd2ca | 0028eeb699b60de854aaf56d7dfebd2fa6f2837e | refs/heads/master | 2020-03-10T05:11:37.146018 | 2018-04-13T02:52:48 | 2018-04-13T02:52:48 | 129,211,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,231 | java | package com.longe.myresource.view;
import android.app.Activity;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
/**
* Created by si on 05/07/2017.
*/
public class AndroidBug5497Workaround {
// For more information, see https://code.google.com/p/android/issues/detail?id=5497
// To use this class, simply invoke assistActivity() on an Activity that already has its content view set.
public static void assistActivity (Activity activity) {
new AndroidBug5497Workaround(activity);
}
private View mChildOfContent;
private int usableHeightPrevious;
private FrameLayout.LayoutParams frameLayoutParams;
private AndroidBug5497Workaround(Activity activity) {
FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content);
mChildOfContent = content.getChildAt(0);
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
possiblyResizeChildOfContent();
}
});
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
}
private void possiblyResizeChildOfContent() {
int usableHeightNow = computeUsableHeight();
if (usableHeightNow != usableHeightPrevious) {
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
if (heightDifference > (usableHeightSansKeyboard/4)) {
// keyboard probably just became visible
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
} else {
// keyboard probably just became hidden
frameLayoutParams.height = usableHeightSansKeyboard;
}
mChildOfContent.requestLayout();
usableHeightPrevious = usableHeightNow;
}
}
private int computeUsableHeight() {
Rect r = new Rect();
mChildOfContent.getWindowVisibleDisplayFrame(r);
return (r.bottom - r.top);
}
}
| [
"944639839@qq.com"
] | 944639839@qq.com |
2639ef22e5a6fad96a6b9767d7429dbd660698f3 | 476c7d76eae6b69a836b1e3d13aa1b6116e50359 | /gmall-mbg/src/main/java/com/mars/gmall/oms/mapper/CartItemMapper.java | 19c77783b941e6763b31596212ed308d4ad4cf28 | [] | no_license | lwx666666/mars-gmall | 603559c79b69ce096327102a9492583d60148930 | 115db6d5d9da4065f0f98a8d1d815fc0be0105ef | refs/heads/master | 2022-06-22T03:26:05.725191 | 2020-01-19T15:41:12 | 2020-01-19T15:41:12 | 234,536,643 | 0 | 0 | null | 2022-06-21T02:40:04 | 2020-01-17T11:40:20 | Java | UTF-8 | Java | false | false | 295 | java | package com.mars.gmall.oms.mapper;
import com.mars.gmall.oms.entity.CartItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 购物车表 Mapper 接口
* </p>
*
* @author Mars
* @since 2020-01-17
*/
public interface CartItemMapper extends BaseMapper<CartItem> {
}
| [
"lb_168@126.com"
] | lb_168@126.com |
f9d28edc2657605d4a906ef42b2e9882ca5dfcd2 | 9ec3045b736ce00789db5c5d8fc6a0cd9edaa197 | /src/Java8Test/scratch.java | f3fad9e14b58077f536ae7328cfe0f7e18355956 | [] | no_license | anujachockalingam/fun-coding | f72003deffd8aafc180a30ff59a3d4dc79a5e183 | b15363e98b39150af62c0f7c7888278c4864f583 | refs/heads/master | 2022-12-24T16:24:13.700888 | 2020-10-01T20:56:30 | 2020-10-01T20:56:30 | 296,708,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,240 | java | package Java8Test;
import java.util.*;
class Java8Tester {
public static void main(String[] args) {
List<String> names1 = new ArrayList<String>();
names1.add("Mahesh ");
names1.add("Suresh ");
names1.add("Ramesh ");
names1.add("Naresh ");
names1.add("Kalpesh ");
List<String> names2 = new ArrayList<String>();
names2.add("Mahesh ");
names2.add("Suresh ");
names2.add("Ramesh ");
names2.add("Naresh ");
names2.add("Kalpesh ");
Java8Tester tester = new Java8Tester();
System.out.println("Sort using Java 7 syntax: ");
tester.sortUsingJava7(names1);
System.out.println(names1);
System.out.println("Sort using Java 8 syntax: ");
tester.sortUsingJava8(names2);
System.out.println(names2);
}
private void sortUsingJava8(List<String> names) {
Collections.sort(names, (s1,s2) -> s1.compareTo(s2));
}
private void sortUsingJava7(List<String> names) {
Collections.sort(names, new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o1.compareTo(o2);
}
});
}
} | [
"anuja.chockalingam@experian.com"
] | anuja.chockalingam@experian.com |
c2a2e4e5f80f328d31d9e12a9913dfbf36282d66 | de4090699ca1c5bce1c6660ac20d89c7a76d7b21 | /Hello_World.java | 57782cefe9db93dd948575d7b7c28f0cf8685e10 | [] | no_license | anne871101/test_git | b9a913760b620b06bb023245a2e57d5183c0ebbf | c41d17fc62784c6f5639342ac41305753f3bd459 | refs/heads/master | 2021-01-18T16:22:36.880157 | 2014-09-07T23:54:02 | 2014-09-07T23:54:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | public class Hello_World {
public static main(String[] args) {
System.out.println("HELLO WORLD");
}
}
| [
"anne871101@gmail.com"
] | anne871101@gmail.com |
1166873dff97898c47df11911ee3efe29e1c358e | 4d3ea698dcbac7798258e7ff93e41a0f54dcc00a | /src/BinaryTrees/SpiralPrint.java | f7a70aaf293e1e7f629601dac519d79fac7ac82d | [] | no_license | amanmahajan2190/Algorithms-and-Data-Structure | 94f5b28bd449ac7eff4af8be5fc6b4951ac650ea | 6957cb2e03b33b0376befeee4480dade5739ad57 | refs/heads/master | 2020-12-29T00:55:10.635850 | 2016-08-23T13:12:41 | 2016-08-23T13:12:41 | 45,441,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package BinaryTrees;
import java.util.Stack;
/**
* Created by AMAN on 5/23/2016.
*/
public class SpiralPrint {
Stack<Node> stack1;
Stack<Node> stack2;
SpiralPrint(){
stack1 = new Stack<Node>();
stack2 = new Stack<Node>();
}
public void createTree(Node root){
root.left = new Node(2);
root.right = new Node(3);
root.left.left = new Node(5);
root.left.right = new Node(4);
root.right.left = new Node(7);
root.right.right = new Node(6);
}
public void makeSpiralTree(Node root){
if(root == null){
return;
}
stack1.push(root);
while (!stack1.isEmpty() || !stack2.isEmpty()){
while (!stack1.isEmpty()){
Node t = stack1.pop();
System.out.print(t.data);
if(t.left!= null){
stack2.push(t.left);
}
if(t.left!=null){
stack2.push(t.right);
}
}
while (!stack2.isEmpty()){
Node t = stack2.pop();
System.out.print(t.data);
if(t.left!= null){
stack1.push(t.left);
}
if(t.left!=null){
stack1.push(t.right);
}
}
}
}
public static void main(String[] args){
SpiralPrint print = new SpiralPrint();
Node root = new Node(1);
print.createTree(root);
print.makeSpiralTree(root);
}
}
| [
"amanmahajan2190@hotmail.com"
] | amanmahajan2190@hotmail.com |
09a2334db1039116ced4e999de901be4aabec836 | 1aef4669e891333de303db570c7a690c122eb7dd | /src/main/java/com/alipay/api/response/KoubeiTradeOrderEnterpriseSettleResponse.java | 858073c88a654ce6f29d389f0b0d624265cbb06b | [
"Apache-2.0"
] | permissive | fossabot/alipay-sdk-java-all | b5d9698b846fa23665929d23a8c98baf9eb3a3c2 | 3972bc64e041eeef98e95d6fcd62cd7e6bf56964 | refs/heads/master | 2020-09-20T22:08:01.292795 | 2019-11-28T08:12:26 | 2019-11-28T08:12:26 | 224,602,331 | 0 | 0 | Apache-2.0 | 2019-11-28T08:12:26 | 2019-11-28T08:12:25 | null | UTF-8 | Java | false | false | 1,250 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.trade.order.enterprise.settle response.
*
* @author auto create
* @since 1.0, 2019-03-29 18:50:02
*/
public class KoubeiTradeOrderEnterpriseSettleResponse extends AlipayResponse {
private static final long serialVersionUID = 5748128488453659294L;
/**
* 描述本次返回中的业务属性,该字段用于描述本次返回中的业务属性,现有:BIZ_ALREADY_SUCCESS(幂等业务码)
*/
@ApiField("biz_code")
private String bizCode;
/**
* 口碑订单号
*/
@ApiField("order_no")
private String orderNo;
/**
* 传入的商户订单号
*/
@ApiField("out_order_no")
private String outOrderNo;
public void setBizCode(String bizCode) {
this.bizCode = bizCode;
}
public String getBizCode( ) {
return this.bizCode;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getOrderNo( ) {
return this.orderNo;
}
public void setOutOrderNo(String outOrderNo) {
this.outOrderNo = outOrderNo;
}
public String getOutOrderNo( ) {
return this.outOrderNo;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
49fdcdd12b6b2ab000357c61cdd033f3b6861708 | 009851d339fcf6ecec8e725cf2c47a71ae747639 | /src/main/java/org/notification/module/InitializeUsers.java | a563a1062c0d385cb21a61690407e998734414fb | [] | no_license | nupur-singhal1992/Notificationn_Module | 6c9dddbc4bc71663d7927800cb990a9241fc9103 | bf889dd6bd79fbee4c1826033389a40295420b5b | refs/heads/master | 2022-12-27T02:05:14.696601 | 2020-05-21T16:13:41 | 2020-05-21T16:13:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,056 | java | package org.notification.module;
import org.notification.module.entities.LogBean;
import org.notification.module.entities.User;
import org.notification.module.entities.UserForLog;
import org.notification.module.enums.CommunicationMode;
import org.notification.module.enums.LogType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.notification.module.repository.LogBeanRepository;
import org.notification.module.repository.UserForLogRepository;
import org.notification.module.repository.UserRepository;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@Service
public class InitializeUsers {
@Autowired
private UserRepository userRepository;
@Autowired
private LogBeanRepository logBeanRepository;
@Autowired
private UserForLogRepository userForLogRepository;
public void initializeUsers() {
User user1 = new User();
user1.setName("nupur");
user1.setEmail("nupurnitjsr5@gmail.com");
// user1.setPassword("thisIsMe6#");
user1.setMobileNo(new BigInteger("7829840398"));
user1.setAlertSubscriptionTaken(true);
user1 = userRepository.save(user1);
List<CommunicationMode> communicationModes = new ArrayList<>();
// communicationModes.add(CommunicationMode.SMS);
communicationModes.add(CommunicationMode.EMAIL);
LogBean logBeanForUser1 = new LogBean();
logBeanForUser1.setLogType(LogType.Warning);
logBeanForUser1.setDuration(10);
logBeanForUser1.setFrequency(30);
logBeanForUser1.setWaitTime(100);
logBeanForUser1.setCommunicationModes(communicationModes);
logBeanForUser1 = logBeanRepository.save(logBeanForUser1);
UserForLog userForLog = new UserForLog();
userForLog.setLogType(logBeanForUser1.getLogType());
userForLog.setLogId(logBeanForUser1.getId());
userForLog.setUserId(user1.getId());
userForLogRepository.save(userForLog);
}
}
| [
"nupursinghal@Nupurs-MacBook-Air.local"
] | nupursinghal@Nupurs-MacBook-Air.local |
68e463a59aaa0b2c324bb6490c1ad8b738d66ff1 | ea52e1ee2d8e390b77fdef93882513cfe61c74a2 | /app/src/test/java/com/akb/ANGGI/myapplication/ExampleUnitTest.java | de865cc657e22b941f325cc87874d9521919a5fa | [] | no_license | anggi03/Tugas-UAS-AKB-AKB1-10116042 | a6d6ec84347806843fbd50d928ccdff80b54f359 | 518129d06452058ac08509f94917202e339c680a | refs/heads/master | 2020-07-04T06:43:00.314352 | 2019-08-13T17:21:11 | 2019-08-13T17:21:11 | 202,181,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.akb.ANGGI.myapplication;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"mynameanggi03@gmail.com"
] | mynameanggi03@gmail.com |
8b8cb1a31c73a53858486ee4612e05c4beaf7c3c | ae140feae43cf56cc2faf99a355530e20108d4b9 | /programmers/programmers_basic/dfs2.java | 765fb5034423c207facfece40d0e8886b2dbedee | [] | no_license | Wonji1/coding-test | 6ac7e6a014c6f9d400b0d4b3fc19bf4b102a9980 | 11ff1be18957c65a1bdd571f168a46caa86000a4 | refs/heads/master | 2023-04-12T19:54:32.144543 | 2021-05-04T08:43:58 | 2021-05-04T08:43:58 | 312,788,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | public class dfs2 {
public static int solution(int n, int[][] computers) {
int answer = 0;
boolean[] check = new boolean[n];
for(int i=0;i<n;i++){
if(!check[i]){
answer++;
dfs(i,computers,check);
}
}
return answer;
}
private static void dfs(int i, int[][] computers, boolean[] check) {
check[i] = true;
for(int j=0;j<computers[i].length;j++){
if(!check[j] && computers[i][j] == 1){
dfs(j,computers,check);
}
}
}
public static void main(String[] args) {
int n = 3;
int[][] computers = {{1,1,0},{1,1,0},{0,0,1}};
int answer = solution(n, computers);
System.out.println(answer);
}
}
| [
"53804188+Wonji1@users.noreply.github.com"
] | 53804188+Wonji1@users.noreply.github.com |
1fb7429070b6897b1ac6ddd84c7015be4dcc894e | a54d6cb5ead7dcd721ff9c3985ed140b809f1823 | /app/src/main/java/com/acadgild/fujitsu/assignment51/MainActivity.java | bbe336485ad4aef741577aaf968d30a2aa3bb50d | [] | no_license | Ritesh786/Assignment5.1 | a412f2601647ac935bf9f70e40606a86011fbda2 | a9228d9f85576c5124b79b55175ca06b0822f3a0 | refs/heads/master | 2021-01-19T18:17:16.391650 | 2017-04-15T14:45:15 | 2017-04-15T14:45:15 | 88,353,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,560 | java |
package com.acadgild.fujitsu.assignment51;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.text);
}
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.firstmmenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_red) {
textView.setTextColor(Color.RED);
return true;
}
if (id == R.id.action_blue) {
textView.setTextColor(Color.BLUE);
return true;
}
if (id == R.id.action_yeloow) {
textView.setTextColor(Color.YELLOW);
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"jharitesh6@gmail.com"
] | jharitesh6@gmail.com |
98e7f8a59929b577fcc63fb746e7286e40fdb99f | c9a6b445eb78b303df154d67f1fa68f0afd389d6 | /backend/src/test/java/br/com/digitalhouse/ComunidadeOrganicaApplicationTests.java | d5ca5f5f8bc60e936922a79beaa33121ebe97fc7 | [] | no_license | vyrs/comunidade-organica | 57bf3fb660d3a5f76142a21f01c4c75489233de7 | b9693d5329389aeff33f296b04ebba849aea1b7a | refs/heads/master | 2023-02-13T16:13:56.702851 | 2021-01-12T12:47:31 | 2021-01-12T12:47:31 | 320,680,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package br.com.digitalhouse;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ComunidadeOrganicaApplicationTests {
@Test
void contextLoads() {
}
}
| [
"vitory.rsilva@hotmail.com"
] | vitory.rsilva@hotmail.com |
6d771598538d646cb0a4de3600983e45e43f2dad | 88c76d0ed062c7cc4217a59e5d11566dd5ed9daf | /app/src/main/java/agoption/projetos/com/agoption/helper/ConfiguracaoBanco.java | 264d6caae90af77869edbfa3f6424b56e0aec362 | [] | no_license | FabioSousaFBS/AGOption | 5efe8f783388203340d748cb09d9b555d41c21a4 | 47ccb8d2d13fa770bb9c6f363a8fc3d064ab1acb | refs/heads/master | 2021-01-24T03:57:59.183645 | 2018-04-18T02:47:07 | 2018-04-18T02:47:07 | 122,913,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,184 | java | package agoption.projetos.com.agoption.helper;
import android.database.sqlite.SQLiteDatabase;
public final class ConfiguracaoBanco {
private static SQLiteDatabase banco;
public static SQLiteDatabase getBanco(){
if(banco == null){
banco = SQLiteDatabase.openOrCreateDatabase("DbAGOption", null);
//banco = SQLiteDatabase.op
}
return banco;
}
//CRIAR TABELAS
public static void criarTabelas(){
banco.execSQL("CREATE TABLE IF NOT EXISTS Carros(" +
" idCarro INTEGER PRIMARY KEY AUTOINCREMENT," +
" descricao VARCHAR(30)," +
" fator NUMERIC(10,2));");
banco.execSQL("CREATE TABLE IF NOT EXISTS Historico(" +
" idHistorico INTEGER PRIMARY KEY AUTOINCREMENT," +
" data DATETIME," +
" vlAlcool NUMERIC(10,2)," +
" vlGasolina NUMERIC(10,2)," +
" idCarro_fk INTEGER," +
" melhorOP VARCHAR(10)," +
" fator NUMERIC(10,2)," +
" FOREIGN KEY (idCarro_fk) REFERENCES Carros(idCarro));");
}
}
| [
"fabio@email.com"
] | fabio@email.com |
e7e42e24e7f8fd52301f7a72b0f52e4110b35476 | ba7ea425a956d6ed74d7d52549c6c660071e312d | /stub-idp/src/main/java/uk/gov/ida/stub/idp/resources/singleidp/SingleIdpPreRegistrationResource.java | e8a19775c3bdeb6caf84af38729dce8ecaf9054e | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | willp-bl/verify-stub-idp | a7860f1854f414ee0ba0c5d2620bf0cd77f8a11a | bfbf554b4d73c45e434cc9c1c2117d0388145069 | refs/heads/monorepo | 2023-07-06T01:46:02.867893 | 2019-02-19T16:15:04 | 2019-02-19T16:15:04 | 128,985,826 | 0 | 1 | MIT | 2019-09-25T20:43:39 | 2018-04-10T19:37:08 | Java | UTF-8 | Java | false | false | 3,026 | java | package uk.gov.ida.stub.idp.resources.singleidp;
import uk.gov.ida.common.SessionId;
import uk.gov.ida.stub.idp.Urls;
import uk.gov.ida.stub.idp.cookies.CookieFactory;
import uk.gov.ida.stub.idp.repositories.Idp;
import uk.gov.ida.stub.idp.repositories.IdpSession;
import uk.gov.ida.stub.idp.repositories.IdpSessionRepository;
import uk.gov.ida.stub.idp.repositories.IdpStubsRepository;
import uk.gov.ida.stub.idp.views.CancelPreRegistrationPageView;
import uk.gov.ida.stub.idp.views.ErrorMessageType;
import uk.gov.ida.stub.idp.views.RegistrationPageView;
import javax.inject.Inject;
import javax.validation.constraints.NotNull;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Optional;
import java.util.UUID;
import static uk.gov.ida.stub.idp.views.ErrorMessageType.NO_ERROR;
@Path(Urls.SINGLE_IDP_PRE_REGISTER_RESOURCE)
@Produces(MediaType.TEXT_HTML)
public class SingleIdpPreRegistrationResource {
private final IdpStubsRepository idpStubsRepository;
private final CookieFactory cookieFactory;
private final IdpSessionRepository idpSessionRepository;
@Inject
public SingleIdpPreRegistrationResource(
IdpStubsRepository idpStubsRepository, CookieFactory cookieFactory, IdpSessionRepository idpSessionRepository) {
this.idpStubsRepository = idpStubsRepository;
this.cookieFactory = cookieFactory;
this.idpSessionRepository = idpSessionRepository;
}
@GET
@Path(Urls.SINGLE_IDP_PRE_REGISTER_CANCEL_PATH)
@Produces(MediaType.TEXT_HTML)
public Response getPreRegisterCancel(
@PathParam(Urls.IDP_ID_PARAM) @NotNull String idpName,
@QueryParam(Urls.ERROR_MESSAGE_PARAM) Optional<ErrorMessageType> errorMessage) {
Idp idp = idpStubsRepository.getIdpWithFriendlyId(idpName);
return Response.ok(new CancelPreRegistrationPageView(idp.getDisplayName(), idp.getFriendlyId(), errorMessage.orElse(NO_ERROR).getMessage(), idp.getAssetId())).build();
}
@GET
public Response getPreRegister(
@PathParam(Urls.IDP_ID_PARAM) @NotNull String idpName,
@QueryParam(Urls.ERROR_MESSAGE_PARAM) Optional<ErrorMessageType> errorMessage) {
Idp idp = idpStubsRepository.getIdpWithFriendlyId(idpName);
IdpSession session = new IdpSession(
new SessionId(UUID.randomUUID().toString()));
final SessionId sessionId = idpSessionRepository.createSession(session);
idpSessionRepository.updateSession(session.getSessionId(), session.setNewCsrfToken());
return Response.ok(new RegistrationPageView(idp.getDisplayName(), idp.getFriendlyId(), errorMessage.orElse(NO_ERROR).getMessage(), idp.getAssetId(), Urls.SINGLE_IDP_PRE_REGISTER_PATH, session.getCsrfToken()))
.cookie(cookieFactory.createSessionIdCookie(sessionId))
.build();
}
}
| [
"william.palmer@digital.cabinet-office.gov.uk"
] | william.palmer@digital.cabinet-office.gov.uk |
6c29c571d5ce969da25828a99be7f34840d566ab | 05c2a972a383de999e871b0e1d2b7ee91634c7bf | /zxinglib/src/main/java/com/scan/zxinglib/zxorg/ViewfinderResultPointCallback.java | 77e9ab7a6bd4468ef49beac7d6d95b4d26314f5d | [] | no_license | jackyflame/ZxingTester | 344b126cd09448138669b6bcdd1949ba1ae9471b | e41a5238096b62124dfb81e180979e4c0aa2bc04 | refs/heads/master | 2021-06-25T22:16:11.665016 | 2017-09-14T09:24:07 | 2017-09-14T09:24:07 | 103,254,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,085 | java | /*
* Copyright (C) 2009 ZXing authors
*
* 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 com.scan.zxinglib.zxorg;
import com.google.zxing.ResultPoint;
import com.google.zxing.ResultPointCallback;
final class ViewfinderResultPointCallback implements ResultPointCallback {
private final ViewfinderView viewfinderView;
ViewfinderResultPointCallback(ViewfinderView viewfinderView) {
this.viewfinderView = viewfinderView;
}
@Override
public void foundPossibleResultPoint(ResultPoint point) {
viewfinderView.addPossibleResultPoint(point);
}
}
| [
"263667227@qq.com"
] | 263667227@qq.com |
bab18b1ba0cbc8f4e033a9c2b40883ddf64fdcd3 | 8cf7dc95101060cf7a28f2582915db8ebb81b1c0 | /Hospital - Jovany T/hospital/hospital/src/main/java/br/edu/uniacademia/hospital/dao/ProntuariosDAO.java | cf67b40f74e55535024fa646af897d775dfd972e | [] | no_license | JovanyTvares/TrabalhoHospital | 74d12a205ec566e8e3729a19d17be8c72df39ba7 | 92dcc56863dd77caa7f424f2a5de511e9e39a1b6 | refs/heads/master | 2023-01-04T05:14:56.418214 | 2020-10-29T23:57:55 | 2020-10-29T23:57:55 | 308,478,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,998 | java | package br.edu.uniacademia.hospital.dao;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import br.edu.uniacademia.hospital.model.Prontuarios;
import br.edu.uniacademia.hospital.util.PersistenceUtil;
public class ProntuariosDAO {
public static ProntuariosDAO prontuariosDAO;
public static ProntuariosDAO getInstance() {
if (prontuariosDAO == null) {
prontuariosDAO = new ProntuariosDAO();
}
return prontuariosDAO;
}
public Prontuarios buscar(String descricao) {
EntityManager em = PersistenceUtil.getEntityManager();
Query query = em.createQuery("select a from Prontuarios a where a.descricao =:descricao ");
query.setParameter("descricao", descricao);
List<Prontuarios> prontuariosList = query.getResultList();
if (prontuariosList != null && prontuariosList.size() > 0) {
return prontuariosList.get(0);
}
return null;
}
public List<Prontuarios> buscarTodas() {
EntityManager em = PersistenceUtil.getEntityManager();
Query query = em.createQuery("from Prontuarios As a");
return query.getResultList();
}
public void remover(Prontuarios prontuarios) {
EntityManager em = PersistenceUtil.getEntityManager();
em.getTransaction().begin();
if (!em.contains(prontuarios)) {
prontuarios = em.merge(prontuarios);
}
em.remove(prontuarios);
em.getTransaction().commit();
}
public Prontuarios persistir(Prontuarios prontuarios) {
EntityManager em = PersistenceUtil.getEntityManager();
em.getTransaction().begin();
try {
prontuarios = em.merge(prontuarios);
em.getTransaction().commit();
System.out.println("Registro Prontuarios gravado com sucesso");
} catch (Exception e) {
e.printStackTrace();
}
return prontuarios;
}
public void removeAll() {
EntityManager em = PersistenceUtil.getEntityManager();
em.getTransaction().begin();
Query query = em.createQuery(" delete from Prontuarios ");
query.executeUpdate();
em.getTransaction().commit();
}
}
| [
"jovan.tav@gmail.com"
] | jovan.tav@gmail.com |
58f006f6a2ba9251180efac1ac2cd782c72f2899 | 2ba4aa725e17d29c4482c5699ea8210136339b1e | /app/src/main/java/com/borntonight/loftcoin/data/DataModule.java | b685c85951c48970881eea344e50d5af463e61e8 | [] | no_license | BornToNight/LoftCoin | d44154b6bb17e9551cf3ba8a236baef2ee01ff70 | f422406d43d15f02438c656298166130c0d2dec8 | refs/heads/master | 2023-01-07T02:13:55.466612 | 2020-11-06T05:18:30 | 2020-11-06T05:18:30 | 290,524,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,208 | java | package com.borntonight.loftcoin.data;
import android.content.Context;
import androidx.room.Room;
import com.borntonight.loftcoin.BuildConfig;
import com.squareup.moshi.Moshi;
import javax.inject.Singleton;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.moshi.MoshiConverterFactory;
@Module
public abstract class DataModule {
@Provides
static Moshi moshi() {
final Moshi moshi = new Moshi.Builder().build();
return moshi.newBuilder()
.add(Coin.class, moshi.adapter(AutoValue_CmcCoin.class))
.add(Listings.class, moshi.adapter(AutoValue_Listings.class))
.build();
}
@Provides
static Retrofit retrofit(OkHttpClient httpClient, Moshi moshi) {
final Retrofit.Builder builder = new Retrofit.Builder();
builder.client(httpClient.newBuilder()
.addInterceptor(chain -> {
final Request request = chain.request();
return chain.proceed(request.newBuilder()
.addHeader(CmcApi.API_KEY, BuildConfig.API_KEY)
.build());
})
.build());
builder.baseUrl(BuildConfig.API_ENDPOINT);
builder.addConverterFactory(MoshiConverterFactory.create(moshi));
builder.addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync());
return builder.build();
}
@Provides
static CmcApi cmcApi(Retrofit retrofit) {
return retrofit.create(CmcApi.class);
}
@Provides
@Singleton
static LoftDatabase loftDatabase(Context context) {
if (BuildConfig.DEBUG) {
return Room.inMemoryDatabaseBuilder(context, LoftDatabase.class).build();
} else {
return Room.databaseBuilder(context, LoftDatabase.class, "loft.db").build();
}
}
@Binds
abstract CoinsRepo coinsRepo(CmcCoinsRepo impl);
@Binds
abstract CurrencyRepo currencyRepo(CurrencyRepoImpl impl);
@Binds
abstract WalletsRepo walletsRepo(WalletsRepoImpl impl);
}
| [
"isako-vadim@yandex.ru"
] | isako-vadim@yandex.ru |
2cb4a2791c924721446cdab87d3538c59fbd284a | f1123bdb1e29def659a671cffd92c3d86da39722 | /core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java | 36aa8d7b941b75306759f2dcd8d18437e9ed6e03 | [
"Apache-2.0"
] | permissive | q474818917/elasticsearch-2.3.5 | 075dfcd6dc175ce6a1f477b5f581a4e1ff2176fa | 15210e447f84d77c1fd6a5fb2df8cec2d56e2dda | refs/heads/master | 2022-08-12T12:02:48.663691 | 2019-07-23T06:10:05 | 2019-07-23T06:10:05 | 103,924,125 | 0 | 0 | Apache-2.0 | 2022-07-15T21:06:14 | 2017-09-18T10:15:22 | Java | UTF-8 | Java | false | false | 40,512 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you 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.elasticsearch.search.query;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import com.google.common.collect.Sets;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.MultiMatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.test.ESIntegTestCase;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
import static org.hamcrest.Matchers.*;
public class MultiMatchQueryIT extends ESIntegTestCase {
@Before
public void init() throws Exception {
CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder()
.put(indexSettings())
.put(SETTING_NUMBER_OF_SHARDS, 1)
.put(SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.analysis.analyzer.perfect_match.type", "custom")
.put("index.analysis.analyzer.perfect_match.tokenizer", "keyword")
.put("index.analysis.analyzer.perfect_match.filter", "lowercase")
.put("index.analysis.analyzer.category.type", "custom")
.put("index.analysis.analyzer.category.tokenizer", "whitespace")
.put("index.analysis.analyzer.category.filter", "lowercase")
);
assertAcked(builder.addMapping("test", createMapping()));
ensureGreen();
int numDocs = scaledRandomIntBetween(50, 100);
List<IndexRequestBuilder> builders = new ArrayList<>();
builders.add(client().prepareIndex("test", "test", "theone").setSource(
"full_name", "Captain America",
"first_name", "Captain",
"last_name", "America",
"category", "marvel hero",
"skill", 15,
"int-field", 25));
builders.add(client().prepareIndex("test", "test", "theother").setSource(
"full_name", "marvel hero",
"first_name", "marvel",
"last_name", "hero",
"category", "bogus",
"skill", 5));
builders.add(client().prepareIndex("test", "test", "ultimate1").setSource(
"full_name", "Alpha the Ultimate Mutant",
"first_name", "Alpha the",
"last_name", "Ultimate Mutant",
"category", "marvel hero",
"skill", 1));
builders.add(client().prepareIndex("test", "test", "ultimate2").setSource(
"full_name", "Man the Ultimate Ninja",
"first_name", "Man the Ultimate",
"last_name", "Ninja",
"category", "marvel hero",
"skill", 3));
builders.add(client().prepareIndex("test", "test", "anotherhero").setSource(
"full_name", "ultimate",
"first_name", "wolferine",
"last_name", "",
"category", "marvel hero",
"skill", 1));
List<String> firstNames = new ArrayList<>();
fill(firstNames, "Captain", between(15, 25));
fill(firstNames, "Ultimate", between(5, 10));
fillRandom(firstNames, between(3, 7));
List<String> lastNames = new ArrayList<>();
fill(lastNames, "Captain", between(3, 7));
fillRandom(lastNames, between(30, 40));
for (int i = 0; i < numDocs; i++) {
String first = RandomPicks.randomFrom(getRandom(), firstNames);
String last = randomPickExcept(lastNames, first);
builders.add(client().prepareIndex("test", "test", "" + i).setSource(
"full_name", first + " " + last,
"first_name", first,
"last_name", last,
"category", randomBoolean() ? "marvel hero" : "bogus",
"skill", between(1, 3)));
}
indexRandom(true, false, builders);
}
private XContentBuilder createMapping() throws IOException {
return XContentFactory.jsonBuilder().startObject().startObject("test")
.startObject("properties")
.startObject("full_name")
.field("type", "string")
.field("copy_to", "full_name_phrase")
.field("analyzer", "perfect_match")
.endObject()
.startObject("category")
.field("type", "string")
.field("analyzer", "category")
.endObject()
.startObject("first_name")
.field("type", "string")
.field("omit_norms", "true")
.field("copy_to", "first_name_phrase")
.endObject()
.startObject("last_name")
.field("type", "string")
.field("omit_norms", "true")
.field("copy_to", "last_name_phrase")
.endObject()
.endObject()
.endObject().endObject();
}
@Test
public void testDefaults() throws ExecutionException, InterruptedException {
MatchQueryBuilder.Type type = randomBoolean() ? null : MatchQueryBuilder.Type.BOOLEAN;
SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.OR))).get();
Set<String> topNIds = Sets.newHashSet("theone", "theother");
for (int i = 0; i < searchResponse.getHits().hits().length; i++) {
topNIds.remove(searchResponse.getHits().getAt(i).getId());
// very likely that we hit a random doc that has the same score so orders are random since
// the doc id is the tie-breaker
}
assertThat(topNIds, empty());
assertThat(searchResponse.getHits().hits()[0].getScore(), equalTo(searchResponse.getHits().hits()[1].getScore()));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.OR).useDisMax(false).type(type))).get();
assertFirstHit(searchResponse, anyOf(hasId("theone"), hasId("theother")));
assertThat(searchResponse.getHits().hits()[0].getScore(), greaterThan(searchResponse.getHits().hits()[1].getScore()));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.OR).type(type))).get();
assertFirstHit(searchResponse, hasId("theother"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.AND).type(type))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.AND).type(type))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
}
@Test
public void testPhraseType() {
SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("Man the Ultimate", "full_name_phrase", "first_name_phrase", "last_name_phrase", "category_phrase")
.operator(MatchQueryBuilder.Operator.OR).type(MatchQueryBuilder.Type.PHRASE))).get();
assertFirstHit(searchResponse, hasId("ultimate2"));
assertHitCount(searchResponse, 1l);
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("Captain", "full_name_phrase", "first_name_phrase", "last_name_phrase", "category_phrase")
.operator(MatchQueryBuilder.Operator.OR).type(MatchQueryBuilder.Type.PHRASE))).get();
assertThat(searchResponse.getHits().getTotalHits(), greaterThan(1l));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("the Ul", "full_name_phrase", "first_name_phrase", "last_name_phrase", "category_phrase")
.operator(MatchQueryBuilder.Operator.OR).type(MatchQueryBuilder.Type.PHRASE_PREFIX))).get();
assertSearchHits(searchResponse, "ultimate2", "ultimate1");
assertHitCount(searchResponse, 2l);
}
@Test
public void testSingleField() throws NoSuchFieldException, IllegalAccessException {
SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("15", "skill"))).get();
assertNoFailures(searchResponse);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("15", "skill", "int-field")).analyzer("category")).get();
assertNoFailures(searchResponse);
assertFirstHit(searchResponse, hasId("theone"));
String[] fields = {"full_name", "first_name", "last_name", "last_name_phrase", "first_name_phrase", "category_phrase", "category"};
String[] query = {"marvel","hero", "captain", "america", "15", "17", "1", "5", "ultimate", "Man",
"marvel", "wolferine", "ninja"};
// check if it's equivalent to a match query.
int numIters = scaledRandomIntBetween(10, 100);
for (int i = 0; i < numIters; i++) {
String field = RandomPicks.randomFrom(getRandom(), fields);
int numTerms = randomIntBetween(1, query.length);
StringBuilder builder = new StringBuilder();
for (int j = 0; j < numTerms; j++) {
builder.append(RandomPicks.randomFrom(getRandom(), query)).append(" ");
}
MultiMatchQueryBuilder multiMatchQueryBuilder = randomizeType(multiMatchQuery(builder.toString(), field));
SearchResponse multiMatchResp = client().prepareSearch("test")
// _uid sort field is a tie, in case hits have the same score,
// the hits will be sorted the same consistently
.addSort("_score", SortOrder.DESC)
.addSort("_uid", SortOrder.ASC)
.setQuery(multiMatchQueryBuilder).get();
MatchQueryBuilder matchQueryBuilder = QueryBuilders.matchQuery(field, builder.toString());
if (getType(multiMatchQueryBuilder) != null) {
matchQueryBuilder.type(MatchQueryBuilder.Type.valueOf(getType(multiMatchQueryBuilder).matchQueryType().toString()));
}
SearchResponse matchResp = client().prepareSearch("test")
// _uid tie sort
.addSort("_score", SortOrder.DESC)
.addSort("_uid", SortOrder.ASC)
.setQuery(matchQueryBuilder).get();
assertThat("field: " + field + " query: " + builder.toString(), multiMatchResp.getHits().getTotalHits(), equalTo(matchResp.getHits().getTotalHits()));
SearchHits hits = multiMatchResp.getHits();
for (int j = 0; j < hits.hits().length; j++) {
assertThat(hits.getHits()[j].score(), equalTo(matchResp.getHits().getHits()[j].score()));
assertThat(hits.getHits()[j].getId(), equalTo(matchResp.getHits().getHits()[j].getId()));
}
}
}
@Test
public void testCutoffFreq() throws ExecutionException, InterruptedException {
final long numDocs = client().prepareCount("test")
.setQuery(matchAllQuery()).get().getCount();
MatchQueryBuilder.Type type = randomBoolean() ? null : MatchQueryBuilder.Type.BOOLEAN;
Float cutoffFrequency = randomBoolean() ? Math.min(1, numDocs * 1.f / between(10, 20)) : 1.f / between(10, 20);
SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.OR).cutoffFrequency(cutoffFrequency))).get();
Set<String> topNIds = Sets.newHashSet("theone", "theother");
for (int i = 0; i < searchResponse.getHits().hits().length; i++) {
topNIds.remove(searchResponse.getHits().getAt(i).getId());
// very likely that we hit a random doc that has the same score so orders are random since
// the doc id is the tie-breaker
}
assertThat(topNIds, empty());
assertThat(searchResponse.getHits().hits()[0].getScore(), greaterThanOrEqualTo(searchResponse.getHits().hits()[1].getScore()));
cutoffFrequency = randomBoolean() ? Math.min(1, numDocs * 1.f / between(10, 20)) : 1.f / between(10, 20);
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.OR).useDisMax(false).cutoffFrequency(cutoffFrequency).type(type))).get();
assertFirstHit(searchResponse, anyOf(hasId("theone"), hasId("theother")));
assertThat(searchResponse.getHits().hits()[0].getScore(), greaterThan(searchResponse.getHits().hits()[1].getScore()));
long size = searchResponse.getHits().getTotalHits();
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.OR).useDisMax(false).type(type))).get();
assertFirstHit(searchResponse, anyOf(hasId("theone"), hasId("theother")));
assertThat("common terms expected to be a way smaller result set", size, lessThan(searchResponse.getHits().getTotalHits()));
cutoffFrequency = randomBoolean() ? Math.min(1, numDocs * 1.f / between(10, 20)) : 1.f / between(10, 20);
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.OR).cutoffFrequency(cutoffFrequency).type(type))).get();
assertFirstHit(searchResponse, hasId("theother"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.AND).cutoffFrequency(cutoffFrequency).type(type))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.AND).cutoffFrequency(cutoffFrequency).type(type))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero", "first_name", "last_name", "category")
.operator(MatchQueryBuilder.Operator.AND).cutoffFrequency(cutoffFrequency)
.analyzer("category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theother"));
}
@Test
public void testEquivalence() {
final int numDocs = (int) client().prepareCount("test")
.setQuery(matchAllQuery()).get().getCount();
int numIters = scaledRandomIntBetween(5, 10);
for (int i = 0; i < numIters; i++) {
{
MatchQueryBuilder.Type type = randomBoolean() ? null : MatchQueryBuilder.Type.BOOLEAN;
MultiMatchQueryBuilder multiMatchQueryBuilder = randomBoolean() ? multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category") :
multiMatchQuery("marvel hero captain america", "*_name", randomBoolean() ? "category" : "categ*");
SearchResponse left = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(randomizeType(multiMatchQueryBuilder
.operator(MatchQueryBuilder.Operator.OR).type(type))).get();
SearchResponse right = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(disMaxQuery().
add(matchQuery("full_name", "marvel hero captain america"))
.add(matchQuery("first_name", "marvel hero captain america"))
.add(matchQuery("last_name", "marvel hero captain america"))
.add(matchQuery("category", "marvel hero captain america"))
).get();
assertEquivalent("marvel hero captain america", left, right);
}
{
MatchQueryBuilder.Type type = randomBoolean() ? null : MatchQueryBuilder.Type.BOOLEAN;
String minShouldMatch = randomBoolean() ? null : "" + between(0, 1);
MatchQueryBuilder.Operator op = randomBoolean() ? MatchQueryBuilder.Operator.AND : MatchQueryBuilder.Operator.OR;
MultiMatchQueryBuilder multiMatchQueryBuilder = randomBoolean() ? multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category") :
multiMatchQuery("captain america", "*_name", randomBoolean() ? "category" : "categ*");
SearchResponse left = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(randomizeType(multiMatchQueryBuilder
.operator(op).useDisMax(false).minimumShouldMatch(minShouldMatch).type(type))).get();
SearchResponse right = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(boolQuery().minimumShouldMatch(minShouldMatch)
.should(randomBoolean() ? termQuery("full_name", "captain america") : matchQuery("full_name", "captain america").operator(op))
.should(matchQuery("first_name", "captain america").operator(op))
.should(matchQuery("last_name", "captain america").operator(op))
.should(matchQuery("category", "captain america").operator(op))
).get();
assertEquivalent("captain america", left, right);
}
{
String minShouldMatch = randomBoolean() ? null : "" + between(0, 1);
MatchQueryBuilder.Operator op = randomBoolean() ? MatchQueryBuilder.Operator.AND : MatchQueryBuilder.Operator.OR;
SearchResponse left = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(randomizeType(multiMatchQuery("capta", "full_name", "first_name", "last_name", "category")
.type(MatchQueryBuilder.Type.PHRASE_PREFIX).useDisMax(false).minimumShouldMatch(minShouldMatch))).get();
SearchResponse right = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(boolQuery().minimumShouldMatch(minShouldMatch)
.should(matchPhrasePrefixQuery("full_name", "capta"))
.should(matchPhrasePrefixQuery("first_name", "capta").operator(op))
.should(matchPhrasePrefixQuery("last_name", "capta").operator(op))
.should(matchPhrasePrefixQuery("category", "capta").operator(op))
).get();
assertEquivalent("capta", left, right);
}
{
String minShouldMatch = randomBoolean() ? null : "" + between(0, 1);
MatchQueryBuilder.Operator op = randomBoolean() ? MatchQueryBuilder.Operator.AND : MatchQueryBuilder.Operator.OR;
SearchResponse left;
if (randomBoolean()) {
left = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category")
.type(MatchQueryBuilder.Type.PHRASE).useDisMax(false).minimumShouldMatch(minShouldMatch))).get();
} else {
left = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category")
.type(MatchQueryBuilder.Type.PHRASE).tieBreaker(1.0f).minimumShouldMatch(minShouldMatch))).get();
}
SearchResponse right = client().prepareSearch("test").setSize(numDocs)
.addSort(SortBuilders.scoreSort()).addSort(SortBuilders.fieldSort("_uid"))
.setQuery(boolQuery().minimumShouldMatch(minShouldMatch)
.should(matchPhraseQuery("full_name", "captain america"))
.should(matchPhraseQuery("first_name", "captain america").operator(op))
.should(matchPhraseQuery("last_name", "captain america").operator(op))
.should(matchPhraseQuery("category", "captain america").operator(op))
).get();
assertEquivalent("captain america", left, right);
}
}
}
@Test
public void testCrossFieldMode() throws ExecutionException, InterruptedException {
SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.operator(MatchQueryBuilder.Operator.OR))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero captain america", "full_name", "first_name", "last_name", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.operator(MatchQueryBuilder.Operator.OR))).get();
assertFirstHit(searchResponse, hasId("theone"));
assertSecondHit(searchResponse, hasId("theother"));
assertThat(searchResponse.getHits().hits()[0].getScore(), greaterThan(searchResponse.getHits().hits()[1].getScore()));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("marvel hero", "full_name", "first_name", "last_name", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.operator(MatchQueryBuilder.Operator.OR))).get();
assertFirstHit(searchResponse, hasId("theother"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america", "full_name", "first_name", "last_name", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.operator(MatchQueryBuilder.Operator.AND))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america 15", "full_name", "first_name", "last_name", "category", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category")
.operator(MatchQueryBuilder.Operator.AND))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america 15", "full_name", "first_name", "last_name", "category", "skill", "int-field")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category")
.operator(MatchQueryBuilder.Operator.AND))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america 15", "skill", "full_name", "first_name", "last_name", "category", "int-field")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category")
.operator(MatchQueryBuilder.Operator.AND))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america 15", "first_name", "last_name", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category"))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("15", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category"))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("25 15", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category"))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("25 15", "int-field", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category"))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("25 15", "first_name", "int-field", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category"))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("25 15", "int-field", "skill", "first_name")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category"))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("25 15", "int-field", "first_name", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category"))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america marvel hero", "first_name", "last_name", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.cutoffFrequency(0.1f)
.analyzer("category")
.operator(MatchQueryBuilder.Operator.OR))).get();
assertFirstHit(searchResponse, anyOf(hasId("theother"), hasId("theone")));
long numResults = searchResponse.getHits().totalHits();
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america marvel hero", "first_name", "last_name", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category")
.operator(MatchQueryBuilder.Operator.OR))).get();
assertThat(numResults, lessThan(searchResponse.getHits().getTotalHits()));
assertFirstHit(searchResponse, hasId("theone"));
// test group based on analyzer -- all fields are grouped into a cross field search
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america marvel hero", "first_name", "last_name", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.analyzer("category")
.operator(MatchQueryBuilder.Operator.AND))).get();
assertHitCount(searchResponse, 1l);
assertFirstHit(searchResponse, hasId("theone"));
// counter example
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america marvel hero", "first_name", "last_name", "category")
.type(randomBoolean() ? MultiMatchQueryBuilder.Type.CROSS_FIELDS : null)
.operator(MatchQueryBuilder.Operator.AND))).get();
assertHitCount(searchResponse, 0l);
// counter example
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("captain america marvel hero", "first_name", "last_name", "category")
.type(randomBoolean() ? MultiMatchQueryBuilder.Type.CROSS_FIELDS : null)
.operator(MatchQueryBuilder.Operator.AND))).get();
assertHitCount(searchResponse, 0l);
// test if boosts work
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("the ultimate", "full_name", "first_name", "last_name^2", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.operator(MatchQueryBuilder.Operator.AND))).get();
assertFirstHit(searchResponse, hasId("ultimate1")); // has ultimate in the last_name and that is boosted
assertSecondHit(searchResponse, hasId("ultimate2"));
assertThat(searchResponse.getHits().hits()[0].getScore(), greaterThan(searchResponse.getHits().hits()[1].getScore()));
// since we try to treat the matching fields as one field scores are very similar but we have a small bias towards the
// more frequent field that acts as a tie-breaker internally
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("the ultimate", "full_name", "first_name", "last_name", "category")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.operator(MatchQueryBuilder.Operator.AND))).get();
assertFirstHit(searchResponse, hasId("ultimate2"));
assertSecondHit(searchResponse, hasId("ultimate1"));
assertThat(searchResponse.getHits().hits()[0].getScore(), greaterThan(searchResponse.getHits().hits()[1].getScore()));
// Test group based on numeric fields
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("15", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("15", "skill", "first_name")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS))).get();
assertFirstHit(searchResponse, hasId("theone"));
// Two numeric fields together caused trouble at one point!
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("15", "int-field", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("15", "int-field", "first_name", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS))).get();
assertFirstHit(searchResponse, hasId("theone"));
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("alpha 15", "first_name", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.lenient(true))).get();
assertFirstHit(searchResponse, hasId("ultimate1"));
/*
* Doesn't find theone because "alpha 15" isn't a number and we don't
* break on spaces.
*/
assertHitCount(searchResponse, 1);
// Lenient wasn't always properly lenient with two numeric fields
searchResponse = client().prepareSearch("test")
.setQuery(randomizeType(multiMatchQuery("alpha 15", "int-field", "first_name", "skill")
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.lenient(true))).get();
assertFirstHit(searchResponse, hasId("ultimate1"));
}
private static final void assertEquivalent(String query, SearchResponse left, SearchResponse right) {
assertNoFailures(left);
assertNoFailures(right);
SearchHits leftHits = left.getHits();
SearchHits rightHits = right.getHits();
assertThat(leftHits.getTotalHits(), equalTo(rightHits.getTotalHits()));
assertThat(leftHits.getHits().length, equalTo(rightHits.getHits().length));
SearchHit[] hits = leftHits.getHits();
SearchHit[] rHits = rightHits.getHits();
for (int i = 0; i < hits.length; i++) {
assertThat("query: " + query + " hit: " + i, (double) hits[i].getScore(), closeTo(rHits[i].getScore(), 0.00001d));
}
for (int i = 0; i < hits.length; i++) {
if (hits[i].getScore() == hits[hits.length - 1].getScore()) {
return; // we need to cut off here since this is the tail of the queue and we might not have fetched enough docs
}
assertThat("query: " + query, hits[i].getId(), equalTo(rHits[i].getId()));
}
}
public static List<String> fill(List<String> list, String value, int times) {
for (int i = 0; i < times; i++) {
list.add(value);
}
return list;
}
public List<String> fillRandom(List<String> list, int times) {
for (int i = 0; i < times; i++) {
list.add(randomRealisticUnicodeOfCodepointLengthBetween(1, 5));
}
return list;
}
public <T> T randomPickExcept(List<T> fromList, T butNot) {
while (true) {
T t = RandomPicks.randomFrom(getRandom(), fromList);
if (t.equals(butNot)) {
continue;
}
return t;
}
}
public MultiMatchQueryBuilder randomizeType(MultiMatchQueryBuilder builder) {
try {
MultiMatchQueryBuilder.Type type = getType(builder);
if (type == null && randomBoolean()) {
return builder;
}
if (type == null) {
type = MultiMatchQueryBuilder.Type.BEST_FIELDS;
}
if (randomBoolean()) {
builder.type(type);
} else {
Object oType = type;
switch (type) {
case BEST_FIELDS:
if (randomBoolean()) {
oType = MatchQueryBuilder.Type.BOOLEAN;
}
break;
case MOST_FIELDS:
if (randomBoolean()) {
oType = MatchQueryBuilder.Type.BOOLEAN;
}
break;
case CROSS_FIELDS:
break;
case PHRASE:
if (randomBoolean()) {
oType = MatchQueryBuilder.Type.PHRASE;
}
break;
case PHRASE_PREFIX:
if (randomBoolean()) {
oType = MatchQueryBuilder.Type.PHRASE_PREFIX;
}
break;
}
builder.type(oType);
}
return builder;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
private MultiMatchQueryBuilder.Type getType(MultiMatchQueryBuilder builder) throws NoSuchFieldException, IllegalAccessException {
return builder.getType();
}
}
| [
"wangzx@wangzxdeMacBook-Pro.local"
] | wangzx@wangzxdeMacBook-Pro.local |
94615b9ac111a8b149c4944c012e569d51b220a2 | d7be4442074b22ec3b091888ac57f523e026d182 | /src/evosim/buildingblocks/AminoAcid.java | ca7a2c6fe8b6a1b97f2546ae0f9c888db7b6e3fc | [] | no_license | drwat/EvoSim | 52cc001f33af9c96729905bba98c5d3472a97dd8 | 04ae6f2758b9f816c8a9a20eb5bf1d52460503ba | refs/heads/master | 2021-01-25T10:17:08.493625 | 2012-04-04T02:25:51 | 2012-04-04T02:25:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java | package evosim.buildingblocks;
/**
* @author WooLooWoo
*/
public class AminoAcid extends Molecule {
}
| [
"euaxiadamant@gmail.com"
] | euaxiadamant@gmail.com |
64da47021e3286231471c1190f1817bf6e9ef107 | 8e53bc40ba86cd4d0f7d01a06147bdedc8c56cd1 | /epoxy-adapter/src/main/java/com/airbnb/epoxy/EpoxyVisibilityTracker.java | 79cd33d2f35f726c51bb69e66a142d88d673cd01 | [
"Apache-2.0"
] | permissive | viclee888/epoxy | 6ab53edb2d6039c0c1e5d7b77bf493e5cc741c55 | 6e717cfb55a0e4704394ed791b6843eec4a6d083 | refs/heads/master | 2020-04-04T09:38:00.456507 | 2018-10-22T18:07:09 | 2018-10-22T18:07:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,451 | java | package com.airbnb.epoxy;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.Adapter;
import android.support.v7.widget.RecyclerView.AdapterDataObserver;
import android.support.v7.widget.RecyclerView.OnChildAttachStateChangeListener;
import android.support.v7.widget.RecyclerView.OnScrollListener;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
import java.util.ArrayList;
import java.util.List;
/**
* A simple way to track visibility events on {@link com.airbnb.epoxy.EpoxyModel} within a {@link
* android.support.v7.widget.RecyclerView}.
* <p>
* {@link EpoxyVisibilityTracker} works with any {@link android.support.v7.widget.RecyclerView}
* backed by an Epoxy controller. Once attached the events will be forwarded to the Epoxy model (or
* to the Epoxy view when using annotations).
* <p>
* Note regarding nested lists: The visibility event tracking is not properly handled yet. This is
* on the todo.
* <p>
*
* @see OnVisibilityChanged
* @see OnVisibilityStateChanged
* @see OnModelVisibilityChangedListener
* @see OnModelVisibilityStateChangedListener
*/
public class EpoxyVisibilityTracker {
private static final String TAG = "EpoxyVisibilityTracker";
// Not actionable at runtime. It is only useful for internal test-troubleshooting.
static final boolean DEBUG_LOG = false;
/** Maintain visibility item indexed by view id (identity hashcode) */
private final SparseArray<EpoxyVisibilityItem> visibilityIdToItemMap = new SparseArray<>();
private final List<EpoxyVisibilityItem> visibilityIdToItems = new ArrayList<>();
/** listener used to process scroll, layout and attach events */
private final Listener listener = new Listener();
/** listener used to process data events */
private final DataObserver observer = new DataObserver();
@Nullable
private RecyclerView attachedRecyclerView = null;
@Nullable
private Adapter lastAdapterSeen = null;
private boolean onChangedEnabled = true;
/** This flag is for optimizing the process on detach. If detach is from data changed then it
* need to re-process all views, else no need (ex: scroll). */
private boolean visibleDataChanged = false;
/**
* Enable or disable visibility changed event. Default is `true`, disable it if you don't need
* (triggered by every pixel scrolled).
*
* @see OnVisibilityChanged
* @see OnModelVisibilityChangedListener
*/
public void setOnChangedEnabled(boolean enabled) {
onChangedEnabled = enabled;
}
/**
* Attach the tracker.
*
* @param recyclerView The recyclerview that the EpoxyController has its adapter added to.
*/
public void attach(@NonNull RecyclerView recyclerView) {
attachedRecyclerView = recyclerView;
recyclerView.addOnScrollListener(this.listener);
recyclerView.addOnLayoutChangeListener(this.listener);
recyclerView.addOnChildAttachStateChangeListener(this.listener);
}
/**
* Detach the tracker
*
* @param recyclerView The recycler view that the EpoxyController has its adapter added to.
*/
public void detach(@NonNull RecyclerView recyclerView) {
recyclerView.removeOnScrollListener(this.listener);
recyclerView.removeOnLayoutChangeListener(this.listener);
recyclerView.removeOnChildAttachStateChangeListener(this.listener);
attachedRecyclerView = null;
}
/**
* The tracker is storing visibility states internally and is using if to send events, only the
* difference is sent. Use this method to clear the states and thus regenerate the visibility
* events. This may be useful when you change the adapter on the {@link
* android.support.v7.widget.RecyclerView}
*/
public void clearVisibilityStates() {
// Clear our visibility items
visibilityIdToItemMap.clear();
visibilityIdToItems.clear();
}
private void processChangeEvent(String debug) {
processChangeEventWithDetachedView(null, debug);
}
private void processChangeEventWithDetachedView(@Nullable View detachedView, String debug) {
final RecyclerView recyclerView = attachedRecyclerView;
if (recyclerView != null) {
// On every every events lookup for a new adapter
processNewAdapterIfNecessary();
// Process the detached child if any
if (detachedView != null) {
processChild(detachedView, true, debug);
}
// Process all attached children
for (int i = 0; i < recyclerView.getChildCount(); i++) {
final View child = recyclerView.getChildAt(i);
if (child != null && child != detachedView) {
// Is some case the detached child is still in the recycler view. Don't process it as it
// was already processed.
processChild(child, false, debug);
}
}
}
}
/**
* If there is a new adapter on the attached RecyclerView it will resister the data observer and
* clear the current visibility states
*/
private void processNewAdapterIfNecessary() {
if (attachedRecyclerView != null && attachedRecyclerView.getAdapter() != null) {
if (lastAdapterSeen != attachedRecyclerView.getAdapter()) {
if (lastAdapterSeen != null) {
// Unregister the old adapter
lastAdapterSeen.unregisterAdapterDataObserver(this.observer);
}
// Register the new adapter
attachedRecyclerView.getAdapter().registerAdapterDataObserver(this.observer);
lastAdapterSeen = attachedRecyclerView.getAdapter();
}
}
}
/**
* Don't call this method directly, it is called from
* {@link EpoxyVisibilityTracker#processVisibilityEvents}
*
* @param child the view to process for visibility event
* @param detachEvent true if the child was just detached
* @param eventOriginForDebug a debug strings used for logs
*/
private void processChild(@NonNull View child, boolean detachEvent, String eventOriginForDebug) {
final RecyclerView recyclerView = attachedRecyclerView;
if (recyclerView != null) {
final ViewHolder holder = recyclerView.getChildViewHolder(child);
if (holder instanceof EpoxyViewHolder) {
processVisibilityEvents(
recyclerView,
(EpoxyViewHolder) holder,
recyclerView.getLayoutManager().canScrollVertically(),
detachEvent,
eventOriginForDebug
);
} else {
throw new IllegalEpoxyUsage(
"`EpoxyVisibilityTracker` cannot be used with non-epoxy view holders."
);
}
}
}
/**
* Call this methods every time something related to ui (scroll, layout, ...) or something related
* to data changed.
*
* @param recyclerView the recycler view
* @param epoxyHolder the {@link RecyclerView}
* @param vertical true if the scrolling is vertical
* @param detachEvent true if the event originated from a view detached from the
* recycler view
* @param eventOriginForDebug a debug strings used for logs
*/
private void processVisibilityEvents(
@NonNull RecyclerView recyclerView,
@NonNull EpoxyViewHolder epoxyHolder,
boolean vertical, boolean detachEvent,
String eventOriginForDebug
) {
if (DEBUG_LOG) {
Log.d(TAG, String.format("%s.processVisibilityEvents %s, %s, %s",
eventOriginForDebug,
System.identityHashCode(epoxyHolder),
detachEvent,
epoxyHolder.getAdapterPosition()
));
}
final View itemView = epoxyHolder.itemView;
final int id = System.identityHashCode(itemView);
EpoxyVisibilityItem vi = visibilityIdToItemMap.get(id);
if (vi == null) {
// New view discovered, assign an EpoxyVisibilityItem
vi = new EpoxyVisibilityItem(epoxyHolder.getAdapterPosition());
visibilityIdToItemMap.put(id, vi);
visibilityIdToItems.add(vi);
} else if (epoxyHolder.getAdapterPosition() != RecyclerView.NO_POSITION
&& vi.getAdapterPosition() != epoxyHolder.getAdapterPosition()) {
// EpoxyVisibilityItem being re-used for a different adapter position
vi.reset(epoxyHolder.getAdapterPosition());
}
if (vi.update(itemView, recyclerView, vertical, detachEvent)) {
// View is measured, process events
vi.handleVisible(epoxyHolder, detachEvent);
vi.handleFocus(epoxyHolder, detachEvent);
vi.handleFullImpressionVisible(epoxyHolder, detachEvent);
if (onChangedEnabled) {
vi.handleChanged(epoxyHolder);
}
}
}
/**
* Helper class that host the {@link android.support.v7.widget.RecyclerView} listener
* implementations
*/
private class Listener extends OnScrollListener
implements OnLayoutChangeListener, OnChildAttachStateChangeListener {
@Override
public void onLayoutChange(
@NonNull View recyclerView,
int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom
) {
processChangeEvent("onLayoutChange");
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
processChangeEvent("onScrolled");
}
@Override
public void onChildViewAttachedToWindow(View child) {
processChild(child, false, "onChildViewAttachedToWindow");
}
@Override
public void onChildViewDetachedFromWindow(View child) {
if (visibleDataChanged) {
// On detach event caused by data set changed we need to re-process all children because
// the removal caused the others views to changes.
processChangeEventWithDetachedView(child, "onChildViewDetachedFromWindow");
visibleDataChanged = false;
} else {
processChild(child, true, "onChildViewDetachedFromWindow");
}
}
}
/**
* The layout/scroll events are not enough to detect all sort of visibility changes. We also
* need to look at the data events from the adapter.
*/
class DataObserver extends AdapterDataObserver {
/**
* Clear the current visibility statues
*/
@Override
public void onChanged() {
if (DEBUG_LOG) {
Log.d(TAG, "onChanged()");
}
visibilityIdToItemMap.clear();
visibilityIdToItems.clear();
visibleDataChanged = true;
}
/**
* For all items after the inserted range shift each {@link EpoxyVisibilityTracker} adapter
* position by inserted item count.
*/
@Override
public void onItemRangeInserted(int positionStart, int itemCount) {
if (DEBUG_LOG) {
Log.d(TAG, String.format("onItemRangeInserted(%d, %d)", positionStart, itemCount));
}
for (EpoxyVisibilityItem item : visibilityIdToItems) {
if (item.getAdapterPosition() >= positionStart) {
visibleDataChanged = true;
item.shiftBy(itemCount);
}
}
}
/**
* For all items after the removed range reverse-shift each {@link EpoxyVisibilityTracker}
* adapter position by removed item count
*/
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
if (DEBUG_LOG) {
Log.d(TAG, String.format("onItemRangeRemoved(%d, %d)", positionStart, itemCount));
}
for (EpoxyVisibilityItem item : visibilityIdToItems) {
if (item.getAdapterPosition() >= positionStart) {
visibleDataChanged = true;
item.shiftBy(-itemCount);
}
}
}
/**
* This is a bit more complex, for move we need to first swap the moved position then shift the
* items between the swap. To simplify we split any range passed to individual item moved.
*
* ps: anyway {@link android.support.v7.util.AdapterListUpdateCallback} does not seem to use
* range for moved items.
*/
@Override
public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) {
for (int i = 0; i < itemCount; i++) {
onItemMoved(fromPosition + i, toPosition + i);
}
}
private void onItemMoved(int fromPosition, int toPosition) {
if (DEBUG_LOG) {
Log.d(TAG,
String.format("onItemRangeMoved(%d, %d, %d)", fromPosition, toPosition, 1));
}
for (EpoxyVisibilityItem item : visibilityIdToItems) {
int position = item.getAdapterPosition();
if (position == fromPosition) {
// We found the item to be moved, just swap the position.
item.shiftBy(toPosition - fromPosition);
visibleDataChanged = true;
} else if (fromPosition < toPosition) {
// Item will be moved down in the list
if (position > fromPosition && position <= toPosition) {
// Item is between the moved from and to indexes, it should move up
item.shiftBy(-1);
visibleDataChanged = true;
}
} else if (fromPosition > toPosition) {
// Item will be moved up in the list
if (position >= toPosition && position < fromPosition) {
// Item is between the moved to and from indexes, it should move down
item.shiftBy(1);
visibleDataChanged = true;
}
}
}
}
}
}
| [
"konakid@gmail.com"
] | konakid@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.