blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
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
689M
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
131 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
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
5be2cd9b4acd7868b957cd39536de7c9301c8343
57266851efecf2eee4fc9957ce311c43b268acf8
/tensquare-eureka/src/main/java/zzc/springcloud/EurekaServerApplication_6868.java
426573a84bb74eaaba9728576138e8b9fd8aa016
[]
no_license
zczhao/tensquare-parent
9a55df4f4171f2de0720c654d8f6ae5dadeb0bb7
49e9415becf9f5e52f74310ab0eca6e398c1b480
refs/heads/master
2021-02-08T18:04:27.411717
2020-03-01T16:19:21
2020-03-01T16:19:21
244,181,503
0
0
null
null
null
null
UTF-8
Java
false
false
457
java
package zzc.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class EurekaServerApplication_6868 { public static void main(String[] args) throws Exception { SpringApplication.run(EurekaServerApplication_6868.class, args); } }
[ "fhqfndn@gmail.com" ]
fhqfndn@gmail.com
e77d98edf77450140bd06ba1598028fb943ea96f
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project49/src/test/java/org/gradle/test/performance/largejavamultiproject/project49/p249/Test4992.java
0b6e4406746f0d98e3c59475dd8f776c439a987a
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,171
java
package org.gradle.test.performance.largejavamultiproject.project49.p249; import org.junit.Test; import static org.junit.Assert.*; public class Test4992 { Production4992 objectUnderTest = new Production4992(); @Test public void testProperty0() { Production4983 value = new Production4983(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production4987 value = new Production4987(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production4991 value = new Production4991(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
[ "sterling.greene@gmail.com" ]
sterling.greene@gmail.com
ed2eef7120cdc34de05195af63b069b226593578
9216316acd248c2cca4a107806ddbc1c60d1820d
/eclipse-workspace/FileComparison/src/com/lnt/framework/LayersM.java
534240f189ccbfa667fc082db9600a374e2d3fa9
[]
no_license
shambhavi-031195/file-comparision-project
d11703ec760c2f09e05fe42de7ed0cf761e27bf2
81e3d08a13635d193de722742800fcdbfc24ac30
refs/heads/master
2020-12-10T09:46:36.541594
2020-01-13T09:35:37
2020-01-13T09:35:37
233,559,120
0
0
null
null
null
null
UTF-8
Java
false
false
1,463
java
package com.lnt.framework; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class LayersM { String sourcepath; String targetpath; String tardel; String sourcedel; String arrayDel; String source_table_name; String target_table_name; InputStream inputStream; String sp; public void getPropValues() { try { Properties prop = new Properties(); String propFileName = "config.properties"; inputStream = new FileInputStream("./resources/config.properties"); if (inputStream != null) { prop.load(inputStream); } else { throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath"); } // get the property value and print it out sourcepath = prop.getProperty("sourcepath"); targetpath = prop.getProperty("targetpath"); tardel = prop.getProperty("tardel"); sourcedel = prop.getProperty("sourcedel"); arrayDel = prop.getProperty("arrayDel"); source_table_name = prop.getProperty("source_table_name"); target_table_name = prop.getProperty("target_table_name"); sp = prop.getProperty("sp"); } catch (Exception e) { System.out.println("Exception: " + e); } finally { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "noreply@github.com" ]
shambhavi-031195.noreply@github.com
17af3d94b50529f9078bfb4300b37cc543c10b4a
c74c3674a48f924a97686dc9d50324aaeba94ea4
/Lab-01/src/com/company/RomoveElementsFromArrayListExample.java
aa2949ba5a5d9db70de142db6429135ad884f406
[]
no_license
tson1234/Java02
79ccfc666c9fe50b8cad429e8c16efb9803df945
b4b15cb49afbf20de48dbe9e42381855ea21f7e0
refs/heads/master
2023-01-24T13:49:29.096468
2020-11-13T03:02:27
2020-11-13T03:02:27
311,216,811
0
0
null
null
null
null
UTF-8
Java
false
false
1,471
java
package com.company; import java.util.ArrayList; import java.util.List; public class RomoveElementsFromArrayListExample { public static void main(String[] args) { List<String> programminglanguages = new ArrayList<>(); programminglanguages.add("C"); programminglanguages.add("C++"); programminglanguages.add("Java"); programminglanguages.add("Kotlin"); programminglanguages.add("Python"); programminglanguages.add("Perl"); programminglanguages.add("Ruby"); System.out.println("Initial List: " + programminglanguages); programminglanguages.remove(5); System.out.println("After remove(5): " + programminglanguages); boolean isRemoved = programminglanguages.remove("Kotlin"); System.out.println("After remove(\"Kotlin\"): " + programminglanguages); List<String> scriptLanguages = new ArrayList<>(); scriptLanguages.add("Python"); scriptLanguages.add("Ruby"); scriptLanguages.add("Perl"); programminglanguages.removeAll(scriptLanguages); System.out.println("After removeAll(scriptingLanguages): " + programminglanguages); programminglanguages.removeIf(n -> (n.charAt(0) == 'T')); System.out.println("After Removing all elements that start with \"C\": " + programminglanguages); programminglanguages.clear(); System.out.println("After clear(): " + programminglanguages); } }
[ "59167876+tson1234@users.noreply.github.com" ]
59167876+tson1234@users.noreply.github.com
dd688197b198f7ab749bd3c157cbb4196caf94f6
86504a6f0a51ece9b099f14d4d29c1e7e45e1485
/web/src/main/java/com/night/web/service/base/IBaseService.java
f33f8d8f24a92f0159daeb46a0da59be55fcd59d
[]
no_license
chilious/repertory
2d071c318742c84d3fbd20b045e539fdaad5c7b4
5f5771a6c1337e762803e4078dd1b6485e7c0d0d
refs/heads/master
2021-01-21T03:44:23.912841
2017-09-11T07:13:41
2017-09-11T07:13:41
101,889,184
0
0
null
null
null
null
UTF-8
Java
false
false
1,007
java
package com.night.web.service.base; import java.util.List; /** * Created by Administrator on 2017/8/24. */ public interface IBaseService { /** * 根据ID找到记录 * @param id * @param <T> * @return * @throws Exception */ public <T> T findByID(Class<T> t, Long id)throws Exception; /** * 找到所有记录 * @param t * @param <T> * @return * @throws Exception */ public <T> List<T> findAll(Class<T> t)throws Exception; /** * 保存一个实体 */ public <T> void save(T t)throws Exception; /** * 批量保存实体 */ public <T> void save(List<T> list)throws Exception; /** * 删除一个实体 * @param t * @param <T> * @throws Exception */ public <T> void delete(T t)throws Exception; /** * 删除多个实体 * @param list * @param <T> * @throws Exception */ public <T> void delete(List<T> list)throws Exception; }
[ "782905278@qq.com" ]
782905278@qq.com
16971791c289c5d20dc74ab2e608ead7163942ef
2c7939a76799a0b367f67ddce43bb69def88558e
/LeetCode/dailyTemperatures.java
d30eb159c3685a723ee031af84c312b9db24d912
[]
no_license
shaniakiat/Programming-Team
8cc2599bab7edfd5d1a67a51b74b426c88e6167c
2619f5d7fa3df7d0a6198db8ffe9886a50a542c4
refs/heads/master
2021-06-26T22:56:06.119102
2021-03-18T13:09:36
2021-03-18T13:09:36
200,123,462
0
0
null
null
null
null
UTF-8
Java
false
false
1,062
java
public class dailyTemperatures { public static void main(String[] args) { int[] T = { 89, 62, 70, 58, 47, 47, 46, 76, 100, 70 }; int[] res = getDailyTemperatures(T); for (int i = 0; i < res.length; i++) { System.out.println(res[i]); } } public static int[] getDailyTemperatures(int[] T) { int n = T.length; int[] res = new int[n]; for (int i = 0; i < n; i++) { boolean found = false; // found the warmer temperature int count = 0; int current = T[i]; for (int j = i + 1; j < n; j++) { int nextDay = T[j]; if (nextDay <= current) { count++; } if (nextDay > current) { found = true; count++; break; } } if (found) { res[i] = count; } else { res[i] = 0; } } return res; } }
[ "kiat.shania@gmail.com" ]
kiat.shania@gmail.com
ebcfe6df9eaf9dae5032049d929131cc902bb179
58c84f232161736cb14c99d0e00603d064387bb6
/HM/src/boardSolver.java
85880eac4f05ce1b13227d8b95f4067daa732f1f
[]
no_license
abenezeraddisu/coding-problems
c36bcadf9fe710a681e9cf763422625331bbe34e
a64db6f2a0ee630c4add6241420451bde32cb4f7
refs/heads/main
2023-03-04T21:39:11.222374
2021-02-06T12:56:25
2021-02-06T12:56:25
336,520,453
0
0
null
null
null
null
UTF-8
Java
false
false
2,304
java
import java.util.ArrayList; import java.util.List; class boardSolver { char[][] board; int rowlen; int collen; public boolean exist(char[][] board, String word) { this.board = board; this.rowlen = board.length; this.collen = board[0].length; boolean b = false; for (int i = 0; i < rowlen; i++) { for (int j = 0; j < collen; j++) { b = backtrack(i, j, word, 0); if (b) return true; } } return false; } private boolean backtrack(int row, int col, String word, int index) { if (index >= rowlen) return true; if (row < 0 || row >= rowlen || col < 0 || col >= collen || board[row][col] != word.charAt(index)) return false; boolean toret = false; board[row][col] = '@'; int[] rowoff = new int[]{0, 1, -1, 0}; int[] coloff = new int[]{1, 0, 0, -1}; for (int i = 0; i < 4; i++) { toret = backtrack(row + rowoff[i], col + coloff[i], word, index + 1); if (toret) break; } board[row][col] = word.charAt(index); return toret; } public List<List<Integer>> subsets(int[] nums) { List<List<Integer>> holder = new ArrayList<>(); holder.add(new ArrayList<>()); for (int number : nums) { List<List<Integer>> temp = new ArrayList<>(); for (List<Integer> list : holder) { temp.add(new ArrayList<>(list) {{ add(number); }}; } for (List<Integer> list : temp) { holder.add(list); } } return holder; } public List<List<Integer>> subsets2(int[] nums) { List<List<Integer>> holder = new ArrayList<>(); holder.add(new ArrayList<>()); if (nums == null || nums.length == 0) return holder; for (int number : nums) { int holder_length = holder.size(); for (int i = 0; i < holder_length; i++) { List<Integer> set = new ArrayList<>(holder.get(i)); set.add(number); holder.add(set); } } return holder; } }
[ "noreply@github.com" ]
abenezeraddisu.noreply@github.com
0b26f775a0dd3b142aee01e98ec3ddd0f19c2e67
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-13372-6-8-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/org/xwiki/extension/xar/internal/handler/packager/DocumentMergeImporter_ESTest_scaffolding.java
6f588b591cee1b0d66c6385976aa0bf9f7dbb3b1
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
475
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Mon Apr 06 03:55:09 UTC 2020 */ package org.xwiki.extension.xar.internal.handler.packager; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class DocumentMergeImporter_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
cddb4e0235eb4d002fdedaa1cff61b19383b8baf
24f3b0596e134796cabe5fbd6c64130bf9be2b3c
/src/main/java/org/erppyme/model/DocumentoVenta.java
58f743831d3b1abd5ddb558b8c43c02428939e8e
[]
no_license
drjesusf/erppyme
0215515176289c18d535929681f836a19538409a
c15c93481faef2936e5bbb491c70f64477209b60
refs/heads/master
2021-01-20T12:00:35.886622
2015-06-09T17:09:40
2015-06-09T17:09:40
6,501,119
0
0
null
null
null
null
UTF-8
Java
false
false
1,709
java
package org.erppyme.model; import java.util.Date; import org.springframework.stereotype.Component;; @Component(value = "documentoVenta") public class DocumentoVenta{ private int codDocumentoVenta; private Venta venta; private TipoDocumentoVenta tipoDocumentoVenta; private String nroDocumento; private Date fechaEmision; private String estado; public DocumentoVenta(){} public DocumentoVenta( int codDocumentoVenta,Venta venta ,TipoDocumentoVenta tipoDocumentoVenta,String nroDocumento, Date fechaEmision, String estado) { super(); this.codDocumentoVenta = codDocumentoVenta; this.venta = venta; this.tipoDocumentoVenta = tipoDocumentoVenta; this.nroDocumento = nroDocumento; this.fechaEmision = fechaEmision; this.estado = estado; } public int getCodDocumentoVenta() { return codDocumentoVenta; } public void setCodDocumentoVenta(int codDocumentoVenta) { this.codDocumentoVenta = codDocumentoVenta; } public Venta getVenta() { return venta; } public void setVenta(Venta venta) { this.venta = venta; } public TipoDocumentoVenta getTipoDocumentoVenta() { return tipoDocumentoVenta; } public void setTipoDocumentoVenta(TipoDocumentoVenta tipoDocumentoVenta) { this.tipoDocumentoVenta = tipoDocumentoVenta; } public String getNroDocumento() { return nroDocumento; } public void setNroDocumento(String nroDocumento) { this.nroDocumento = nroDocumento; } public Date getFechaEmision() { return fechaEmision; } public void setFechaEmision(Date fechaEmision) { this.fechaEmision = fechaEmision; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } }
[ "dcubas16@gmail.com" ]
dcubas16@gmail.com
3c5bab75f2ba861452ebb993c2a991551826fa03
fd0f9437866e8ef151cfa5b777462c9fa47adec1
/Programming/src/Recurssion/MoveAllXAtEnd.java
251f4c82ad08a0d378024a9203aa9568461171d6
[]
no_license
vikass101786/Learning
26241e9a74635d58e73437345f512b047fc747b8
ca99d1b1c9d93f2bf5d7ad950a14fd1950008903
refs/heads/master
2023-04-12T08:19:46.530494
2021-05-01T07:36:30
2021-05-01T07:36:30
293,844,333
0
0
null
null
null
null
UTF-8
Java
false
false
980
java
package Recurssion; import java.util.Scanner; public class MoveAllXAtEnd { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); System.out.println(moveXAtEnd(str,0)); } private static String moveXAtEnd(String str, int i) { // TODO Auto-generated method stub if(str.length()-1 <= i) { return str; } String output = moveXAtEnd(str, i+1); if(str.substring(i, i+1).equals("x")) { output = output.substring(0,i) + output.substring(i+1) + str.substring(i, i+1); } else { return output; } return output; } /* * public static String move(String s) { if (s.length() <= 1) return s; * * String ros = s.substring(1); ros = move(ros); if (s.charAt(0) == 'x') return * ros + s.charAt(0); else return s.charAt(0) + ros; } * * public static void main(String[] args) { Scanner sc = new Scanner(System.in); * String s = sc.next(); * * System.out.println(move(s)); } */ }
[ "vikash.srivastava@amadeus.com" ]
vikash.srivastava@amadeus.com
96c4e881a8d864d55ec3d049848d7afbd6b2e400
7a5819afd33b7c8a3a700fe7eb8803d274d11163
/src/test/java/com/spring/boot/test/CyclicBarrierDemo.java
0b339f4279e2609c938c9b5c837097f14ff7594c
[]
no_license
Gwind1993/spring-boot-hello
a71cd06afbb0d95a7d02c89fcd7a11336e0db579
3d2b13fa305b4bbb64dcfed34add1b15f3365c5c
refs/heads/master
2021-05-17T07:12:55.334724
2020-04-08T14:50:44
2020-04-08T14:50:44
250,691,531
0
0
null
null
null
null
UTF-8
Java
false
false
907
java
package com.spring.boot.test; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; public class CyclicBarrierDemo { public static void main(String[] args) { CyclicBarrier cyclicBarrier = new CyclicBarrier(7,() ->{ System.out.println("*******召唤神龙*********"); }); for (int i = 1; i <= 7; i++) { final int tempInt = i; new Thread(() -> { try { System.out.println("收集到了龙珠"+tempInt+"号"); System.out.println(cyclicBarrier.isBroken()); cyclicBarrier.await(); } catch (InterruptedException e) { e.printStackTrace(); } catch (BrokenBarrierException e) { e.printStackTrace(); } }).start(); } } }
[ "1195770519@qq.com" ]
1195770519@qq.com
3e40ca359e216a174aaca58b6fbd7db906103c3e
56d8254d63ebe616f7f24dc239c74b7fe3cabafd
/src/cards/InvalidSuitException.java
37cd7e9f6a250c508717a321ff05a778a839c257
[]
no_license
nhalsteadvt/Clock-Solitaire
86262795583b0d84b1bc33ab8238d0449f0aac7f
90a875bb3e1d24f24e271b8f17d472b9b2702a02
refs/heads/main
2023-02-07T10:04:38.347962
2020-12-25T01:52:20
2020-12-25T01:52:20
324,266,435
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
/** * */ package cards; /** * @author nhalstead * */ @SuppressWarnings("serial") public class InvalidSuitException extends Exception { /** * Prints a message * * @param suit * the int representing the suit of the invalid Card object */ public InvalidSuitException(int suit) { super( "Your suit is invalid. It must be an int 0-3 inclusive.\nYour suit: " + suit); } }
[ "noreply@github.com" ]
nhalsteadvt.noreply@github.com
467a0c6c248604becf3a3652268cfe5562a76270
fe7b22afa540dca1a3a0d7e6a432a5a31d98a8d0
/Training 7/src/Nasledovanie/Cats.java
d31a3d0f1b3e84aab066f71cf1f364ac30a8de51
[]
no_license
AlexShirey/belhard_java_training_eclipse_projects
99505ffee7be056b4a84b6ed8570911b2884e700
c8c61a435956c4a89fa09e57cdf1673ed63075de
refs/heads/master
2022-12-06T06:24:18.728398
2020-08-17T19:04:32
2020-08-17T19:04:32
288,263,569
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package Nasledovanie; import java.util.Scanner; /** * Created by Shirey on 13.05.2016. */ public class Cats extends Animals{ private static String className = "Cats"; private String voice; public Cats(){ } public Cats(String name, int age, int weight, String voice) { super(name, age, weight); this.voice = voice; } public void create(){ super.create(); System.out.println("Введите голос"); Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ System.out.println("Вы ввели не голос"); sc = new Scanner(System.in); } this.voice = sc.nextLine(); } public void show(){ super.show(); StringBuffer sb = new StringBuffer(); sb.append(voice).append(" voice "); System.out.print(sb); } public String getClassName(){ return className; } public String getVoice(){ return voice; } public void setVoice(String voice){ this.voice = voice; } }
[ "alexander_shirey@epam.com" ]
alexander_shirey@epam.com
917f876534dc0e6834c1556cbc919f5afb82058e
595685a598a3847dc796c3b6be75cdd83cdcf433
/working/F/F.java
376bd04295b7a9a4bcef0a6fe86b0bf5d9c3d11e
[ "Unlicense" ]
permissive
BakedBeanz1111/csc435Blockchain
f89ae155c7af8f74fd5ba7cfbc9a6644a4bba5d2
d766ee9e33cb66b17e9d7009072e6a33f55e9223
refs/heads/main
2023-01-08T15:31:34.852849
2020-11-05T00:57:10
2020-11-05T00:57:10
304,777,450
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
/* Copy and extend the previous code so that EACH processes multicasts the message "Hello multicast message from Process [N]" and then print each of these three messages on each console. */ /* # To-Do List # 1) Take previous code from EACH # 2) Build a Listener so class F can connect to it # 3) Everytime something connects to the listener, say where the process came from */ public class F { public static void main(Strings []args) { int pNum; String serverName = "localhost"; int port = 9001; Socket socket; ServerSocket serverSocket; /* Show how to set the process ID pNum from a command line argument: */ if (args.length < 1) pNum = 0; else if (args[0].equals("0")) pNum = 0; else if (args[0].equals("1")) pNum = 1; else if (args[0].equals("2")) pNum = 2; else pNum = 0; /* Default for badly formed argument */ System.out.println("Hello from Process " + pNum); try{ TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { System.out.println(e); } System.out.println("Hello multicast message from Process " + pNum); while(true) { socket = serverSocket.accept(); new Multicast(socket).start(); } } } class Multicast extends Thread { Socket socket; Multicast(Socket socket) { socket = socket; } public void run() { PrintStream out = null; BufferedReader in = null; try { } catch (IOException ioe) { System.out.println(ioe); } } }
[ "amad.ali@sandc.com" ]
amad.ali@sandc.com
843e49aef579162fb976e983f226d4458fd82d3b
780ea2a49b6878c086ffd2d08e0cdadba237cfa7
/src/main/java/com/algaworks/algamoney/api/exceptionhandler/AlgaMoneyExceptionHandler.java
767ed30e3793bb3d0dbc9516f5263c0185b854af
[]
no_license
ailtonluiz/algamoney-api
1c8ccf1ff7b0869b5c3cc0e248a2a3f63cae85d5
d72071d21ec1906f19fdf0f28520399953fdfe20
refs/heads/master
2023-03-30T02:42:42.577789
2021-03-31T15:07:07
2021-03-31T15:07:07
351,076,306
0
0
null
null
null
null
UTF-8
Java
false
false
4,363
java
package com.algaworks.algamoney.api.exceptionhandler; import lombok.Getter; import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; @ControllerAdvice public class AlgaMoneyExceptionHandler extends ResponseEntityExceptionHandler { @Autowired private MessageSource messageSource; @Override protected ResponseEntity<Object> handleHttpMessageNotReadable(HttpMessageNotReadableException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { String mensagemUsuario = this.messageSource.getMessage("mensagem.invalida", null, LocaleContextHolder.getLocale()); String mensagemDesenvolvedor = Optional.ofNullable(ex.getCause()).orElse(ex).toString(); List<Erro> erros = Arrays.asList(new Erro(mensagemUsuario, mensagemDesenvolvedor)); return handleExceptionInternal(ex, erros, headers, HttpStatus.BAD_REQUEST, request); } @Override protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { List<Erro> erros = criarListaDeErros(ex.getBindingResult()); return handleExceptionInternal(ex, erros, headers, HttpStatus.BAD_REQUEST, request); } @ExceptionHandler({EmptyResultDataAccessException.class}) public ResponseEntity<Object> handleEmptyResultDataAccessException(EmptyResultDataAccessException ex, WebRequest request) { String mensagemUsuario = messageSource.getMessage("recurso.nao-encontrado", null, LocaleContextHolder.getLocale()); String mensagemDesenvolvedor = ex.toString(); List<Erro> erros = Arrays.asList(new Erro(mensagemUsuario, mensagemDesenvolvedor)); return handleExceptionInternal(ex, erros, new HttpHeaders(), HttpStatus.NOT_FOUND, request); } @ExceptionHandler({DataIntegrityViolationException.class}) public ResponseEntity<Object> handleDataIntegrityViolationException(DataIntegrityViolationException ex, WebRequest request){ String mensagemUsuario = messageSource.getMessage("recurso.operacao-nao-permitida", null, LocaleContextHolder.getLocale()); String mensagemDesenvolvedor = ExceptionUtils.getRootCauseMessage(ex); List<Erro> erros = Arrays.asList(new Erro(mensagemUsuario, mensagemDesenvolvedor)); return handleExceptionInternal(ex, erros, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); } private List<Erro> criarListaDeErros(BindingResult bindingResult) { List<Erro> erros = new ArrayList<>(); for (FieldError fieldError : bindingResult.getFieldErrors()) { String mensagemUsuario = messageSource.getMessage(fieldError, LocaleContextHolder.getLocale()); String mensagemDesenvolvedor = fieldError.toString(); erros.add(new Erro(mensagemUsuario, mensagemDesenvolvedor)); } return erros; } @Getter public static class Erro { private String mensagemUsuario; private String mensagemDesenvolvedor; public Erro(String mensagemUsuario, String mensagemDesenvolvedor) { this.mensagemUsuario = mensagemUsuario; this.mensagemDesenvolvedor = mensagemDesenvolvedor; } } }
[ "ailtonatn@gmail.com" ]
ailtonatn@gmail.com
698bc100f1040ba8881ae0ad6c6c4772fdb6840c
3b6667a49de087d3d1dc9d443c1ebaf19e9fc3b8
/src/main/java/com/company/javatest/model/dto/HolidayDto.java
49d9a81c23e4efde81682a8642c47bcb7c35ad7c
[]
no_license
inF1ames/javatest
1bedf8cea72c394f1d68f362c9ba5382a6845e38
f26c28cc156d85f29fa2fad259ae870bf1d15a19
refs/heads/master
2021-08-31T02:13:05.643581
2017-12-20T06:33:02
2017-12-20T06:33:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,784
java
package com.company.javatest.model.dto; public class HolidayDto { private Long id; private String name; private Integer day; private Integer month; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getDay() { return day; } public void setDay(Integer day) { this.day = day; } public Integer getMonth() { return month; } public void setMonth(Integer month) { this.month = month; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HolidayDto that = (HolidayDto) o; if (id != null ? !id.equals(that.id) : that.id != null) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false; if (day != null ? !day.equals(that.day) : that.day != null) return false; return month != null ? month.equals(that.month) : that.month == null; } @Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (day != null ? day.hashCode() : 0); result = 31 * result + (month != null ? month.hashCode() : 0); return result; } @Override public String toString() { return "HolidayDto{" + "id=" + id + ", name='" + name + '\'' + ", day=" + day + ", month=" + month + '}'; } }
[ "inFlames.dp@gmail.com" ]
inFlames.dp@gmail.com
a7ff405ac8ea8af3d73cc3425224b8076dfcac0e
c95b26c2f7dd77f5e30e2d1cd1a45bc1d936c615
/azureus-core/src/main/java/org/gudy/azureus2/core3/tracker/protocol/udp/PRUDPPacketReplyScrape.java
9ef7f122ebaa8e183f5b9ff54d5be956dfb42541
[]
no_license
ostigter/testproject3
b918764f5c7d4c10d3846411bd9270ca5ba2f4f2
2d2336ef19631148c83636c3e373f874b000a2bf
refs/heads/master
2023-07-27T08:35:59.212278
2023-02-22T09:10:45
2023-02-22T09:10:45
41,742,046
2
1
null
2023-07-07T22:07:12
2015-09-01T14:02:08
Java
UTF-8
Java
false
false
3,460
java
/* * File : PRUDPPacketReplyScrape.java * Created : 21-Jan-2004 * By : parg * * Azureus - a Java Bittorrent client * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 ( see the LICENSE file ). * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.gudy.azureus2.core3.tracker.protocol.udp; /** * @author parg * */ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import com.aelitis.net.udp.uc.PRUDPPacketReply; public class PRUDPPacketReplyScrape extends PRUDPPacketReply { // protected int interval; protected static final int BYTES_PER_ENTRY = 32; protected byte[][] hashes; protected int[] complete; protected int[] incomplete; protected int[] downloaded; public PRUDPPacketReplyScrape(int trans_id) { super(PRUDPPacketTracker.ACT_REPLY_SCRAPE, trans_id); } protected PRUDPPacketReplyScrape(DataInputStream is, int trans_id) throws IOException { super(PRUDPPacketTracker.ACT_REPLY_SCRAPE, trans_id); // interval = is.readInt(); hashes = new byte[is.available() / BYTES_PER_ENTRY][]; complete = new int[hashes.length]; incomplete = new int[hashes.length]; downloaded = new int[hashes.length]; for (int i = 0; i < hashes.length; i++) { hashes[i] = new byte[20]; is.read(hashes[i]); complete[i] = is.readInt(); downloaded[i] = is.readInt(); incomplete[i] = is.readInt(); } } /* * public void setInterval( int value ) { interval = value; } public int getInterval() { return( interval ); } */ public void setDetails(byte[][] _hashes, int[] _complete, int[] _downloaded, int[] _incomplete) { hashes = _hashes; complete = _complete; downloaded = _downloaded; incomplete = _incomplete; } public byte[][] getHashes() { return (hashes); } public int[] getComplete() { return (complete); } public int[] getDownloaded() { return (downloaded); } public int[] getIncomplete() { return (incomplete); } public void serialise(DataOutputStream os) throws IOException { super.serialise(os); // os.writeInt( interval ); if (hashes != null) { for (int i = 0; i < hashes.length; i++) { os.write(hashes[i]); os.writeInt(complete[i]); os.writeInt(downloaded[i]); os.writeInt(incomplete[i]); } } } public String getString() { return (super.getString().concat("[hashes=").concat(String.valueOf(hashes.length)).concat("]")); // return( super.getString() + "[interval=" + interval + ", hashes=" + hashes.length + "]" ); } }
[ "oscar.stigter@e0aef87a-ea4e-0410-81cd-4b1fdc67522b" ]
oscar.stigter@e0aef87a-ea4e-0410-81cd-4b1fdc67522b
586af2e1fe678df0ebedf2defb4cccf0f4e3b287
81242a2f73c4628140abcc2f35a2e4ae30871695
/src/main/java/kodlamaio/hrms/business/constans/Messages.java
078e3295ebf669a8fbef238eb21284f03f7f530f
[]
no_license
rumeysacelik/hrms
9776f7a2feb69a3c46118c2957fbced8aebff9d2
d1a8fd101742170fb155d82e8f3c83529f85b0e9
refs/heads/master
2023-06-14T21:10:23.859002
2021-07-03T23:33:39
2021-07-03T23:33:39
365,863,514
8
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
package kodlamaio.hrms.business.constans; public class Messages { public static final String requiredFirstName = "Ad bilgisi doldurulmak zorundadır"; public static final String isRegisterSuccessForCandidateMessage = "İş arayan hesabı eklendi , doğrulama kodu gönderildi:"; public static final String isRegisterSuccessForSystemUserMessage = "Admin hesabı eklendi , doğrulama kodu gönderildi:"; public static final String requiredLastName = "SoyAd bilgisi doldurulmak zorundadır"; public static final String requiredBirthDate ="Doğum tarihi doldurulmak zorundadır"; public static final String requiredEmail = "Email bilgisi doldurulmak zorundadır"; public static final String requiredPassword = "Şifre bilgisi doldurulmak zorundadır"; public static final String isRealMail = "Email adresi uyumsuz"; public static final String requiredId = "TcNo boş bırakılamaz"; public static final String alreadyRegisteredMail = "Email zaten kayıtlı"; public static final String alreadyRegisteredId = "TcNo zaten kayıtlı"; public static final String listedCandidates = "İş arayanlar başarıyla listelendi"; }
[ "rmysclk61@icloud.com" ]
rmysclk61@icloud.com
55f116cafb973d5617fd2c966c4d0898b51b4144
f31730d8e865e8bf4d26595bbea7bc09ab8a151e
/test/com/ettp/OracleJDBCConnectionTest.java
08c8b770c0d787cdad1bff97722b49b6f64379aa
[]
no_license
vdnh/rb_util
7963d54a8a12acc4383cd2ae8e268321ba5344d9
e321db7ec24f4b47d4debf2f4476c670758e384c
refs/heads/master
2021-09-02T02:33:08.949244
2017-12-29T19:02:53
2017-12-29T19:02:53
115,747,572
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
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 com.ettp; import java.sql.Connection; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author vdnh */ public class OracleJDBCConnectionTest { public OracleJDBCConnectionTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of getJDBCConnection method, of class OracleJDBCConnection. */ @Test public void testGetJDBCConnection() { System.out.println("getJDBCConnection"); //Connection expResult = null; Connection result = OracleJDBCConnection.getJDBCConnection(); //assertEquals(expResult, result); assertNotNull(result); // TODO review the generated test code and remove the default call to fail. //fail("The test case is a prototype."); } }
[ "vdnh@yahoo.com" ]
vdnh@yahoo.com
3601376773aad2beb35951897b4791371580effb
d7668b7557280958bce57694ba82d2f83be86842
/src/main/java/com/clz/circle/service/EventPraiseService.java
9fdfb052152dc1ac7f17a1e7bb5984590218394b
[]
no_license
danny14159/classes
b57a003ded342307527a80046fb4194c92904491
a5b38e688a67c1ac0a9d3a053694859617b8bcaa
refs/heads/master
2021-01-17T13:01:27.373781
2016-10-30T14:41:53
2016-10-30T14:41:53
57,369,552
0
1
null
null
null
null
UTF-8
Java
false
false
189
java
package com.clz.circle.service; import com.clz.circle.bean.TEventPraise; import com.clz.core.service.BaseService; public interface EventPraiseService extends BaseService<TEventPraise>{ }
[ "lei.deng@newtouch.cn" ]
lei.deng@newtouch.cn
a30f0341446768f88523f0d5125c18802988479b
867c79d8f712eaeb2243e0e3a1f2b88a6763bcec
/L7.3 MS/src/main/java/main/clients/Client.java
d429bc84bd8958ed89159ce484113370f9846c8a
[ "MIT" ]
permissive
A1QA/stepik-java-webserver
d2c19284055a3f2446d6c4f7d217bc1c194fde0a
955dd46dd4142c0dbc6961ccbe0535ff6cba01a8
refs/heads/master
2020-04-11T19:22:36.802940
2018-04-13T22:38:35
2018-04-13T22:38:35
162,031,831
1
0
MIT
2018-12-16T19:04:18
2018-12-16T19:04:18
null
UTF-8
Java
false
false
3,479
java
package main.clients; import frontEnd.FrontEndService; import gameMechanics.GameRules; import main.ThreadSettings; import java.util.Random; /** * Created by esin on 06.12.2014. */ public class Client extends Thread { private static final Random RANDOM = new Random(); private FrontEndService service; private String name; private String password; private String sessionId = ""; private State state = State.Register; public Client(FrontEndService service, String name) { this.service = service; this.name = name; this.password = name; setName(name); // метод класса Thread } @Override public void run() { while (state != State.Finished) { switch (state) { case Register: register(); break; case CheckRegistration: checkRegistration(); break; case Auth: auth(); break; case CheckAuth: checkAuth(); break; case GetScore: getScore(); break; case IncreaseScore: increaseScore(); break; } try { Thread.sleep(ThreadSettings.CLIENT_SLEEP_TIME + RANDOM.nextInt(ThreadSettings.CLIENT_SLEEP_TIME * 10)); } catch (InterruptedException e) { e.printStackTrace(); } } } private void register() { System.out.println(name + " is registering..."); service.register(name, password); state = State.CheckRegistration; } private void checkRegistration() { final boolean registered = service.isRegistered(name); System.out.println(name + " registered: " + registered); if (registered) { state = State.Auth; } } private void auth() { System.out.println(name + " is authenticating..."); sessionId = service.authenticate(name, password); System.out.println(name + " got sessionId: " + sessionId); state = State.CheckAuth; } private void checkAuth() { System.out.println(name + " is checking auth for session " + sessionId); final boolean authenticated = service.isAuthenticated(sessionId); System.out.println(name + " is authenticated: " + authenticated); if (authenticated) { state = State.GetScore; } } private void getScore() { final int score = service.getScore(sessionId); System.out.println(name + " score is " + score); if (score == GameRules.MAX_SCORE || score == GameRules.MIN_SCORE) { System.out.println("==== " + name + " finished with score " + score + " ===="); state = State.Finished; } else { state = State.IncreaseScore; } } private void increaseScore() { final int delta = RANDOM.nextInt(GameRules.MAX_SCORE) - (GameRules.MAX_SCORE / 2); System.out.println(name + " increasing score by " + delta); service.updateScore(sessionId, delta); state = State.GetScore; } private enum State { Register, CheckRegistration, Auth, CheckAuth, GetScore, IncreaseScore, Finished } }
[ "michall-alter@rambler.ru" ]
michall-alter@rambler.ru
f56dc43a1803999ecfd0a8a7d0b2ac1460b341b7
588e0551a666b67ed935ad3b89763cf809254928
/weblib/src/main/java/com/app/weblib/OnSwipeWebviewTouchListener.java
0752d33cd529e2759a2db5079bc1b6e3cff874c8
[]
no_license
rkrot2210/web-lib
9ad03a414772dabbf0ea761219091e6fab66a3a4
e1286627de9d9b57a7596201356a3b21ae14215a
refs/heads/master
2023-04-04T17:23:09.116373
2021-04-18T20:23:11
2021-04-18T20:23:11
359,245,034
0
0
null
null
null
null
UTF-8
Java
false
false
1,968
java
package com.app.weblib; import android.content.Context; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; public class OnSwipeWebviewTouchListener implements View.OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeWebviewTouchListener(Context ctx, TouchListener touchListener) { gestureDetector = new GestureDetector(ctx, new GestureListener(touchListener)); } @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } private final class GestureListener extends GestureDetector.SimpleOnGestureListener { private TouchListener touchListener; GestureListener(TouchListener touchListener) { super(); this.touchListener = touchListener; } @Override public boolean onDown(MotionEvent e) { return false; // THIS does the trick } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { boolean result = false; try { float diffY = e2.getY() - e1.getY(); float diffX = e2.getX() - e1.getX(); if (Math.abs(diffX) > Math.abs(diffY)) { // You can customize these settings, so 30 is an example if (Math.abs(diffX) > 30 && Math.abs(velocityX) > 30) { if (diffX > 0) { touchListener.onSwipeRight(); } else { touchListener.onSwipeLeft(); } result = true; } } else { result = false; } } catch (Exception exception) { exception.printStackTrace(); } return result; } } }
[ "rkrot2210@gmail.com" ]
rkrot2210@gmail.com
ee47a87a232623616c541e3d4d2949d259d5176c
f41bdbc59cb6f1f48d6520a93f517fd44f83f153
/net/minecraft/enchantment/EnchantmentOxygen.java
ae8e0c518e6324438d13a3f01d75853b71a616ae
[ "MIT" ]
permissive
BantorSchwanzVor/plotscanner-leak
f9ec02b2538fe51af94cfc807c7beb3ef158f106
cbf130076159711d939affb4b0343c46c3466107
refs/heads/master
2021-05-20T12:02:47.993998
2020-04-01T21:23:59
2020-04-01T21:23:59
252,285,321
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
package net.minecraft.enchantment; import net.minecraft.inventory.EntityEquipmentSlot; public class EnchantmentOxygen extends Enchantment { public EnchantmentOxygen(Enchantment.Rarity rarityIn, EntityEquipmentSlot... slots) { super(rarityIn, EnumEnchantmentType.ARMOR_HEAD, slots); setName("oxygen"); } public int getMinEnchantability(int enchantmentLevel) { return 10 * enchantmentLevel; } public int getMaxEnchantability(int enchantmentLevel) { return getMinEnchantability(enchantmentLevel) + 30; } public int getMaxLevel() { return 3; } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\enchantment\EnchantmentOxygen.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
[ "germangamera@gmail.com" ]
germangamera@gmail.com
cfeb31aac2f417ef11a7fd8930f1838c811e9e96
79c8e1b919c26cb916d4333f6b983588fba22287
/SE/src/main/java/com/project/SE/libraryManagement/service/LibraryServiceRequestBook.java
ffe9004ce14ce17a0226e782ccc09e564009da42
[]
no_license
viral789/Project
e2b49a74e164cac1b26ccf60c5ffcaf94fc14bc1
74763238a58eeb00e8ce40a8025ac4c7ab68df98
refs/heads/master
2021-01-23T06:55:31.935515
2018-06-18T23:04:52
2018-06-18T23:04:52
80,493,719
0
2
null
null
null
null
UTF-8
Java
false
false
3,469
java
package com.project.SE.libraryManagement.service; import java.sql.Statement; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.project.SE.libraryManagement.model.DBUtility; import com.project.SE.libraryManagement.pojo.LibraryRequestBook; public class LibraryServiceRequestBook { private Connection connection; /** * Get Database connection */ public LibraryServiceRequestBook(){ connection = DBUtility.getConnection(); } /** * Add Requested book into bookRequest table using insert command * @param request */ public void addbookRequest(LibraryRequestBook request){ try{ String query = "Insert into bookRequest (studentName, studentEmail, bookName, bookIsbn) values(?,?,?,?)"; PreparedStatement statement = connection.prepareStatement(query); statement.setString(1, request.getStudentName()); statement.setString(2, request.getStudentEmail()); statement.setString(3, request.getBookName()); statement.setString(4, request.getBookIsbn()); statement.executeUpdate(); }catch(SQLException e){ e.printStackTrace(); } } /** * Search requested book based on emailID * @param emailId * @return Object */ public LibraryRequestBook getRequestByEmailId(String emailId) { LibraryRequestBook request = new LibraryRequestBook(); try { String query = "select * from bookRequest where studentEmail = ?"; PreparedStatement preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, emailId); ResultSet resultSet = preparedStatement.executeQuery(); if (resultSet != null) { while (resultSet.next()) { request.setStudentName(resultSet.getString("studentName")); request.setStudentEmail(resultSet.getString("studentEmail")); request.setBookName(resultSet.getString("bookName")); request.setBookIsbn(resultSet.getString("bookIsbn")); } } } catch (SQLException e) { e.printStackTrace(); } return request; } /** * Select all the Requested book of all the students * @return List of Object */ public List<LibraryRequestBook> getAllstudentBookRequest(){ List<LibraryRequestBook> libraryRequestBooks = new ArrayList<LibraryRequestBook>(); try{ Statement statement = connection.createStatement(); String query = "select * from bookRequest"; ResultSet rs = statement.executeQuery(query); while(rs.next()){ LibraryRequestBook request = new LibraryRequestBook(); request.setStudentName(rs.getString("studentName")); request.setStudentEmail(rs.getString("studentEmail")); request.setBookName(rs.getString("bookName")); request.setBookIsbn(rs.getString("bookIsbn")); libraryRequestBooks.add(request); } }catch(SQLException e){ e.printStackTrace(); }; return libraryRequestBooks; } /** * Delete request based on emailId and ISBN from bookRequest once book is accepted or rejected * @param email * @param ISBN */ public void deleteRequest(String email, String ISBN){ try { String query = "delete from bookRequest where studentEmail = ? and bookIsbn = ?"; PreparedStatement preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, email); preparedStatement.setString(2, ISBN); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } }
[ "bhojaniviral92@gmail.com" ]
bhojaniviral92@gmail.com
8d25a4a21e58c23404b8bbc808ae0827ffd42f6e
4bc4745e0aae484a50289d9535cf0eb86d9c7003
/src/test/java/ru/vershinin/controller/StartControllerTest.java
c5b975479458d95c132f7e29d49ad6c255920173
[]
no_license
pitver/camunda
02579055bf53cb023dae1da73cacfb1650456234
00557965518f940bf486d2ea96fc15b463f7b861
refs/heads/master
2023-07-01T00:30:06.416254
2021-07-30T09:50:09
2021-07-30T09:50:09
391,014,221
0
0
null
null
null
null
UTF-8
Java
false
false
2,181
java
package ru.vershinin.controller; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import ru.vershinin.model.NewUser; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.hamcrest.Matchers.containsString; import static org.springframework.test.web.client.match.MockRestRequestMatchers.jsonPath; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest @AutoConfigureMockMvc @TestPropertySource("/application-test.yaml") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @ActiveProfiles("test") public class StartControllerTest { @Autowired private ObjectMapper objectMapper; @Autowired public MockMvc mockMvc; @Autowired private StartController startController; @Test public void test() throws Exception { assertThat(startController).isNotNull(); } /** * запуск процесса * * @throws Exception */ @Order(1) @Test public void testStartProcess() throws Exception { this.mockMvc.perform(post("/rest/startprocess") .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isCreated()) .andExpect(MockMvcResultMatchers.jsonPath("$.businessKey").exists()) .andDo(print()); } }
[ "pitver2014@yandex.ru" ]
pitver2014@yandex.ru
3d38187fa7236cac88bb4e8cd8d4588a98539714
91aee3cd3e30402e344615273efb03ea059021f1
/src/test/java/com/brodzik/adrian/simplefilesynchronizer/concurrent/BackgroundSynchronizerTest.java
43a648b8c83d6e62f822cf005846fd2a334d72bb
[ "MIT" ]
permissive
brodzik/simple-file-synchronizer
fff715519bfa912a4135514d0853553945b08a34
5dd1262f9a3dd853b46b889883131b158f72e13b
refs/heads/master
2020-12-03T18:03:01.265866
2020-01-14T00:38:09
2020-01-14T00:38:09
231,421,186
0
0
null
null
null
null
UTF-8
Java
false
false
3,122
java
package com.brodzik.adrian.simplefilesynchronizer.concurrent; import com.brodzik.adrian.simplefilesynchronizer.data.Entry; import com.brodzik.adrian.simplefilesynchronizer.data.SyncDirection; import com.brodzik.adrian.simplefilesynchronizer.handler.EntryHandler; import com.brodzik.adrian.simplefilesynchronizer.handler.SyncHandler; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.io.FileWriter; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Date; class BackgroundSynchronizerTest { @Test void testEmptyRun() throws InterruptedException { EntryHandler.INSTANCE.getEntries().forEach(EntryHandler.INSTANCE::remove); BackgroundSynchronizer backgroundSynchronizer = new BackgroundSynchronizer(); Thread thread = new Thread(backgroundSynchronizer); thread.start(); Thread.sleep(1000); backgroundSynchronizer.stop(); thread.join(); } @Test void testRun() throws Exception { EntryHandler.INSTANCE.getEntries().forEach(EntryHandler.INSTANCE::remove); Path pathA = Files.createTempDirectory("a"); Path pathB = Files.createTempDirectory("b"); { FileWriter writer = new FileWriter(Paths.get(pathA.toString(), "test1.txt").toFile()); writer.write("test 1"); writer.close(); } { FileWriter writer = new FileWriter(Paths.get(pathB.toString(), "test2.txt").toFile()); writer.write("test 2"); writer.close(); } EntryHandler.INSTANCE.add(new Entry(0, "", pathA.toString(), pathB.toString(), SyncDirection.BIDIRECTIONAL, 5, true, new Date(0))); BackgroundSynchronizer backgroundSynchronizer = new BackgroundSynchronizer(); Thread thread = new Thread(backgroundSynchronizer); thread.start(); Thread.sleep(1000); backgroundSynchronizer.stop(); thread.join(); Assertions.assertTrue(Files.isRegularFile(Paths.get(pathA.toString(), "test1.txt"))); Assertions.assertTrue(Files.isRegularFile(Paths.get(pathA.toString(), "test2.txt"))); Assertions.assertTrue(Files.isRegularFile(Paths.get(pathB.toString(), "test1.txt"))); Assertions.assertTrue(Files.isRegularFile(Paths.get(pathB.toString(), "test2.txt"))); FileUtils.forceDelete(Paths.get(pathA.toString(), "test1.txt").toFile()); FileUtils.forceDelete(Paths.get(pathA.toString(), "test2.txt").toFile()); SyncHandler.INSTANCE.syncAll(); Assertions.assertFalse(Files.isRegularFile(Paths.get(pathA.toString(), "test1.txt"))); Assertions.assertFalse(Files.isRegularFile(Paths.get(pathA.toString(), "test2.txt"))); Assertions.assertFalse(Files.isRegularFile(Paths.get(pathB.toString(), "test1.txt"))); Assertions.assertFalse(Files.isRegularFile(Paths.get(pathB.toString(), "test2.txt"))); FileUtils.deleteDirectory(pathA.toFile()); FileUtils.deleteDirectory(pathB.toFile()); } }
[ "adrianbrodzyk@gmail.com" ]
adrianbrodzyk@gmail.com
c6dca7e21f5f357815bac61d484d7dd350ad185a
55505276af65ba74416ef032d4f6b2427a79627d
/src/main/java/co/edu/usbcali/demo/service/PaymentMethodService.java
0808c650a08cb81a23e97f9e990d9b2c964ed958
[]
no_license
Jcss1462/demo-rest
3edec2382e662a3594b9dfeacf8e2306a302524e
e2704fb4c4babb67a760e382d811cb47947205e1
refs/heads/master
2023-01-28T18:33:50.806030
2020-12-07T03:30:41
2020-12-07T03:30:41
292,022,230
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package co.edu.usbcali.demo.service; import java.util.List; import co.edu.usbcali.demo.domain.PaymentMethod; public interface PaymentMethodService extends GenericService<PaymentMethod, Integer> { public List<PaymentMethod> findByEnable(); }
[ "jcss1462@gmail.com" ]
jcss1462@gmail.com
202ed59a755153c4ece0bc7ef13fb9ea249ccede
305b65de7e4946f6727e53be05dad2d5ab4489c3
/src/com/bils/code/templatemethodpattern/GoMart.java
54b24abfde4947745db2954742a0f2d15f37d039
[]
no_license
PlumpMath/DesignPattern-161
962c2fa75e2962ef369ee722a24f1991bbe91c6b
8811e16569239574ef88372ca9b082abfc4a22ab
refs/heads/master
2021-01-20T09:36:34.245990
2016-04-21T10:09:08
2016-04-21T10:09:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package com.bils.code.templatemethodpattern; /** * Created by nabilla on 3/4/16. */ public class GoMart extends Gojek { public GoMart() { pay = new PayCash(); } @Override public void orderGojek() { System.out .println("You ordered some stuffs from our market and success added stuffs to cart"); } @Override public void deliveredToCustomer() { System.out.println("Your stuffs is coming and arrive to your location"); } }
[ "nabilla@icehousecorp.com" ]
nabilla@icehousecorp.com
751a0b43e830ac422005605d5580295fd91a8c91
560b9284928614fc1108ffc751a0cd87e36f69d6
/JavaCore/src/main/java/edu/gqq/design/vending/Item.java
3e00e2cd9067cd37601855f9f15690f0ace60b4f
[ "Apache-2.0" ]
permissive
jilianggqq/mavenNewTec
031f89d7dad5dca7012f7040e9fb56714f50c758
4ef3d5dc39886a20010ccc794e6d26134669f129
refs/heads/develop
2022-08-10T06:22:45.370477
2019-07-18T00:42:08
2019-07-18T00:42:08
30,721,231
2
3
null
2022-07-07T22:10:20
2015-02-12T20:08:07
Java
UTF-8
Java
false
false
403
java
package edu.gqq.design.vending; /** * You must know how to implement an enum. * @author gqq * */ public enum Item { Coke("Coke", 25), Pepsi("Pepsi", 35), Soda("Soda", 45); private String desc; private int price; Item(String desc, int price) { this.desc = desc; this.price = price; } public String getDesc() { return this.desc; } public int getPrice() { return this.price; } }
[ "gqq_w541_ubuntu@itu.edu" ]
gqq_w541_ubuntu@itu.edu
417b1ccf6dc89107eac0808693171cebb0fe4c48
3e7d482a2558ff400cb3e917feb3decc05713a26
/app/src/main/java/com/kgy/project_0518/HelpActivity.java
eeacfd545d8cc6ea1a7e11294963d5652548d66f
[]
no_license
rp119/ToeicApp
5230272979282de6af86033370b7a8c3df051759
87532af2d90783b460ee41aa51179000cebc838b
refs/heads/master
2022-12-15T23:47:58.117718
2020-09-04T07:22:40
2020-09-04T07:22:40
292,778,552
0
0
null
null
null
null
UTF-8
Java
false
false
1,806
java
package com.kgy.project_0518; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; public class HelpActivity extends AppCompatActivity { private RelativeLayout mlayoutColor; ImageView helpimg = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.helpactivity); mlayoutColor = (RelativeLayout)findViewById(R.id.layout); helpimg = (ImageView)findViewById(R.id.helpimg); final Button nextbtn = (Button)findViewById(R.id.NextBtn); nextbtn.setOnClickListener(new View.OnClickListener() { int count = 0; @Override public void onClick(View view) { if (count == 0) { mlayoutColor.setBackgroundResource(R.color.helpimg2); helpimg.setImageResource(R.drawable.helpimg2); nextbtn.setBackgroundResource(R.color.help_background2); count++; } else if(count==1){ mlayoutColor.setBackgroundResource(R.color.helpimg3); helpimg.setImageResource(R.drawable.helpimg3); nextbtn.setBackgroundResource(R.color.help_background3); count++; nextbtn.setText("START"); } else if(count==2){ Intent intent = new Intent(getApplicationContext(),MainActivity.class); startActivity(intent); } } }); } }
[ "51767601+rp119@users.noreply.github.com" ]
51767601+rp119@users.noreply.github.com
5345d1ba11598da0435002c718eb6743f3bbc34d
c2ea1be719b7bbb13ff3776389dc0a9a7767edfb
/src/main/java/com/fawnanddoug/soccerschedule/domain/Team.java
5461a4a3b7995fe69fdeffc242e44691a28d98fe
[]
no_license
dhaber/SoccerSchedule
071d871147421aa4850e9452b377c7e7858da9c5
70c36fc58311a3f405227c21d18925068fbfa18b
refs/heads/master
2021-01-10T12:01:41.936966
2016-03-15T16:44:44
2016-03-15T16:44:44
51,968,155
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.fawnanddoug.soccerschedule.domain; import org.apache.commons.lang.builder.ToStringBuilder; import org.codehaus.jackson.map.ObjectMapper; public class Team { private String name; private String record; private String logoUrl; public Team(String name, String record, String logoUrl) { super(); this.name = name; this.record = record; this.logoUrl = logoUrl; } public String getName() { return name; } public String getRecord() { return record; } public String getLogoUrl() { return logoUrl; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } }
[ "doug@fawnanddoug.com" ]
doug@fawnanddoug.com
8e3d1c84e72fb5f88171a53e9c981ae877b8e2b1
16134ec2c1d5c390641334d69cc3ba0432b104b2
/src/_2infrastracturepattern/_1adaptor/_1classadaptor/Source.java
f2a4082a96f2dd16be1d1ac9b077fef1f7b012cc
[]
no_license
liming84525/shejimoshi
fd108b02a686ef4acb52febbd7174dd158eec15c
c854107888cd19213456e04a587b484351b4d925
refs/heads/master
2021-01-17T20:15:32.291989
2016-06-15T11:37:18
2016-06-15T11:37:18
61,203,133
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package _2infrastracturepattern._1adaptor._1classadaptor; /** * Created by lm on 16-6-14. */ public class Source { public void m1() { System.out.println("this is origin"); } }
[ "liming84525@163.com" ]
liming84525@163.com
cd9462102602e33b899a2f653baa3076ec8ce02a
78f979d3157ec834fb980e18fe4042ff6263bb04
/src/main/java/de/gravitex/trainmaster/dto/test/GreetingDTO.java
a9c38e38294eca016eb6d4006ed82de2a9b738d4
[]
no_license
gheddie/TrainMasterServer
f6f92bbc6fa501fe92934070d2a408e06a8e7a41
b370eeee5355ce37d821bbef1fcb7161a1cf0ae9
refs/heads/master
2020-09-15T13:41:47.212561
2019-12-09T17:43:41
2019-12-09T17:43:41
223,463,398
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package de.gravitex.trainmaster.dto.test; import de.gravitex.trainmaster.dto.ServerDTO; public class GreetingDTO implements ServerDTO { private final long id; private final String content; public GreetingDTO(long id, String content) { this.id = id; this.content = content; } public long getId() { return id; } public String getContent() { return content; } }
[ "Sts@YellowMeerkat.sternico.local" ]
Sts@YellowMeerkat.sternico.local
17b5aadef5e5cac99005e33cf12829a446b1d414
635bae4e7196e87da1243386ed96a42154371d09
/src/Ovning2/Triangle.java
63cf5be594485272b73eb3d79dd6bcdfd1bf5df4
[]
no_license
Oltapens/Programmerings-Uppgifter
c1616683694f94ae654a719cd27fc8035c26d199
e543f96c6ad64ef359557b472fabd2001fabb302
refs/heads/master
2022-01-04T05:53:14.974634
2014-01-07T12:08:15
2014-01-07T12:08:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,166
java
package Ovning2; public class Triangle { public static boolean berakna(double a, double b, double c) { boolean calcklar = true; double sinab = 0; double sinbc = 0; double sinca = 0; if(a+b>c && b+c>a && a+c>b) { if(a<b) { sinab = Math.toDegrees(Math.asin(a/b)); } else if(a>b) { sinab = Math.toDegrees(Math.asin(b/a)); } if(b<c) { sinbc = Math.toDegrees(Math.asin(b/c)); } else if(b>c) { sinbc = Math.toDegrees(Math.asin(c/b)); } if(a<c) { sinca = Math.toDegrees(Math.asin(a/c)); } else if(a>c) { sinca = Math.toDegrees(Math.asin(c/a)); } if(sinbc != 0 && sinca !=0 && sinab !=0) { if(sinbc >= 120 && sinca >= 120 && sinab >=120) { calcklar = false; return calcklar; } else { calcklar = true; } } else { calcklar = false; return calcklar; } } else { calcklar = false; return calcklar; } return calcklar; } public static double sp(double a, double b, double c) { double rv = 0.5D * (a + b + c); return rv; } public static double area(double a, double b, double c) { double rv = sp(a, b, c) * (sp(a, b, c) - a) * (sp(a, b, c) - b) * (sp(a, b, c) - c); rv = Math.sqrt(rv); return rv; } public static double incircle_radius(double a, double b, double c) { double sp = sp(a, b, c); double radius = (sp - a) * (sp - b) * (sp - c) / sp; radius = Math.sqrt(radius); return radius; } public static double incircle_area(double a, double b, double c) { double rv = incircle_radius(a, b, c) * incircle_radius(a, b, c) * Math.PI; return rv; } public static double circumcircle_radius(double a, double b, double c) { double diameter = a* b * c / (2.0D * area(a, b, c)); double radius = diameter / 2.0D; return radius; } public static double circumcircle_area(double a, double b, double c) { double rv = circumcircle_radius(a, b, c) * circumcircle_radius(a, b, c) * Math.PI; return rv; } }
[ "owlivee@gmail.com" ]
owlivee@gmail.com
c97a485408fc2bc8dae2e72a8021463c91611f4e
6e1bf4ef942b22f0a9c376875cccaf7f28868ee5
/src/com/server/dao/mapper/LargecuspriceMapper.java
dd758c265d6d2abf1d7446402a8b3f395d09bb19
[]
no_license
jzxyouok/guli
cf408844b88840f4373953920c6832c507ec321c
892ac9405a1a8530b22266471c6e7944e7f1cd53
refs/heads/master
2021-04-15T09:19:31.412118
2016-06-08T01:28:07
2016-06-08T01:28:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.server.dao.mapper; import com.server.pojo.entity.Largecusprice; public interface LargecuspriceMapper { /** * 根据主键删除 */ int deleteByPrimaryKey(String largecuspriceid); /** * 选择性添加 */ int insertSelective(Largecusprice record); /** * 根据主键选择性修改 */ int updateByPrimaryKeySelective(Largecusprice record); }
[ "xvhandong@sina.com" ]
xvhandong@sina.com
814712c8fc59f730caef11951818ff58b203cdfc
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project48/src/main/java/org/gradle/test/performance/largejavamultiproject/project48/p243/Production4870.java
b332de5fa8df6258c5549d8b687d4d31bec74fb3
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,887
java
package org.gradle.test.performance.largejavamultiproject.project48.p243; public class Production4870 { private String property0; public String getProperty0() { return property0; } public void setProperty0(String value) { property0 = value; } private String property1; public String getProperty1() { return property1; } public void setProperty1(String value) { property1 = value; } private String property2; public String getProperty2() { return property2; } public void setProperty2(String value) { property2 = value; } private String property3; public String getProperty3() { return property3; } public void setProperty3(String value) { property3 = value; } private String property4; public String getProperty4() { return property4; } public void setProperty4(String value) { property4 = value; } private String property5; public String getProperty5() { return property5; } public void setProperty5(String value) { property5 = value; } private String property6; public String getProperty6() { return property6; } public void setProperty6(String value) { property6 = value; } private String property7; public String getProperty7() { return property7; } public void setProperty7(String value) { property7 = value; } private String property8; public String getProperty8() { return property8; } public void setProperty8(String value) { property8 = value; } private String property9; public String getProperty9() { return property9; } public void setProperty9(String value) { property9 = value; } }
[ "sterling.greene@gmail.com" ]
sterling.greene@gmail.com
64109d75337518937a676195fe20b1ce44caea8c
9a068491e8b98b4e9cd78fbfb962d70f6067e42d
/src/main/java/com/zdp/study/behavioral/visitor/CommanderVisitor.java
05b6b95e3acacfcab3a2235eabdb37c58058e37a
[]
no_license
xianghuangzdp/design-pattern
0361c0d36ca24ad81a63046ee924e6dea05fe86b
abeb78998a33c9c3ff651be20f7a1cd40986515d
refs/heads/main
2023-05-31T10:30:54.775832
2021-06-30T20:12:07
2021-06-30T20:12:07
338,602,775
1
0
null
null
null
null
UTF-8
Java
false
false
463
java
package com.zdp.study.behavioral.visitor; /** * @author zdp * @date 2021/6/29 * @desc 指挥官访问者 */ public class CommanderVisitor implements UnitVisitor { @Override public void visitSoldier(Soldier soldier) { } @Override public void visitSergeant(Sergeant sergeant) { } @Override public void visitCommander(Commander commander) { System.out.println(String.format("Good to see you %s",commander)); } }
[ "zdp_main@163.com" ]
zdp_main@163.com
ddfd6687a4e79b336b6918ea468bac27deaed261
6ddf14e66abcc9a00233176aed8eb0ae0d97adcf
/src/tiy/pink/cocoSolver.java
0f9eb9df122009e9e774750fc9a8ad3aaaf7e72d
[]
no_license
yehia830/day13
dd583e73434f047f5e5eac283bd42f61a6b07071
c68004e2863b368efa45014bbe98f1f5d8987941
refs/heads/master
2020-12-25T15:08:52.544081
2016-08-25T04:27:38
2016-08-25T04:27:38
66,524,650
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
package tiy.pink; /** * Created by Yehia830 on 8/24/16. */ public class cocoSolver { public int makeChocolate(int small, int big, int chocGoal) { if(chocGoal<5&&small>=chocGoal) { return chocGoal; } if(chocGoal<5&&small<chocGoal) { return -1; } if(chocGoal>=5) { if(5 * big > chocGoal) { int flag = chocGoal/5; if(chocGoal - flag * 5 <= small) { return chocGoal-flag*5; } if(chocGoal - flag * 5 > small) { return -1; } } if(5*big<chocGoal) { if(small <(chocGoal -5 * big)) { return -1; } if(small>=(chocGoal-5*big)) { return chocGoal-5*big; } } } return 0; } }
[ "Yehia830@Yehias-MacBook-Air.local" ]
Yehia830@Yehias-MacBook-Air.local
47b83e4323159034c0f91e5202d9d5870020e2de
91b779a6c157af42f36d4d7ba6e06952ca77addd
/src/comdis_4/classes/Request.java
19495685dbef6ace2bd144d0f09a47ab53e95480
[]
no_license
aculledor/ComDis_4
05029b84bb65978a93c68d5ce707cf8c35326d9e
becdec9964101065c11378c163867786af9ca26e
refs/heads/master
2023-04-14T10:00:37.525725
2021-04-29T21:00:03
2021-04-29T21:00:03
351,415,932
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
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 comdis_4.classes; import java.io.Serializable; /** * * @author aculledor */ public class Request implements Serializable { private String source; private String destination; public Request() { } public Request(String source, String destination) { this.source = source; this.destination = destination; } public String getDestination() { return destination; } public String getSource() { return source; } public void setDestination(String destination) { this.destination = destination; } public void setSource(String source) { this.source = source; } @Override public String toString() { return "Origen: "+source+"; Destino: "+destination; } @Override public int hashCode() { return super.hashCode(); //To change body of generated methods, choose Tools | Templates. } }
[ "abraham.cocodin@gmail.com" ]
abraham.cocodin@gmail.com
9b897b88e4d8fc2c195fea9ee30e72b8b6c39b5a
1d6ea99135804dde4ad2aa330eb12adde3d6d463
/app/src/main/java/com/makeryan/lib/photopicker/fragment/PhotoPickerFragment.java
3fcf79571ffc686212776ab5065ba34b32dfc12f
[]
no_license
554889309/Fragment_Framework
7d89393aac5dfbeaec4a94355aee8b80347af6ee
577c3a8de2498aceff47c18ad2d3260f82282a87
refs/heads/dev
2021-03-12T18:29:46.368846
2017-05-16T07:19:14
2017-05-16T07:19:14
91,452,654
1
0
null
2017-05-16T11:53:14
2017-05-16T11:53:14
null
UTF-8
Java
false
false
2,824
java
package com.makeryan.lib.photopicker.fragment; import android.databinding.ViewDataBinding; import android.os.Bundle; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.ViewGroup; import com.makeryan.lib.R; import com.makeryan.lib.databinding.FragmentPhotoPickerBinding; import com.makeryan.lib.fragment.BaseFragment; import com.makeryan.lib.mvp.presenter.BasePresenter; import com.makeryan.lib.photopicker.mvp.presenter.PhotoPickerPresenter; import java.util.ArrayList; import static android.speech.RecognizerIntent.EXTRA_ORIGIN; import static com.makeryan.lib.photopicker.PhotoPicker.EXTRA_GRID_COLUMN; import static com.makeryan.lib.photopicker.PhotoPicker.EXTRA_MAX_COUNT; import static com.makeryan.lib.photopicker.PhotoPicker.EXTRA_PREVIEW_ENABLED; import static com.makeryan.lib.photopicker.PhotoPicker.EXTRA_SHOW_CAMERA; import static com.makeryan.lib.photopicker.PhotoPicker.EXTRA_SHOW_GIF; /** * Created by donglua on 15/5/31. */ public class PhotoPickerFragment extends BaseFragment { //目录弹出框的一次最多显示的目录数目 public static int COUNT_MAX = 4; protected FragmentPhotoPickerBinding mBinding; protected PhotoPickerPresenter mPresenter; public static PhotoPickerFragment newInstance(boolean showCamera, boolean showGif, boolean previewEnable, int column, int maxCount, ArrayList<String> originalPhotos) { Bundle args = new Bundle(); args.putBoolean( EXTRA_SHOW_CAMERA, showCamera ); args.putBoolean( EXTRA_SHOW_GIF, showGif ); args.putBoolean( EXTRA_PREVIEW_ENABLED, previewEnable ); args.putInt( EXTRA_GRID_COLUMN, column ); args.putInt( EXTRA_MAX_COUNT, maxCount ); args.putStringArrayList( EXTRA_ORIGIN, originalPhotos ); return newInstance(args); } public static PhotoPickerFragment newInstance(@NonNull Bundle args) { PhotoPickerFragment fragment = new PhotoPickerFragment(); fragment.setArguments(args); return fragment; } /** * @return 初始化并返回当前Presenter */ @Override protected BasePresenter getPresenter() { return mPresenter == null ? mPresenter = new PhotoPickerPresenter(this) : mPresenter; } /** * @return 布局Id */ @Override protected int getLayoutResID() { return R.layout.fragment_photo_picker; } /** * 初始化DataBinding * * @param inflater * @param parent */ @Override protected ViewDataBinding initDataBinding(LayoutInflater inflater, ViewGroup parent) { return mBinding == null ? mBinding = FragmentPhotoPickerBinding.inflate( inflater, parent, false ) : mBinding; } /** * 开始处理 */ @Override protected void doAction() { mPresenter.init(mBinding); } }
[ "light.yan@qq.com" ]
light.yan@qq.com
69b900a65617d96d4dfcc49906234d742c031fa2
a5a743e5c98fd6025abed29ace3f394ef18945d6
/app/src/main/java/com/maxpilotto/esame2015/HOME01.java
6257fcc5d82e2f3ef9250c4fd014e57716c280f7
[]
no_license
maxpilottoITS/esame-2015
8b59fd4a120a1179c67f68681240f325588313ae
c2bf995140643d8bf1ffb652b466bef1ee0b51a7
refs/heads/master
2022-10-28T01:21:35.513270
2020-06-16T11:36:03
2020-06-16T11:36:03
269,335,722
0
0
null
null
null
null
UTF-8
Java
false
false
1,268
java
package com.maxpilotto.esame2015; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import com.maxpilotto.esame2015.persistance.WorkoutProvider; public class HOME01 extends AppCompatActivity { private TextView totalWorkouts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home01); int count = getContentResolver().query(WorkoutProvider.URI_WORKOUTS,null,null,null,null).getCount(); totalWorkouts = findViewById(R.id.totalWorkouts); totalWorkouts.setText(getString(R.string.totalWorkouts,count)); findViewById(R.id.newWorkout).setOnClickListener(v -> { startActivity(new Intent(this,NEW01.class)); }); findViewById(R.id.workoutList).setOnClickListener(v -> { startActivity(new Intent(this,LIST01.class)); }); } @Override protected void onResume() { super.onResume(); int count = getContentResolver().query(WorkoutProvider.URI_WORKOUTS,null,null,null,null).getCount(); totalWorkouts.setText(getString(R.string.totalWorkouts,count)); } }
[ "maxpil99@outlook.com" ]
maxpil99@outlook.com
67456bd5f7b5e0e8ede7dba32282efb785a2a03a
c5b4ff3402372ae13d0236f41296448b07e6c90b
/security-service/src/main/java/com/example/securityservice/security/UserRole.java
bc8a5cd1ef2ce12c6efb72f5c2205d36c843ce0b
[]
no_license
stanislav222/test-spring-cloud
a44b6e552f633fa5f3c9e6c7353c0b7dd178b1ea
393e842f7ec78b58c9041bcf8cd594611bb53abb
refs/heads/main
2023-03-27T17:04:40.506841
2021-03-30T11:50:00
2021-03-30T11:50:00
352,980,760
0
0
null
null
null
null
UTF-8
Java
false
false
94
java
package com.example.securityservice.security; public enum UserRole { USER, ADMIN; }
[ "stanislau.krukouski@it-wk.ru" ]
stanislau.krukouski@it-wk.ru
29eb0fac0bfd08bc081308729e4fa725493f3723
2b3ce6584547caf822c4ac553dab33121e3e9cb2
/src/com/harink/exception/domain/Factorial.java
8d70cd037e0b38f6aabd90919e5cc6d4e58224f9
[]
no_license
HariniBhuvana/Day5
4ed417d434a99bba85f2fa6f5ad9bad14ee0a850
2510ad8bfb1bd9e64193f9d8ef35b021768c81cd
refs/heads/master
2020-03-27T10:49:21.645343
2018-09-03T09:35:38
2018-09-03T09:35:38
146,447,063
0
0
null
null
null
null
UTF-8
Java
false
false
894
java
package com.harink.exception.domain; import com.harink.exception.domain.exception.FactorialException; import com.harink.exception.domain.exception.InvalidInputException; public class Factorial { public Factorial() { super(); // TODO Auto-generated constructor stub } public static int getFactorial(int num) throws InvalidInputException, FactorialException { int result = 0; if (num < 2) { throw new InvalidInputException("Invalid input given"); } result = factorialFunction(num); return result; } private static int factorialFunction(int num) throws FactorialException { int fact = 1; int prevResult; for (int i = 1; i <= num; i++) { prevResult = fact; fact = fact * i; if (fact < prevResult) { throw new FactorialException("Integer range exceeds"); } } return fact; } }
[ "Harink@IN-MUM-LDVM039.corp.capgemini.com" ]
Harink@IN-MUM-LDVM039.corp.capgemini.com
bc13f582fa93d02a1cfc247894f6d58d4d8b2934
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
/src/number_of_direct_superinterfaces/i57075.java
974ad239d0e1b2b665fe5233777062a614cc95bb
[]
no_license
vincentclee/jvm-limits
b72a2f2dcc18caa458f1e77924221d585f23316b
2fd1c26d1f7984ea8163bc103ad14b6d72282281
refs/heads/master
2020-05-18T11:18:41.711400
2014-09-14T04:25:18
2014-09-14T04:25:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
package number_of_direct_superinterfaces; public interface i57075 {}
[ "vincentlee.dolbydigital@yahoo.com" ]
vincentlee.dolbydigital@yahoo.com
4062f0f7164f737a3963916a5a96a9a87a9ffe07
857e06417369b258faeea601ea8e971e9f51e70f
/src/com/io/input.java
d0553172098840d68df952178e865c413ba41ea5
[ "MIT" ]
permissive
lukas783/JavaClient
5ea844d3d7ca2edb4d4fd5617215e7c9b9b2f467
145f7dfbf26dda3f864a898b86da24f6bc244594
refs/heads/master
2021-01-10T07:40:40.151589
2015-11-09T10:16:34
2015-11-09T10:16:34
45,724,152
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
120
java
package com.io; /** * Created by Lukas on 11/2/2015. */ public class input { //TODO: all of it (?°?°??? ??? }
[ "lucas.carpenter@mines.sdsmt.edu" ]
lucas.carpenter@mines.sdsmt.edu
3f7895c1763a6f381a1b8ca2d0bcebe0b806a5f1
9640a4191c6098f0c59dddb5559f690186800687
/src/main/java/org/virutor/chess/ui/model/UiGameListener.java
dd9adc9c18e9bedb1b9f47a232876d0ef5211a50
[]
no_license
vicsyl/chess-tools
73c6f4c42916c59d966cf23971758f1ee1d02aa4
403c1aeb80a2ac4afae1caea3feb380b4813926c
refs/heads/master
2021-01-10T02:10:26.720829
2016-01-16T23:42:59
2016-01-16T23:42:59
49,162,813
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package org.virutor.chess.ui.model; import org.virutor.chess.model.Move; public interface UiGameListener { public enum GameChangeType { MOVE_INDEX, COMPLETE_CHANGE, CONFIG_CHANGE, } void onGenericChange(GameChangeType gameChangeType); void onDoMove(Move move); void onUndoMove(Move move); }
[ "vicsyl@27bf3eb0-c72c-4dfa-b5f9-f7a6064c582b" ]
vicsyl@27bf3eb0-c72c-4dfa-b5f9-f7a6064c582b
183a45515a0530eccf21b74727cd8020263d4cc2
a9d2eb9a5723362b43f1b001662ba5b9f4a19eea
/kodilla-spring/src/test/java/com/kodilla/spring/forum/ForumUserTestSuite.java
b5ac9956af30889e020ccee74b2551d4dad49565
[]
no_license
filipotrebski/filip-otrebski-kodilla-java
2f35c806dc1707709b49a0041fb797f1cb3c1555
b1d893e87f95dd9f85864e9d77906854d219d531
refs/heads/master
2020-03-30T08:20:27.738016
2019-03-12T21:05:49
2019-03-12T21:05:49
151,007,402
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
package com.kodilla.spring.forum; import org.junit.Assert; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class ForumUserTestSuite { @Test public void testGetUserName(){ //Given ApplicationContext context = new AnnotationConfigApplicationContext("com.kodilla.spring"); ForumUser user = context.getBean(ForumUser.class); //When String name = user.getUsername(); //Then Assert.assertEquals("John Smith",name); } }
[ "otrebskifilip@gmail.com" ]
otrebskifilip@gmail.com
7d3144046d40c7839960eacfe77e0ed8268dee7c
fd817ccf578060336efb59f4eaf465b41968dfe3
/server/poleme/xmu/src/main/java/com/xmu/test/controller/LoginController.java
64a9de6cff557f966e57f392b0369c49547d1730
[]
no_license
JerryWang-xmu/poleme
befe33603611fbfa6164fd40f97ab66d316d1045
7d91ace12a82683b2a235c8a27329f99c1e54dcb
refs/heads/master
2023-06-23T17:27:47.863879
2021-07-20T02:01:16
2021-07-20T02:01:16
386,467,794
0
1
null
null
null
null
UTF-8
Java
false
false
1,930
java
package com.xmu.test.controller; import com.alibaba.fastjson.JSON; import com.xmu.test.bean.User; import com.xmu.test.dao.UserDao; import com.xmu.test.util.Hash; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; @RestController public class LoginController { @Autowired UserDao userDao; @CrossOrigin @RequestMapping("/login") public String userLogin(@RequestBody User user) {//RequestBody注解去掉头,取数值部分 int id = 0; //初始化查询id int count = userDao.getUserNumByMassage(user.getUsername(), Hash.sha1(user.getPassword()), user.getRole()); //数据库中符合条件的记录条数 HashMap<String, String> resMap = new HashMap<>(); //创造键值对,向后端返回signal和用户id if (count > 0) { //当数据库中符合前端发回的查询条件的记录大于0条时 id = userDao.getUserByMassage(user.getUsername(), Hash.sha1(user.getPassword())); //必须先做if判断,否则数据库中该内容为空会引发异常 } else { resMap.put("ERROR", "0"); String res = JSON.toJSONString(resMap); return res; //向前端返回键值对 } if (user.getRole().equals("管理员")) { resMap.put("str", "MNOK"); resMap.put("count", id + ""); String res = JSON.toJSONString(resMap); return res; //向前端返回键值对 } resMap.put("str", "USOK"); resMap.put("count", id + ""); String res = JSON.toJSONString(resMap); return res; //向前端返回键值对 } }
[ "1071641947@qq.com" ]
1071641947@qq.com
432569700d917db8c2933b14858b7bd6b74d40dd
d1f69cecf76b1fa83dad2121542fb7b0956bade6
/src/main/java/demomaster/controller/TAnswerController.java
0896d410586c77c2d95847c0a39d43d10a1d46de
[]
no_license
chao313/300-online_questions
bcef86fb65268dc13b54ab1871c398b8c06db53d
432940f21ce47eafa13fd13fa21687a77856796e
refs/heads/master
2023-07-18T10:19:03.234915
2021-09-08T14:01:43
2021-09-08T14:01:43
356,459,423
0
0
null
null
null
null
UTF-8
Java
false
false
13,886
java
package demomaster.controller; import java.util.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import demo.spring.boot.demospringboot.enums.BlackStatus; import demo.spring.boot.demospringboot.framework.Code; import demo.spring.boot.demospringboot.framework.OneToMore; import demo.spring.boot.demospringboot.framework.Response; import demomaster.service.TAnswerSecondService; import demomaster.service.VAnswerSecondUserService; import demomaster.service.VAnswerUserService; import demomaster.vo.TAnswerSecondVo; import demomaster.vo.TAnswerVo; import demomaster.service.TAnswerService; import demomaster.vo.VAnswerSecondUserVo; import demomaster.vo.VAnswerUserVo; import demomaster.vo.request.TAnswerRequestUpdateBase; import demomaster.vo.request.TAnswerRequestUpdatePrimaryKey; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping(value = "/TAnswerController") @Slf4j public class TAnswerController { @Autowired private TAnswerService service; @Autowired private VAnswerUserService vAnswerUserService; @Autowired private VAnswerSecondUserService tAnswerSecondService; /** * 插入一条记录: 请求体是json * * @param vo * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/insert") public Response insert(@RequestBody TAnswerVo vo) { Response response = new Response(); try { Boolean result = service.insert(vo); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 插入多条记录: 请求体是json * * @param vos * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/inserts") public Response insert(@RequestBody List<TAnswerVo> vos) { Response response = new Response(); try { Boolean result = service.insert(vos); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 多条件查询语句,每个字段只要不为null就是查询条件 * * @param query * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/queryBase") public Response queryBase(@RequestBody TAnswerVo query) { Response response = new Response(); try { List<TAnswerVo> result = service.queryBase(query); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 多条件查询语句,每个字段只要不为null就是查询条件 * 这里添加了分页插件,能够返回的数据包含页码,下一页... , 自动查询count * * @param query * @param pageNum 页码 默认值为1 * @param pageSize 每页的size 默认值为10 * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/queryBasePageHelper") public Response queryBasePageHelper(@RequestBody TAnswerVo query, @RequestParam(value = "pageNum", defaultValue = "1", required = false) Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize) { Response response = new Response(); try { PageHelper.startPage(pageNum, pageSize); List<TAnswerVo> result = service.queryBase(query); PageInfo pageInfo = new PageInfo(result); response.setCode(Code.System.OK); response.setContent(pageInfo); log.info("success pageInfo -> {} ", pageInfo); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 多条件更新语句, * source每个字段只要不为null就是更新数据 -> 慎用 * target每个字段只要不为null就是查询条件 -> 慎用 * * @param source * @param target * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/updateBase") public Response updateBase(@RequestBody TAnswerRequestUpdateBase update) { Response response = new Response(); try { Boolean result = service.updateBase(update.getSource(), update.getTarget()); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 多条件更新语句,(包含null) * source每个字段都是更新数据 -> 慎用 * target每个字段只要不为null就是查询条件 -> 慎用 * * @param source * @param target * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/updateBaseIncludeNull") public Response updateBaseIncludeNull(@RequestBody TAnswerRequestUpdateBase update) { Response response = new Response(); try { Boolean result = service.updateBaseIncludeNull(update.getSource(), update.getTarget()); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 多条件查询语句, * 每个字段只要不为null就是查询条件 * * @param vo * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/deleteBase") public Response deleteBase(@RequestBody TAnswerVo vo) { Response response = new Response(); try { Boolean result = service.deleteBase(vo); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 主键查询语句, * 因为是主键 -> 查询返回的是一条记录 * * @param id * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @GetMapping(value = "/queryByPrimaryKey") public Response queryByPrimaryKey(String id) { Response response = new Response(); try { TAnswerVo result = service.queryByPrimaryKey(id); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 主键删除语句, * 因为是主键 -> 删除的是一条记录 * * @param id * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @GetMapping(value = "/deleteByPrimaryKey") public Response deleteByPrimaryKey(String id) { Response response = new Response(); try { Boolean result = service.deleteByPrimaryKey(id); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 根据PrimaryKey更新,会根据主键去更新其他的值(空值不覆盖有值) * * @param update.source 只包含非主键的字段 * @param update.target 只包含主键的字段 * @param id * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/updateByPrimaryKey") public Response updateByPrimaryKey(@RequestBody TAnswerRequestUpdatePrimaryKey update) { Response response = new Response(); try { Boolean result = service.updateByPrimaryKey(update.getSource(), update.getTarget()); response.setCode(Code.System.OK); response.setContent(result); log.info("success result -> {} ", result); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } /** * 多条件查询语句,每个字段只要不为null就是查询条件 * 这里添加了分页插件,能够返回的数据包含页码,下一页... , 自动查询count * * @param query * @param pageNum 页码 默认值为1 * @param pageSize 每页的size 默认值为10 * @return 成功和失败都返回Response,具体的结果在response的 * code :状态码 * content:具体返回值 */ @PostMapping(value = "/queryBasePageSecondHelper") public Response queryBasePageSecondHelper(@RequestBody VAnswerUserVo query, @RequestParam(value = "pageNum", defaultValue = "1", required = false) Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize) { Response response = new Response(); try { List<OneToMore<TAnswerVo, List<TAnswerSecondVo>>> result = new ArrayList<>(); PageHelper.startPage(pageNum, pageSize); List<VAnswerUserVo> results = vAnswerUserService.queryBase(query); Collections.sort(results, new Comparator<VAnswerUserVo>() { @Override public int compare(VAnswerUserVo o1, VAnswerUserVo o2) { return -o1.getTime().compareTo(o2.getTime()); } }); results.forEach(tAnswerVo -> { VAnswerSecondUserVo tAnswerSecondVo = new VAnswerSecondUserVo(); tAnswerSecondVo.setAnswerId(tAnswerVo.getId()); tAnswerSecondVo.setBlackFlag(BlackStatus.NOT_IN_BLACK.getValue()); tAnswerSecondVo.setBlackListUser(BlackStatus.NOT_IN_BLACK.getValue()); List<VAnswerSecondUserVo> tAnswerSecondVos = tAnswerSecondService.queryBase(tAnswerSecondVo); Collections.sort(tAnswerSecondVos, new Comparator<VAnswerSecondUserVo>() { @Override public int compare(VAnswerSecondUserVo o1, VAnswerSecondUserVo o2) { return -o1.getTime().compareTo(o2.getTime()); } }); result.add(OneToMore.build(tAnswerVo, tAnswerSecondVos)); }); PageInfo pageInfo = new PageInfo(result); response.setCode(Code.System.OK); response.setContent(pageInfo); log.info("success pageInfo -> {} ", pageInfo); } catch (Exception e) { response.setCode(Code.System.FAIL); response.setMsg(e.getMessage()); response.addException(e); log.error("异常 -> {} ", e.getMessage(), e); } return response; } }
[ "m18888106873@163.com" ]
m18888106873@163.com
0ecf5d37e47adc39a79f95fcd07c646ba690bf2f
cad13393604a694259ab6976189f92474811e2d7
/src/infinitefdv/Rental.java
2cba45e0d46d4480d80acdb10957d81c5e50de7e
[]
no_license
Kailcor/infinitefdv
018e090df4971ed28d7e7739758539c352b00bcf
3bc961497f9a2667988cd33d9a02057075e6e719
refs/heads/master
2021-08-20T05:33:28.483684
2017-11-28T08:31:51
2017-11-28T08:31:51
112,300,859
0
0
null
null
null
null
UTF-8
Java
false
false
1,065
java
package infinitefdv; /** * * @author Angel Rodrigues * @date 2017/11/27 */ public abstract class Rental { private double price; private int numberOfBikes; private int time; public double rent() { return getNumberOfBikes() * getPrice() * getTime(); } /** * @return the price */ public double getPrice() { return price; } /** * @param price */ void setPrice(double price) { this.price = price; } /** * @return the time */ public int getTime() { return time; } /** * @param time the time to set */ public void setTime(int time) { this.time = time; } /** * @return the numberOfBikes */ public int getNumberOfBikes() { return numberOfBikes; } /** * @param numberOfBikes the numberOfBikes to set */ public void setNumberOfBikes(int numberOfBikes) { this.numberOfBikes = numberOfBikes; } }
[ "noreply@github.com" ]
Kailcor.noreply@github.com
828db35ceb62eabe8009ade70a18156ba831aaa7
0e18f7de51d0ea8c8ebc10cb9512f99b8e801bcb
/0725/En5_6.java
b50dbd9addcd2cf0946266198df9ea51913a66cf
[]
no_license
s17004/algo
7821aa9e10a8c7394ace7a66a2a0034d82c2e2b2
3a6cd494f3d7f5502dcd2efb0e335868f884186f
refs/heads/master
2020-03-22T05:06:04.052261
2018-08-31T04:11:46
2018-08-31T04:11:46
139,542,165
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
import java.util.Scanner; class En5_6 { static String[] name = {"A","B","C"}; static void move(int no, int x, int y) { if (no > 1) move(no - 1, x, 6 - x - y); System.out.println("円盤[" + no + "]を" + name[x-1] + "軸から" + name[y-1] + "軸へ移動"); if (no > 1) move(no - 1, 6 - x - y, y); } public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); System.out.println("ハノイの塔"); System.out.print("円盤の枚数:"); int n = stdIn.nextInt(); move(n, 1, 3); // 第1軸に積まれたn枚を第3軸に移動 } }
[ "s17004@std.it-college.ac.jp" ]
s17004@std.it-college.ac.jp
6a59026bea8c490cc613c030ff911f773c823ab6
f6f5da4a4a1501291e2a0c0f1df413273a9b4a0a
/src/lox/TokenType.java
35fba298f78386bdcb79791efcc7f90e44267885
[]
no_license
MohamedAlmaki/jlox
b794b783acecc6b36bc925bdef16286fe8a80bff
95c7e754e49141e88b5e2465cf46cad29dc39319
refs/heads/master
2020-04-03T23:48:09.983005
2019-02-15T21:06:47
2019-02-15T21:06:47
155,631,128
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package lox; public enum TokenType{ //Single Character token LEFT_PAREN,RIGHT_PAREN,LEFT_BRACE,RIGHT_BRACE,COMMA,DOT,MINUS,PLUS,SEMICOLON,SLASH,STAR,BITWISE_OR,BITWISE_AND,XOR, //One or two Character token BANG,BANG_EQUAL, EQUAL,EQUAL_EQUAL, GREATER,GREATER_EQUAL, LESS,LESS_EQUAL, COLON,QMARK, //Literals IDENTIFIER,STRING,NUMBER, //Keywords AND,CLASS,ELSE,FALSE,FUN,FOR,IF,NIL,OR,PRINT,RETURN,SUPER,THIS,TRUE,VAR,WHILE,EOF,BREAK,CONTINUE }
[ "mmakky1@gmail.com" ]
mmakky1@gmail.com
c280b3aaad173b42167ceff41a094c575e584e21
cffac9e7e0cf3ee3fb8b5eb970d2ce4a75abf102
/src/main/java/damd/rainbow/xml/DomReader.java
1be46bf760f9c9472219d499b7082e567cc7507b
[]
no_license
dmad/rainbow
94d50dc446a41f9c58f60ed7ab779ae3894594af
85c9532fc131d260638b9c255c67358ccff4f516
refs/heads/master
2020-05-21T19:09:42.203266
2016-08-17T14:31:47
2016-08-17T14:31:47
41,999,424
2
0
null
null
null
null
UTF-8
Java
false
false
6,525
java
package damd.rainbow.xml; import java.util.NoSuchElementException; import java.util.ArrayDeque; import org.w3c.dom.Node; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; public class DomReader { private Element root_element; private Element current_element; private ArrayDeque<Element> bookmarks; public DomReader (Element element) { root_element = current_element = element; } public DomReader (Document document) { root_element = current_element = document.getDocumentElement (); } public String serialize () { String xml = null; Document doc; if (null != (doc = current_element.getOwnerDocument ())) { DOMImplementationLS dom_impl; DOMConfiguration dom_conf; LSSerializer serializer; dom_impl = (DOMImplementationLS) doc.getImplementation (); serializer = dom_impl.createLSSerializer (); dom_conf = serializer.getDomConfig (); dom_conf.setParameter ("format-pretty-print", true); dom_conf.setParameter ("xml-declaration", false); xml = serializer.writeToString (current_element); } return xml; } public Element getElement () { return current_element; } public String getName () { return current_element.getTagName (); } public String getAttribute (String name, boolean mandatory) throws XmlMissingAttributeException { String value = current_element.getAttribute (name); /* Element.getAttribute returns an empty string if the attribute is not specified, change it to null */ if (null != value && value.isEmpty ()) value = null; if (mandatory && null == value) throw new XmlMissingAttributeException (current_element, name); return value; } public String getText (boolean mandatory) throws XmlMissingValueException { StringBuilder sb = null; String text; for (Node child = current_element.getFirstChild (); null != child; child = child.getNextSibling ()) { if (Node.TEXT_NODE == child.getNodeType()) if (null == sb) sb = new StringBuilder (child.getNodeValue ()); else sb.append (child.getNodeValue ()); } text = (null == sb ? null : sb.toString ()); if (null != text) { if (text.trim ().isEmpty ()) text = null; } if (mandatory && null == text) throw new XmlMissingValueException (current_element); return text; } public String getCData (final boolean mandatory) throws XmlMissingValueException { StringBuilder sb = null; String text; for (Node child = current_element.getFirstChild (); null != child; child = child.getNextSibling ()) { if (Node.CDATA_SECTION_NODE == child.getNodeType ()) if (null == sb) sb = new StringBuilder (child.getNodeValue ()); else sb.append (child.getNodeValue ()); } if (null != (text = (null == sb ? null : sb.toString ())) && text.trim ().isEmpty ()) text = null; if (mandatory && null == text) throw new XmlMissingValueException (current_element); return text; } public DomReader push () { if (null == bookmarks) bookmarks = new ArrayDeque<Element> (); bookmarks.push (current_element); return this; } public DomReader pop () throws NoSuchElementException { if (null == bookmarks) throw new NoSuchElementException ("No bookmarks where ever created"); current_element = bookmarks.pop (); return this; } public DomReader moveToRoot () { current_element = root_element; return this; } public boolean tryMoveToParent () { boolean found = true; Node parent = current_element.getParentNode (); if (Node.ELEMENT_NODE == parent.getNodeType ()) current_element = (Element) parent; else found = false; return found; } public DomReader moveToParent () throws XmlMissingElementException { if (!tryMoveToParent ()) throw new XmlMissingElementException (current_element, "[parent]"); return this; } public boolean tryMoveToChild () { boolean found = false; for (Node child = current_element.getFirstChild (); !found && null != child; child = child.getNextSibling ()) if (found = (Node.ELEMENT_NODE == child.getNodeType ())) current_element = (Element) child; return found; } public DomReader moveToChild () throws XmlMissingElementException { if (!tryMoveToChild ()) throw new XmlMissingElementException (current_element, "[child]"); return this; } public boolean tryMoveToNext () { boolean found = false; for (Node sibling = current_element.getNextSibling (); !found && null != sibling; sibling = sibling.getNextSibling ()) if (found = (Node.ELEMENT_NODE == sibling.getNodeType ())) current_element = (Element) sibling; return found; } public DomReader moveToNext () throws XmlMissingElementException { if (!tryMoveToNext ()) throw new XmlMissingElementException (current_element, "[next]"); return this; } public boolean tryMoveToNamedChild (String name) { boolean found = false; for (Node child = current_element.getFirstChild (); !found && null != child; child = child.getNextSibling ()) if (Node.ELEMENT_NODE == child.getNodeType ()) { String child_name = child.getNodeName (); if (found = name.equals (child.getNodeName ())) current_element = (Element) child; } return found; } public DomReader moveToNamedChild (String name) throws XmlMissingElementException { if (!tryMoveToNamedChild (name)) throw new XmlMissingElementException (current_element, name); return this; } public boolean tryMoveToNextNamed () { boolean found = false; for (Node sibling = current_element.getNextSibling (); !found && null != sibling; sibling = sibling.getNextSibling ()) if (Node.ELEMENT_NODE == sibling.getNodeType ()) { if (found = (current_element.getNodeName () .equals (sibling.getNodeName ()))) current_element = (Element) sibling; } return found; } public DomReader moveToNextNamed () throws XmlMissingElementException { if (!tryMoveToNextNamed ()) throw new XmlMissingElementException (current_element.getParentNode (), current_element.getNodeName ()); return this; } public DomReader getStanzaReader () { return new DomReader (current_element); } }
[ "dirk.dierckx@gmail.com" ]
dirk.dierckx@gmail.com
10df5aab2cec1a5687e03aebee19ac0d94ea8ef6
a005511a1f406a96a99e296cf4ee0287f8309362
/listview3/src/main/java/com/imooc/demo/app/listview/ChatActivity.java
085dddbe0c7be170679d97e110c824eb2c9b755a
[]
no_license
johnYin2015/NetPopulateFramework
6544c8752a8a0f663dc03afe7200a57e05073619
3b5ae9446034be92e2bf28ee07e588147a53eef2
refs/heads/master
2020-06-16T05:27:24.720368
2020-03-19T12:59:50
2020-03-19T12:59:50
195,490,580
1
1
null
null
null
null
UTF-8
Java
false
false
4,941
java
package com.imooc.demo.app.listview; import android.content.Context; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.imooc.demo.R; import com.imooc.demo.model.ChatMessage; import java.util.ArrayList; import java.util.List; /** * Function: * Create date on 16/8/13. * * @author Conquer * @version 1.0 */ public class ChatActivity extends AppCompatActivity { private ListView mListView; List<ChatMessage> mChatMessages = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mListView = (ListView) findViewById(R.id.list_view_demo); ChatMessage chatMessage = new ChatMessage(1,2,"刘小明","8:20","你好吗","","",true); ChatMessage chatMessage2 = new ChatMessage(2,1,"小军","8:21","我很好","","",false); ChatMessage chatMessage3 = new ChatMessage(1,2,"刘小明","8:22","今天天气怎么样","","",true); ChatMessage chatMessage4 = new ChatMessage(2,1,"小军","8:23","热成狗了","","",false); mChatMessages.add(chatMessage); mChatMessages.add(chatMessage2); mChatMessages.add(chatMessage3); mChatMessages.add(chatMessage4); mListView.setAdapter(new ChatMessageAdapter(this, mChatMessages)); } public static class ChatMessageAdapter extends BaseAdapter { public interface IMessageViewType { int COM_MESSAGE = 0; int TO_MESSAGE = 1; } private List<ChatMessage> mChatMessages; private LayoutInflater mInflater; public ChatMessageAdapter(Context context, List<ChatMessage> coll) { this.mChatMessages = coll; mInflater = LayoutInflater.from(context); } public int getCount() { return mChatMessages.size(); } public Object getItem(int position) { return mChatMessages.get(position); } public long getItemId(int position) { return position; } public int getItemViewType(int position) { ChatMessage entity = mChatMessages.get(position); if (entity.getMsgType()) { return IMessageViewType.COM_MESSAGE; } else { return IMessageViewType.TO_MESSAGE; } } public int getViewTypeCount() { return 2; } public View getView(int position, View convertView, ViewGroup parent) { final ChatMessage entity = mChatMessages.get(position); boolean isComMsg = entity.getMsgType(); ViewHolder viewHolder; if (convertView == null) { if (isComMsg) { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_left, null); } else { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_right, null); } viewHolder = new ViewHolder(); viewHolder.mSendTime = (TextView) convertView.findViewById(R.id.tv_send_time); viewHolder.mUserName = (TextView) convertView.findViewById(R.id.tv_username); viewHolder.mContent = (TextView) convertView.findViewById(R.id.tv_chat_content); viewHolder.mTime = (TextView) convertView.findViewById(R.id.tv_time); viewHolder.mUserAvatar = (ImageView) convertView.findViewById(R.id.iv_user_head); viewHolder.mIsComMessage = isComMsg; convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.mSendTime.setText(entity.getDate()); viewHolder.mContent.setText(entity.getContent()); viewHolder.mContent.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); viewHolder.mTime.setText(""); viewHolder.mUserName.setText(entity.getName()); if (isComMsg) { viewHolder.mUserAvatar.setImageResource(R.drawable.avatar); } else { viewHolder.mUserAvatar.setImageResource(R.mipmap.ic_launcher); // ImageLoader.getInstance().displayImage(entity.getAvatarUrl(), viewHolder.mUserAvatar); } return convertView; } class ViewHolder { public TextView mSendTime; public TextView mUserName; public TextView mContent; public TextView mTime; public ImageView mUserAvatar; public boolean mIsComMessage = true; } } }
[ "wit.zhaoguo@gmail.com" ]
wit.zhaoguo@gmail.com
cfc0709ef36ce4abaf994b83ad81213752cb285c
1df87aa60158a2fa4314c25001e6f29e5b7530df
/Rabin-Karp/Java/RabinKarp.java
deaaebfc8618cac8f7a13b1f2024d11c468d316e
[ "Apache-2.0" ]
permissive
Ritzing/Algorithms-2
7285a39b48546209132fb6a2179b158ecaad3511
a4a2bccbe2e80adbb2c26afa2a2fe989d31db542
refs/heads/master
2020-03-17T04:04:48.824187
2018-05-03T15:55:11
2018-05-03T15:55:11
133,262,023
4
3
Apache-2.0
2018-10-03T08:29:24
2018-05-13T18:04:53
C++
UTF-8
Java
false
false
1,634
java
/* * Author:- Prarik Kayastha * Email-id:- pratikkayastha98@gmail.com * Program Name:- Rabin-Karp Algorithm * Description:- This algorithm uses to find pattern in given string. * Time-Complexity:- O(mn) * */ import java.util.Scanner; public class RabinKarp { static final long prime = 101; public static String searchSubstring(String str,int n,String sub,int m) { long key= getSubKey(sub, m); long oldHash = getSubKey(str.substring(0, m), m); if(key==oldHash && equal(str, sub, 0)) return "Yes"; for(int i=m;i<n;i++) { oldHash = getNewHash(str, i-m, i, oldHash, m); if(key==oldHash && equal(str, sub, i-m+1)) return "Yes"; } return "No"; } public static long getNewHash(String str,int oldIndex,int newIndex,long oldHash,int m)//get newhash in constant time { long newHash=((oldHash-str.charAt(oldIndex)+96)/prime)+((str.charAt(newIndex)-96)*(long)Math.pow(prime, m-1)); return newHash; } public static long getSubKey(String sub,int m)//hashing function { long key=0; for(int i=0;i<m;i++) { key += (sub.charAt(i)-96)*(long)Math.pow(prime, i); } return key; } public static boolean equal(String str,String sub,int index)//to check two string are equal or not { for(int i=0;i<sub.length();i++) if(str.charAt(index+i)!=sub.charAt(i)) return false; return true; } public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String sub = sc.nextLine(); int n = str.length(); int m = sub.length(); System.out.println(searchSubstring(str,n,sub,m)); sc.close(); } }
[ "pratikkayastha98@gmail.com" ]
pratikkayastha98@gmail.com
7e06b99964061c20886a9dd09024350a3ab9f5cd
575774ee9e3fe4902a5bea5c6486d455f8cce24b
/src/main/java/com/spring/JDKproxy/Student.java
3d5f6057e00b2f41b23205af0fff33fdba1ffc63
[]
no_license
yanzxu/learning
4559821cf5c49732bef86804bc3b4beceda9b3af
6a7a458001258b035c68ea3039404734527c3b6c
refs/heads/master
2022-09-24T06:48:50.627417
2022-09-07T09:24:53
2022-09-07T09:24:53
179,941,433
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package com.spring.JDKproxy; public class Student implements Person { @Override public void speak() { System.out.println("==== I am a Student ====="); } }
[ "yzxu@thoughtworks.com" ]
yzxu@thoughtworks.com
4b58ed7012a007f81646975a0aee995c7cd39a5e
dd27b05be123323fbbf8764afe465dd4675512c1
/learn-common-dao/src/main/java/com/vince/java/learn/netty/dao/UserDao.java
b69bd4cd4dbe79a7527bfaa242399ab87d4e6492
[]
no_license
VinceZhh/learn
1ed35ae31b08b8456039b076f6a76eee27e59706
38975283954f54ffd8ffde1e7bff69d09f4e61a9
refs/heads/master
2022-12-20T23:44:19.033687
2020-11-25T15:00:35
2020-11-25T15:00:35
125,005,261
0
1
null
2022-12-16T08:39:48
2018-03-13T06:48:06
Java
UTF-8
Java
false
false
1,025
java
package com.vince.java.learn.netty.dao; import com.vince.java.learn.netty.entity.User; import java.util.List; /** * @author vince_zh */ public interface UserDao { /** * 获得User数据集合 * @return User数据集合 */ List<User> selectUser(); /** * 获得一个User对象,以参数User对象中不为空的属性作为条件进行查询 * @param obj user * @return user */ User selectUserByObj(User obj); /** * 通过User的id获得User对象 * @param id 主键id * @return user */ User selectUserById(Long id); /** * 插入User到数据库,包括null值 * @param value user */ void insertUser(User value); /** * 通过User的id删除User * @param id 主键id * @return 影响行数 */ int deleteUserById(Long id); /** * 通过User的id更新User中的数据 不包括null * @param user user * @return 影响行数 */ int updateUserById(User user); }
[ "zhanghao12@jd.com" ]
zhanghao12@jd.com
1fba377f3babc8ae343f15d430d548a8af81f548
eafaeddcfb91b6b96b82aec63cf64cec98bab6d3
/src/com/luv2code/aopdemo/dao/AccountDAO.java
ec2850072979be8f3c15c2b7c6123bc6a378184d
[]
no_license
wisezt/spring-demo-aop
8c5365dd69c41450b298c953c6d70126fcc30773
22ac4d0133870c8a3d970d83743d99b702322613
refs/heads/master
2020-05-21T14:30:10.911749
2019-05-14T00:43:11
2019-05-14T00:43:11
186,079,997
0
0
null
null
null
null
UTF-8
Java
false
false
1,001
java
package com.luv2code.aopdemo.dao; import org.springframework.stereotype.Component; import com.luv2code.aopdemo.Account; import java.util.ArrayList; import java.util.List; @Component() public class AccountDAO { boolean testBoolean = true; public void addAccount(Account theAccount, boolean vipFlag) { System.out.println(getClass() + ": DOING MY DBWORK: ADDING AN ACCOUNT"); } public void updateAccount() { System.out.println("AccountDAO updateAccount()!"); } public String findAccounts(){ List<Account> theAccounts = new ArrayList<>(); String result = "All good!"; // creawte sample accounts Account temp1 = new Account("John", "1"); Account temp2 = new Account("Madhu", "2"); Account temp3 = new Account("Luca", "3"); // add them to our accounts list theAccounts.add(temp1); theAccounts.add(temp2); theAccounts.add(temp3); if (testBoolean) { throw new RuntimeException("I am the RuntimeException in findAccount "); } return result; } }
[ "wisezt@hotmail.com" ]
wisezt@hotmail.com
39431eed2b31efdaf9b417204f7d84b1e702e347
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/15/15_aa2f9b927087cbd43120f585dd43fbac10747b5f/CassandraHiveMetaStore/15_aa2f9b927087cbd43120f585dd43fbac10747b5f_CassandraHiveMetaStore_s.java
d20cea460a8a1b23411159b09df558f447501b80
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
26,143
java
package org.apache.cassandra.hadoop.hive.metastore; import java.util.*; import org.apache.cassandra.thrift.Cassandra; import org.apache.cassandra.thrift.CfDef; import org.apache.cassandra.thrift.InvalidRequestException; import org.apache.cassandra.thrift.KsDef; import org.apache.cassandra.thrift.NotFoundException; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.metastore.RawStore; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Index; import org.apache.hadoop.hive.metastore.api.InvalidObjectException; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet; import org.apache.hadoop.hive.metastore.api.PrincipalType; import org.apache.hadoop.hive.metastore.api.PrivilegeBag; import org.apache.hadoop.hive.metastore.api.Role; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.api.Type; import org.apache.hadoop.hive.metastore.model.MDBPrivilege; import org.apache.hadoop.hive.metastore.model.MGlobalPrivilege; import org.apache.hadoop.hive.metastore.model.MPartitionColumnPrivilege; import org.apache.hadoop.hive.metastore.model.MPartitionPrivilege; import org.apache.hadoop.hive.metastore.model.MRoleMap; import org.apache.hadoop.hive.metastore.model.MStorageDescriptor; import org.apache.hadoop.hive.metastore.model.MTableColumnPrivilege; import org.apache.hadoop.hive.metastore.model.MTablePrivilege; import org.apache.thrift.TBase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Serializes thrift structs for Hive Meta Store to Apache Cassandra. * * All of the 'entities' in the meta store schema go into a single row for * the database for which they belong. * * Database names are stored in a special row with the key '__databases__' * * Meta information such as roles and privileges (that is, 'entities' that * can be cross-database) go into the row with the key '__meta__' * * * @author zznate */ public class CassandraHiveMetaStore implements RawStore { private static final Logger log = LoggerFactory.getLogger(CassandraHiveMetaStore.class); private Configuration configuration; private MetaStorePersister metaStorePersister; private CassandraClientHolder cassandraClientHolder; public CassandraHiveMetaStore() { log.debug("Creating CassandraHiveMetaStore"); } public void setConf(Configuration conf) { configuration = conf; cassandraClientHolder = new CassandraClientHolder(configuration); Cassandra.Iface client = cassandraClientHolder.getClient(); createSchemaIfNeeded(client, conf); metaStorePersister = new MetaStorePersister(configuration); } public Configuration getConf() { return configuration; } private void createSchemaIfNeeded(Cassandra.Iface client, Configuration conf) { // Database_entities : {[name].name=name} // FIXME add these params to configuration // databaseName=metastore_db;create=true try { client.set_keyspace(cassandraClientHolder.getKeyspaceName()); return; } catch (InvalidRequestException ire) { log.info("HiveMetaStore keyspace did not exist. Creating."); } catch (Exception e) { throw new CassandraHiveMetaStoreException("Could not create or validate existing schema", e); } //Sleep a random amount of time to stagger ks creations on many nodes try { Thread.sleep(new Random().nextInt(5000)); } catch (InterruptedException e1) { } //check again... try { client.set_keyspace(cassandraClientHolder.getKeyspaceName()); return; } catch (InvalidRequestException ire) { } catch (Exception e) { throw new CassandraHiveMetaStoreException("Could not create or validate existing schema", e); } CfDef cf = new CfDef(cassandraClientHolder.getKeyspaceName(), cassandraClientHolder.getColumnFamily()); cf.setComparator_type("UTF8Type"); KsDef ks = new KsDef(cassandraClientHolder.getKeyspaceName(), "org.apache.cassandra.locator.SimpleStrategy", conf.getInt(CassandraClientHolder.CONF_PARAM_REPLICATION_FACTOR, 1), Arrays.asList(cf)); try { client.system_add_keyspace(ks); } catch (Exception e) { throw new CassandraHiveMetaStoreException("Could not create Hive MetaStore database: " + e.getMessage(), e); } } public void createDatabase(Database database) throws InvalidObjectException, MetaException { log.debug("createDatabase with {}", database); metaStorePersister.save(database.metaDataMap, database, database.getName()); metaStorePersister.save(database.metaDataMap, database, CassandraClientHolder.DATABASES_ROW_KEY); } public Database getDatabase(String databaseName) throws NoSuchObjectException { log.debug("in getDatabase with database name: {}", databaseName); Database db = new Database(); try { metaStorePersister.load(db, databaseName); } catch (NotFoundException e) { throw new NoSuchObjectException("Database named " + databaseName + " did not exist."); } return db; } public List<String> getDatabases(String databaseNamePattern) throws MetaException { log.debug("in getDatabases with databaseNamePattern: {}", databaseNamePattern); List<TBase> databases = metaStorePersister.find(new Database(), CassandraClientHolder.DATABASES_ROW_KEY, databaseNamePattern,100); List<String> results = new ArrayList<String>(databases.size()); for (TBase tBase : databases) { Database db = (Database)tBase; if ( StringUtils.isEmpty(databaseNamePattern) || db.getName().matches(databaseNamePattern) ) results.add(db.getName()); } return results; } public boolean alterDatabase(String oldDatabaseName, Database database) throws NoSuchObjectException, MetaException { try { createDatabase(database); } catch (InvalidObjectException e) { throw new CassandraHiveMetaStoreException("Error attempting to alter database: " + oldDatabaseName, e); } List<String> tables = getAllTables(oldDatabaseName); List<TBase> removeable = new ArrayList<TBase>(); for (String table : tables) { Table t = getTable(oldDatabaseName, table); try { Table nTable = t.deepCopy(); nTable.setDbName(database.getName()); removeable.addAll(updateTableComponents(oldDatabaseName, database, t.getTableName(), t)); createTable(nTable); } catch (Exception e) { throw new MetaException("Problem in database rename"); } removeable.add(t); } metaStorePersister.removeAll(removeable, oldDatabaseName); return true; } public boolean dropDatabase(String databaseName) throws NoSuchObjectException, MetaException { Database database = new Database(); database.setName(databaseName); metaStorePersister.remove(database, databaseName); return true; } public List<String> getAllDatabases() throws MetaException { return getDatabases(StringUtils.EMPTY); } public void createTable(Table table) throws InvalidObjectException, MetaException { metaStorePersister.save(table.metaDataMap, table, table.getDbName()); } public Table getTable(String databaseName, String tableName) throws MetaException { log.debug("in getTable with database name: {} and table name: {}", databaseName, tableName); Table table = new Table(); table.setTableName(tableName); try { metaStorePersister.load(table, databaseName); } catch (NotFoundException e) { //throw new MetaException("Table: " + tableName + " did not exist in database: " + databaseName); return null; } return table; } /** * Retrieve the tables for the given database and pattern. * * @param dbName * @param tableNamePattern the pattern passed as is to {@link String#matches(String)} of * {@link Table#getTableName()} */ public List<String> getTables(String dbName, String tableNamePattern) throws MetaException { log.info("in getTables with dbName: {} and tableNamePattern: {}", dbName, tableNamePattern); List<TBase> tables = metaStorePersister.find(new Table(), dbName); List<String> results = new ArrayList<String>(tables.size()); for (TBase tBase : tables) { Table table = (Table)tBase; if ( StringUtils.isEmpty(tableNamePattern) || table.getTableName().matches(tableNamePattern)) results.add(table.getTableName()); } return results; } public List<String> getAllTables(String databaseName) throws MetaException { log.debug("in getAllTables"); return getTables(databaseName, StringUtils.EMPTY); } public void alterTable(String databaseName, String oldTableName, Table table) throws InvalidObjectException, MetaException { if ( log.isDebugEnabled() ) log.debug("Altering oldTableName {} on datbase: {} new Table: {}", new Object[]{oldTableName, databaseName, table}); updateTableComponents(databaseName, null, oldTableName, table); dropTable(databaseName, oldTableName); } private List<TBase> updateTableComponents(String oldDatabaseName, Database database, String oldTableName, Table table) throws InvalidObjectException, MetaException { createTable(table); List<Partition> parts = getPartitions(oldDatabaseName, oldTableName, -1); List<TBase> toRemove = new ArrayList<TBase>(); for (Partition partition : parts) { toRemove.add(partition.deepCopy()); if ( database != null ) partition.setDbName(database.getName()); partition.setTableName(table.getTableName()); addPartition(partition); } // getIndexes List<Index> indexes = getIndexes(oldDatabaseName, oldTableName, -1); for (Index index : indexes) { toRemove.add(index.deepCopy()); if ( database != null ) index.setDbName(database.getName()); index.setOrigTableName(table.getTableName()); addIndex(index); } return toRemove; } public boolean dropTable(String databaseName, String tableName) throws MetaException { Table table = new Table(); table.setDbName(databaseName); table.setTableName(tableName); metaStorePersister.remove(table, databaseName); return true; } public boolean addIndex(Index index) throws InvalidObjectException, MetaException { metaStorePersister.save(index.metaDataMap, index, index.getDbName()); return false; } public Index getIndex(String databaseName, String tableName, String indexName) throws MetaException { Index index = new Index(); index.setDbName(databaseName); index.setIndexName(indexName); index.setOrigTableName(tableName); try { metaStorePersister.load(index, databaseName); } catch (NotFoundException nfe) { throw new MetaException("Index: " + indexName + " did not exist for table: " + tableName + " in database: " + databaseName ); } return index; } public List<Index> getIndexes(String databaseName, String originalTableName, int max) throws MetaException { List results = metaStorePersister.find(new Index(), databaseName, originalTableName, max); return (List<Index>)results; } public List<String> listIndexNames(String databaseName, String originalTableName, short max) throws MetaException { List<Index> indexes = getIndexes(databaseName, originalTableName, max); List<String> results = new ArrayList<String>(indexes.size()); for (Index index : indexes) { results.add(index.getIndexName()); } return results; } public void alterIndex(String databaseName, String originalTableName, String originalIndexName, Index index) throws InvalidObjectException, MetaException { if ( log.isDebugEnabled() ) log.debug("Altering index {} on database: {} and table: {} Index: {}", new Object[]{ originalIndexName, databaseName, originalTableName, index}); addIndex(index); dropIndex(databaseName, originalTableName, originalIndexName); } public boolean dropIndex(String databaseName, String originalTableName, String indexName) throws MetaException { Index index = new Index(); index.setDbName(databaseName); index.setOrigTableName(originalTableName); index.setIndexName(indexName); metaStorePersister.remove(index, databaseName); return true; } public boolean addPartition(Partition partition) throws InvalidObjectException, MetaException { log.debug("in addPartition with: {}", partition); metaStorePersister.save(partition.metaDataMap, partition, partition.getDbName()); return true; } public Partition getPartition(String databaseName, String tableName, List<String> partitions) throws MetaException, NoSuchObjectException { log.debug("in getPartition databaseName: {} tableName: {} partitions: {}", new Object[]{databaseName, tableName, partitions}); Partition partition = new Partition(); partition.setDbName(databaseName); partition.setTableName(tableName); partition.setValues(partitions); try { metaStorePersister.load(partition, databaseName); } catch (NotFoundException e) { throw new NoSuchObjectException("Could not find partition for: " + partitions + " on table: " + tableName + " in database: " + databaseName); } return partition; } public List<Partition> getPartitions(String databaseName, String tableName, int max) throws MetaException { log.debug("in getPartitions: databaseName: {} tableName: {} max: {}", new Object[]{databaseName, tableName, max}); List results = metaStorePersister.find(new Partition(), databaseName, tableName, max); return (List<Partition>)results; } public List<String> listPartitionNames(String databaseName, String tableName, short max) throws MetaException { log.debug("in listPartitionNames: databaseName: {} tableName: {} max: {}", new Object[]{databaseName, tableName, max}); List<Partition> partitions = getPartitions(databaseName, tableName, max); List<String> results = new ArrayList<String>(partitions.size()); if ( partitions == null ) return results; for (Partition partition : partitions) { results.add(partition.getSd().getLocation()); } return results; } public void alterPartition(String databaseName, String tableName, Partition partition) throws InvalidObjectException, MetaException { if ( log.isDebugEnabled() ) log.debug("Altering partiion for table {} on database: {} Partition: {}", new Object[]{tableName, databaseName, partition}); Partition oldPartition; try { oldPartition = getPartition(databaseName, tableName, partition.getValues()); } catch (NoSuchObjectException nse) { throw new InvalidObjectException(nse.getMessage()); } addPartition(partition); } public boolean dropPartition(String databaseName, String tableName, List<String> partitions) throws MetaException { Partition partition = new Partition(); partition.setDbName(databaseName); partition.setTableName(tableName); partition.setValues(partitions); metaStorePersister.remove(partition, databaseName); return true; } public boolean addRole(String roleName, String ownerName) throws InvalidObjectException, MetaException, NoSuchObjectException { Role role = new Role(); role.setOwnerName(ownerName); role.setRoleName(roleName); metaStorePersister.save(role.metaDataMap, role, CassandraClientHolder.META_DB_ROW_KEY); return true; } public Role getRole(String roleName) throws NoSuchObjectException { Role role = new Role(); role.setRoleName(roleName); try { metaStorePersister.load(role, CassandraClientHolder.META_DB_ROW_KEY); } catch (NotFoundException nfe) { throw new NoSuchObjectException("could not find role: " + roleName); } return role; } public boolean createType(Type type) { metaStorePersister.save(type.metaDataMap, type, CassandraClientHolder.META_DB_ROW_KEY); return true; } public Type getType(String type) { Type t = new Type(); t.setName(type); try { metaStorePersister.load(t, CassandraClientHolder.META_DB_ROW_KEY); } catch (NotFoundException e) { return null; } return t; } public boolean dropType(String type) { Type t = new Type(); t.setName(type); metaStorePersister.remove(t, CassandraClientHolder.META_DB_ROW_KEY); return true; } public boolean commitTransaction() { // FIXME default to true for now return true; } @Override public PrincipalPrivilegeSet getColumnPrivilegeSet(String arg0, String arg1, String arg2, String arg3, String arg4, List<String> arg5) throws InvalidObjectException, MetaException { // TODO Auto-generated method stub return null; } @Override public PrincipalPrivilegeSet getDBPrivilegeSet(String arg0, String arg1, List<String> arg2) throws InvalidObjectException, MetaException { // TODO Auto-generated method stub return null; } @Override public PrincipalPrivilegeSet getPartitionPrivilegeSet(String arg0, String arg1, String arg2, String arg3, List<String> arg4) throws InvalidObjectException, MetaException { // TODO Auto-generated method stub return null; } public Partition getPartitionWithAuth(String databaseName, String tableName, List<String> partVals, String userName, List<String> groupNames) throws MetaException, NoSuchObjectException, InvalidObjectException { log.debug("in getPartitionWithAuth: databaseName: {} tableName: {} userName: {} groupNames: {}", new Object[]{databaseName, tableName, userName, groupNames}); return getPartition(databaseName, tableName, partVals); } public List<Partition> getPartitionsWithAuth(String databaseName, String tableName, short maxParts, String userName, List<String> groupNames) throws MetaException, NoSuchObjectException, InvalidObjectException { log.debug("in getPartitionsWithAuth: databaseName: {} tableName: {} maxParts: {} userName: {}", new Object[]{databaseName, tableName, maxParts, userName}); List<Partition> partitions = getPartitions(databaseName, tableName, maxParts); return partitions; } @Override public List<Partition> getPartitionsByFilter(String databaseName, String tableName, String filter, short maxPartitions) throws MetaException, NoSuchObjectException { // TODO Auto-generated method stub return null; } @Override public PrincipalPrivilegeSet getTablePrivilegeSet(String arg0, String arg1, String arg2, List<String> arg3) throws InvalidObjectException, MetaException { // TODO Auto-generated method stub return null; } @Override public PrincipalPrivilegeSet getUserPrivilegeSet(String arg0, List<String> arg1) throws InvalidObjectException, MetaException { // TODO Auto-generated method stub return null; } @Override public boolean grantPrivileges(PrivilegeBag arg0) throws InvalidObjectException, MetaException, NoSuchObjectException { // TODO Auto-generated method stub return false; } @Override public boolean grantRole(Role arg0, String arg1, PrincipalType arg2, String arg3, PrincipalType arg4, boolean arg5) throws MetaException, NoSuchObjectException, InvalidObjectException { // TODO Auto-generated method stub return false; } @Override public List<MTablePrivilege> listAllTableGrants(String arg0, PrincipalType arg1, String arg2, String arg3) { // TODO Auto-generated method stub return null; } @Override public List<String> listPartitionNamesByFilter(String arg0, String arg1, String arg2, short arg3) throws MetaException { // TODO Auto-generated method stub return null; } @Override public List<MDBPrivilege> listPrincipalDBGrants(String arg0, PrincipalType arg1, String arg2) { // TODO Auto-generated method stub return null; } @Override public List<MGlobalPrivilege> listPrincipalGlobalGrants(String arg0, PrincipalType arg1) { // TODO Auto-generated method stub return null; } @Override public List<MPartitionColumnPrivilege> listPrincipalPartitionColumnGrants( String arg0, PrincipalType arg1, String arg2, String arg3, String arg4, String arg5) { // TODO Auto-generated method stub return null; } @Override public List<MPartitionPrivilege> listPrincipalPartitionGrants(String arg0, PrincipalType arg1, String arg2, String arg3, String arg4) { // TODO Auto-generated method stub return null; } @Override public List<MTableColumnPrivilege> listPrincipalTableColumnGrants( String arg0, PrincipalType arg1, String arg2, String arg3, String arg4) { // TODO Auto-generated method stub return null; } @Override public List<String> listRoleNames() { // TODO Auto-generated method stub return null; } @Override public List<MRoleMap> listRoles(String arg0, PrincipalType arg1) { // TODO Auto-generated method stub return null; } @Override public boolean openTransaction() { // TODO Auto-generated method stub return true; } @Override public boolean removeRole(String arg0) throws MetaException, NoSuchObjectException { // TODO Auto-generated method stub return false; } @Override public boolean revokePrivileges(PrivilegeBag arg0) throws InvalidObjectException, MetaException, NoSuchObjectException { // TODO Auto-generated method stub return false; } @Override public boolean revokeRole(Role arg0, String arg1, PrincipalType arg2) throws MetaException, NoSuchObjectException { // TODO Auto-generated method stub return false; } @Override public void rollbackTransaction() { // TODO Auto-generated method stub } @Override public void shutdown() { // TODO Auto-generated method stub } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
035479535ded61f6a72cff06a1a5735ea4887919
a9e8d114137352e0958215b948804c8ae2291681
/app/src/main/java/com/example/townservices/Tractor.java
a6605a4ff2541d07c1e4fef16fb0357ed79c6219
[]
no_license
prakhar-oriental/TownServices
22c89eabccd506a48ff33ab1a746c45a2f7311a8
b6fff5910afd89676a1d90e447014bce5d83a2b7
refs/heads/master
2023-05-15T02:22:03.110087
2021-06-11T17:07:49
2021-06-11T17:07:49
376,087,482
0
0
null
null
null
null
UTF-8
Java
false
false
2,719
java
package com.example.townservices; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Bundle; import java.util.ArrayList; public class Tractor extends AppCompatActivity { RecyclerView tractorrecyclerView; TractorOptionAdapter tractorOptionAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tractor); tractorrecyclerView = findViewById(R.id.rcvTractor); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false); tractorrecyclerView.setLayoutManager(linearLayoutManager); tractorOptionAdapter = new TractorOptionAdapter(tractordata(),getApplicationContext()); tractorrecyclerView.setAdapter(tractorOptionAdapter); } public ArrayList<TractorData> tractordata() { ArrayList<TractorData> tractorData = new ArrayList<>(); TractorData tfirstpersona = new TractorData(); tfirstpersona.setTractorimg(R.drawable.person); tfirstpersona.setTractorname("Ravi"); tfirstpersona.setTractorphoneNumber("4083085072"); tfirstpersona.setTractoraddressimg(R.drawable.location); tractorData.add(tfirstpersona); TractorData tfirstpersonb = new TractorData(); tfirstpersonb.setTractorimg(R.drawable.person); tfirstpersonb.setTractorname("Ravi"); tfirstpersonb.setTractorphoneNumber("4083085072"); tfirstpersonb.setTractoraddressimg(R.drawable.location); tractorData.add(tfirstpersonb); TractorData tfirstpersonc = new TractorData(); tfirstpersonc.setTractorimg(R.drawable.person); tfirstpersonc.setTractorname("Ravi"); tfirstpersonc.setTractorphoneNumber("4083085072"); tfirstpersonc.setTractoraddressimg(R.drawable.location); tractorData.add(tfirstpersonc); TractorData tfirstpersond = new TractorData(); tfirstpersond.setTractorimg(R.drawable.person); tfirstpersond.setTractorname("Ravi"); tfirstpersond.setTractorphoneNumber("4083085072"); tfirstpersond.setTractoraddressimg(R.drawable.location); tractorData.add(tfirstpersond); TractorData tfirstpersone = new TractorData(); tfirstpersone.setTractorimg(R.drawable.person); tfirstpersone.setTractorname("Ravi"); tfirstpersone.setTractorphoneNumber("4083085072"); tfirstpersone.setTractoraddressimg(R.drawable.location); tractorData.add(tfirstpersone); return tractorData; } }
[ "prakhar.r786@gmail.com" ]
prakhar.r786@gmail.com
cd8be94f9e9e6f23d3b8f2aba850a79d980a48e3
cb16920ecdec4cef8b39d51ca109d38d18372d7b
/src/main/java/br/mackenzie/interdisciplinarproject/service/UploadService.java
0a513a7c3b9817ce4f75ed3b6893e04a6c7fcfab
[]
no_license
University-Mackenzie/interdisciplinar-project
06dda30fd65a928d94a2f8caedf863906768005a
3244bd5432f6315a457c14d8d0659a6e033e4470
refs/heads/master
2021-01-21T04:40:23.482837
2016-06-21T17:41:40
2016-06-21T17:41:40
55,848,518
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package br.mackenzie.interdisciplinarproject.service; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public interface UploadService { /** * Retorna lista de Alunos * @return */ //List<Aluno> listarAlunos(); public void processRequest(); public void FileUpload(HttpServletRequest request, HttpServletResponse response); public String getString(); }
[ "jonymackenzie@gmail.com" ]
jonymackenzie@gmail.com
a468fb30d95b904ad3f17184a8e23971a12ee150
5dae8c81d9bc9f2b771497c674ec62321e401310
/src/GraphicsUserInterface/SimpleGUI.java
5fadc2e38b69a4d4dc309fc59283320bad7148ef
[]
no_license
kingSta8/HelloWorld
cf6e9a3f46d9f2ac245317c8f77be701de88cd40
c2726560a409f0ce390ed5d8ec55b3fd8ae74841
refs/heads/master
2021-05-07T20:50:43.291412
2018-01-23T11:18:27
2018-01-23T11:18:27
108,969,789
1
0
null
2017-10-31T09:04:13
2017-10-31T08:56:05
Java
UTF-8
Java
false
false
1,907
java
package GraphicsUserInterface; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class SimpleGUI extends JFrame { private JButton button = new JButton("Press"); private JTextField input = new JTextField("", 5); private JLabel label = new JLabel("Input:"); private JRadioButton radio1 = new JRadioButton("Select this"); private JRadioButton radio2 = new JRadioButton("Select that"); private JCheckBox check = new JCheckBox("Check", false); public SimpleGUI() { super("Simple Example"); this.setBounds(100,100,250,100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container container = this.getContentPane(); container.setLayout(new GridLayout(3,2,2,2)); container.add(label); container.add(input); ButtonGroup group = new ButtonGroup(); group.add(radio1); group.add(radio2); container.add(radio1); radio1.setSelected(true); container.add(radio2); container.add(check); button.addActionListener(new ButtonEventListener()); container.add(button); } class ButtonEventListener implements ActionListener { public void actionPerformed(ActionEvent e) { String message = ""; message += "Button was pressed\n"; message += "Text is " + input.getText() + "\n"; message += (radio1.isSelected()?"Radio #1":"Radio #2") + " is selected\n"; message += "CheckBox is " + ((check.isSelected()) ?"checked":"unchecked"); JOptionPane.showMessageDialog(null, message, "Output", JOptionPane.PLAIN_MESSAGE); } } public static void main(String[] args) { SimpleGUI app = new SimpleGUI(); app.setVisible(true); } }
[ "egor.stahovskiy@mail.ru" ]
egor.stahovskiy@mail.ru
f422aea5d28791da190c7a3ac92e1a047d48343d
9e6f65d6eabdf23de319db48640424e817477507
/src/chuong_1/Bai03.java
9eab71c00194379c033e0459ef88da03fa9475a2
[]
no_license
tdson/bt_java
65c0d5ddcfa6ee9297fac0f201771591f23d0ad9
e767bd53c00fc3a173cbfee8e6526859ae07175e
refs/heads/master
2021-01-12T04:13:07.043698
2016-12-28T17:01:37
2016-12-28T17:01:37
77,548,203
0
0
null
null
null
null
UTF-8
Java
false
false
442
java
// 3. Tìm số trung gian của 3 số a,b,c package chuong_1; public class Bai03 { public static void main(String[] args) { int a = 0, b = 2, c = 1; System.out.println("Số trung gian của " + a + ", " + b + ", " + c + " là: " + new Bai03().soTrungGian(a, b, c)); } // Phương thức tìm số trung gian private int soTrungGian(int a, int b, int c) { return Math.min(Math.max(a, b), Math.max(Math.min(a, b), c)); } }
[ "sontd.it@gmail.com" ]
sontd.it@gmail.com
d0f1b8ef0f715b11ebcb13b89ef8968aaebd6938
32636a447fefcb208bc08df6bdf7ba3d6f79a2af
/src/test/java/com/business/retail/demo/service/CategoryBTaxTest.java
0f31582411d687474d577bd3f06957c7077d7951
[]
no_license
ekpatil/BillingApplication
dd4eb8a7eb9e4f74891afdf166f0da3c0878fdbc
2f750e614033f3148ff5b3b4e116dc6eae37fcf9
refs/heads/master
2020-03-18T14:34:04.633870
2018-05-25T13:16:26
2018-05-25T13:16:26
134,854,688
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package com.business.retail.demo.service; import org.junit.Test; import java.math.*; import static org.junit.Assert.*; public class CategoryBTaxTest { private Tax tax = new CategoryBTax(); @Test public void calculateTax () { BigDecimal taxOfTwo = tax.calculateTax(2, new BigDecimal(100.50)); assertEquals(taxOfTwo,new BigDecimal("40.20").setScale(2,RoundingMode.HALF_EVEN)); } }
[ "Eknath.Patil@ideas.com" ]
Eknath.Patil@ideas.com
71bc92206e94cb03ee6bcd990e6bc08866b774c2
141a22866490958e7381c5c16a970085e16f3b67
/Arrays/sortAnArrayT2String.java
4ba07296a679e9d3f268b79229023c26fbf18345
[]
no_license
skambali/javamypractice
955baac13544f502fcb16d4a1b8327d345569b10
07e0280e66c734b0a2f44b46e7498b567d27461c
refs/heads/master
2020-07-28T14:47:23.671496
2017-02-03T01:11:05
2017-02-03T01:11:05
73,408,862
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package Arrays; public class sortAnArrayT2String { public static void main(String[] args){ String arr[]={"a","v","a","b","z","d"}; String temp; for(int i=0;i<arr.length;i++){ for(int j=i+1;j<arr.length;j++){ if(arr[i].compareTo(arr[j])>0){ temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; } } } for(String a:arr){ System.out.print(a); System.out.println(" "); } } } /*String arr[]={"h","w","t","s"}; //String arr[]={"a","v","a","b","z","d"}; for(String a:arr){ System.out.print(a); System.out.println(); } System.out.println("after sort"); String temp; for(int i=0;i<arr.length;i++){ for(int j=i+1;j<arr.length;j++){ if(arr[i].compareTo(arr[j])<0) { }*/
[ "rkambali@ebay.com" ]
rkambali@ebay.com
fd77e3ee970219fba9cb49b0ca7edd98659a4f93
0fb8bab283c017c5f68672a37d722e2e8e202b0f
/src/com/annotation/NokiaPhone.java
3533dabb9d5ba6ec404e0a3344fb42da0951bef5
[]
no_license
lakshmansingh33/java-examples
33af3b990c816788577bb4cac912a5bcc4d3a91c
474eba5cacfbdd994e43c479eddd484c72260182
refs/heads/master
2021-01-02T09:28:52.027631
2017-08-07T06:21:39
2017-08-07T06:21:39
99,221,047
0
0
null
null
null
null
UTF-8
Java
false
false
586
java
/** * */ package com.annotation; /** * @author lmuriyal * */ @SmartPhone(osName="Symbain_new",version=6) public class NokiaPhone { private String model; private int screenSize; public NokiaPhone() { } public NokiaPhone(String model, int screenSize) { this.model = model; this.screenSize = screenSize; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public int getScreenSize() { return screenSize; } public void setScreenSize(int screenSize) { this.screenSize = screenSize; } }
[ "lmuriyal@CBR-LAP-DEL2477.CIBER-INDIA.IN" ]
lmuriyal@CBR-LAP-DEL2477.CIBER-INDIA.IN
869ba4cc2b08abfc42641a7673639bdd0c9d8af9
e1c0eaa78925c9a9a5a89a3d4e70f7b87e381e53
/src/main/java/org/sample/foo/DemoApplication.java
1fbc9a15f1b0cf696dfe8b2cebf81ed2819fc588
[]
no_license
sample-projects-only/springboot-app-docker-image-demo
7a5461ca1bebd877f73eb6cd3edee4c15c932596
f4e520896d898c4d4dd2efc10c725615423e18d5
refs/heads/master
2023-06-20T17:27:12.771431
2021-08-01T14:11:34
2021-08-01T16:54:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package org.sample.foo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "yilativs@gmail.com" ]
yilativs@gmail.com
a57efa512f050d27ddc85a1aeb203509cb740007
ba82d07d05b4a58b64fe58b971dfc05bb20dde68
/ts-export-service/src/main/java/com/biglabs/iot/tsexportservice/config/WebConfig.java
b48d62db54bea5f347d85b228dd41048003699af
[ "Apache-2.0" ]
permissive
biglabs1/thingsboard
f2bcc402d09b3aa642529619af3604829376a72a
18110d9ef0f6db08d9e71770f711f933c7243d6e
refs/heads/master
2021-07-05T10:46:25.065279
2017-09-29T10:15:01
2017-09-29T10:15:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
977
java
/** * Copyright © 2016-2017 The Thingsboard 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.biglabs.iot.tsexportservice.config; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class WebConfig { @RequestMapping(value = "/{path:^(?!api$)(?!static$)(?!webjars$)[^\\.]*}/**") public String redirect() { return "forward:/index.html"; } }
[ "duc.tran@biglabs.com" ]
duc.tran@biglabs.com
c523f00d61f96b1c6ed3f52e94ef3100da9c3677
d00958862bdeab0de6eafb29625be92ca5fda62e
/src/collection/map/RemoveEntryByValue.java
7884108a2d97f7dde2908e5bfd481b444679a25f
[]
no_license
mrashmi791/Practice_Program
9b556fb8014cd579d28252575c5809e2cae7a71f
866180429b00d1e337df48eafeac86b17a7b3ccb
refs/heads/master
2022-06-30T20:41:42.936447
2020-05-13T10:03:22
2020-05-13T10:03:22
243,255,292
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package collection.map; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.Set; import javax.xml.crypto.dsig.keyinfo.KeyValue; public class RemoveEntryByValue { @SuppressWarnings("unlikely-arg-type") public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc= new Scanner(System.in); Map<Integer, Character> map = new HashMap<Integer, Character>(); String str = sc.nextLine(); // char value = sc.nextLine().charAt(0); for(int i = 0; i < str.length(); i++) { map.put(i,str.charAt(i)); } map.entrySet() .removeIf( entry -> ("2".equals(""+entry.getKey()))); System.out.println(map); } }
[ "mrashmi791@gmail.com" ]
mrashmi791@gmail.com
507bbbb1ed6abb9489869a729b8a480115c21644
46398cecda9358973c9514bf7b805ee674c40a3d
/manager_account/src/main/java/com/jcrspace/manager_account/event/RegisterCompleteEvent.java
2d2878a9c92cc4e60d5c74591fdc9ef03f6b6fef
[ "Apache-2.0" ]
permissive
csgajcr/Qs
1eb6877c2448cd18eaa0ad3afbdcca4e8ee63d9a
9ac18bda989e183455fdaedc4f10bfb232194370
refs/heads/master
2021-01-23T05:24:01.397435
2017-06-01T00:57:25
2017-06-01T00:57:25
92,965,327
3
0
null
null
null
null
UTF-8
Java
false
false
433
java
package com.jcrspace.manager_account.event; /** * Created by Jcr on 2017/5/28 0028. */ public class RegisterCompleteEvent { public boolean isSuccess; public String errorMessage; public String userName; public RegisterCompleteEvent(boolean isSuccess, String errorMessage, String userName) { this.isSuccess = isSuccess; this.errorMessage = errorMessage; this.userName = userName; } }
[ "610691723@qq.com" ]
610691723@qq.com
53244813e63a19e37dbf579f4417798ac65fbc2e
385e3414ccb7458bbd3cec326320f11819decc7b
/packages/apps/Camera/src/com/android/camera/v2/ui/RotateAnimationImageView.java
67447875adca0a0751fb15a118842c90ae8f44a4
[ "Apache-2.0" ]
permissive
carlos22211/Tango_AL813
14de7f2693c3045b9d3c0cb52017ba2bb6e6b28f
b50b1b7491dc9c5e6b92c2d94503635c43e93200
refs/heads/master
2020-03-28T08:09:11.127995
2017-06-26T05:05:29
2017-06-26T05:05:29
147,947,860
1
0
null
2018-09-08T15:55:46
2018-09-08T15:55:45
null
UTF-8
Java
false
false
3,330
java
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein is * confidential and proprietary to MediaTek Inc. and/or its licensors. Without * the prior written permission of MediaTek inc. and/or its licensors, any * reproduction, modification, use or disclosure of MediaTek Software, and * information contained herein, in whole or in part, shall be strictly * prohibited. * * MediaTek Inc. (C) 2014. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek * Software") have been modified by MediaTek Inc. All revisions are subject to * any receiver's applicable license agreements with MediaTek Inc. */ package com.android.camera.v2.ui; import android.content.Context; import android.graphics.drawable.AnimationDrawable; import android.util.AttributeSet; import com.android.camera.Log; public class RotateAnimationImageView extends RotateImageView { private static final String TAG = "RotateAniImageView"; public RotateAnimationImageView(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void setImageResource(int resId) { setAnimationRunning(false); super.setImageResource(resId); setAnimationRunning(true); } private void setAnimationRunning(boolean run) { Log.d(TAG, "setAnimationRunning(" + run + ")"); AnimationDrawable anim = null; if (getDrawable() instanceof AnimationDrawable) { anim = (AnimationDrawable) getDrawable(); } if (anim != null) { if (run && !anim.isRunning()) { anim.start(); } if (!run && anim.isRunning()) { anim.stop(); } } } }
[ "zhangjinqiang@huaqin.com" ]
zhangjinqiang@huaqin.com
75b7210fea4fd0fc090892d76d60bdab70f2e197
9ff2b368f7f208fcaab70f47ad17d46b2c24c21f
/mifosio-cheques/src/main/java/io/mifos/cheque/service/internal/service/helper/OrganizationService.java
4a1108826118e133ead8b597447c58277a1fbddb
[]
no_license
liseri/mifosio
a481944422f42d6777641510953eb76d784e893f
33f28ffd7d2269162137a46742a43a55130bb1b5
refs/heads/master
2021-05-11T06:57:26.458030
2018-02-10T15:53:18
2018-02-10T15:53:18
118,004,103
0
4
null
null
null
null
UTF-8
Java
false
false
1,880
java
/* * Copyright 2017 Kuelap, Inc. * * All Rights Reserved. * * NOTICE: All information contained herein is, and remains * the property of Kuelap, Inc and its suppliers, if any. * The intellectual and technical concepts contained herein * are proprietary to Kuelap, Inc and its suppliers and may * be covered by U.S. and Foreign Patents, patents in process, * and are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * Kuelap, Inc. */ package io.mifos.cheque.service.internal.service.helper; import io.mifos.cheque.service.ServiceConstants; import io.mifos.office.api.v1.client.NotFoundException; import io.mifos.office.api.v1.client.OrganizationManager; import io.mifos.office.api.v1.domain.Office; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import java.util.Optional; @Service public class OrganizationService { private final Logger logger; private final OrganizationManager organizationManager; @Autowired public OrganizationService(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger, final OrganizationManager organizationManager) { super(); this.logger = logger; this.organizationManager = organizationManager; } public boolean officeExistsByBranchSortCode(final String branchSortCode) { return this.findOffice(branchSortCode).isPresent(); } public Optional<Office> findOffice(final String branchSortCode) { try { return Optional.of(this.organizationManager.findOfficeByIdentifier(branchSortCode)); } catch (final NotFoundException nfex) { return Optional.empty(); } } }
[ "lishuai061@126.com" ]
lishuai061@126.com
2cdf43d1dda2daac5c9b471833923645b20c6c24
2effbb04f613a857779b66fc2a216d3b78ae9783
/LabGuide3/LabGuide3-1/src/labguide3/pkg1/LabGuide31.java
339a70ed832a9645d2176fe697a36645b5d722df
[]
no_license
ByUnal/ObjectOrientedProgramming
880fc7012c7f58a5dc28dce29ebb21ed4b914ad3
a9a2e4bee733c8720e34cb1f773a0f211dcd9bbf
refs/heads/master
2020-04-01T10:09:31.062656
2018-12-03T18:44:42
2018-12-03T18:44:42
153,105,128
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package labguide3.pkg1; public class LabGuide31 { public static void main(String[] args) { Book b1 = new Book(); b1.display(); } }
[ "43930582+ByUnal@users.noreply.github.com" ]
43930582+ByUnal@users.noreply.github.com
f47f843c1fb9737de9a8be4988d2639e7b2f3015
f3112970615d852cbd434f2ba3cb616c85c88504
/src/main/java/com/zed/jms/test/producer/app/SendJMSHeaderInfo.java
3c509fda6c22c539d81ad650ee9c0aa8ad71e2aa
[]
no_license
zymme/activemqSendJmsSamples
cf77c2a8f69e4c3490e54e37104e86b84302fd39
60e87652291ebb73457988437180af013503f4b2
refs/heads/master
2020-05-13T01:06:57.400699
2014-04-29T15:45:15
2014-04-29T15:45:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,829
java
package com.zed.jms.test.producer.app; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageProducer; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; public class SendJMSHeaderInfo { private ConnectionFactory connectionFactory; private Connection connection; private Session queueSession; private Destination destination; private MessageProducer producer; private static String headerQueue = "testHeaderQueue"; private static String brokerURL = ActiveMQConnectionFactory.DEFAULT_BROKER_URL; private String item; private String stage; private String stagetime; private String user; private int messageLoop; public SendJMSHeaderInfo(String item, String stage, String stagetime, String user, String messagesToSend) { this.item = item; this.stage = stage; this.stagetime = stagetime; this.user = user; this.messageLoop = Integer.parseInt(messagesToSend); } public static void main(String[] args) throws JMSException, InterruptedException { if(args.length < 5) { System.out.println("Usage: SendJMSHeaderInfo <item> <stage> <stagetime> <user>"); System.exit(0); } else { SendJMSHeaderInfo sendJMSHeaders = new SendJMSHeaderInfo(args[0], args[1], args[2], args[3], args[4]); sendJMSHeaders.createConnectionToJms(); System.out.println("about to send jms header information"); // sendJMSHeaders.sendQuitHeaderInfo(); sendJMSHeaders.sendHeaderInfo(); sendJMSHeaders.close(); System.out.println("Application closing ..."); System.exit(0); } } protected void createConnectionToJms() throws JMSException { this.connectionFactory = new ActiveMQConnectionFactory(brokerURL); this.connection = connectionFactory.createConnection(); this.connection.start(); // JMS messages are sent and received using a Session. We will // create here a non-transactional session object. this.queueSession = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE); //setup destination and producer components this.destination = this.queueSession.createQueue(headerQueue); this.producer = this.queueSession.createProducer(destination); } protected void sendQuitHeaderInfo() throws JMSException { Message message = this.queueSession.createMessage(); // message.setStringProperty("item"+i, this.item); // message.setStringProperty("stage"+i, this.stage); // message.setStringProperty("stagetime"+i, this.stagetime); message.setStringProperty("user", "quit"); //send the message this.producer.send(message); } protected void sendHeaderInfo() throws JMSException, InterruptedException { StopWatch sw = new StopWatch(); sw.start(); for (int i = 0; i < this.messageLoop; i++) { Message message = this.queueSession.createMessage(); message.setStringProperty("item"+i, this.item + " " + i); message.setStringProperty("stage"+i, this.stage+ " " + i); message.setStringProperty("stagetime"+i, this.stagetime+ " " + i); message.setStringProperty("user"+i, this.user+ " " + i); //send the message this.producer.send(message); int imsgCount = 0; imsgCount += i; System.out.println("Sending message # " + imsgCount); // Thread.sleep(200); } sw.stop(); System.out.println("Total time to send " + this.messageLoop + " with Message only and 4 properties is : " + sw.getElapsedTime() + " ms"); System.out.println("Message sent : [" + this.item + " : " + this.stage + " : " + this.stagetime + " : " + this.user + "]"); } protected void close() throws JMSException { this.connection.close(); } }
[ "david.zimmer@pinnacol.com" ]
david.zimmer@pinnacol.com
a175dc9fdaba8a92987276c1d17f784b6dd783c5
739ea3ea16a8a53981bc9bfcd7aad2c4e71c3d63
/JavaRushTasks/1.JavaSyntax/src/com/javarush/task/task09/task0918/Solution.java
f2352d7d94628e1d9e81246e688559418f26ab61
[]
no_license
AtaNatalya/Study
744615732e646a490043dd5224e128bcc7e62da6
afe6363ecc72a442869a655385c5471be70364b3
refs/heads/master
2020-03-16T03:17:08.619977
2018-10-19T16:48:10
2018-10-19T16:48:10
132,484,166
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.javarush.task.task09.task0918; /* Все свои, даже исключения */ import java.io.FileNotFoundException; public class Solution { public static void main(String[] args) { } static class MyException extends IndexOutOfBoundsException{ } static class MyException2 extends ClassNotFoundException{ } static class MyException3 extends FileNotFoundException { } static class MyException4 extends RuntimeException{ } }
[ "natalia.atanasii@ab-soft.net" ]
natalia.atanasii@ab-soft.net
65f266b9bada2c06bb5e32c0c3a076d514d35cd3
02cd2722ae6fa330005a8f42c655c0f1c2b1d816
/CCG/src/main/java/com/yukthi/ccg/xml/TypeControlledBean.java
e80d4bc0d73b48060a5c979d2c8c82d53204a050
[]
no_license
pritam285/utils
b201020fdf6f2adc4ac31dedb10be70039503141
302211e49c24ff54be7f62d37b160ccc50a6521d
refs/heads/master
2020-04-05T23:11:54.639378
2016-11-06T08:58:20
2016-11-06T08:58:20
61,019,862
0
0
null
2016-11-06T08:58:21
2016-06-13T08:21:48
Java
UTF-8
Java
false
false
111
java
package com.yukthi.ccg.xml; public interface TypeControlledBean { public Class<?> getExpectedType(); }
[ "akranthikiran@gmail.com" ]
akranthikiran@gmail.com
27b4d5778b8d3b2eb00a1ad9d5e2360f7f97ebec
e58d1c111eb2d59160b9c2350146f5531d0544c4
/src/LispEvaluator.java
026128f1d4ddc58449b556235eca30e5313aaecf
[]
no_license
posixroot/LispInterpreter
2ebd18f55d18ff398bc9f2bd899ae952bc6e5762
49c63985565c61b1f48cd680e88d90e51ccb9ad1
refs/heads/master
2021-01-17T20:53:38.290483
2015-11-25T01:58:32
2015-11-25T01:58:32
45,758,112
0
0
null
null
null
null
UTF-8
Java
false
false
28,459
java
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.HashMap; /** * Created by kiran on 10/22/15. */ public class LispEvaluator { HashMap<String, Node> dlist; public LispEvaluator() { dlist = new HashMap<>(); } public Node eval(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { return evalAtom(root, alist); } else { return evalList(root, alist); } } private Node evalList(Node root, HashMap<String,ArrayDeque<Node>> alist) { Node funNode = root.left; Node n = null; if(funNode.lexToken!=null) { String funcName = funNode.lexToken.getLiteralValue(); //System.out.println("DEBUG funcname : " + funcName); switch(funcName) { case "QUOTE": n=evalQuoteFunction(root.right, alist); break; case "COND": n=evalCondFunction(root.right, alist); break; case "CAR": if(evalCdrFunction(root.right, alist).lexToken==null || !evalCdrFunction(root.right, alist).lexToken.getLiteralValue().equals("NIL")) { System.out.println("CAR error: Too many parameters."); System.exit(0); } n=evalCarFunction(eval(evalCarFunction(root.right, alist), alist), alist); break; case "CDR": if(evalCdrFunction(root.right, alist).lexToken==null || !evalCdrFunction(root.right, alist).lexToken.getLiteralValue().equals("NIL")) { System.out.println("CDR error: Too many parameters."); System.exit(0); } n=evalCdrFunction(eval(evalCarFunction(root.right, alist), alist), alist); break; case "CONS": n=evalConsFunction(root.right, alist); break; case "ATOM": n=evalAtomFunction(root.right, alist); break; case "EQ": n=evalEqFunction(root.right, alist); break; case "INT": n=evalIntFunction(root.right, alist); break; case "NULL": n=evalNullFunction(root.right, alist); break; case "PLUS": n=evalPlusFunction(root.right, alist); break; case "MINUS": n=evalMinusFunction(root.right, alist); break; case "TIMES": n=evalTimesFunction(root.right, alist); break; case "QUOTIENT": n=evalQuotientFunction(root.right, alist); break; case "REMAINDER": n=evalRemainderFunction(root.right, alist); break; case "LESS": n=evalLessFunction(root.right, alist); break; case "GREATER": n=evalGreaterFunction(root.right, alist); break; case "DEFUN": n=updateDlist(root.right, alist); break; default: n = apply(funcName, root.right, alist); if(n==null) { System.out.println("Invalid function name!"); System.exit(0); } break; } } else { root.left = eval(root.left, alist); root.right = eval(root.right, alist); n = root; n.isList = n.right.isList; setInnerList(n); } return n; } private Node apply(String funcName, Node next, HashMap<String, ArrayDeque<Node>> alist) { if(!dlist.containsKey(funcName) //|| next.lexToken!=null ) { System.out.println("Apply error: Invalid function call arguments."); System.exit(0); } Node actualList = next; Node formalList = evalCarFunction(evalCdrFunction(dlist.get(funcName), alist), alist); if(!checkParameterCount(actualList, formalList, alist)) { System.out.println("Apply error: " + funcName + " formal/acutal parameters mismatch."); System.exit(0); } ArrayList<String> formalVarsBacktrack = new ArrayList<>(); Node actualIter = actualList, formalIter = formalList; while(actualIter.lexToken==null && formalIter.lexToken==null) { //check if there is only one variable on the left in case of formal parameter list. Node formalVar = evalCarFunction(formalIter, alist); Node actualVar = eval(evalCarFunction(actualIter, alist),alist); if (formalVar.lexToken == null //|| actualVar.lexToken == null ) { System.out.println("Apply error: Invalid formal/actual parameter list."); System.exit(0); } if (!checkValidName(formalVar) && evalInt(formalVar, alist) != null) { System.out.println("Apply error: Invalid formal parameter name"); System.exit(0); } // need to check if variable name is in dlist(function-name) ? Nope.... String formalName = formalVar.lexToken.getLiteralValue(); formalVarsBacktrack.add(formalName); if (!alist.containsKey(formalName)) { alist.put(formalName, new ArrayDeque<>()); } alist.get(formalName).addLast(actualVar); actualIter = evalCdrFunction(actualIter, alist); formalIter = evalCdrFunction(formalIter, alist); } //System.out.println("Apply Debug: formals/actuals matched and added."); Node funcBody = evalCarFunction(evalCdrFunction(evalCdrFunction(dlist.get(funcName), alist), alist), alist); Node ret = eval(funcBody, alist); for(String s : formalVarsBacktrack) { alist.get(s).removeLast(); } return ret; } private boolean checkParameterCount(Node actualList, Node formalList, HashMap<String, ArrayDeque<Node>> alist) { Node actualIter = actualList; Node formalIter = formalList; int actualCount=0, formalCount=0; while(actualIter.lexToken==null && formalIter.lexToken==null) { actualCount++; formalCount++; actualIter = evalCdrFunction(actualIter, alist); formalIter = evalCdrFunction(formalIter, alist); } if(actualIter.lexToken!=null && formalIter.lexToken!=null) { if(!actualIter.lexToken.getLiteralValue().equals("NIL") || !formalIter.lexToken.getLiteralValue().equals("NIL")) { return false; } } else { while(actualIter.lexToken==null) { /*if(evalCarFunction(actualIter, alist).lexToken!=null //&& !evalCarFunction(actualIter, alist).lexToken.getLiteralValue().equals("NIL") ) {*/ actualCount++; //} actualIter = evalCdrFunction(actualIter, alist); } if(!actualIter.lexToken.getLiteralValue().equals("NIL")) { System.out.println("Apply error: Invalid end of actual Parameter List."); System.exit(0); } while(formalIter.lexToken==null) { formalCount++; formalIter = evalCdrFunction(formalIter, alist); } } //System.out.println("Debug paramCount: actual: " + actualCount + " formalCount: " + formalCount); return actualCount==formalCount; } private Node updateDlist(Node root, HashMap<String, ArrayDeque<Node>> alist) { Node func = evalCarFunction(root, alist); if(func.lexToken==null || !checkValidName(func)) { System.out.println("Update Dlist error: Expected an atom but got list instead."); System.exit(0); } //check param and body argument counts. if(evalCdrFunction(root,alist).lexToken!=null || evalCdrFunction(evalCdrFunction(root, alist), alist).lexToken!=null || evalCdrFunction(evalCdrFunction(evalCdrFunction(root, alist), alist), alist).lexToken==null || !evalCdrFunction(evalCdrFunction(evalCdrFunction(root, alist), alist), alist).lexToken.getLiteralValue().equals("NIL") ) { System.out.println("Update Dlist error: wrong parameter list and body of new function."); System.exit(0); } //check if param names are duplicates. ArrayList<String> formalVarsBacktrace = new ArrayList<>(); Node paramList = evalCarFunction(evalCdrFunction(root, alist), alist); while(paramList.lexToken==null) { Node formalVar = evalCarFunction(paramList, alist); String formalName = formalVar.lexToken.getLiteralValue(); if(formalVarsBacktrace.contains(formalName) || !checkValidName(formalVar)) { System.out.println("Defun error: Duplicate/invalid parameter name detected."); System.exit(0); } formalVarsBacktrace.add(formalName); paramList = evalCdrFunction(paramList, alist); } //check if paramlist is ending with NIL. if(!paramList.lexToken.getLiteralValue().equals("NIL")) { System.out.println("Defun error: List end discrepancy."); System.exit(0); } dlist.put(func.lexToken.getLiteralValue(), root); System.out.println(func.lexToken.getLiteralValue()); //return root; return null; } private boolean checkValidName(Node func) { switch(func.lexToken.getLiteralValue()) { case "CAR":case "CDR": case "CONS":case "ATOM":case "EQ":case "NULL":case "INT":case "PLUS": case "MINUS":case "TIMES":case "REMAINDER":case "QUOTIENT":case "LESS":case "GREATER":case "COND": case "QUOTE":case "DEFUN":case "T":case "NIL": return false; default: return true; } } private Node evalGreaterFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { Node result = evalMinusFunction(root, alist); Node ret = new Node(new LexToken(LexTokenID.ATOM, false)); if(result.lexToken.getNumericValue()>0) { ret.lexToken.setLiteralValue("T"); ret.isList = false; ret.isInnerList = false; } else { ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; } return ret; } private Node evalLessFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { Node result = evalMinusFunction(root, alist); Node ret = new Node(new LexToken(LexTokenID.ATOM, false)); if(result.lexToken.getNumericValue()<0) { ret.lexToken.setLiteralValue("T"); ret.isList = false; ret.isInnerList = false; } else { ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; } return ret; } private Node evalRemainderFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { System.out.println("REMAINDER error: Expecting a list, but got atom instead."); System.exit(0); } Node op1 = evalInt(eval(evalCarFunction(root, alist), alist), alist); Node op2 = evalInt(eval(evalCarFunction(evalCdrFunction(root, alist), alist), alist), alist); Node op3 = evalCdrFunction(evalCdrFunction(root, alist), alist); if(op3.lexToken==null || !op3.lexToken.getLiteralValue().equals("NIL")) { System.out.println("PLUS error: Illegal parameters"); System.exit(0); } Node ret = new Node(new LexToken(LexTokenID.ATOM, true)); int rem = op1.lexToken.getNumericValue() % op2.lexToken.getNumericValue(); if((rem>=0 && op1.lexToken.getNumericValue()<0) || (rem<0 && op1.lexToken.getNumericValue()>=0)) rem *= -1; ret.lexToken.setNumericValue(rem); ret.lexToken.setLiteralValue(String.valueOf(ret.lexToken.getNumericValue())); ret.isList = false; ret.isInnerList = false; return ret; } private Node evalQuotientFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { System.out.println("QUOTIENT error: Expecting a list, but got atom instead."); System.exit(0); } Node op1 = evalInt(eval(evalCarFunction(root, alist), alist), alist); Node op2 = evalInt(eval(evalCarFunction(evalCdrFunction(root, alist), alist), alist), alist); Node op3 = evalCdrFunction(evalCdrFunction(root, alist), alist); if(op3.lexToken==null || !op3.lexToken.getLiteralValue().equals("NIL")) { System.out.println("PLUS error: Illegal parameters"); System.exit(0); } Node ret = new Node(new LexToken(LexTokenID.ATOM, true)); int quotient = op1.lexToken.getNumericValue() / op2.lexToken.getNumericValue(); ret.lexToken.setNumericValue(quotient); ret.lexToken.setLiteralValue(String.valueOf(ret.lexToken.getNumericValue())); ret.isList = false; ret.isInnerList = false; return ret; } private Node evalTimesFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { System.out.println("TIMES error: Expecting a list, but got atom instead."); System.exit(0); } Node op1 = evalInt(eval(evalCarFunction(root, alist), alist), alist); Node op2 = evalInt(eval(evalCarFunction(evalCdrFunction(root, alist), alist), alist), alist); Node op3 = evalCdrFunction(evalCdrFunction(root, alist), alist); if(op3.lexToken==null || !op3.lexToken.getLiteralValue().equals("NIL")) { System.out.println("PLUS error: Illegal parameters"); System.exit(0); } Node ret = new Node(new LexToken(LexTokenID.ATOM, true)); int mult = op1.lexToken.getNumericValue() * op2.lexToken.getNumericValue(); ret.lexToken.setNumericValue(mult); ret.lexToken.setLiteralValue(String.valueOf(ret.lexToken.getNumericValue())); ret.isList = false; ret.isInnerList = false; return ret; } private Node evalMinusFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { System.out.println("MINUS error: Expecting a list, but got atom instead."); System.exit(0); } Node op1 = evalInt(eval(evalCarFunction(root, alist), alist), alist); Node op2 = evalInt(eval(evalCarFunction(evalCdrFunction(root, alist), alist), alist), alist); Node op3 = evalCdrFunction(evalCdrFunction(root, alist), alist); if(op3.lexToken==null || !op3.lexToken.getLiteralValue().equals("NIL")) { System.out.println("PLUS error: Illegal parameters"); System.exit(0); } Node ret = new Node(new LexToken(LexTokenID.ATOM, true)); int diff = op1.lexToken.getNumericValue() - op2.lexToken.getNumericValue(); ret.lexToken.setNumericValue(diff); ret.lexToken.setLiteralValue(String.valueOf(ret.lexToken.getNumericValue())); ret.isList = false; ret.isInnerList = false; return ret; } private Node evalPlusFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { System.out.println("PLUS error: Expecting a list, but got atom instead."); System.exit(0); } Node op1 = evalInt(eval(evalCarFunction(root, alist), alist), alist); Node op2 = evalInt(eval(evalCarFunction(evalCdrFunction(root, alist), alist), alist), alist); Node op3 = evalCdrFunction(evalCdrFunction(root, alist), alist); if(op3.lexToken==null || !op3.lexToken.getLiteralValue().equals("NIL")) { System.out.println("PLUS error: Illegal parameters"); System.exit(0); } Node ret = new Node(new LexToken(LexTokenID.ATOM, true)); int sum = op1.lexToken.getNumericValue() + op2.lexToken.getNumericValue(); ret.lexToken.setNumericValue(sum); ret.lexToken.setLiteralValue(String.valueOf(ret.lexToken.getNumericValue())); ret.isList = false; ret.isInnerList = false; return ret; } private Node evalConsFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { System.out.println("CONS error: Expecting a list, but got atom instead."); System.exit(0); } Node leftTree = eval(evalCarFunction(root, alist), alist); Node rightTree = eval(evalCarFunction(evalCdrFunction(root, alist), alist), alist); Node nullTree = evalCdrFunction(evalCdrFunction(root, alist), alist); if(nullTree.lexToken==null || !nullTree.lexToken.getLiteralValue().equals("NIL")) { System.out.println("CONS error: More than 2 parameters detected."); System.exit(0); } Node ret = new Node(leftTree, rightTree); ret.isList = ret.right.isList; setInnerList(ret); return ret; } private void setInnerList(Node node) { Node right = node.right; Node left = node.left; node.isInnerList = (right.lexToken==null? right.isInnerList : right.lexToken.getLiteralValue().equals("NIL"))&&((left.lexToken==null)? left.isInnerList : true); } private Node evalCdrFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { root = eval(root, alist); if(root.lexToken!=null) { System.out.println("CDR error: Expecting a list, but got atom instead."); System.exit(0); } } return root.right; } private Node evalCarFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { root = eval(root, alist); if(root.lexToken!=null) { System.out.println("CAR error: Expecting a list, but got atom instead."); System.exit(0); } } return root.left; } private Node evalCondFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null) { System.out.println("COND error: Expecting a list, but got atom instead."); System.out.println("DEBUG COND: Failed at 1"); System.exit(0); } Node pair = evalCarFunction(root, alist); if(pair.lexToken!=null) { //error because we are expecting a pair(list) System.out.println("COND error: Expecting a list, but got atom instead."); System.out.println("DEBUG COND: Failed at 2"); //(COND.( (NIL.6).(T.4) )) fails here but not (COND.( (NIL.6).((T.4).NIL) )) System.exit(0); } Node conditionResult = eval(evalCarFunction(pair, alist), alist); if(conditionResult.lexToken==null){ //error expcting a T or NIL System.out.println("COND error: Expecting T or NIL, but got a list instead."); System.out.println("DEBUG COND: Failed at 3"); System.exit(0); } if(conditionResult.lexToken.getLiteralValue().equals("T")) { //check for more elements Node check = eval(evalCdrFunction(evalCdrFunction(pair, alist), alist), alist); if(check.lexToken==null || !check.lexToken.getLiteralValue().equals("NIL")) { System.out.println("COND error: Too many arguments"); System.exit(0); } return eval(evalCarFunction(evalCdrFunction(pair, alist), alist), alist); } else if(conditionResult.lexToken.getLiteralValue().equals("NIL")) { return evalCondFunction(evalCdrFunction(root, alist), alist); } else { //error only expecting T or NIL System.out.println("COND error: Expecting T or NIL."); System.out.println("DEBUG COND: Failed at 4"); System.exit(0); return null; } } private Node evalQuoteFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken!=null || root.right.lexToken==null || !root.right.lexToken.getLiteralValue().equals("NIL")) { System.out.println("QUOTE error: More than 1 parameter detected."); System.exit(0); } return evalCarFunction(root, alist); } private Node evalAtomFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { Node ret = new Node(new LexToken(LexTokenID.ATOM, false)); Node result = eval(evalCarFunction(root, alist), alist); if(evalCdrFunction(root, alist).lexToken!=null && evalCdrFunction(root, alist).lexToken.getLiteralValue().equals("NIL")) { if (result.left == null && result.right == null && result.lexToken != null) { ret.lexToken.setLiteralValue("T"); ret.isList = false; ret.isInnerList = false; return ret; } } ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; return ret; } private Node evalIntFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { Node ret = new Node(new LexToken(LexTokenID.ATOM, false)); Node result = eval(evalCarFunction(root, alist), alist); if(evalCdrFunction(root, alist).lexToken==null || !evalCdrFunction(root, alist).lexToken.getLiteralValue().equals("NIL")) { System.out.println("INT error: Too many parameters."); System.exit(0); } if(result.lexToken==null) { ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; return ret; } if(!result.lexToken.isNumericAtom) { ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; return ret; } int numval = -1; try { numval = Integer.parseInt(result.lexToken.getLiteralValue()); } catch (Exception e) { System.out.println("Int error: Invalid numeric Atom!"); System.exit(0); } ret.lexToken.setLiteralValue("T"); ret.isList = false; ret.isInnerList = false; return ret; } private Node evalNullFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { //check if the argument is a list Node list = eval(evalCarFunction(root, alist), alist); Node ret = new Node(new LexToken(LexTokenID.ATOM, false)); if(evalCdrFunction(root, alist).lexToken==null || !evalCdrFunction(root, alist).lexToken.getLiteralValue().equals("NIL")) { System.out.println("Null error: Too many parameters."); System.exit(0); } if(list.lexToken!=null) { list = eval(list, alist); } if(list.lexToken!=null) { if(list.lexToken.getLiteralValue().equals("NIL")) { ret.lexToken.setLiteralValue("T"); ret.isList = false; ret.isInnerList = false; return ret; } else { System.out.println("NULL error: Expecting a list, but got an atom instead."); System.exit(0); } } ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; return ret; } private Node evalEqFunction(Node root, HashMap<String,ArrayDeque<Node>> alist) { //check if it is a list and not an atom if(root.left==null || root.right==null || root.lexToken!=null) { System.out.println("EQ error: Expecting a list, but got an atom instead."); System.exit(0); } Node lop = eval(evalCarFunction(root, alist), alist); Node rop = eval(evalCarFunction(evalCdrFunction(root, alist), alist), alist); Node nullop = eval (evalCdrFunction(evalCdrFunction(root, alist), alist) , alist); if(nullop.lexToken==null || !nullop.lexToken.getLiteralValue().equals("NIL")) { System.out.println("EQ error: Too many parameters."); System.exit(0); } Node ret = new Node(new LexToken(LexTokenID.ATOM, false)); if(lop.lexToken==null || rop.lexToken==null) { System.out.println("EQ error: atom expected but got a list."); System.exit(0); } if(lop.lexToken.isNumericAtom ^ rop.lexToken.isNumericAtom) { System.out.println("EQ error: Numeric Atom cannot be compared to Literal Atom"); System.exit(0); } if(lop.lexToken.isNumericAtom) { lop = evalInt(lop, alist); rop = evalInt(rop, alist); if (lop.lexToken.getNumericValue() == rop.lexToken.getNumericValue()) { ret.lexToken.setLiteralValue("T"); ret.isList = false; ret.isInnerList = false; } else { ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; } } else { if (lop.lexToken.getLiteralValue().equals(rop.lexToken.getLiteralValue())) { ret.lexToken.setLiteralValue("T"); ret.isList = false; ret.isInnerList = false; } else { ret.lexToken.setLiteralValue("NIL"); ret.isList = true; ret.isInnerList = true; } } return ret; } private Node evalInt(Node root, HashMap<String,ArrayDeque<Node>> alist) { //check that there is only one element if(root.lexToken==null) { System.out.println("Illegal List - Expected an atom!"); System.exit(0); } String s = root.lexToken.getLiteralValue(); int numval = -1; try { numval = Integer.parseInt(s); } catch (Exception e) { System.out.println("Invalid numeric Atom!"); System.exit(0); } root.lexToken.setNumericValue(numval); return root; } private Node evalAtom(Node root, HashMap<String,ArrayDeque<Node>> alist) { if(root.lexToken==null) { System.out.println("Expecting an atom, but got a list instead."); System.exit(0); } String s = root.lexToken.getLiteralValue(); if(s.equals("T")) { return root; } else if(s.equals("NIL")) { return root; } else if(root.lexToken.isNumericAtom){ return evalInt(root, alist); } else { //implement bound and getval if(bound(s, alist)) { Node ret = getVal(s, alist); if(ret.lexToken!=null && ret.lexToken.isNumericAtom) { return evalInt(ret, alist); } return ret; } System.out.println("Unidentified Atom!"); System.exit(0); return null; } } private Node getVal(String s, HashMap<String, ArrayDeque<Node>> alist) { return alist.get(s).getLast(); } private boolean bound(String s, HashMap<String, ArrayDeque<Node>> alist) { if(alist.containsKey(s) && !alist.get(s).isEmpty()) { return true; } return false; } }
[ "kiranbny@gmail.com" ]
kiranbny@gmail.com
6eebf50d6e82e29796d9f7bacd074c00e2b2baf8
68e8295e66b48e2960dea8020970eeb332c64646
/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java
fdf364868cbeb9e6002dabc6bd446d7fd106e02a
[ "BSD-2-Clause" ]
permissive
highsource/jaxb2-basics
52aeed82cf39b898128df3a037ed0b33e061a056
77fc1a3d5b3561af68d19ebe8e01adb9d567f5bd
refs/heads/master
2023-08-30T12:00:57.009957
2023-06-30T14:11:52
2023-06-30T14:11:52
24,514,964
99
56
BSD-2-Clause
2023-06-30T14:11:53
2014-09-26T20:50:41
Java
UTF-8
Java
false
false
3,275
java
package org.jvnet.jaxb2_commons.xml.bind.model.util; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jvnet.jaxb2_commons.lang.StringUtils; import org.jvnet.jaxb2_commons.lang.Validate; import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; public class PackageInfoQNameAnalyzer<T, C extends T> { private final MModelInfo<T, C> modelInfo; public PackageInfoQNameAnalyzer(MModelInfo<T, C> modelInfo) { Validate.notNull(modelInfo); this.modelInfo = modelInfo; } public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { final NamespaceURICounter counter = new NamespaceURICounter(); final QNameCollector collector = new QNameCollector() { public void element(QName name) { counter.add(name.getNamespaceURI()); } public void attribute(QName name) { } }; collectNamespaceURIs(packageInfo, collector); return counter.getMostUsedNamespaceURI(); } public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { final NamespaceURICounter counter = new NamespaceURICounter(); final QNameCollector collector = new QNameCollector() { public void element(QName name) { } public void attribute(QName name) { counter.add(name.getNamespaceURI()); } }; collectNamespaceURIs(packageInfo, collector); return counter.getMostUsedNamespaceURI(); } private void collectNamespaceURIs(MPackageInfo packageInfo, final QNameCollector collector) { for (MElementInfo<T, C> elementInfo : modelInfo.getElementInfos()) { if (elementInfo.getPackageInfo() == packageInfo) { collector.element(elementInfo.getElementName()); } } final QNameCollectingPropertyInfoVisitor<T, C> visitor = new QNameCollectingPropertyInfoVisitor<T, C>( collector); for (MClassInfo<T, C> classInfo : modelInfo.getClassInfos()) { if (classInfo.getPackageInfo() == packageInfo) { for (MPropertyInfo<T, C> propertyInfo : classInfo .getProperties()) { propertyInfo.acceptPropertyInfoVisitor(visitor); } } } } private static class NamespaceURICounter { private Map<String, Integer> map = new HashMap<String, Integer>(); public void add(String namespaceURI) { final Integer count = map.get(namespaceURI); if (count == null) { map.put(namespaceURI, Integer.valueOf(1)); } else { map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); } } public String getMostUsedNamespaceURI() { String namespaceURI = null; int count = 0; for (Map.Entry<String, Integer> e : map.entrySet()) { final String currentNamespaceURI = e.getKey(); final int currentCount = e.getValue(); if (namespaceURI == null) { namespaceURI = currentNamespaceURI; count = currentCount; } else { if (currentCount > count || (currentCount == count && namespaceURI == null)) { namespaceURI = currentNamespaceURI; count = currentCount; } } } return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; } } }
[ "aleksei.valikov@gmail.com" ]
aleksei.valikov@gmail.com
eab08590e2e9d0e931bdba32fa9226a9c0ad16fa
6ed3d3ec7861c3471747b1307d48b8f8e9d3f38f
/src/microsoft/exchange/webservices/data/ItemWrapper.java
3b5ad7cf7d2c86b04dfb84b75236c365c4439f9e
[]
no_license
msld/EWS-Java-API
583c49a27e72f7282c07cde9439039941e843815
146467ed1a9b3684c038467fcc5265654460541d
refs/heads/master
2021-01-23T18:10:47.029613
2013-05-30T12:16:13
2013-05-30T12:16:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,613
java
/************************************************************************** * copyright file="ItemWrapper.java" company="Microsoft" * Copyright (c) Microsoft Corporation. All rights reserved. * * Defines the ItemWrapper.java. **************************************************************************/ package microsoft.exchange.webservices.data; import microsoft.exchange.webservices.data.exceptions.ServiceLocalException; /*** * Represents an item Id provided by a ItemBase object. */ class ItemWrapper extends AbstractItemIdWrapper { /*** *The ItemBase object providing the Id. */ private Item item; /** * * Initializes a new instance of ItemWrapper. * * @param item * the item * @throws ServiceLocalException * the service local exception */ protected ItemWrapper(Item item) throws ServiceLocalException { EwsUtilities .EwsAssert(item != null, "ItemWrapper.ctor", "item is null"); EwsUtilities.EwsAssert(!item.isNew(), "ItemWrapper.ctor", "item does not have an Id"); this.item = item; } /*** *Obtains the ItemBase object associated with the wrapper. * * @return The ItemBase object associated with the wrapper */ public Item getItem() { return this.item; } /** * * Writes the Id encapsulated in the wrapper to XML. * * @param writer * the writer * @throws Exception * the exception */ @Override protected void writeToXml(EwsServiceXmlWriter writer) throws Exception { this.item.getId().writeToXml(writer); } }
[ "therion66" ]
therion66
2f8b9cc9b0d103e6a5bdf01bc199b307598cbf1f
0a404f92b370ac31e79d944694f3c5931d5a5aa3
/src/main/java/br/aplicacao/eletrica/servico/report/ReportUtils.java
50fe12df44e4a88bddf5ecb2752b36726f4d0e51
[]
no_license
chrisprojetoseletricos/Eletrica7
e517f02abf59b3a01fa9aff52c56db6d2614ce03
4d1556caa6aa55d1279d1b5c969681bcfe82a65e
refs/heads/master
2020-04-01T02:25:09.245045
2018-10-15T17:02:37
2018-10-15T17:02:37
152,778,128
0
0
null
null
null
null
UTF-8
Java
false
false
3,919
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 br.aplicacao.eletrica.servico.report; import java.awt.BorderLayout; import java.io.InputStream; import java.sql.Connection; import java.util.Map; import javax.swing.JFrame; import net.sf.jasperreports.engine.JRDataSource; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.swing.JRViewer; /** * * @author chris */ public class ReportUtils { /** * Abre um relatório usando uma conexão como datasource. * * @param titulo Título usado na janela do relatório. * @param inputStream InputStream que contém o relatório. * @param parametros Parâmetros utilizados pelo relatório. * @param conexao Conexão utilizada para a execução da query. * @throws JRException Caso ocorra algum problema na execução do relatório */ public static void openReport( String titulo, InputStream inputStream, Map parametros, Connection conexao) throws JRException { /* * Cria um JasperPrint, que é a versão preenchida do relatório, * usando uma conexão. */ System.out.println("inputStream: " + inputStream); System.out.println("parametros: " + parametros); System.out.println("conexao: " + conexao); @SuppressWarnings("unchecked") JasperPrint print = JasperFillManager.fillReport( inputStream,// parametros,// conexao); // abre o JasperPrint em um JFrame viewReportFrame(titulo, print); } /** * Abre um relatório usando um datasource genérico. * * @param titulo Título usado na janela do relatório. * @param inputStream InputStream que contém o relatório. * @param parametros Parâmetros utilizados pelo relatório. * @param dataSource Datasource a ser utilizado pelo relatório. * @throws JRException Caso ocorra algum problema na execução do relatório */ public static void openReport( String titulo, InputStream inputStream, Map parametros, JRDataSource dataSource) throws JRException { /* * Cria um JasperPrint, que é a versão preenchida do relatório, * usando um datasource genérico. */ @SuppressWarnings("unchecked") JasperPrint print = JasperFillManager.fillReport( inputStream,// parametros,// dataSource); // abre o JasperPrint em um JFrame viewReportFrame(titulo, print); } /** * Cria um JFrame para exibir o relatório representado pelo JasperPrint. * * @param titulo Título do JFrame. * @param print JasperPrint do relatório. */ private static void viewReportFrame(String titulo, JasperPrint print) { /* * Cria um JRViewer para exibir o relatório. * Um JRViewer é uma JPanel. */ JRViewer viewer = new JRViewer(print); // cria o JFrame JFrame frameRelatorio = new JFrame(titulo); // adiciona o JRViewer no JFrame frameRelatorio.add(viewer, BorderLayout.CENTER); // configura o tamanho padrão do JFrame frameRelatorio.setSize(500, 500); // maximiza o JFrame para ocupar a tela toda. frameRelatorio.setExtendedState(JFrame.MAXIMIZED_BOTH); // configura a operação padrão quando o JFrame for fechado. frameRelatorio.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // exibe o JFrame frameRelatorio.setVisible(true); } }
[ "chris@chris" ]
chris@chris
0c4e6b4a995923db2bc771d7106fe311bd9271fa
c26b12302d6cc4e75dcf3e51429d0177043c1aeb
/light-core/src/main/java/com/lamp/light/handler/DefaultCall.java
545b831f0cd313810c81ee3274c6a20167656378
[]
no_license
Conlin569/light
08f1279a657b019dc3ebc93c025771c0c9d560d7
4f455d81d22d6f737003fde3394e302d7ff5902f
refs/heads/master
2023-04-28T18:52:25.700878
2021-05-12T08:27:41
2021-05-12T08:27:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,062
java
package com.lamp.light.handler; import java.net.InetSocketAddress; import com.lamp.light.Call; import com.lamp.light.Callback; import com.lamp.light.netty.NettyClient; import com.lamp.light.response.Response; import com.lamp.light.response.ReturnMode; public class DefaultCall<T> implements Call<T> { private AsynReturn asynReturn; private NettyClient nettyClient; private Callback<T> callback; private Response<T> response; private InetSocketAddress inetSocketAddress; private Throwable throwable; public DefaultCall(AsynReturn asynReturn, NettyClient nettyClient,InetSocketAddress inetSocketAddress ) { this.asynReturn = asynReturn; this.nettyClient = nettyClient; this.inetSocketAddress = inetSocketAddress; } @Override public Response<T> execute() { nettyClient.write(asynReturn, inetSocketAddress); asynReturn.setReturnMode(ReturnMode.CALL_SYNS); return null; } @Override public void execute(Callback<T> callback) { this.callback = callback; nettyClient.write(asynReturn, inetSocketAddress); asynReturn.setReturnMode(ReturnMode.CALL_ASYNS); } @Override public boolean isExecuted() { return false; } @Override public void cancel() { } @Override public boolean isCanceled() { return false; } public Callback<T> getCallback() { return callback; } public Response<T> getResponse() { return response; } public void setResponse(Response<T> response) { this.response = response; } public void setThrowable(Throwable throwable) { this.throwable = throwable; } public Throwable getThrowable() { return throwable; } @Override public void throwThrowable() { throw new RuntimeException(throwable); } @Override public boolean isSuccess() { return throwable == null; } }
[ "2372554140@qq.com" ]
2372554140@qq.com
a7a0be64eea36e80b3e31aacbc0e77a5a00e5f4e
d2c3b9408d7209497dc7780a5835bfac8ea66415
/src/main/java/nl/hsleiden/persistence/CartDAO.java
05845fa0a46fab88c1716b2cd4fcd5f9ef6afb42
[]
no_license
meesk/webshop-api
adcae569626716d0eb987af63f5f09a8494e2921
d3e9f0f03dce4693f0de40ccc3d67fc6dcb028bb
refs/heads/master
2021-09-10T07:45:17.048381
2018-03-22T10:03:25
2018-03-22T10:03:25
116,179,188
0
0
null
null
null
null
UTF-8
Java
false
false
3,499
java
package nl.hsleiden.persistence; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.inject.Inject; import javax.inject.Singleton; import nl.hsleiden.model.Product; /** * * @author Mees Kluivers */ @Singleton public class CartDAO { private final List<Product> products; private final Database db; @Inject public CartDAO() { products = new ArrayList<>(); db = new Database(); } public List<Product> getCart(int id){ List<Product> productsInCart = new ArrayList<Product>(); try{ Connection con = db.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT p.* FROM product p JOIN cart c ON c.product_id = p.prod_nummer JOIN gebruiker g ON c.gebruiker_id = g.gebruiker_id WHERE g.gebruiker_id = ?"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); Product product; while(rs.next()){ product = new Product(); product.setProdNaam(rs.getString("prod_naam")); product.setProdBeschrijving(rs.getString("prod_beschrijving")); product.setProdNummer(rs.getInt("prod_nummer")); product.setProdAfbeelding(rs.getString("prod_afbeelding")); product.setProdPrijs(rs.getDouble("prod_prijs")); productsInCart.add(product); } db.closeConnection(con); return productsInCart; }catch(SQLException e){ e.printStackTrace(); return null; } } public void addCart(int prodId, int userId){ try{ Connection con = db.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO cart (product_id, gebruiker_id) VALUES (?,?);"); ps.setInt(1, prodId); ps.setInt(2, userId); ps.execute(); db.closeConnection(con); }catch(SQLException e){ e.printStackTrace(); } } public void deleteCart(int prodId, int userId){ try{ Connection con = db.getConnection(); PreparedStatement ps = con.prepareStatement("DELETE FROM cart WHERE product_id = ? AND gebruiker_id = ? limit 1"); ps.setInt(1, prodId); ps.setInt(2, userId); ps.execute(); db.closeConnection(con); }catch(SQLException e){ e.printStackTrace(); } } public void deleteAll(int userId){ try{ Connection con = db.getConnection(); PreparedStatement ps = con.prepareStatement("DELETE FROM cart WHERE gebruiker_id = ?"); ps.setInt(1, userId); ps.execute(); db.closeConnection(con); }catch(SQLException e){ e.printStackTrace(); } } public void updateCart(int prodId, int userId){ try{ Connection con = db.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE cart SET product_id = ? WHERE gebruiker_id = ?"); ps.setInt(1, prodId); ps.setInt(2, userId); ps.execute(); db.closeConnection(con); }catch(SQLException e){ e.printStackTrace(); } } }
[ "meeskluivers@gmail.com" ]
meeskluivers@gmail.com
b801b15f93989719242ba55099b198aa75102a4b
922cbfd75ee7f6597e12373be7e345af631906bc
/JiKeService/src/com/jike/common/MD5.java
ba564e66aaa685695a543f77c890c00206277d28
[]
no_license
jameschinese/JIkeDream
f1d968894c5ccac9baefd3b6c07be2d0a1e2586f
e164f6605e9d5e6ca1f433babe8acd0c36457988
refs/heads/master
2021-01-17T22:04:58.542868
2015-05-22T12:11:16
2015-05-22T12:11:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package com.jike.common; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * 加密类 * @author Administrator * */ public class MD5 { public String str; public String transFormMD5(String text) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(text.getBytes()); byte b[] = md.digest(); int x; StringBuffer buf = new StringBuffer(""); for (int i = 0; i < b.length; i++) { x = b[i]; if (x < 0) x += 256; if (x < 16) buf.append("0"); buf.append(Integer.toHexString(x)); } str = buf.toString(); return buf.toString(); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ""; } }
[ "929280059@qq.com" ]
929280059@qq.com
3bf30ad44e9b6a3faf805af34904a178d4cb5ce5
507b3d378915763731ca0dcfd512bc19d3e48ac7
/src/main/java/items/Torch.java
8835777c2da74c244779870b5363dc5ee8d34533
[]
no_license
uigiporc/TextAdventure
c7548779fd5823449c97f1b3fec8f03e62680fff
5612a875b9dcc33198a05e7713713971cb88a3d3
refs/heads/master
2022-11-08T22:40:52.098719
2020-06-29T15:21:33
2020-06-29T15:21:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
963
java
package items; import engine.GameProgress; import engine.Inventory; import gui.UIHandler; import util.LightStatus; import java.util.ResourceBundle; public class Torch extends Item{ private static final long serialVersionUID = -317659910826339075L; public void use() { Thread torchTurnOn = new Thread(itemUsedThreads, this); torchTurnOn.start(); } @Override public void run() { GameProgress.setPlayerLight(LightStatus.BRIGHT); UIHandler.printInFrame(ResourceBundle.getBundle("bundles/itemsUsage").getString("torchOn")); Inventory.getInventory().removeFromBag(this.getItemName()); try { Thread.sleep(180_000); UIHandler.printInFrame(ResourceBundle.getBundle("bundles/itemsUsage").getString("torchOff")); } catch (InterruptedException e) { //If the thread is interrupted, we act like if the torch ran out, entering the finally block. Thread.currentThread().interrupt(); } finally { GameProgress.resetPlayerLight(); } } }
[ "porcelli995@gmail.com" ]
porcelli995@gmail.com
a84adc878bd61c104aa4b9bb2b13f144fbbd794d
a9b237008cfacf89f38cba9cd5df7ed5fbebdbb5
/frontend/LiTHeLunch/src/se/serp/LiULunch/MenuParser.java
c2a5a456b5595d81fc3c79fb7cd78d10dbcb337a
[]
no_license
serpis/LiTHe-Lunch
3d751719f6ede08ed80965a88dde63c1e0773eaa
fe097b23ac40af100265c6d490bc343580dacecb
refs/heads/master
2016-09-06T10:39:22.710007
2012-09-01T20:34:35
2012-09-01T20:34:35
3,396,245
1
0
null
null
null
null
UTF-8
Java
false
false
1,910
java
package se.serp.LiULunch; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class MenuParser { private static Calendar parseDate(JSONObject jsonDate) throws JSONException { return new GregorianCalendar(jsonDate.getInt("year"), jsonDate.getInt("month") - 1, jsonDate.getInt("day")); } private static RestaurantDayMenu parseRestaurantDayMenu(JSONObject jsonRestaurantDayMenu) throws JSONException { String restaurantName = jsonRestaurantDayMenu.getString("name"); ArrayList<Dish> dishList = new ArrayList<Dish>(); JSONArray dishes = jsonRestaurantDayMenu.getJSONArray("dishes"); for (int j = 0; j < dishes.length(); j++) { JSONObject dish = dishes.getJSONObject(j); String price = dish.getString("price"); String dishName = dish.getString("name"); dishList.add(new Dish(dishName, price)); } return new RestaurantDayMenu(restaurantName, dishList.toArray(new Dish[0])); } private static DayMenu parseDayMenu(JSONObject jsonDayMenu) throws JSONException { ArrayList<RestaurantDayMenu> restaurantDayMenus = new ArrayList<RestaurantDayMenu>(); Calendar date = parseDate(jsonDayMenu.getJSONObject("date")); JSONArray jsonRestaurantDayMenus = jsonDayMenu.getJSONArray("menus"); for (int i = 0; i < jsonRestaurantDayMenus.length(); i++) { restaurantDayMenus.add(parseRestaurantDayMenu(jsonRestaurantDayMenus.getJSONObject(i))); } return new DayMenu(date, restaurantDayMenus.toArray(new RestaurantDayMenu[0])); } public static DayMenu[] parseDayMenus(JSONArray root) throws JSONException { ArrayList<DayMenu> dayMenus = new ArrayList<DayMenu>(); for (int i = 0; i < root.length(); i++) { dayMenus.add(parseDayMenu(root.getJSONObject(i))); } return (DayMenu[])dayMenus.toArray(new DayMenu[0]); } }
[ "serp@faa19bf1-cec3-42f2-b97a-75b8b971c877" ]
serp@faa19bf1-cec3-42f2-b97a-75b8b971c877
5526270880dce2dbd8e2fb9a143441a8cc86150e
77f41106d18d9d2fd2ca85c18531f7e30e6968a8
/chorus/model/src/main/java/com/infoclinika/mssharing/model/extraction/MsFunctionExtractionContentExpert.java
cf59fb0cdecfa7b66e6b93d2e61e4c9c73669d65
[]
no_license
StratusBioSciences/chorus
a8abaa7ab1e9e8f6d867d327c7ec26e804e6fe0b
c9d8099419733314c0166980ee6270563a212383
refs/heads/master
2021-01-20T12:41:17.996158
2017-05-05T13:33:37
2017-05-05T13:33:37
90,378,816
0
4
null
2019-05-08T17:09:36
2017-05-05T13:32:47
Java
UTF-8
Java
false
false
374
java
package com.infoclinika.mssharing.model.extraction; import com.infoclinika.analysis.storage.cloud.CloudStorageItemReference; import java.util.Set; /** * @author andrii.loboda */ public interface MsFunctionExtractionContentExpert { CloudStorageItemReference selectMatchingMS2Filter(Set<CloudStorageItemReference> translatedContents, final double groupPrecursor); }
[ "vladimir.moiseiev@teamdev.com" ]
vladimir.moiseiev@teamdev.com
464011006e8881ff455e5c87c3dc023b3dc7e731
315515c0e4f1971a92f7f2b3787ff09e3750946b
/src/test/java/MyTest.java
445d383f422ac5b656e7bccc8783d2c9802cf1d3
[]
no_license
linmt/spring_01
24a71887b53c914547fe161eeb0fc4725c73f0a5
98a56f4b5d9fef278ac3e3727792ab882039a1a6
refs/heads/master
2020-04-02T09:35:46.924212
2018-10-24T07:47:44
2018-10-24T07:47:44
154,300,212
0
0
null
null
null
null
UTF-8
Java
false
false
761
java
import com.lmt.dao.CostDao; import com.lmt.entity.Cost; import org.junit.Test; import org.springframework.test.annotation.Rollback; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; /** * Created by 张洲徽 on 2018/10/24. */ public class MyTest extends BaseJunit4Test{ @Resource //自动注入,默认按名称 private CostDao costdao; @Test //标明是测试方法 @Transactional //标明此方法需使用事务 @Rollback(true) //标明使用完此方法后事务不回滚,true时为回滚 public void find( ) { List<Cost> list=costdao.findAll(); for (Cost cost:list) { System.out.println(cost.getName()); } } }
[ "43060283+linmt@users.noreply.github.com" ]
43060283+linmt@users.noreply.github.com
f0bb04bbf7b21f19202b2561e7aac139c59389bb
629871b7cb4fc74dcc13c3b2e5f20b233bd39caf
/src/main/java/chatter/client/ChatBotHelper.java
b71281aef6a1e76ad72ec0526c52e3dfc79656ad
[]
no_license
manojkhanwalkar/jabber
2e90f3bc83844e2a6459bce78bc5011465fe0c83
6dac212822847ae63058612c6704ae6cb20d05e4
refs/heads/master
2022-11-05T08:47:58.623236
2020-06-26T22:41:08
2020-06-26T22:41:08
266,450,374
0
0
null
null
null
null
UTF-8
Java
false
false
3,545
java
package chatter.client; import chatter.data.Packet; import util.JSONUtil; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.Socket; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class ChatBotHelper { public ChatBotHelper() { } static class ReceiverHandler implements Runnable { BufferedReader in; QueryProcessor queryProcessor; public ReceiverHandler(Socket socket) { try { in = new BufferedReader( new InputStreamReader( socket.getInputStream() ) ); } catch (IOException e) { e.printStackTrace(); } queryProcessor = new QueryProcessor(socket); } public void run() { while(true) { String line = null; try { line = in.readLine(); } catch (IOException e) { e.printStackTrace(); } if( line != null ) { System.out.println( "Query Received " + line ); queryProcessor.process(line); // line = in.readLine(); } } } } static class QueryProcessor { PrintStream out; String user; public QueryProcessor(Socket socket) { // Create input and output streams to read from and write to the server try { out = new PrintStream(socket.getOutputStream()); user = System.getProperty("user"); out.println(user); out.flush(); init(); } catch (IOException e) { e.printStackTrace(); } } Map<String, String> answers = new HashMap<>(); private void init() { for (int i = 0; i < 10; i++) { answers.put("Q" + i, "A" + i); } } ExecutorService pool = Executors.newFixedThreadPool(10); public void process(String query) { CompletableFuture.runAsync(() -> { Packet input = (Packet) JSONUtil.fromJSON(query, Packet.class); String answer = answers.getOrDefault(input.getMessage(), "Unable t answer"); Packet packet = new Packet(); packet.setFrom(user); packet.setTo(input.getFrom()); packet.setMessage(answer); synchronized (out) { out.println(JSONUtil.toJSON(packet)); out.flush(); } }, pool); } } Socket socket; public void start() { String server = "localhost"; try { // Connect to the server socket = new Socket( server, 5000 ); ReceiverHandler receiverHandler = new ReceiverHandler(socket); CompletableFuture.runAsync(receiverHandler); } catch( Exception e ) { e.printStackTrace(); } } public void stop() { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "manoj.khanwalkar@gmail.com" ]
manoj.khanwalkar@gmail.com
9f9b55bd9a755b5376d5198952859c2e07e4c498
029a60dd1daeac58f1683503d70f9a756d550bbc
/level07/src/main/java/lesson06/task01/com/javarush/test/level07/lesson06/task01/Solution.java
5fcde82db90a6575058518dd8d232682c820ab72
[]
no_license
Borislove/JavaRush-1
4d66837bd07697299d97c234b751c0310ea57042
752373a5972c32e57fa1bffa60013a0da9e49b67
refs/heads/master
2023-05-03T12:32:29.577155
2021-05-24T13:12:55
2021-05-24T13:12:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,031
java
package lesson06.task01.com.javarush.test.level07.lesson06.task01; /* 5 различных строчек в списке 1. Создай список строк. 2. Добавь в него 5 различных строчек. 3. Выведи его размер на экран. 4. Используя цикл выведи его содержимое на экран, каждое значение с новой строки. */ import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public class Solution { public static void main(String[] args) throws Exception { //Напишите тут ваш код ArrayList<String> strings = new ArrayList<String> (); strings.add ("a1"); strings.add ("a2"); strings.add ("a3"); strings.add ("a4"); strings.add ("a5"); System.out.println (strings.size ()); for (int i = 0; i < strings.size (); i++) { System.out.println (strings.get(i)); } } }
[ "krohmal_kirill@mail.ru" ]
krohmal_kirill@mail.ru
bc372144790a5132e4afdeb644c6b3eb6b8b165c
997da64b6d133469d834cc900e14480a3f47ddd9
/presentation/src/main/java/com/lemon/lemonmovies/model/detail/credits/PersonCreditDataModel.java
a2000321ad929d7b2b5cff2246e27cb2f9fded9b
[]
no_license
Anarbekovs/lemovie
3bc2b0638b08184c9b5893ba6473d200f1e2a3a3
f052b450ccf59d0fa029c516bd03fbb1295be916
refs/heads/master
2020-04-14T21:18:15.923183
2019-01-07T06:25:17
2019-01-07T06:25:17
164,123,915
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
package com.lemon.lemonmovies.model.detail.credits; /** * Model that represents Person Credit in presentation-layer */ public final class PersonCreditDataModel { private final int mId; private final String mName; private final String mCharacter; private final String mPhoto; public PersonCreditDataModel(int id, String name, String character, String photo) { this.mId = id; this.mName = name; this.mCharacter = character; this.mPhoto = photo; } public int getId() { return mId; } public String getName() { return mName; } public String getCharacter() { return mCharacter; } public String getPhoto() { return mPhoto; } }
[ "staauis1@gmail.com" ]
staauis1@gmail.com
e96249e68c8981a392fb1db863520431a4ffff37
162ccf832840a229bbc1cd40abb2854543aeb860
/src/main/java/tn/S/entities/Clients.java
c3160c9241d0ce5ddc089844bf0fe458728d2ba4
[]
no_license
ayarinho/Project_SpringBoot_back_end
ac09d2d3a67d9de5f4027788131c9c08fc50e4c1
dbe669029ac1ab0e34bc3aa2573b15f95a02d02e
refs/heads/master
2022-12-11T01:58:12.594355
2020-09-03T12:08:34
2020-09-03T12:08:34
292,557,989
0
0
null
null
null
null
UTF-8
Java
false
false
1,593
java
package tn.S.entities; import java.io.Serializable; import java.util.List; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.*; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import javax.persistence.Table; import org.springframework.beans.factory.annotation.Autowired; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @Entity @Table(name = "T_client") @ApiModel(value = "Client") public class Clients implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @ApiModelProperty(value = "Id") private Long id; @ApiModelProperty(value = "client_name") private String clientname; @OneToMany(mappedBy = "clients", fetch = FetchType.EAGER) private List<Employes> employes; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getClientname() { return clientname; } public void setClientname(String clientname) { this.clientname = clientname; } public List<Employes> getEmployes() { return employes; } public void setEmployes(List<Employes> employes) { this.employes = employes; } public Clients(String clientname) { super(); this.clientname = clientname; } public Clients() { super(); // TODO Auto-generated constructor stub } }
[ "youssef.ayari1@esprit.tn" ]
youssef.ayari1@esprit.tn
1aeba236d5085841c2c937a73149b7885b49ced7
f84b1c0894f857dfb0b30ed5c0d5c41f26ad7900
/service/service_msm/src/main/java/com/atguigu/msmservice/service/impl/MsmServiceImpl.java
f2bc7c971d56fc60a258abfc068c0b24f9ca65b3
[]
no_license
zycloud68/eduonline
52c5fc99699be45611727bd53dfee8e6f7d2cad4
866e630bac4dc1f8592b85f32a625006a959b55d
refs/heads/main
2023-04-23T11:45:43.222112
2021-05-14T10:44:02
2021-05-14T10:44:02
367,326,611
0
0
null
null
null
null
UTF-8
Java
false
false
1,959
java
package com.atguigu.msmservice.service.impl; import com.alibaba.fastjson.JSONObject; import com.aliyuncs.CommonRequest; import com.aliyuncs.CommonResponse; import com.aliyuncs.DefaultAcsClient; import com.aliyuncs.IAcsClient; import com.aliyuncs.http.MethodType; import com.aliyuncs.profile.DefaultProfile; import com.atguigu.msmservice.service.MsmService; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.Map; @Service public class MsmServiceImpl implements MsmService { @Override public boolean send(Map<String, Object> param, String phone) { if(StringUtils.isEmpty(phone)) return false; DefaultProfile profile = DefaultProfile.getProfile("default", "LTAI4FvvVEWiTJ3GNJJqJnk7", "9st82dv7EvFk9mTjYO1XXbM632fRbG"); IAcsClient client = new DefaultAcsClient(profile); //设置相关固定的参数 CommonRequest request = new CommonRequest(); //request.setProtocol(ProtocolType.HTTPS); request.setMethod(MethodType.POST); request.setDomain("dysmsapi.aliyuncs.com"); request.setVersion("2017-05-25"); request.setAction("SendSms"); //设置发送相关的参数 request.putQueryParameter("PhoneNumbers",phone); //手机号 request.putQueryParameter("SignName","我的谷粒在线教育网站"); //申请阿里云 签名名称 request.putQueryParameter("TemplateCode","SMS_180051135"); //申请阿里云 模板code request.putQueryParameter("TemplateParam", JSONObject.toJSONString(param)); //验证码数据,转换json数据传递 try { //最终发送 CommonResponse response = client.getCommonResponse(request); boolean success = response.getHttpResponse().isSuccess(); return success; }catch(Exception e) { e.printStackTrace(); return false; } } }
[ "zhang@zhangyandeMacBook-Pro.local" ]
zhang@zhangyandeMacBook-Pro.local
d20a4e0cbee661a543c0f3d60657ebef170c6a6d
d577f066627703130e70c60374d1b65f31072b43
/Items/Tools/ItemSplashGun.java
2267dee5d826457dd76f807dd682bba06d7c62c0
[]
no_license
lrivera25/ChromatiCraft
bef7960c1d81af29883a5d909cac8b652e38aac1
42842ad41ea3f8b2663f9dc19cb0b8983f64545e
refs/heads/master
2021-03-24T05:35:43.135925
2020-03-14T20:50:10
2020-03-14T20:50:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
/******************************************************************************* * @author Reika Kalseki * * Copyright 2017 * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. ******************************************************************************/ package Reika.ChromatiCraft.Items.Tools; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import Reika.ChromatiCraft.Base.ItemProjectileFiringTool; import Reika.ChromatiCraft.Entity.EntitySplashGunShot; public class ItemSplashGun extends ItemProjectileFiringTool { public ItemSplashGun(int index) { super(index); } @Override protected Entity createProjectile(ItemStack is, World world, EntityPlayer ep) { return new EntitySplashGunShot(world, ep); } }
[ "reikasminecraft@gmail.com" ]
reikasminecraft@gmail.com
4df54d3418acf3a50ca9d8585bf816cbd8527521
75e0a76a64695f80de56eebbbba40e4100aba483
/app/src/main/java/com/zhaoweihao/architechturesample/data/Login.java
5133f8f299a7d9022e7523b8ac47825a40298aea
[]
no_license
hu800-gg/EasyCourse
8e56ef1abb36e5e141b12b7e9e9a4146094627c1
c85b5413919204137cea935e0623f3b94816874d
refs/heads/master
2022-01-18T17:50:23.885483
2018-06-16T13:20:41
2018-06-16T13:20:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
536
java
package com.zhaoweihao.architechturesample.data; public class Login { /** * @username 登录需要的用户名 * @password 登录需要的密码 */ private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
[ "1028410337@qq.com" ]
1028410337@qq.com
1fbeb5bedcde000c5f0b1b33e4dbcf6893ce8730
f5d9dd91dd29a13b298885b1cfd0d45345fde576
/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/styles/RotatingTextAnchorPositionActivity.java
d2a38f24a369885304588e3223af6e5024a24c0c
[ "BSD-2-Clause" ]
permissive
mapbox/mapbox-android-demo
ba3eee3674035079b675a8999be2c6308cd58293
8550db83d86f0ef4f1292e569254b1c4d26e7e76
refs/heads/master
2023-08-30T03:36:11.560928
2022-01-04T19:57:27
2022-01-04T19:57:27
16,709,229
775
619
BSD-2-Clause
2021-12-23T10:40:32
2014-02-10T21:01:59
Java
UTF-8
Java
false
false
6,474
java
package com.mapbox.mapboxandroiddemo.examples.styles; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import com.mapbox.mapboxandroiddemo.R; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.style.layers.Layer; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_BOTTOM; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_BOTTOM_LEFT; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_BOTTOM_RIGHT; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_CENTER; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_LEFT; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_RIGHT; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_TOP; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_TOP_LEFT; import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_TOP_RIGHT; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textAllowOverlap; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textAnchor; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textIgnorePlacement; /** * Use runtime-styling to adjust the state label SymbolLayer's textField anchor position. */ public class RotatingTextAnchorPositionActivity extends AppCompatActivity { private MapView mapView; private Layer stateLabelSymbolLayer; private int index = 0; private TextView anchorPositionTextView; private static final String[] anchorOptions = new String[] { TEXT_ANCHOR_CENTER, // The center of the text is placed closest to the anchor. TEXT_ANCHOR_LEFT, // The left side of the text is placed closest to the anchor. TEXT_ANCHOR_RIGHT, // The right side of the text is placed closest to the anchor. TEXT_ANCHOR_TOP, // The top of the text is placed closest to the anchor. TEXT_ANCHOR_BOTTOM, // The bottom of the text is placed closest to the anchor. TEXT_ANCHOR_TOP_LEFT, // The top left corner of the text is placed closest to the anchor. TEXT_ANCHOR_TOP_RIGHT, // The top right corner of the text is placed closest to the anchor. TEXT_ANCHOR_BOTTOM_LEFT, // The bottom left corner of the text is placed closest to the anchor. TEXT_ANCHOR_BOTTOM_RIGHT, // The bottom right corner of the text is placed closest to the anchor. }; private static final String[] anchorDescriptions = new String[] { "The center of the text is placed closest to the anchor.", "The left side of the text is placed closest to the anchor.", "The right side of the text is placed closest to the anchor.", "The top of the text is placed closest to the anchor.", "The bottom of the text is placed closest to the anchor.", "The top left corner of the text is placed closest to the anchor.", "The top right corner of the text is placed closest to the anchor.", "The bottom left corner of the text is placed closest to the anchor.", "The bottom right corner of the text is placed closest to the anchor." }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Mapbox access token is configured here. This needs to be called either in your application // object or in the same activity which contains the mapview. Mapbox.getInstance(this, getString(R.string.access_token)); // This contains the MapView in XML and needs to be called after the access token is configured. setContentView(R.layout.activity_dds_style_rotating_text_anchor); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { stateLabelSymbolLayer = style.getLayer("state-label"); if (stateLabelSymbolLayer != null) { // Use runtime-styling to ignore collision and allow overlap, so that adjusted text in this example, // is more easily visible. stateLabelSymbolLayer.setProperties( textIgnorePlacement(true), textAllowOverlap(true) ); anchorPositionTextView = findViewById(R.id.anchor_position_textview); setTextView(anchorOptions[index], anchorDescriptions[index]); findViewById(R.id.switch_anchor_position_fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { index++; if (index == anchorOptions.length - 1) { index = 0; } // Use runtime styling to adjust the SymbolLayer's textAnchor position stateLabelSymbolLayer.setProperties(textAnchor(anchorOptions[index])); setTextView(anchorOptions[index], anchorDescriptions[index]); } }); } } }); } }); } private void setTextView(String anchorOption, String anchorDescription) { anchorPositionTextView.setText(String.format(getString(R.string.position_textview), anchorOption, anchorDescription)); } // Add the mapView lifecycle to the activity's lifecycle methods @Override public void onResume() { super.onResume(); mapView.onResume(); } @Override protected void onStart() { super.onStart(); mapView.onStart(); } @Override protected void onStop() { super.onStop(); mapView.onStop(); } @Override public void onPause() { super.onPause(); mapView.onPause(); } @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); } @Override protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); } }
[ "noreply@github.com" ]
mapbox.noreply@github.com
01c2f552c513c00cf15739ba49b40f8718d9cea1
85ed3b5db4ca762543cc63d06e3d6563e364562b
/model/storage/src/main/java/org/openfact/models/common/DebitNoteLineType.java
9e4f059503b5a195905524fc8bf7bfd19f08beaf
[ "MIT" ]
permissive
carlosthe19916/openfact-temp
0850115566ed12f2c8e36d0e47b2dbed71069d5f
0ca315fbea20e6f816b12d1df06ae2e8ea18f34a
refs/heads/master
2020-04-06T04:35:38.393748
2016-08-26T20:48:04
2016-08-26T20:48:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
38,609
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2016.08.16 at 10:50:18 AM PET // package org.openfact.models.common; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ABIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Details&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;Information about a Debit Note Line.&lt;/ccts:Definition&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * * * <p>Java class for DebitNoteLineType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="DebitNoteLineType"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}ID"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}UUID" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}Note" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}DebitedQuantity" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}LineExtensionAmount"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}TaxPointDate" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}AccountingCostCode" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}AccountingCost" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}DiscrepancyResponse" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}DespatchLineReference" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}ReceiptLineReference" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}BillingReference" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}DocumentReference" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}PricingReference" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}Delivery" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}TaxTotal" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}Item" minOccurs="0"/&gt; * &lt;element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}Price" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DebitNoteLineType", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", propOrder = { "id", "uuid", "note", "debitedQuantity", "lineExtensionAmount", "taxPointDate", "accountingCostCode", "accountingCost", "discrepancyResponse", "despatchLineReference", "receiptLineReference", "billingReference", "documentReference", "pricingReference", "delivery", "taxTotal", "item", "price" }) public class DebitNoteLineType { @XmlElement(name = "ID", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", required = true) protected IDType id; @XmlElement(name = "UUID", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected UUIDType uuid; @XmlElement(name = "Note", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected NoteType note; @XmlElement(name = "DebitedQuantity", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected DebitedQuantityType debitedQuantity; @XmlElement(name = "LineExtensionAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", required = true) protected LineExtensionAmountType lineExtensionAmount; @XmlElement(name = "TaxPointDate", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected TaxPointDateType taxPointDate; @XmlElement(name = "AccountingCostCode", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected AccountingCostCodeType accountingCostCode; @XmlElement(name = "AccountingCost", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2") protected AccountingCostType accountingCost; @XmlElement(name = "DiscrepancyResponse") protected List<ResponseType> discrepancyResponse; @XmlElement(name = "DespatchLineReference") protected List<LineReferenceType> despatchLineReference; @XmlElement(name = "ReceiptLineReference") protected List<LineReferenceType> receiptLineReference; @XmlElement(name = "BillingReference") protected List<BillingReferenceType> billingReference; @XmlElement(name = "DocumentReference") protected List<DocumentReferenceType> documentReference; @XmlElement(name = "PricingReference") protected PricingReferenceType pricingReference; @XmlElement(name = "Delivery") protected List<DeliveryType> delivery; @XmlElement(name = "TaxTotal") protected List<TaxTotalType> taxTotal; @XmlElement(name = "Item") protected ItemType item; @XmlElement(name = "Price") protected PriceType price; /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Identifier&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;Identifies the Debit Note Line.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Identifier&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Identifier&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Identifier. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link IDType } * */ public IDType getID() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link IDType } * */ public void setID(IDType value) { this.id = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. UUID. Identifier&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;A universally unique identifier for an instance of this ABIE.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;UUID&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Identifier&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Identifier. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link UUIDType } * */ public UUIDType getUUID() { return uuid; } /** * Sets the value of the uuid property. * * @param value * allowed object is * {@link UUIDType } * */ public void setUUID(UUIDType value) { this.uuid = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Note. Text&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;Free-form text applying to the Debit Note Line. This element may contain notes or any other similar information that is not contained explicitly in another structure.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Note&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Text&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Text. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link NoteType } * */ public NoteType getNote() { return note; } /** * Sets the value of the note property. * * @param value * allowed object is * {@link NoteType } * */ public void setNote(NoteType value) { this.note = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Debited_ Quantity. Quantity&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;The quantity of Items debited.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTermQualifier&gt;Debited&lt;/ccts:PropertyTermQualifier&gt;&lt;ccts:PropertyTerm&gt;Quantity&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Quantity&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Quantity. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link DebitedQuantityType } * */ public DebitedQuantityType getDebitedQuantity() { return debitedQuantity; } /** * Sets the value of the debitedQuantity property. * * @param value * allowed object is * {@link DebitedQuantityType } * */ public void setDebitedQuantity(DebitedQuantityType value) { this.debitedQuantity = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Line Extension Amount. Amount&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;The total amount for the Debit Note Line, including Allowance Charges but net of taxes.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Line Extension Amount&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Amount&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Amount. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link LineExtensionAmountType } * */ public LineExtensionAmountType getLineExtensionAmount() { return lineExtensionAmount; } /** * Sets the value of the lineExtensionAmount property. * * @param value * allowed object is * {@link LineExtensionAmountType } * */ public void setLineExtensionAmount(LineExtensionAmountType value) { this.lineExtensionAmount = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Tax Point Date. Date&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;The date of the Debit Note Line, used to indicate the point at which tax becomes applicable.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Tax Point Date&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Date&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Date. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link TaxPointDateType } * */ public TaxPointDateType getTaxPointDate() { return taxPointDate; } /** * Sets the value of the taxPointDate property. * * @param value * allowed object is * {@link TaxPointDateType } * */ public void setTaxPointDate(TaxPointDateType value) { this.taxPointDate = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Accounting Cost Code. Code&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;The buyer's accounting code applied to the Debit Note Line.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Accounting Cost Code&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Code&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Code. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link AccountingCostCodeType } * */ public AccountingCostCodeType getAccountingCostCode() { return accountingCostCode; } /** * Sets the value of the accountingCostCode property. * * @param value * allowed object is * {@link AccountingCostCodeType } * */ public void setAccountingCostCode(AccountingCostCodeType value) { this.accountingCostCode = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;BBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Accounting Cost. Text&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;The buyer's accounting code applied to the Debit Note Line, expressed as text.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Accounting Cost&lt;/ccts:PropertyTerm&gt;&lt;ccts:RepresentationTerm&gt;Text&lt;/ccts:RepresentationTerm&gt;&lt;ccts:DataType&gt;Text. Type&lt;/ccts:DataType&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link AccountingCostType } * */ public AccountingCostType getAccountingCost() { return accountingCost; } /** * Sets the value of the accountingCost property. * * @param value * allowed object is * {@link AccountingCostType } * */ public void setAccountingCost(AccountingCostType value) { this.accountingCost = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Discrepancy_ Response. Response&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Discrepancy Response; the reason for the Debit.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..n&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTermQualifier&gt;Discrepancy&lt;/ccts:PropertyTermQualifier&gt;&lt;ccts:PropertyTerm&gt;Response&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Response&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * Gets the value of the discrepancyResponse property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the discrepancyResponse property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDiscrepancyResponse().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ResponseType } * * */ public List<ResponseType> getDiscrepancyResponse() { if (discrepancyResponse == null) { discrepancyResponse = new ArrayList<ResponseType>(); } return this.discrepancyResponse; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Despatch_ Line Reference. Line Reference&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An associative reference to Despatch Line.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..n&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTermQualifier&gt;Despatch&lt;/ccts:PropertyTermQualifier&gt;&lt;ccts:PropertyTerm&gt;Line Reference&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Line Reference&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * Gets the value of the despatchLineReference property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the despatchLineReference property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDespatchLineReference().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link LineReferenceType } * * */ public List<LineReferenceType> getDespatchLineReference() { if (despatchLineReference == null) { despatchLineReference = new ArrayList<LineReferenceType>(); } return this.despatchLineReference; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Receipt_ Line Reference. Line Reference&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An associative reference to Receipt Line.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..n&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTermQualifier&gt;Receipt&lt;/ccts:PropertyTermQualifier&gt;&lt;ccts:PropertyTerm&gt;Line Reference&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Line Reference&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * Gets the value of the receiptLineReference property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the receiptLineReference property. * * <p> * For example, to add a new item, do as follows: * <pre> * getReceiptLineReference().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link LineReferenceType } * * */ public List<LineReferenceType> getReceiptLineReference() { if (receiptLineReference == null) { receiptLineReference = new ArrayList<LineReferenceType>(); } return this.receiptLineReference; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Billing Reference&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Billing Reference.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..n&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Billing Reference&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Billing Reference&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * Gets the value of the billingReference property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the billingReference property. * * <p> * For example, to add a new item, do as follows: * <pre> * getBillingReference().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link BillingReferenceType } * * */ public List<BillingReferenceType> getBillingReference() { if (billingReference == null) { billingReference = new ArrayList<BillingReferenceType>(); } return this.billingReference; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Document Reference&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Document Reference.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..n&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Document Reference&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Document Reference&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * Gets the value of the documentReference property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the documentReference property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDocumentReference().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DocumentReferenceType } * * */ public List<DocumentReferenceType> getDocumentReference() { if (documentReference == null) { documentReference = new ArrayList<DocumentReferenceType>(); } return this.documentReference; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Pricing Reference&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Pricing Reference.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Pricing Reference&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Pricing Reference&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link PricingReferenceType } * */ public PricingReferenceType getPricingReference() { return pricingReference; } /** * Sets the value of the pricingReference property. * * @param value * allowed object is * {@link PricingReferenceType } * */ public void setPricingReference(PricingReferenceType value) { this.pricingReference = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Delivery&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Delivery.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..n&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Delivery&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Delivery&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * Gets the value of the delivery property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the delivery property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDelivery().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DeliveryType } * * */ public List<DeliveryType> getDelivery() { if (delivery == null) { delivery = new ArrayList<DeliveryType>(); } return this.delivery; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Tax Total&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Tax Total.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..n&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Tax Total&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Tax Total&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * Gets the value of the taxTotal property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the taxTotal property. * * <p> * For example, to add a new item, do as follows: * <pre> * getTaxTotal().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link TaxTotalType } * * */ public List<TaxTotalType> getTaxTotal() { if (taxTotal == null) { taxTotal = new ArrayList<TaxTotalType>(); } return this.taxTotal; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Item&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Item&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Item&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Item&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link ItemType } * */ public ItemType getItem() { return item; } /** * Sets the value of the item property. * * @param value * allowed object is * {@link ItemType } * */ public void setItem(ItemType value) { this.item = value; } /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;ccts:ComponentType&gt;ASBIE&lt;/ccts:ComponentType&gt;&lt;ccts:DictionaryEntryName&gt;Debit Note Line. Price&lt;/ccts:DictionaryEntryName&gt;&lt;ccts:Definition&gt;An association to Price.&lt;/ccts:Definition&gt;&lt;ccts:Cardinality&gt;0..1&lt;/ccts:Cardinality&gt;&lt;ccts:ObjectClass&gt;Debit Note Line&lt;/ccts:ObjectClass&gt;&lt;ccts:PropertyTerm&gt;Price&lt;/ccts:PropertyTerm&gt;&lt;ccts:AssociatedObjectClass&gt;Price&lt;/ccts:AssociatedObjectClass&gt;&lt;/ccts:Component&gt; * </pre> * * * @return * possible object is * {@link PriceType } * */ public PriceType getPrice() { return price; } /** * Sets the value of the price property. * * @param value * allowed object is * {@link PriceType } * */ public void setPrice(PriceType value) { this.price = value; } }
[ "carlosthe19916@gmail.com" ]
carlosthe19916@gmail.com
1d8e8c381a93816c20b39dfbc1833af72c1748f0
97fa61b654f6cc945aa7886d4da4d07fd1c388f4
/honey-back/Honeypot/src/main/java/com/honeypot/honeypot/util/DateUtil.java
897c5bfff7a53cd80b83cbcd3f65c3651f227554
[]
no_license
aa792978017/NewHoney
7bbd1f2118fc8e953f5ebf0c13968ec6ebcea8c6
0174d1c9cb4e649c992350bd11677fd462e18f11
refs/heads/master
2020-04-02T03:39:32.585705
2019-02-25T09:13:44
2019-02-25T09:13:44
153,977,170
3
2
null
null
null
null
UTF-8
Java
false
false
1,078
java
package com.honeypot.honeypot.util; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * 日期工具类 */ public class DateUtil { /** * 获取某一时间的前n天的日期 * @param specifiedDay * @param n * @return */ public static String getSpecifiedDayBefore(String specifiedDay, int n){ // StringBuilder stringBuilder = new StringBuilder(specifiedDay); // stringBuilder.setCharAt(4,'-'); // stringBuilder.setCharAt(7,'-'); // specifiedDay = stringBuilder.substring(0,10); // System.out.println(specifiedDay); Calendar c = Calendar.getInstance(); Date date=null; try { date = new SimpleDateFormat("yyyy-MM-dd").parse(specifiedDay); } catch (Exception e) { e.printStackTrace(); } c.setTime(date); int day=c.get(Calendar.DATE); c.set(Calendar.DATE,day-n); String dayBefore=new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); return dayBefore; } }
[ "792978017@qq.com" ]
792978017@qq.com
f4b9f9f8bbc387470fae90d8f22b4bee9dd27868
be82d0c728a0bf9b2481012cf012755e3b2a5fe4
/api/src/main/java/com/epidemicalarm/api/domain/DiagnosedCase.java
1e3a155e5da5dbb58966fb600e2816cd8330c2b1
[]
no_license
BartekBac/EpidemicAlarm
c9fbbb94fa666c2c4ee437bd124af7d2474d5b76
bccadec35a53e281520ca42475594918f68c1388
refs/heads/master
2023-06-22T09:28:45.921769
2021-07-21T17:31:00
2021-07-21T17:31:00
361,198,071
0
0
null
2021-07-21T17:31:01
2021-04-24T15:29:56
Java
UTF-8
Java
false
false
1,797
java
package com.epidemicalarm.api.domain; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.JsonIdentityReference; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import java.sql.Date; @Data @Builder @AllArgsConstructor @Entity public class DiagnosedCase extends DBEntity { private Date diagnosisDate; private int duration; // in days private Date expirationDate; private int status; private double locationLat; private double locationLng; private String region; private String subregion; private String city; @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = DiagnosedCase.class) @JsonIdentityReference(alwaysAsId = true) @ManyToOne(cascade = CascadeType.REFRESH) @JoinColumn(name = "identityId", referencedColumnName = "id") private Identity identity; @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = DiagnosedCase.class) @JsonIdentityReference(alwaysAsId = true) @ManyToOne @JoinColumn(name = "institutionId", referencedColumnName = "id") private Institution institution; @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = DiagnosedCase.class) @JsonIdentityReference(alwaysAsId = true) @ManyToOne(cascade = CascadeType.REFRESH) @JoinColumn(name = "dataAdministratorId", referencedColumnName = "id") private DataAdministrator introducer; public DiagnosedCase() {} }
[ "bac2@vp.pl" ]
bac2@vp.pl
272d794296d9d2a0dcaa3c88a10aac583df8b696
2949f7b384caffdd80b49e4a9977a53e2805e9a7
/TileDemo/src/com/bayninestudios/tiledemo/demo2/Landscape.java
877efb90a47d258c6004b821aafbe9fa5059e906
[]
no_license
kaltuku1/bayninestudios
578b02d357c1d5f843c20d1bbe1c98d97f16116a
5d94881361bd038f497c9dcd985006ce6c814f56
refs/heads/master
2020-04-06T06:24:51.324327
2011-06-02T02:39:31
2011-06-02T02:39:31
33,656,359
0
1
null
null
null
null
UTF-8
Java
false
false
1,632
java
package com.bayninestudios.tiledemo.demo2; import javax.microedition.khronos.opengles.GL10; import com.bayninestudios.tiledemo.R; import android.content.Context; import java.util.Random; public class Landscape { private DrawModel tile; private int[][] tiles; public Landscape(Context context) { tile = new DrawModel(context, R.xml.tile); // create tiles, completely random tiles = new int[100][100]; Random rand = new Random(System.currentTimeMillis()); for (int x = 0; x < 100; x++) for (int y = 0; y < 100; y++) { tiles[x][y] = rand.nextInt() % 5; } } public void draw(GL10 gl, float charX, float charY) { // just draw the 12x8 tiles around the character for (int y = -4; y < 4; y++) { for (int x = -6; x < 6; x++) { int tileX = x + (int) charX; int tileY = y + (int) charY; int tileType = tiles[tileX][tileY]; switch (tileType) { case 0: gl.glColor4f(0f, 0f, .7f, 1f); break; case 1: gl.glColor4f(0f, 0.5f, 0f, 1f); break; case 2: gl.glColor4f(0.5f, 0.25f, 0.25f, 1f); break; case 3: gl.glColor4f(0.5f, 0.5f, 0.25f, 1f); break; case 4: gl.glColor4f(0.5f, 0.5f, 0.5f, 1f); break; default: break; } tile.draw(gl, tileX, tileY, 0f); } } } }
[ "lee.davey@537026a8-1f4a-11df-b04c-09d9927b732b" ]
lee.davey@537026a8-1f4a-11df-b04c-09d9927b732b
c2c61091cb5416a0b1619ce740021a9e736816b7
ed31841d39ddb9226df97299f9be7b67a054ed4a
/jmiser-poi/src/main/java/org/miser/poi/excel/style/StyleUtil.java
8487e04f1d362bac45975971ec388f47a5f6803e
[ "Apache-2.0" ]
permissive
kezf/jmiser
da8b01f2de13bea2ae2cccbee75c954b4f9e01d7
d72a0deedf18e682c782096aa87695921c0f5500
refs/heads/main
2021-12-04T06:52:26.912289
2021-07-20T15:16:26
2021-07-20T15:16:26
50,419,766
0
0
null
null
null
null
UTF-8
Java
false
false
6,203
java
package org.miser.poi.excel.style; import org.miser.core.util.StringUtil; import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.DataFormat; import org.apache.poi.ss.usermodel.FillPatternType; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.ss.usermodel.Workbook; /** * Excel样式工具类 * * @author Oliver * */ public class StyleUtil { /** * 克隆新的{@link CellStyle} * * @param cell 单元格 * @param cellStyle 被复制的样式 * @return {@link CellStyle} */ public static CellStyle cloneCellStyle(Cell cell, CellStyle cellStyle) { return cloneCellStyle(cell.getSheet().getWorkbook(), cellStyle); } /** * 克隆新的{@link CellStyle} * * @param workbook 工作簿 * @param cellStyle 被复制的样式 * @return {@link CellStyle} */ public static CellStyle cloneCellStyle(Workbook workbook, CellStyle cellStyle) { final CellStyle newCellStyle = createCellStyle(workbook); newCellStyle.cloneStyleFrom(cellStyle); return newCellStyle; } /** * 设置cell文本对齐样式 * * @param cellStyle {@link CellStyle} * @param halign 横向位置 * @param valign 纵向位置 * @return {@link CellStyle} */ public static CellStyle setAlign(CellStyle cellStyle, HorizontalAlignment halign, VerticalAlignment valign) { cellStyle.setAlignment(halign); cellStyle.setVerticalAlignment(valign); return cellStyle; } /** * 设置cell的四个边框粗细和颜色 * * @param cellStyle {@link CellStyle} * @param borderSize 边框粗细{@link BorderStyle}枚举 * @param colorIndex 颜色的short值 * @return {@link CellStyle} */ public static CellStyle setBorder(CellStyle cellStyle, BorderStyle borderSize, IndexedColors colorIndex) { cellStyle.setBorderBottom(borderSize); cellStyle.setBottomBorderColor(colorIndex.index); cellStyle.setBorderLeft(borderSize); cellStyle.setLeftBorderColor(colorIndex.index); cellStyle.setBorderRight(borderSize); cellStyle.setRightBorderColor(colorIndex.index); cellStyle.setBorderTop(borderSize); cellStyle.setTopBorderColor(colorIndex.index); return cellStyle; } /** * 给cell设置颜色 * * @param cellStyle {@link CellStyle} * @param color 背景颜色 * @param fillPattern 填充方式 {@link FillPatternType}枚举 * @return {@link CellStyle} */ public static CellStyle setColor(CellStyle cellStyle, IndexedColors color, FillPatternType fillPattern) { return setColor(cellStyle, color.index, fillPattern); } /** * 给cell设置颜色 * * @param cellStyle {@link CellStyle} * @param color 背景颜色 * @param fillPattern 填充方式 {@link FillPatternType}枚举 * @return {@link CellStyle} */ public static CellStyle setColor(CellStyle cellStyle, short color, FillPatternType fillPattern) { cellStyle.setFillForegroundColor(color); cellStyle.setFillPattern(fillPattern); return cellStyle; } /** * 创建字体 * * @param workbook {@link Workbook} * @param color 字体颜色 * @param fontSize 字体大小 * @param fontName 字体名称,可以为null使用默认字体 * @return {@link Font} */ public static Font createFont(Workbook workbook, short color, short fontSize, String fontName) { final Font font = workbook.createFont(); return setFontStyle(font, color, fontSize, fontName); } /** * 设置字体样式 * * @param font 字体{@link Font} * @param color 字体颜色 * @param fontSize 字体大小 * @param fontName 字体名称,可以为null使用默认字体 * @return {@link Font} */ public static Font setFontStyle(Font font, short color, short fontSize, String fontName) { if (color > 0) { font.setColor(color); } if (fontSize > 0) { font.setFontHeightInPoints(fontSize); } if (StringUtil.isNotBlank(fontName)) { font.setFontName(fontName); } return font; } /** * 创建单元格样式 * * @param workbook {@link Workbook} 工作簿 * @return {@link CellStyle} * @see Workbook#createCellStyle() * */ public static CellStyle createCellStyle(Workbook workbook) { if (null == workbook) { return null; } return workbook.createCellStyle(); } /** * 创建默认普通单元格样式 * * <pre> * 1. 文字上下左右居中 * 2. 细边框,黑色 * </pre> * * @param workbook {@link Workbook} 工作簿 * @return {@link CellStyle} */ public static CellStyle createDefaultCellStyle(Workbook workbook) { final CellStyle cellStyle = createCellStyle(workbook); setAlign(cellStyle, HorizontalAlignment.CENTER, VerticalAlignment.CENTER); setBorder(cellStyle, BorderStyle.THIN, IndexedColors.BLACK); return cellStyle; } /** * 创建默认头部样式 * * @param workbook {@link Workbook} 工作簿 * @return {@link CellStyle} */ public static CellStyle createHeadCellStyle(Workbook workbook) { final CellStyle cellStyle = createCellStyle(workbook); setAlign(cellStyle, HorizontalAlignment.CENTER, VerticalAlignment.CENTER); setBorder(cellStyle, BorderStyle.THIN, IndexedColors.BLACK); setColor(cellStyle, IndexedColors.GREY_25_PERCENT, FillPatternType.SOLID_FOREGROUND); return cellStyle; } /** * 给定样式是否为null(无样式)或默认样式,默认样式为{@code workbook.getCellStyleAt(0)} * * @param workbook 工作簿 * @param style 被检查的样式 * @return 是否为null(无样式)或默认样式 * */ public static boolean isNullOrDefaultStyle(Workbook workbook, CellStyle style) { return (null == style) || style.equals(workbook.getCellStyleAt(0)); } /** * 创建数据格式并获取格式 * * @param workbook {@link Workbook} * @param format 数据格式 * @return 数据格式 * */ public Short getFormat(Workbook workbook, String format) { final DataFormat dataFormat = workbook.createDataFormat(); return dataFormat.getFormat(format); } }
[ "kezf@kmac.local" ]
kezf@kmac.local