blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
sequence
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
โŒ€
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
โŒ€
gha_stargazers_count
int32
0
112k
โŒ€
gha_forks_count
int32
0
39.4k
โŒ€
gha_open_issues_count
int32
0
11k
โŒ€
gha_language
stringlengths
1
21
โŒ€
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
sequence
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
beaafe6a635e1f18d4ce4070a6394089ab2300bf
36,378,373,023,416
900cbc795968e113f10499983ffde0a41e4ca26e
/Workspace/java27_StringExam/src/string/step1/test/StringExamTest.java
a7be59c2718403af6e83c50c41aa00460079b50a
[]
no_license
Neozuni/Javax
https://github.com/Neozuni/Javax
87ac711d67a22e3130bf45f6841062cf8a79581e
826ad8ff5bc193a00c08318c6e9570d43f8446c5
refs/heads/master
2021-01-16T19:13:19.651000
2017-09-22T09:51:17
2017-09-22T09:51:17
100,154,770
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package string.step1.test; import java.util.StringTokenizer; /* * String Class(char[ ]) * :: * ๋ณ€ํ•˜์ง€ ์•Š๋Š”(Immutable) ๋ฌธ์ž์—ด ์ƒ์ˆ˜๋ฅผ ๋‹ค๋ฃจ๋Š” ํด๋ž˜์Šค * ์ŠคํŠธ๋ง ํด๋ ˆ์Šค์—์„œ ์ œ๊ณตํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ์ด์šฉํ•ด์„œ ๋ฌธ์ž์—ด์ด * ๋ณ€๊ฒฝ๋  ๋•Œ๋งˆ๋‹ค ๊ณ„์†ํ•ด์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋จ. * ๋ฌธ์ž์—ด์ด ์ƒ์„ฑ๋ ๋•Œ๋งˆ๋‹ค Heap์— ๊ฐ์ฒด๊ฐ€ ๊ณ„์† ๋งŒ๋“ค์–ด์ง€๊ธฐ ๋–„๋ฌธ์— * ๋ฌธ์ž์—ด ์กฐ์ž‘, ๋ณ€๊ฒฝ์ด ๋นˆ๋ฒˆํ•  ๊ฒฝ์šฐ String์„ ์‚ฌ์šฉํ•˜๋ฉด * ๋ฉ”๋ชจ๋ฆฌ ํšจ์œจ์„ฑ์„ ๋–จ์–ด๋œจ๋ฆฌ๋Š” ๊ฒฐ๊ณผ๋ฅผ ์ดˆ๋ž˜ํ•œ๋‹ค. * :: * StringBuffer ํ˜น์€ (StringBuilder) ์‚ฌ์šฉ์„ ๊ถŒ์žฅ */ public class StringExamTest { public static void main(String[] args) { System.out.println("======length(), replace(), substring()================"); String str1= "์•„์ด์œ  ";//5 String str2= "์•„์ด์œ  ";//1 String str= "์•„์ด์œ ";//0 System.out.println("1. str๊ฐ์ฒด์˜ ๋ฌธ์ž์—ด ๊ธธ์ด : "+str.length()); String str3=str.replace('์œ ', '๋ฆฌ'); System.out.println("2. ์•„์ด์œ ์˜ '์œ '--> '๋ฆฌ'๋กœ ๋ณ€๊ฒฝ :: "+str); System.out.println("2. ์•„์ด์œ ์˜ '์œ '--> '๋ฆฌ'๋กœ ๋ณ€๊ฒฝ :: "+str3); //'์•„์ด์œ '๋งŒ ์ถœ๋ ฅ๋˜๋„๋ก //String str4=str.substring(1, 3); String str4=str.substring(1); System.out.println("3 ์ด์œ ๋งŒ ์ถœ๋ ฅ :: "+str4); System.out.println(str); //๋ฌธ์ž์—ด ์ƒ์ˆ˜ System.out.println("=============trim() :: ์•ž,๋’ค ๊ณต๋ฐฑ์„ ์ œ๊ฑฐ ============"); String s1 = "์ œ์ž„์Šค๊ณ ์Šฌ๋ง"; String s2 = " ์ œ์ž„์Šค ๊ณ ์Šฌ๋ง"; String s3 = "์ œ์ž„์Šค ๊ณ ์Šฌ๋ง "; if(s1.equals(s2)) System.out.println("Same Data1?"); if(s1.equals(s2.trim())) System.out.println("Same Data2"); if(s2.trim().equals(s3.trim())) System.out.println("Same Data3"); System.out.println("=============s1.equals(s2) ============"); if(s1.equals(s2.replace(" ", ""))) System.out.println("๊ณต๋ฐฑ์ œ๊ฑฐ ์„ฑ๊ณต!!"); System.out.println("\n==========indexOf(), charAt()===================="); System.out.println("======s1์—์„œ '๊ณ '์— ํ•ด๋‹นํ•˜๋Š” index๋ฅผ ๋ฆฌํ„ด๋ฐ›์•„ ์ถœ๋ ฅ :: "+s1.indexOf('๊ณ ')); System.out.println("\n======s1์—์„œ index 3์— ํ•ด๋‹นํ•˜๋Š” char๋ฅผ ๋ฆฌํ„ด๋ฐ›์•„ ์ถœ๋ ฅ :: "+s1.charAt(3)); /* * ์ด๋ฒˆ์—๋Š” ๊ณต๋ฐฑ์„ ๊ธฐ์ค€์œผ๋กœ ๋ฌธ์ž๋ฅผ ๋‚˜๋ˆ„๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ * , / ์ด๋Ÿฐ๊ฒƒ๋“ค์„ ๊ธฐ์ค€์œผ๋กœ ๋ฌธ์ž์—ด์„ ๋‚˜๋ˆ„๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„์•ผํ•œ๋‹ค. */ System.out.println("\n=============sprit()=============="); String star = "์•„์ด์œ , ์ดํšจ๋ฆฌ, ๊น€์ƒ์ˆœ, ๋น…๋ฑ… , ์•„์ด์œ , ํƒœ์–‘"; String[ ] starArr=star.split(","); for(String s : starArr) { System.out.println(s); } System.out.println("\n=============StringTokenizer=============="); StringTokenizer st = new StringTokenizer(star, ","); while(st.hasMoreTokens()) { System.out.println(st.nextToken()); } System.out.println("\n=============Self Test=============="); String ss = "๋Œ๊ณ ๋ž˜ ํŒฌ๋” ๋‚˜๋ฌด๋Š˜๋ณด ๋ฏธ์–ด์บฃ ํ†ฐ์Šจ๊ฐ€์ ค ์ฝ”๋ชจ๋„"; /* * sprit() - space๋ฅผ ๋ชจ๋‘๊ฐ€ ์ธ์‹ํ•œ๋‹ค. * StringTokenizser ์‚ฌ์šฉ -space๋ฅผ ์•„๋ฌด๋ฆฌ ๋งŽ์ด ์ค˜๋„ ํ•˜๋‚˜๋กœ ์ธ์‹ */ String[ ] ssArr =ss.split(" "); for(String s : ssArr) { if(!s.equals("")) System.out.println(s); } System.out.println(" "); StringTokenizer st1 = new StringTokenizer(ss); while(st1.hasMoreTokens()) { System.out.println(st1.nextToken()); } System.out.println(" "); System.out.println("=============startsWith(), endsWith()======="); String start = "์˜ค๋Š˜ ์ ์‹ฌ ๋ฉ”๋‰ด๋Š” ๋ญ˜๋กœ ํ•˜์‹ค ๊ฑด๊ฐ€์š”?"; System.out.println("startsWith() :: "+start.startsWith("์ ์‹ฌ")); System.out.println("startsWith() :: "+start.startsWith("์˜ค๋Š˜ ์ ์‹ฌ")); System.out.println("endsWith() :: "+start.endsWith("์š”?")); System.out.println(" "); System.out.println("===========toUpperCase(), toLowerCase()========"); String lower = "james gosling"; String upper = "JAMES GOSLING"; System.out.println("JAMES GOSLING์œผ๋กœ ๋ณ€๊ฒฝ :: "+lower.toUpperCase()); System.out.println(lower.equalsIgnoreCase(upper)); } }
UTF-8
Java
4,045
java
StringExamTest.java
Java
[ { "context": "ase(), toLowerCase()========\");\n\t\tString lower = \"james gosling\";\n\t\tString upper = \"JAMES GOSLING\";\n\t\tSystem.out.", "end": 3133, "score": 0.9974386096000671, "start": 3120, "tag": "NAME", "value": "james gosling" }, { "context": "String lower = \"james gosling\";\n\t\tString upper = \"JAMES GOSLING\";\n\t\tSystem.out.println(\"JAMES GOSLING์œผ๋กœ ๋ณ€๊ฒฝ :: \"+l", "end": 3167, "score": 0.9994497299194336, "start": 3154, "tag": "NAME", "value": "JAMES GOSLING" } ]
null
[]
package string.step1.test; import java.util.StringTokenizer; /* * String Class(char[ ]) * :: * ๋ณ€ํ•˜์ง€ ์•Š๋Š”(Immutable) ๋ฌธ์ž์—ด ์ƒ์ˆ˜๋ฅผ ๋‹ค๋ฃจ๋Š” ํด๋ž˜์Šค * ์ŠคํŠธ๋ง ํด๋ ˆ์Šค์—์„œ ์ œ๊ณตํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ์ด์šฉํ•ด์„œ ๋ฌธ์ž์—ด์ด * ๋ณ€๊ฒฝ๋  ๋•Œ๋งˆ๋‹ค ๊ณ„์†ํ•ด์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋จ. * ๋ฌธ์ž์—ด์ด ์ƒ์„ฑ๋ ๋•Œ๋งˆ๋‹ค Heap์— ๊ฐ์ฒด๊ฐ€ ๊ณ„์† ๋งŒ๋“ค์–ด์ง€๊ธฐ ๋–„๋ฌธ์— * ๋ฌธ์ž์—ด ์กฐ์ž‘, ๋ณ€๊ฒฝ์ด ๋นˆ๋ฒˆํ•  ๊ฒฝ์šฐ String์„ ์‚ฌ์šฉํ•˜๋ฉด * ๋ฉ”๋ชจ๋ฆฌ ํšจ์œจ์„ฑ์„ ๋–จ์–ด๋œจ๋ฆฌ๋Š” ๊ฒฐ๊ณผ๋ฅผ ์ดˆ๋ž˜ํ•œ๋‹ค. * :: * StringBuffer ํ˜น์€ (StringBuilder) ์‚ฌ์šฉ์„ ๊ถŒ์žฅ */ public class StringExamTest { public static void main(String[] args) { System.out.println("======length(), replace(), substring()================"); String str1= "์•„์ด์œ  ";//5 String str2= "์•„์ด์œ  ";//1 String str= "์•„์ด์œ ";//0 System.out.println("1. str๊ฐ์ฒด์˜ ๋ฌธ์ž์—ด ๊ธธ์ด : "+str.length()); String str3=str.replace('์œ ', '๋ฆฌ'); System.out.println("2. ์•„์ด์œ ์˜ '์œ '--> '๋ฆฌ'๋กœ ๋ณ€๊ฒฝ :: "+str); System.out.println("2. ์•„์ด์œ ์˜ '์œ '--> '๋ฆฌ'๋กœ ๋ณ€๊ฒฝ :: "+str3); //'์•„์ด์œ '๋งŒ ์ถœ๋ ฅ๋˜๋„๋ก //String str4=str.substring(1, 3); String str4=str.substring(1); System.out.println("3 ์ด์œ ๋งŒ ์ถœ๋ ฅ :: "+str4); System.out.println(str); //๋ฌธ์ž์—ด ์ƒ์ˆ˜ System.out.println("=============trim() :: ์•ž,๋’ค ๊ณต๋ฐฑ์„ ์ œ๊ฑฐ ============"); String s1 = "์ œ์ž„์Šค๊ณ ์Šฌ๋ง"; String s2 = " ์ œ์ž„์Šค ๊ณ ์Šฌ๋ง"; String s3 = "์ œ์ž„์Šค ๊ณ ์Šฌ๋ง "; if(s1.equals(s2)) System.out.println("Same Data1?"); if(s1.equals(s2.trim())) System.out.println("Same Data2"); if(s2.trim().equals(s3.trim())) System.out.println("Same Data3"); System.out.println("=============s1.equals(s2) ============"); if(s1.equals(s2.replace(" ", ""))) System.out.println("๊ณต๋ฐฑ์ œ๊ฑฐ ์„ฑ๊ณต!!"); System.out.println("\n==========indexOf(), charAt()===================="); System.out.println("======s1์—์„œ '๊ณ '์— ํ•ด๋‹นํ•˜๋Š” index๋ฅผ ๋ฆฌํ„ด๋ฐ›์•„ ์ถœ๋ ฅ :: "+s1.indexOf('๊ณ ')); System.out.println("\n======s1์—์„œ index 3์— ํ•ด๋‹นํ•˜๋Š” char๋ฅผ ๋ฆฌํ„ด๋ฐ›์•„ ์ถœ๋ ฅ :: "+s1.charAt(3)); /* * ์ด๋ฒˆ์—๋Š” ๊ณต๋ฐฑ์„ ๊ธฐ์ค€์œผ๋กœ ๋ฌธ์ž๋ฅผ ๋‚˜๋ˆ„๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ * , / ์ด๋Ÿฐ๊ฒƒ๋“ค์„ ๊ธฐ์ค€์œผ๋กœ ๋ฌธ์ž์—ด์„ ๋‚˜๋ˆ„๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„์•ผํ•œ๋‹ค. */ System.out.println("\n=============sprit()=============="); String star = "์•„์ด์œ , ์ดํšจ๋ฆฌ, ๊น€์ƒ์ˆœ, ๋น…๋ฑ… , ์•„์ด์œ , ํƒœ์–‘"; String[ ] starArr=star.split(","); for(String s : starArr) { System.out.println(s); } System.out.println("\n=============StringTokenizer=============="); StringTokenizer st = new StringTokenizer(star, ","); while(st.hasMoreTokens()) { System.out.println(st.nextToken()); } System.out.println("\n=============Self Test=============="); String ss = "๋Œ๊ณ ๋ž˜ ํŒฌ๋” ๋‚˜๋ฌด๋Š˜๋ณด ๋ฏธ์–ด์บฃ ํ†ฐ์Šจ๊ฐ€์ ค ์ฝ”๋ชจ๋„"; /* * sprit() - space๋ฅผ ๋ชจ๋‘๊ฐ€ ์ธ์‹ํ•œ๋‹ค. * StringTokenizser ์‚ฌ์šฉ -space๋ฅผ ์•„๋ฌด๋ฆฌ ๋งŽ์ด ์ค˜๋„ ํ•˜๋‚˜๋กœ ์ธ์‹ */ String[ ] ssArr =ss.split(" "); for(String s : ssArr) { if(!s.equals("")) System.out.println(s); } System.out.println(" "); StringTokenizer st1 = new StringTokenizer(ss); while(st1.hasMoreTokens()) { System.out.println(st1.nextToken()); } System.out.println(" "); System.out.println("=============startsWith(), endsWith()======="); String start = "์˜ค๋Š˜ ์ ์‹ฌ ๋ฉ”๋‰ด๋Š” ๋ญ˜๋กœ ํ•˜์‹ค ๊ฑด๊ฐ€์š”?"; System.out.println("startsWith() :: "+start.startsWith("์ ์‹ฌ")); System.out.println("startsWith() :: "+start.startsWith("์˜ค๋Š˜ ์ ์‹ฌ")); System.out.println("endsWith() :: "+start.endsWith("์š”?")); System.out.println(" "); System.out.println("===========toUpperCase(), toLowerCase()========"); String lower = "<NAME>"; String upper = "<NAME>"; System.out.println("JAMES GOSLING์œผ๋กœ ๋ณ€๊ฒฝ :: "+lower.toUpperCase()); System.out.println(lower.equalsIgnoreCase(upper)); } }
4,031
0.579921
0.566879
105
30.4
22.423456
82
false
false
0
0
0
0
0
0
2.409524
false
false
3
93a71f6c842defcac53ecf4e623b975b084c7be4
13,924,284,039,346
f9bc79f57aadf7e0b2ddb3a1d109ad92e22aad07
/org.blacklist.web/src/main/java/org/blacklist/web/control/model/SearchOutValue.java
ff190e1cf88ec71c12dc1e09019859acacec8b7f
[]
no_license
dengdaiyemanren/blacklist
https://github.com/dengdaiyemanren/blacklist
44bae3a47338897bfa9550db4c5644a5b982ebd3
9d3270439af67b45a3db65647c2f0d4db22f1757
refs/heads/master
2021-01-11T17:10:11.843000
2017-01-24T15:48:51
2017-01-24T15:48:51
79,729,197
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.blacklist.web.control.model; import java.util.ArrayList; import java.util.List; public class SearchOutValue { String searchAccount; String score; String scoreDesc; String scoreReason; List<SearchOutValue> result = new ArrayList(); public List<SearchOutValue> getResult() { return result; } public void setResult(List<SearchOutValue> result) { this.result = result; } public String getSearchAccount() { return searchAccount; } public void setSearchAccount(String searchAccount) { this.searchAccount = searchAccount; } public String getScore() { return score; } public void setScore(String score) { this.score = score; } public String getScoreDesc() { return scoreDesc; } public void setScoreDesc(String scoreDesc) { this.scoreDesc = scoreDesc; } public String getScoreReason() { return scoreReason; } public void setScoreReason(String scoreReason) { this.scoreReason = scoreReason; } }
UTF-8
Java
960
java
SearchOutValue.java
Java
[]
null
[]
package org.blacklist.web.control.model; import java.util.ArrayList; import java.util.List; public class SearchOutValue { String searchAccount; String score; String scoreDesc; String scoreReason; List<SearchOutValue> result = new ArrayList(); public List<SearchOutValue> getResult() { return result; } public void setResult(List<SearchOutValue> result) { this.result = result; } public String getSearchAccount() { return searchAccount; } public void setSearchAccount(String searchAccount) { this.searchAccount = searchAccount; } public String getScore() { return score; } public void setScore(String score) { this.score = score; } public String getScoreDesc() { return scoreDesc; } public void setScoreDesc(String scoreDesc) { this.scoreDesc = scoreDesc; } public String getScoreReason() { return scoreReason; } public void setScoreReason(String scoreReason) { this.scoreReason = scoreReason; } }
960
0.735417
0.735417
51
17.82353
16.789009
53
false
false
0
0
0
0
0
0
1.372549
false
false
3
a555504ee0565438e87751481c2e723a36230096
38,869,454,062,315
08f3935f13cd022e52703fa92f5d78dc5d061c2d
/Trawellmate/app/src/main/java/net/promasoft/trawellmate/DetailsAct.java
a083f4459eeedf70544d900e68a921956bc00eb0
[]
no_license
AndroidVic/GitShare
https://github.com/AndroidVic/GitShare
0f479268697771100d5fc7c0679c3e92a08257df
b3e3f2d4e5b03285d177668096867d8064777e5c
refs/heads/master
2020-12-08T15:07:15.555000
2020-02-10T09:28:57
2020-02-10T09:28:57
233,012,217
0
0
null
false
2020-01-14T06:20:53
2020-01-10T09:26:40
2020-01-10T09:39:01
2020-01-14T06:20:52
295
0
0
0
Java
false
false
package net.promasoft.trawellmate; import androidx.appcompat.app.AppCompatActivity; import androidx.core.view.ViewCompat; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; import com.google.android.material.appbar.AppBarLayout; import net.promasoft.trawellmate.adp.AdpDaWiseDetails; import net.promasoft.trawellmate.argapp.DataDayWise; import net.promasoft.trawellmate.dsgn.CustomTextLink; import net.promasoft.trawellmate.util.AlineActivityHelper; import net.promasoft.trawellmate.util.DelayHelper; import net.promasoft.trawellmate.util.DiamensionManager; import net.promasoft.trawellmate.util.ViewECAnimator; import java.util.ArrayList; public class DetailsAct extends AppCompatActivity { private ImageView statusBarBg; private boolean searchBgVisible = false; private NestedScrollView nestedContainer; private ImageView preExpandCont; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); new AlineActivityHelper(DetailsAct.this, true); statusBarBg = findViewById(R.id.ID_sts_bg_lay); nestedContainer = findViewById(R.id.ID_nested_container); AppBarLayout appBarLayout = findViewById(R.id.id_appBar_main); appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) { // Collapsed if (statusBarBg.getVisibility() == View.INVISIBLE) { searchBgVisible = true; // bottom_menu_lay.setVisibility(View.VISIBLE); // bottom_menu_lay.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up)); statusBarBg.setVisibility(View.VISIBLE); statusBarBg.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in_anim)); } } else if (verticalOffset == 0) { // Expanded if (statusBarBg.getVisibility() == View.VISIBLE) { searchBgVisible = false; statusBarBg.setVisibility(View.INVISIBLE); statusBarBg.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out_anim)); } } else if (searchBgVisible) { // Collapsed if (statusBarBg.getVisibility() == View.VISIBLE) { searchBgVisible = false; // bottom_menu_lay.setVisibility(View.GONE); // bottom_menu_lay.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_down)); statusBarBg.setVisibility(View.INVISIBLE); statusBarBg.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out_anim)); } } } }); ImageView arwBack = findViewById(R.id.ID_arw_bck); arwBack.setOnClickListener(view -> { onBackPressed(); }); initAboutPackage(); initDaywiseLay(); CustomTextLink writeReview = findViewById(R.id.ID_write_review); writeReview.setOnClickListener(view -> { startActivity(new Intent(DetailsAct.this, WriteReview.class)); }); Button bookATrip = findViewById(R.id.ID_hm_login); bookATrip.setOnClickListener(view -> { startActivity(new Intent(DetailsAct.this, BookingAct.class)); }); } private LinearLayoutManager layoutManager; private RecyclerView recyclerView; private ArrayList<DataDayWise> dataModel; private AdpDaWiseDetails adapter; private void initDaywiseLay() { recyclerView = (RecyclerView) findViewById(R.id.ID_daywise_rv); layoutManager = new LinearLayoutManager(getApplicationContext()); recyclerView.setLayoutManager(layoutManager); RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator(); itemAnimator.setAddDuration(1000); itemAnimator.setRemoveDuration(1000); recyclerView.setItemAnimator(itemAnimator); recyclerView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(getApplicationContext(), R.anim.layout_animation_fall_down)); dataModel = new ArrayList<DataDayWise>(); adapter = new AdpDaWiseDetails(getApplicationContext(), dataModel, new AdpDaWiseDetails.ClickLstnr() { @Override public void onClickItem(View view, int type) { } }); recyclerView.setAdapter(adapter); ViewCompat.setNestedScrollingEnabled(recyclerView, false); recyclerView.setItemViewCacheSize(5); getData(); } private void getData() { //TODO HERE dataModel.clear(); DataDayWise data = new DataDayWise(); data.mTitle = "Day 1- Arrive at Cochin - Munnar"; data.mDescription = "You are greeted on arrival at Kochi International Airport/ Railway station by The Travel Planners representative and thereafter drive to Munnar hills (130 kms / 4 hrs). Enroute visit Cheyyappara Waterfalls. On the way to Munnar you can see tea gardens spread like a green carpet over hundreds of kilometers, lush green hills, a place so difficult to describe, very low population too far from pollution, most of the area covered by Tata tea. On arrival isExpanded in at Hotel and relax. Overnight stay at Nature Zone - Tree House"; dataModel.add(data); DataDayWise data1 = new DataDayWise(); data1.mTitle = "Day 2 - Munnar"; data1.mDescription = "Morning sightseeing in Munnar which includes Mattupetty, Eco-Point, Tea Museum, Pothamedu etc. You can also enjoy boating in the Lake (optional). Overnight stay at Nature Zone - Tree House"; dataModel.add(data1); DataDayWise data2 = new DataDayWise(); data2.mTitle = "Day 3 - Munnar, Tekkady"; data2.mDescription = "Morning drive to Thekkady covering a distance of 110 kms / 3.5 hrs through cardamom hills. Check into the Resort. After lunch visit spice plantation like cardamom, Pepper, Coffee, and tea estate etcโ€ฆ On way back to hotel you could stop at the local market and pick up some fragrant spices. Overnight at Poetree Sarovar - Club Room"; dataModel.add(data2); DataDayWise data3 = new DataDayWise(); data3.mTitle = "Day 4 - Tekkady"; data3.mDescription = "Morning breakfast. Full day programme at Gavi (Jeep safari, boating, trekking) includes breakfast, lunch & entry fees. Gavi is an eco-tourist spot in Kerala. A must visit place for all nature lovers as Gavi is preserved in its natural scenic beauty untainted by the mighty hands of modernity. Evening come back at the hotel. Overnight stay at Poetree Sarovar - Club Room"; dataModel.add(data3); DataDayWise data4 = new DataDayWise(); data4.mTitle = "Day 5 - Tekkady, Houseboat"; data4.mDescription = "Today morning after breakfast drive to Alleppey, Water locked place is endowed with immense natural beauty and array of rivers, canals and lakes ideal for boat cruise. On arrival isExpanded in to a traditional Kerala Style Houseboat and Cruise through the backwaters is the fabulous way to explore the fascinating beauty of the backwaters. Stay overnight in the Houseboat (Premium A/C [24 hour A/C])."; dataModel.add(data4); DataDayWise data5 = new DataDayWise(); data5.mTitle = "Day 6 - Departure"; data5.mDescription = "Departure transfer to Cochin airport for onward flight."; dataModel.add(data5); recyclerView.setItemViewCacheSize(dataModel.size()); adapter.notifyDataSetChanged(); if (dataModel.size() > 0) { // noDataLay.setVisibility(View.GONE); } else { // noDataLay.setVisibility(View.VISIBLE); } } FrameLayout expandable_view; Boolean isExpanded = false; ImageView arrow_btn; private void initAboutPackage() { preExpandCont = findViewById(R.id.ID_preexpnd_container); expandable_view = findViewById(R.id.expand); arrow_btn = findViewById(R.id.indicator_down); Drawable drawable = getResources().getDrawable(R.drawable.ic_arrow_up); Drawable rdrawable = getResources().getDrawable(R.drawable.ic_arrow_down); expandable_view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int matchParentMeasureSpec = View.MeasureSpec.makeMeasureSpec(((View) v.getParent()).getWidth(), View.MeasureSpec.EXACTLY); int wrapContentMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); v.measure(matchParentMeasureSpec, wrapContentMeasureSpec); final int targetHeight = v.getMeasuredHeight(); preExpandCont.setMinimumHeight(targetHeight); if (!isExpanded) { // preExpandCont.setVisibility(View.VISIBLE); DelayHelper.delayStartWith(100, () -> { int scrollTo = ((View) preExpandCont.getParent().getParent()).getTop() - DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 200) + targetHeight; // int scrollTo = preExpandCont.getTop() + targetHeight - DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 50); nestedContainer.smoothScrollTo(0, scrollTo); }); ViewECAnimator.expand(expandable_view, (int) DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 210), targetHeight, 1); arrow_btn.setImageDrawable(drawable); isExpanded = true; } else { // preExpandCont.setVisibility(View.GONE); ViewECAnimator.collapse(expandable_view, (int) DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 210), targetHeight, 1); arrow_btn.setImageDrawable(rdrawable); isExpanded = false; } } }); } }
UTF-8
Java
10,964
java
DetailsAct.java
Java
[ { "context": ";\n data.mTitle = \"Day 1- Arrive at Cochin - Munnar\";\n data.mDescription = \"You are greet", "end": 5664, "score": 0.7641807794570923, "start": 5663, "tag": "NAME", "value": "M" }, { "context": "new DataDayWise();\n data2.mTitle = \"Day 3 - Munnar, Tekkady\";\n data2.mDescription = \"Morning drive to ", "end": 6696, "score": 0.993452787399292, "start": 6681, "tag": "NAME", "value": "Munnar, Tekkady" } ]
null
[]
package net.promasoft.trawellmate; import androidx.appcompat.app.AppCompatActivity; import androidx.core.view.ViewCompat; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; import com.google.android.material.appbar.AppBarLayout; import net.promasoft.trawellmate.adp.AdpDaWiseDetails; import net.promasoft.trawellmate.argapp.DataDayWise; import net.promasoft.trawellmate.dsgn.CustomTextLink; import net.promasoft.trawellmate.util.AlineActivityHelper; import net.promasoft.trawellmate.util.DelayHelper; import net.promasoft.trawellmate.util.DiamensionManager; import net.promasoft.trawellmate.util.ViewECAnimator; import java.util.ArrayList; public class DetailsAct extends AppCompatActivity { private ImageView statusBarBg; private boolean searchBgVisible = false; private NestedScrollView nestedContainer; private ImageView preExpandCont; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); new AlineActivityHelper(DetailsAct.this, true); statusBarBg = findViewById(R.id.ID_sts_bg_lay); nestedContainer = findViewById(R.id.ID_nested_container); AppBarLayout appBarLayout = findViewById(R.id.id_appBar_main); appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) { // Collapsed if (statusBarBg.getVisibility() == View.INVISIBLE) { searchBgVisible = true; // bottom_menu_lay.setVisibility(View.VISIBLE); // bottom_menu_lay.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up)); statusBarBg.setVisibility(View.VISIBLE); statusBarBg.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in_anim)); } } else if (verticalOffset == 0) { // Expanded if (statusBarBg.getVisibility() == View.VISIBLE) { searchBgVisible = false; statusBarBg.setVisibility(View.INVISIBLE); statusBarBg.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out_anim)); } } else if (searchBgVisible) { // Collapsed if (statusBarBg.getVisibility() == View.VISIBLE) { searchBgVisible = false; // bottom_menu_lay.setVisibility(View.GONE); // bottom_menu_lay.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_down)); statusBarBg.setVisibility(View.INVISIBLE); statusBarBg.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out_anim)); } } } }); ImageView arwBack = findViewById(R.id.ID_arw_bck); arwBack.setOnClickListener(view -> { onBackPressed(); }); initAboutPackage(); initDaywiseLay(); CustomTextLink writeReview = findViewById(R.id.ID_write_review); writeReview.setOnClickListener(view -> { startActivity(new Intent(DetailsAct.this, WriteReview.class)); }); Button bookATrip = findViewById(R.id.ID_hm_login); bookATrip.setOnClickListener(view -> { startActivity(new Intent(DetailsAct.this, BookingAct.class)); }); } private LinearLayoutManager layoutManager; private RecyclerView recyclerView; private ArrayList<DataDayWise> dataModel; private AdpDaWiseDetails adapter; private void initDaywiseLay() { recyclerView = (RecyclerView) findViewById(R.id.ID_daywise_rv); layoutManager = new LinearLayoutManager(getApplicationContext()); recyclerView.setLayoutManager(layoutManager); RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator(); itemAnimator.setAddDuration(1000); itemAnimator.setRemoveDuration(1000); recyclerView.setItemAnimator(itemAnimator); recyclerView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(getApplicationContext(), R.anim.layout_animation_fall_down)); dataModel = new ArrayList<DataDayWise>(); adapter = new AdpDaWiseDetails(getApplicationContext(), dataModel, new AdpDaWiseDetails.ClickLstnr() { @Override public void onClickItem(View view, int type) { } }); recyclerView.setAdapter(adapter); ViewCompat.setNestedScrollingEnabled(recyclerView, false); recyclerView.setItemViewCacheSize(5); getData(); } private void getData() { //TODO HERE dataModel.clear(); DataDayWise data = new DataDayWise(); data.mTitle = "Day 1- Arrive at Cochin - Munnar"; data.mDescription = "You are greeted on arrival at Kochi International Airport/ Railway station by The Travel Planners representative and thereafter drive to Munnar hills (130 kms / 4 hrs). Enroute visit Cheyyappara Waterfalls. On the way to Munnar you can see tea gardens spread like a green carpet over hundreds of kilometers, lush green hills, a place so difficult to describe, very low population too far from pollution, most of the area covered by Tata tea. On arrival isExpanded in at Hotel and relax. Overnight stay at Nature Zone - Tree House"; dataModel.add(data); DataDayWise data1 = new DataDayWise(); data1.mTitle = "Day 2 - Munnar"; data1.mDescription = "Morning sightseeing in Munnar which includes Mattupetty, Eco-Point, Tea Museum, Pothamedu etc. You can also enjoy boating in the Lake (optional). Overnight stay at Nature Zone - Tree House"; dataModel.add(data1); DataDayWise data2 = new DataDayWise(); data2.mTitle = "Day 3 - <NAME>"; data2.mDescription = "Morning drive to Thekkady covering a distance of 110 kms / 3.5 hrs through cardamom hills. Check into the Resort. After lunch visit spice plantation like cardamom, Pepper, Coffee, and tea estate etcโ€ฆ On way back to hotel you could stop at the local market and pick up some fragrant spices. Overnight at Poetree Sarovar - Club Room"; dataModel.add(data2); DataDayWise data3 = new DataDayWise(); data3.mTitle = "Day 4 - Tekkady"; data3.mDescription = "Morning breakfast. Full day programme at Gavi (Jeep safari, boating, trekking) includes breakfast, lunch & entry fees. Gavi is an eco-tourist spot in Kerala. A must visit place for all nature lovers as Gavi is preserved in its natural scenic beauty untainted by the mighty hands of modernity. Evening come back at the hotel. Overnight stay at Poetree Sarovar - Club Room"; dataModel.add(data3); DataDayWise data4 = new DataDayWise(); data4.mTitle = "Day 5 - Tekkady, Houseboat"; data4.mDescription = "Today morning after breakfast drive to Alleppey, Water locked place is endowed with immense natural beauty and array of rivers, canals and lakes ideal for boat cruise. On arrival isExpanded in to a traditional Kerala Style Houseboat and Cruise through the backwaters is the fabulous way to explore the fascinating beauty of the backwaters. Stay overnight in the Houseboat (Premium A/C [24 hour A/C])."; dataModel.add(data4); DataDayWise data5 = new DataDayWise(); data5.mTitle = "Day 6 - Departure"; data5.mDescription = "Departure transfer to Cochin airport for onward flight."; dataModel.add(data5); recyclerView.setItemViewCacheSize(dataModel.size()); adapter.notifyDataSetChanged(); if (dataModel.size() > 0) { // noDataLay.setVisibility(View.GONE); } else { // noDataLay.setVisibility(View.VISIBLE); } } FrameLayout expandable_view; Boolean isExpanded = false; ImageView arrow_btn; private void initAboutPackage() { preExpandCont = findViewById(R.id.ID_preexpnd_container); expandable_view = findViewById(R.id.expand); arrow_btn = findViewById(R.id.indicator_down); Drawable drawable = getResources().getDrawable(R.drawable.ic_arrow_up); Drawable rdrawable = getResources().getDrawable(R.drawable.ic_arrow_down); expandable_view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int matchParentMeasureSpec = View.MeasureSpec.makeMeasureSpec(((View) v.getParent()).getWidth(), View.MeasureSpec.EXACTLY); int wrapContentMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); v.measure(matchParentMeasureSpec, wrapContentMeasureSpec); final int targetHeight = v.getMeasuredHeight(); preExpandCont.setMinimumHeight(targetHeight); if (!isExpanded) { // preExpandCont.setVisibility(View.VISIBLE); DelayHelper.delayStartWith(100, () -> { int scrollTo = ((View) preExpandCont.getParent().getParent()).getTop() - DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 200) + targetHeight; // int scrollTo = preExpandCont.getTop() + targetHeight - DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 50); nestedContainer.smoothScrollTo(0, scrollTo); }); ViewECAnimator.expand(expandable_view, (int) DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 210), targetHeight, 1); arrow_btn.setImageDrawable(drawable); isExpanded = true; } else { // preExpandCont.setVisibility(View.GONE); ViewECAnimator.collapse(expandable_view, (int) DiamensionManager.getInstance().convertDpToPixel(DetailsAct.this, 210), targetHeight, 1); arrow_btn.setImageDrawable(rdrawable); isExpanded = false; } } }); } }
10,955
0.670954
0.664933
229
46.868996
64.502197
560
false
false
0
0
0
0
0
0
0.777293
false
false
3
e1b714b031fa9860b90efa4c9c4cafe0fea31d86
12,120,397,775,290
9643c578f3735f47a051f71a488a5347f946c657
/src/main/java/com/airwire/controller/UploadController.java
1c4f8e8b2ac8a3dfc8072dd4c243e372bc3b390f
[]
no_license
PMSShivRitesh/prepaidcode
https://github.com/PMSShivRitesh/prepaidcode
eab761dd03261f55be63a4192fb466a1198438d0
fce55f8e34f7e607128b1853a413539f8f32155d
refs/heads/master
2022-03-26T16:40:14.830000
2020-01-18T20:26:07
2020-01-18T20:26:07
105,272,179
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.airwire.controller; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.security.Principal; import java.util.Date; import java.util.StringTokenizer; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.airwire.model.HotelInfo; import com.airwire.model.Plan; import com.airwire.model.PrepaidCode; import com.airwire.model.User; import com.airwire.service.HotelService; import com.airwire.service.PlanService; import com.airwire.service.PrepaidCodeService; import com.airwire.service.UserService; import au.com.bytecode.opencsv.CSVReader; /** * * @author ShivshankerMhadiwale * */ @Controller public class UploadController { @Autowired PrepaidCodeService prepaidCodeService; @Autowired UserService userService; @Autowired HotelService hotelService; @Autowired PlanService planService; private CSVReader reader; private BufferedOutputStream stream; @RequestMapping("importcsv") public String uploadcsv(Model model, Principal principal) { model.addAttribute("userName", principal.getName()); model.addAttribute("hotelInfoList", hotelService.findAll()); User user = userService.findByUsername(principal.getName()); if(user.getHotelInfo()==null){ model.addAttribute("planList", planService.findAll()); }else{ model.addAttribute("planList", planService.findByHotelInfo(user.getHotelInfo())); } return "admin/importcsv"; } @RequestMapping(value = "uploadprepaidcodeexcelfile", method = RequestMethod.POST) public String uploadprepaidCodeExcelFile(Principal principal, ModelMap model, @RequestParam("file") MultipartFile file, @RequestParam(required = false) Long hotelId, @RequestParam("plan") Long plan, @RequestParam("amount") int amount, HttpServletRequest request) { if (file.isEmpty()) { model.put("msg", "failed to upload file because its empty"); return "mainpage"; } String rootPath = request.getSession().getServletContext().getRealPath("/"); File dir = new File(rootPath + File.separator + "uploadedfile"); if (!dir.exists()) { dir.mkdirs(); } File serverFile = new File(dir.getAbsolutePath() + File.separator + file.getOriginalFilename()); try { InputStream is = file.getInputStream(); stream = new BufferedOutputStream(new FileOutputStream(serverFile)); int i; while ((i = is.read()) != -1) { stream.write(i); } stream.flush(); } catch (IOException e) { model.put("msg", "failed to process file because : " + e.getMessage()); return "admin/importcsv"; } String[] nextLine; try { FileReader fileReader = new FileReader(serverFile); reader = new CSVReader(fileReader, ';', '\'', 1); User user = userService.findByUsername(principal.getName()); HotelInfo hotelInfo = null; if (hotelId != null && hotelId > 0) { hotelInfo = hotelService.findById(hotelId); } else { hotelInfo = user.getHotelInfo(); } Plan planObject = planService.findById(plan); while ((nextLine = reader.readNext()) != null) { StringTokenizer t = new StringTokenizer(nextLine[0]); PrepaidCode prepaidCode = new PrepaidCode(); if (hotelInfo.getControllerName().equalsIgnoreCase("WIFISOFT")) { String prepaidCodeTemp = t.nextToken(","); prepaidCodeTemp = prepaidCodeTemp.replaceAll("\"", ""); prepaidCode.setPrepaidCode(prepaidCodeTemp); } else { String wuserid = t.nextToken(","); String wpassword = t.nextToken(","); wuserid = wuserid.replaceAll("\"", ""); wpassword = wpassword.replaceAll("\"", ""); prepaidCode.setWuserid(wuserid); prepaidCode.setWpassword(wpassword); } prepaidCode.setHotelInfo(hotelInfo); prepaidCode.setAmount(amount); prepaidCode.setPlan(planObject); //prepaidCode.setDays(plan); prepaidCode.setStatus("1"); prepaidCode.setUser(user); Date date = new Date(); prepaidCode.setDate(date); prepaidCodeService.savePrepaidCode(prepaidCode); } } catch (IOException e) { model.put("msg", "error while reading csv andprocess : " + e.getMessage()); } model.put("msg", "File successfully uploaded and processed"); model.addAttribute("userName", principal.getName()); model.addAttribute("hotelInfoList", hotelService.findAll()); User user = userService.findByUsername(principal.getName()); if(user.getHotelInfo()==null){ model.addAttribute("planList", planService.findAll()); }else{ model.addAttribute("planList", planService.findByHotelInfo(user.getHotelInfo())); } return "admin/importcsv"; } }
UTF-8
Java
5,218
java
UploadController.java
Java
[ { "context": ".bytecode.opencsv.CSVReader;\r\n/**\r\n * \r\n * @author ShivshankerMhadiwale\r\n *\r\n */\r\n@Controller\r\npublic class UploadControl", "end": 1198, "score": 0.9998319149017334, "start": 1178, "tag": "NAME", "value": "ShivshankerMhadiwale" } ]
null
[]
package com.airwire.controller; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.security.Principal; import java.util.Date; import java.util.StringTokenizer; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.airwire.model.HotelInfo; import com.airwire.model.Plan; import com.airwire.model.PrepaidCode; import com.airwire.model.User; import com.airwire.service.HotelService; import com.airwire.service.PlanService; import com.airwire.service.PrepaidCodeService; import com.airwire.service.UserService; import au.com.bytecode.opencsv.CSVReader; /** * * @author ShivshankerMhadiwale * */ @Controller public class UploadController { @Autowired PrepaidCodeService prepaidCodeService; @Autowired UserService userService; @Autowired HotelService hotelService; @Autowired PlanService planService; private CSVReader reader; private BufferedOutputStream stream; @RequestMapping("importcsv") public String uploadcsv(Model model, Principal principal) { model.addAttribute("userName", principal.getName()); model.addAttribute("hotelInfoList", hotelService.findAll()); User user = userService.findByUsername(principal.getName()); if(user.getHotelInfo()==null){ model.addAttribute("planList", planService.findAll()); }else{ model.addAttribute("planList", planService.findByHotelInfo(user.getHotelInfo())); } return "admin/importcsv"; } @RequestMapping(value = "uploadprepaidcodeexcelfile", method = RequestMethod.POST) public String uploadprepaidCodeExcelFile(Principal principal, ModelMap model, @RequestParam("file") MultipartFile file, @RequestParam(required = false) Long hotelId, @RequestParam("plan") Long plan, @RequestParam("amount") int amount, HttpServletRequest request) { if (file.isEmpty()) { model.put("msg", "failed to upload file because its empty"); return "mainpage"; } String rootPath = request.getSession().getServletContext().getRealPath("/"); File dir = new File(rootPath + File.separator + "uploadedfile"); if (!dir.exists()) { dir.mkdirs(); } File serverFile = new File(dir.getAbsolutePath() + File.separator + file.getOriginalFilename()); try { InputStream is = file.getInputStream(); stream = new BufferedOutputStream(new FileOutputStream(serverFile)); int i; while ((i = is.read()) != -1) { stream.write(i); } stream.flush(); } catch (IOException e) { model.put("msg", "failed to process file because : " + e.getMessage()); return "admin/importcsv"; } String[] nextLine; try { FileReader fileReader = new FileReader(serverFile); reader = new CSVReader(fileReader, ';', '\'', 1); User user = userService.findByUsername(principal.getName()); HotelInfo hotelInfo = null; if (hotelId != null && hotelId > 0) { hotelInfo = hotelService.findById(hotelId); } else { hotelInfo = user.getHotelInfo(); } Plan planObject = planService.findById(plan); while ((nextLine = reader.readNext()) != null) { StringTokenizer t = new StringTokenizer(nextLine[0]); PrepaidCode prepaidCode = new PrepaidCode(); if (hotelInfo.getControllerName().equalsIgnoreCase("WIFISOFT")) { String prepaidCodeTemp = t.nextToken(","); prepaidCodeTemp = prepaidCodeTemp.replaceAll("\"", ""); prepaidCode.setPrepaidCode(prepaidCodeTemp); } else { String wuserid = t.nextToken(","); String wpassword = t.nextToken(","); wuserid = wuserid.replaceAll("\"", ""); wpassword = wpassword.replaceAll("\"", ""); prepaidCode.setWuserid(wuserid); prepaidCode.setWpassword(wpassword); } prepaidCode.setHotelInfo(hotelInfo); prepaidCode.setAmount(amount); prepaidCode.setPlan(planObject); //prepaidCode.setDays(plan); prepaidCode.setStatus("1"); prepaidCode.setUser(user); Date date = new Date(); prepaidCode.setDate(date); prepaidCodeService.savePrepaidCode(prepaidCode); } } catch (IOException e) { model.put("msg", "error while reading csv andprocess : " + e.getMessage()); } model.put("msg", "File successfully uploaded and processed"); model.addAttribute("userName", principal.getName()); model.addAttribute("hotelInfoList", hotelService.findAll()); User user = userService.findByUsername(principal.getName()); if(user.getHotelInfo()==null){ model.addAttribute("planList", planService.findAll()); }else{ model.addAttribute("planList", planService.findByHotelInfo(user.getHotelInfo())); } return "admin/importcsv"; } }
5,218
0.711
0.710042
156
31.448717
24.728861
101
false
false
0
0
0
0
0
0
2.544872
false
false
3
e9d3618f1c416919162832d21a1635d2a8823607
36,344,013,296,810
d3b858d40175be0930e65a6c292d05d4f4dfa784
/src/main/java/com/hibernate/mapping/demo/controller/CpuController.java
56ed1b79271ffd200c00fa93893bcf17b477700e
[]
no_license
BadThylacine/Associations
https://github.com/BadThylacine/Associations
26c492db07f919fc85a9380bf9deecedbcbb0886
fe9fefa7478c97ba0be8f60b5986400574fea88e
refs/heads/master
2023-02-15T03:29:07.926000
2021-01-16T18:31:50
2021-01-16T18:31:50
330,229,818
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hibernate.mapping.demo.controller; import com.hibernate.mapping.demo.model.Cpu; import com.hibernate.mapping.demo.model.Customer; import com.hibernate.mapping.demo.model.Pc; import com.hibernate.mapping.demo.model.Pc; import com.hibernate.mapping.demo.service.CpuService; import com.hibernate.mapping.demo.service.CustomerService; import com.hibernate.mapping.demo.service.PcService; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/cpu") public class CpuController { CpuService cpuService; PcService pcService; CustomerService customerService; CpuController(CpuService cpuService) { this.cpuService = cpuService; } @PostMapping public Cpu createCpu(@RequestBody Cpu cpu) { cpuService.createCpu(cpu); return cpu; } @GetMapping("/all") public List<Cpu> getAllCpus() { return cpuService.getAllCpu(); } @GetMapping("/byid/{id}") public Cpu getCpuById(@PathVariable int id) { return cpuService.getCpuById(id); } @DeleteMapping("/{id}") public String deleteCpuById(@PathVariable int id) { cpuService.deleteCpuById(id); return "Deleted: " + id; } @PostMapping("addcpu/{pcid}/{customerid}") public Cpu getPcAndCustomer(@PathVariable int pcid, @PathVariable int customerid, @RequestBody Cpu cpu) { Pc pc = pcService.getPcById(pcid); Customer customer = customerService.getCustomerById(customerid); cpu.setPc(pc); cpu.setCustomer((List<Customer>) customer); return cpuService.createCpu(cpu); } }
UTF-8
Java
1,642
java
CpuController.java
Java
[]
null
[]
package com.hibernate.mapping.demo.controller; import com.hibernate.mapping.demo.model.Cpu; import com.hibernate.mapping.demo.model.Customer; import com.hibernate.mapping.demo.model.Pc; import com.hibernate.mapping.demo.model.Pc; import com.hibernate.mapping.demo.service.CpuService; import com.hibernate.mapping.demo.service.CustomerService; import com.hibernate.mapping.demo.service.PcService; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/cpu") public class CpuController { CpuService cpuService; PcService pcService; CustomerService customerService; CpuController(CpuService cpuService) { this.cpuService = cpuService; } @PostMapping public Cpu createCpu(@RequestBody Cpu cpu) { cpuService.createCpu(cpu); return cpu; } @GetMapping("/all") public List<Cpu> getAllCpus() { return cpuService.getAllCpu(); } @GetMapping("/byid/{id}") public Cpu getCpuById(@PathVariable int id) { return cpuService.getCpuById(id); } @DeleteMapping("/{id}") public String deleteCpuById(@PathVariable int id) { cpuService.deleteCpuById(id); return "Deleted: " + id; } @PostMapping("addcpu/{pcid}/{customerid}") public Cpu getPcAndCustomer(@PathVariable int pcid, @PathVariable int customerid, @RequestBody Cpu cpu) { Pc pc = pcService.getPcById(pcid); Customer customer = customerService.getCustomerById(customerid); cpu.setPc(pc); cpu.setCustomer((List<Customer>) customer); return cpuService.createCpu(cpu); } }
1,642
0.705238
0.705238
56
28.339285
22.505774
109
false
false
0
0
0
0
0
0
0.482143
false
false
3
3493f00642c32bac335b4490fd681859c188432d
36,344,013,293,443
aa5dd2f01c452882de10cfc8f6e8e0bd025372f8
/src/main/java/xyz/cofe/scriptool/gui/Expander.java
1711d08a80cecac057634bcf45bef16b4d683fd2
[ "MIT" ]
permissive
gochaorg/scriptool
https://github.com/gochaorg/scriptool
f951927606d6b6f200a304fbb62ca85e897b2f5d
2d89df609decad5f1f7cb05762a0b5d441adeaa2
refs/heads/master
2015-09-25T10:26:48.700000
2015-09-17T12:46:16
2015-09-17T12:46:16
40,117,998
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * The MIT License * * Copyright 2015 Kamnev Georgiy (nt.gocha@gmail.com). * * ะ”ะฐะฝะฝะฐั ะปะธั†ะตะฝะทะธั ั€ะฐะทั€ะตัˆะฐะตั‚, ะฑะตะทะฒะพะทะผะตะทะดะฝะพ, ะปะธั†ะฐะผ, ะฟะพะปัƒั‡ะธะฒัˆะธะผ ะบะพะฟะธัŽ ะดะฐะฝะฝะพะณะพ ะฟั€ะพะณั€ะฐะผะผะฝะพะณะพ * ะพะฑะตัะฟะตั‡ะตะฝะธั ะธ ัะพะฟัƒั‚ัั‚ะฒัƒัŽั‰ะตะน ะดะพะบัƒะผะตะฝั‚ะฐั†ะธะธ (ะฒ ะดะฐะปัŒะฝะตะนัˆะตะผ ะธะผะตะฝัƒะตะผั‹ะผะธ "ะŸั€ะพะณั€ะฐะผะผะฝะพะต ะžะฑะตัะฟะตั‡ะตะฝะธะต"), * ะธัะฟะพะปัŒะทะพะฒะฐั‚ัŒ ะŸั€ะพะณั€ะฐะผะผะฝะพะต ะžะฑะตัะฟะตั‡ะตะฝะธะต ะฑะตะท ะพะณั€ะฐะฝะธั‡ะตะฝะธะน, ะฒะบะปัŽั‡ะฐั ะฝะตะพะณั€ะฐะฝะธั‡ะตะฝะฝะพะต ะฟั€ะฐะฒะพ ะฝะฐ * ะธัะฟะพะปัŒะทะพะฒะฐะฝะธะต, ะบะพะฟะธั€ะพะฒะฐะฝะธะต, ะธะทะผะตะฝะตะฝะธะต, ะพะฑัŠะตะดะธะฝะตะฝะธะต, ะฟัƒะฑะปะธะบะฐั†ะธัŽ, ั€ะฐัะฟั€ะพัั‚ั€ะฐะฝะตะฝะธะต, ััƒะฑะปะธั†ะตะฝะทะธั€ะพะฒะฐะฝะธะต * ะธ/ะธะปะธ ะฟั€ะพะดะฐะถัƒ ะบะพะฟะธะน ะŸั€ะพะณั€ะฐะผะผะฝะพะณะพ ะžะฑะตัะฟะตั‡ะตะฝะธั, ั‚ะฐะบะถะต ะบะฐะบ ะธ ะปะธั†ะฐะผ, ะบะพั‚ะพั€ั‹ะผ ะฟั€ะตะดะพัั‚ะฐะฒะปัะตั‚ัั * ะดะฐะฝะฝะพะต ะŸั€ะพะณั€ะฐะผะผะฝะพะต ะžะฑะตัะฟะตั‡ะตะฝะธะต, ะฟั€ะธ ัะพะฑะปัŽะดะตะฝะธะธ ัะปะตะดัƒัŽั‰ะธั… ัƒัะปะพะฒะธะน: * * ะ’ั‹ัˆะตัƒะฟะพะผัะฝัƒั‚ั‹ะน ะบะพะฟะธั€ะฐะนั‚ ะธ ะดะฐะฝะฝั‹ะต ัƒัะปะพะฒะธั ะดะพะปะถะฝั‹ ะฑั‹ั‚ัŒ ะฒะบะปัŽั‡ะตะฝั‹ ะฒะพ ะฒัะต ะบะพะฟะธะธ * ะธะปะธ ะทะฝะฐั‡ะธะผั‹ะต ั‡ะฐัั‚ะธ ะดะฐะฝะฝะพะณะพ ะŸั€ะพะณั€ะฐะผะผะฝะพะณะพ ะžะฑะตัะฟะตั‡ะตะฝะธั. * * ะ”ะะะะžะ• ะŸะ ะžะ“ะ ะะœะœะะžะ• ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะ• ะŸะ ะ•ะ”ะžะกะขะะ’ะ›ะฏะ•ะขะกะฏ ยซะšะะš ะ•ะกะขะฌยป, ะ‘ะ•ะ— ะ›ะฎะ‘ะžะ“ะž ะ’ะ˜ะ”ะ ะ“ะะ ะะะขะ˜ะ™, * ะฏะ’ะะž ะ’ะซะ ะะ–ะ•ะะะซะฅ ะ˜ะ›ะ˜ ะŸะžะ”ะ ะะ—ะฃะœะ•ะ’ะะ•ะœะซะฅ, ะ’ะšะ›ะฎะงะะฏ, ะะž ะะ• ะžะ“ะ ะะะ˜ะงะ˜ะ’ะะฏะกะฌ ะ“ะะ ะะะขะ˜ะฏะœะ˜ ะขะžะ’ะะ ะะžะ™ ะŸะ ะ˜ะ“ะžะ”ะะžะกะขะ˜, * ะกะžะžะขะ’ะ•ะขะกะขะ’ะ˜ะฏ ะŸะž ะ•ะ“ะž ะšะžะะšะ ะ•ะขะะžะœะฃ ะะะ—ะะะงะ•ะะ˜ะฎ ะ˜ ะะ•ะะะ ะฃะจะ•ะะ˜ะฏ ะŸะ ะะ’. ะะ˜ ะ’ ะšะะšะžะœ ะกะ›ะฃะงะะ• ะะ’ะขะžะ ะซ * ะ˜ะ›ะ˜ ะŸะ ะะ’ะžะžะ‘ะ›ะะ”ะะขะ•ะ›ะ˜ ะะ• ะะ•ะกะฃะข ะžะขะ’ะ•ะขะกะขะ’ะ•ะะะžะกะขะ˜ ะŸะž ะ˜ะกะšะะœ ะž ะ’ะžะ—ะœะ•ะฉะ•ะะ˜ะ˜ ะฃะฉะ•ะ ะ‘ะ, ะฃะ‘ะซะขะšะžะ’ * ะ˜ะ›ะ˜ ะ”ะ ะฃะ“ะ˜ะฅ ะขะ ะ•ะ‘ะžะ’ะะะ˜ะ™ ะŸะž ะ”ะ•ะ™ะกะขะ’ะฃะฎะฉะ˜ะœ ะšะžะะขะ ะะšะขะะœ, ะ”ะ•ะ›ะ˜ะšะขะะœ ะ˜ะ›ะ˜ ะ˜ะะžะœะฃ, ะ’ะžะ—ะะ˜ะšะจะ˜ะœ ะ˜ะ—, ะ˜ะœะ•ะฎะฉะ˜ะœ * ะŸะ ะ˜ะงะ˜ะะžะ™ ะ˜ะ›ะ˜ ะกะ’ะฏะ—ะะะะซะœ ะก ะŸะ ะžะ“ะ ะะœะœะะซะœ ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะ•ะœ ะ˜ะ›ะ˜ ะ˜ะกะŸะžะ›ะฌะ—ะžะ’ะะะ˜ะ•ะœ ะŸะ ะžะ“ะ ะะœะœะะžะ“ะž ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะฏ * ะ˜ะ›ะ˜ ะ˜ะะซะœะ˜ ะ”ะ•ะ™ะกะขะ’ะ˜ะฏะœะ˜ ะก ะŸะ ะžะ“ะ ะะœะœะะซะœ ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะ•ะœ. */ package xyz.cofe.scriptool.gui; import java.awt.Color; import java.awt.Cursor; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.border.LineBorder; import xyz.cofe.collection.Func0; /** * * @author nt.gocha@gmail.com */ public class Expander extends JLabel { //<editor-fold defaultstate="collapsed" desc="log ะคัƒะฝะบั†ะธะธ"> private static void logFine(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.FINE, message, args); } private static void logFiner(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.FINER, message, args); } private static void logFinest(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.FINEST, message, args); } private static void logInfo(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.INFO, message, args); } private static void logWarning(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.WARNING, message, args); } private static void logSevere(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.SEVERE, message, args); } private static void logException(Throwable ex){ Logger.getLogger(Expander.class.getName()).log(Level.SEVERE, null, ex); } //</editor-fold> private static Icon minusIcon = null; private static boolean tryLoadMinusIcon = true; private static Icon minusIcon(){ if( minusIcon!=null )return minusIcon; if( !tryLoadMinusIcon )return null; URL url = ScriptObjectUI.class.getResource("/xyz/cofe/scriptool/gui/minus.png"); if( url==null ){ tryLoadMinusIcon = false; return null; } try { BufferedImage bufIm = ImageIO.read(url); minusIcon = new ImageIcon(bufIm); } catch (IOException ex) { Logger.getLogger(ScriptObjectUI.class.getName()).log(Level.SEVERE, null, ex); tryLoadMinusIcon = false; } return minusIcon; } private static Icon plusIcon = null; private static boolean tryLoadPlusIcon = true; private static Icon plusIcon(){ if( plusIcon!=null )return plusIcon; if( !tryLoadPlusIcon )return null; URL url = ScriptObjectUI.class.getResource("/xyz/cofe/scriptool/gui/plus.png"); if( url==null ){ tryLoadPlusIcon = false; return null; } try { BufferedImage bufIm = ImageIO.read(url); plusIcon = new ImageIcon(bufIm); } catch (IOException ex) { Logger.getLogger(ScriptObjectUI.class.getName()).log(Level.SEVERE, null, ex); tryLoadPlusIcon = false; } return plusIcon; } private String collapsedText = "+"; private String expandedText = "-"; private boolean expaneded = false; private Func0 expand = null; private Func0 collapse = null; // private Icon public boolean isExpaneded() { return expaneded; } public void setExpaneded(boolean expaneded) { boolean changed = this.expaneded != expaneded; this.expaneded = expaneded; if( changed ){ if( expaneded ){ setText(expandedText); setIcon(minusIcon()); if( expand!=null )expand.apply(); }else{ setText(collapsedText); setIcon(plusIcon()); if( collapse!=null )collapse.apply(); } firePropertyChange("expaneded", !expaneded, expaneded); } } public Expander(final JComponent body){ this( new Func0<Object>() { @Override public Object apply() { body.setVisible(true); return null; } }, new Func0<Object>() { @Override public Object apply() { body.setVisible(false); return null; } }); } public Expander( Func0 expand, Func0 collapse ){ this.expand = expand; this.collapse = collapse; Icon icop = plusIcon(); Icon icom = minusIcon(); if( icop!=null && icom!=null ){ collapsedText = ""; expandedText = ""; }else{ setBorder(new LineBorder(Color.black)); } setText(collapsedText); setIcon(plusIcon()); setOpaque(false); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if( Expander.this.isExpaneded() ){ if( Expander.this.collapse!=null ){ setExpaneded(!isExpaneded()); } }else{ setExpaneded(!isExpaneded()); } } }); } }
UTF-8
Java
7,974
java
Expander.java
Java
[ { "context": "/* \n * The MIT License\n *\n * Copyright 2015 Kamnev Georgiy (nt.gocha@gmail.com).\n *\n * ะ”ะฐะฝะฝะฐั ะปะธั†ะตะฝะทะธั ั€ะฐะทั€ะต", "end": 58, "score": 0.9998535513877869, "start": 44, "tag": "NAME", "value": "Kamnev Georgiy" }, { "context": " MIT License\n *\n * Copyright 2015 Kamnev Georgiy (nt.gocha@gmail.com).\n *\n * ะ”ะฐะฝะฝะฐั ะปะธั†ะตะฝะทะธั ั€ะฐะทั€ะตัˆะฐะตั‚, ะฑะตะทะฒะพะทะผะตะทะดะฝะพ, ", "end": 78, "score": 0.9999297857284546, "start": 60, "tag": "EMAIL", "value": "nt.gocha@gmail.com" }, { "context": "port xyz.cofe.collection.Func0;\n\n/**\n *\n * @author nt.gocha@gmail.com\n */\npublic class Expander extends JLabel {\n //", "end": 1943, "score": 0.9999098181724548, "start": 1925, "tag": "EMAIL", "value": "nt.gocha@gmail.com" } ]
null
[]
/* * The MIT License * * Copyright 2015 <NAME> (<EMAIL>). * * ะ”ะฐะฝะฝะฐั ะปะธั†ะตะฝะทะธั ั€ะฐะทั€ะตัˆะฐะตั‚, ะฑะตะทะฒะพะทะผะตะทะดะฝะพ, ะปะธั†ะฐะผ, ะฟะพะปัƒั‡ะธะฒัˆะธะผ ะบะพะฟะธัŽ ะดะฐะฝะฝะพะณะพ ะฟั€ะพะณั€ะฐะผะผะฝะพะณะพ * ะพะฑะตัะฟะตั‡ะตะฝะธั ะธ ัะพะฟัƒั‚ัั‚ะฒัƒัŽั‰ะตะน ะดะพะบัƒะผะตะฝั‚ะฐั†ะธะธ (ะฒ ะดะฐะปัŒะฝะตะนัˆะตะผ ะธะผะตะฝัƒะตะผั‹ะผะธ "ะŸั€ะพะณั€ะฐะผะผะฝะพะต ะžะฑะตัะฟะตั‡ะตะฝะธะต"), * ะธัะฟะพะปัŒะทะพะฒะฐั‚ัŒ ะŸั€ะพะณั€ะฐะผะผะฝะพะต ะžะฑะตัะฟะตั‡ะตะฝะธะต ะฑะตะท ะพะณั€ะฐะฝะธั‡ะตะฝะธะน, ะฒะบะปัŽั‡ะฐั ะฝะตะพะณั€ะฐะฝะธั‡ะตะฝะฝะพะต ะฟั€ะฐะฒะพ ะฝะฐ * ะธัะฟะพะปัŒะทะพะฒะฐะฝะธะต, ะบะพะฟะธั€ะพะฒะฐะฝะธะต, ะธะทะผะตะฝะตะฝะธะต, ะพะฑัŠะตะดะธะฝะตะฝะธะต, ะฟัƒะฑะปะธะบะฐั†ะธัŽ, ั€ะฐัะฟั€ะพัั‚ั€ะฐะฝะตะฝะธะต, ััƒะฑะปะธั†ะตะฝะทะธั€ะพะฒะฐะฝะธะต * ะธ/ะธะปะธ ะฟั€ะพะดะฐะถัƒ ะบะพะฟะธะน ะŸั€ะพะณั€ะฐะผะผะฝะพะณะพ ะžะฑะตัะฟะตั‡ะตะฝะธั, ั‚ะฐะบะถะต ะบะฐะบ ะธ ะปะธั†ะฐะผ, ะบะพั‚ะพั€ั‹ะผ ะฟั€ะตะดะพัั‚ะฐะฒะปัะตั‚ัั * ะดะฐะฝะฝะพะต ะŸั€ะพะณั€ะฐะผะผะฝะพะต ะžะฑะตัะฟะตั‡ะตะฝะธะต, ะฟั€ะธ ัะพะฑะปัŽะดะตะฝะธะธ ัะปะตะดัƒัŽั‰ะธั… ัƒัะปะพะฒะธะน: * * ะ’ั‹ัˆะตัƒะฟะพะผัะฝัƒั‚ั‹ะน ะบะพะฟะธั€ะฐะนั‚ ะธ ะดะฐะฝะฝั‹ะต ัƒัะปะพะฒะธั ะดะพะปะถะฝั‹ ะฑั‹ั‚ัŒ ะฒะบะปัŽั‡ะตะฝั‹ ะฒะพ ะฒัะต ะบะพะฟะธะธ * ะธะปะธ ะทะฝะฐั‡ะธะผั‹ะต ั‡ะฐัั‚ะธ ะดะฐะฝะฝะพะณะพ ะŸั€ะพะณั€ะฐะผะผะฝะพะณะพ ะžะฑะตัะฟะตั‡ะตะฝะธั. * * ะ”ะะะะžะ• ะŸะ ะžะ“ะ ะะœะœะะžะ• ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะ• ะŸะ ะ•ะ”ะžะกะขะะ’ะ›ะฏะ•ะขะกะฏ ยซะšะะš ะ•ะกะขะฌยป, ะ‘ะ•ะ— ะ›ะฎะ‘ะžะ“ะž ะ’ะ˜ะ”ะ ะ“ะะ ะะะขะ˜ะ™, * ะฏะ’ะะž ะ’ะซะ ะะ–ะ•ะะะซะฅ ะ˜ะ›ะ˜ ะŸะžะ”ะ ะะ—ะฃะœะ•ะ’ะะ•ะœะซะฅ, ะ’ะšะ›ะฎะงะะฏ, ะะž ะะ• ะžะ“ะ ะะะ˜ะงะ˜ะ’ะะฏะกะฌ ะ“ะะ ะะะขะ˜ะฏะœะ˜ ะขะžะ’ะะ ะะžะ™ ะŸะ ะ˜ะ“ะžะ”ะะžะกะขะ˜, * ะกะžะžะขะ’ะ•ะขะกะขะ’ะ˜ะฏ ะŸะž ะ•ะ“ะž ะšะžะะšะ ะ•ะขะะžะœะฃ ะะะ—ะะะงะ•ะะ˜ะฎ ะ˜ ะะ•ะะะ ะฃะจะ•ะะ˜ะฏ ะŸะ ะะ’. ะะ˜ ะ’ ะšะะšะžะœ ะกะ›ะฃะงะะ• ะะ’ะขะžะ ะซ * ะ˜ะ›ะ˜ ะŸะ ะะ’ะžะžะ‘ะ›ะะ”ะะขะ•ะ›ะ˜ ะะ• ะะ•ะกะฃะข ะžะขะ’ะ•ะขะกะขะ’ะ•ะะะžะกะขะ˜ ะŸะž ะ˜ะกะšะะœ ะž ะ’ะžะ—ะœะ•ะฉะ•ะะ˜ะ˜ ะฃะฉะ•ะ ะ‘ะ, ะฃะ‘ะซะขะšะžะ’ * ะ˜ะ›ะ˜ ะ”ะ ะฃะ“ะ˜ะฅ ะขะ ะ•ะ‘ะžะ’ะะะ˜ะ™ ะŸะž ะ”ะ•ะ™ะกะขะ’ะฃะฎะฉะ˜ะœ ะšะžะะขะ ะะšะขะะœ, ะ”ะ•ะ›ะ˜ะšะขะะœ ะ˜ะ›ะ˜ ะ˜ะะžะœะฃ, ะ’ะžะ—ะะ˜ะšะจะ˜ะœ ะ˜ะ—, ะ˜ะœะ•ะฎะฉะ˜ะœ * ะŸะ ะ˜ะงะ˜ะะžะ™ ะ˜ะ›ะ˜ ะกะ’ะฏะ—ะะะะซะœ ะก ะŸะ ะžะ“ะ ะะœะœะะซะœ ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะ•ะœ ะ˜ะ›ะ˜ ะ˜ะกะŸะžะ›ะฌะ—ะžะ’ะะะ˜ะ•ะœ ะŸะ ะžะ“ะ ะะœะœะะžะ“ะž ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะฏ * ะ˜ะ›ะ˜ ะ˜ะะซะœะ˜ ะ”ะ•ะ™ะกะขะ’ะ˜ะฏะœะ˜ ะก ะŸะ ะžะ“ะ ะะœะœะะซะœ ะžะ‘ะ•ะกะŸะ•ะงะ•ะะ˜ะ•ะœ. */ package xyz.cofe.scriptool.gui; import java.awt.Color; import java.awt.Cursor; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.border.LineBorder; import xyz.cofe.collection.Func0; /** * * @author <EMAIL> */ public class Expander extends JLabel { //<editor-fold defaultstate="collapsed" desc="log ะคัƒะฝะบั†ะธะธ"> private static void logFine(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.FINE, message, args); } private static void logFiner(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.FINER, message, args); } private static void logFinest(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.FINEST, message, args); } private static void logInfo(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.INFO, message, args); } private static void logWarning(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.WARNING, message, args); } private static void logSevere(String message,Object ... args){ Logger.getLogger(Expander.class.getName()).log(Level.SEVERE, message, args); } private static void logException(Throwable ex){ Logger.getLogger(Expander.class.getName()).log(Level.SEVERE, null, ex); } //</editor-fold> private static Icon minusIcon = null; private static boolean tryLoadMinusIcon = true; private static Icon minusIcon(){ if( minusIcon!=null )return minusIcon; if( !tryLoadMinusIcon )return null; URL url = ScriptObjectUI.class.getResource("/xyz/cofe/scriptool/gui/minus.png"); if( url==null ){ tryLoadMinusIcon = false; return null; } try { BufferedImage bufIm = ImageIO.read(url); minusIcon = new ImageIcon(bufIm); } catch (IOException ex) { Logger.getLogger(ScriptObjectUI.class.getName()).log(Level.SEVERE, null, ex); tryLoadMinusIcon = false; } return minusIcon; } private static Icon plusIcon = null; private static boolean tryLoadPlusIcon = true; private static Icon plusIcon(){ if( plusIcon!=null )return plusIcon; if( !tryLoadPlusIcon )return null; URL url = ScriptObjectUI.class.getResource("/xyz/cofe/scriptool/gui/plus.png"); if( url==null ){ tryLoadPlusIcon = false; return null; } try { BufferedImage bufIm = ImageIO.read(url); plusIcon = new ImageIcon(bufIm); } catch (IOException ex) { Logger.getLogger(ScriptObjectUI.class.getName()).log(Level.SEVERE, null, ex); tryLoadPlusIcon = false; } return plusIcon; } private String collapsedText = "+"; private String expandedText = "-"; private boolean expaneded = false; private Func0 expand = null; private Func0 collapse = null; // private Icon public boolean isExpaneded() { return expaneded; } public void setExpaneded(boolean expaneded) { boolean changed = this.expaneded != expaneded; this.expaneded = expaneded; if( changed ){ if( expaneded ){ setText(expandedText); setIcon(minusIcon()); if( expand!=null )expand.apply(); }else{ setText(collapsedText); setIcon(plusIcon()); if( collapse!=null )collapse.apply(); } firePropertyChange("expaneded", !expaneded, expaneded); } } public Expander(final JComponent body){ this( new Func0<Object>() { @Override public Object apply() { body.setVisible(true); return null; } }, new Func0<Object>() { @Override public Object apply() { body.setVisible(false); return null; } }); } public Expander( Func0 expand, Func0 collapse ){ this.expand = expand; this.collapse = collapse; Icon icop = plusIcon(); Icon icom = minusIcon(); if( icop!=null && icom!=null ){ collapsedText = ""; expandedText = ""; }else{ setBorder(new LineBorder(Color.black)); } setText(collapsedText); setIcon(plusIcon()); setOpaque(false); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if( Expander.this.isExpaneded() ){ if( Expander.this.collapse!=null ){ setExpaneded(!isExpaneded()); } }else{ setExpaneded(!isExpaneded()); } } }); } }
7,944
0.627317
0.625724
209
32.033493
27.162523
102
false
false
0
0
0
0
0
0
0.636364
false
false
3
8e4eb26a46c3f351ee862d664551da3d41f6149e
13,185,549,659,288
4ef7bb2fc319d68bf08dea00087a4151996485cb
/src/main/java/com/springboot/modules/system/dto/CustomerDto.java
7c4aebd05dcded13990881b442e74da8411f79c4
[]
no_license
mars-ucas/TEST
https://github.com/mars-ucas/TEST
3e4f90e9923742f41e345ac5453828eca76e120b
34eff28e6153e2a6c12f92d77b81672b085dacb9
refs/heads/master
2020-04-05T10:08:36.364000
2018-12-17T05:08:49
2018-12-17T05:08:49
156,789,210
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.springboot.modules.system.dto; import com.springboot.modules.system.entity.Customer; public class CustomerDto { private long id; private String name; private String tel; private String mobileTel; private String unit; private String address; private String reportNums; public CustomerDto() { super(); } public CustomerDto(long id, String name, String tel, String mobileTel, String unit, String address, String reportNums) { super(); this.id = id; this.name = name; this.tel = tel; this.mobileTel = mobileTel; this.unit = unit; this.address = address; this.reportNums = reportNums; } public CustomerDto(Customer customer) { this.id = customer.getId(); this.name = customer.getName(); this.tel = customer.getTel(); this.mobileTel = customer.getMobileTel(); this.unit = customer.getUnit(); this.address = customer.getAddress(); this.reportNums = customer.getReportNums(); } /** * @return the id */ public long getId() { return id; } /** * @param id the id to set */ public void setId(long id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the tel */ public String getTel() { return tel; } /** * @param tel the tel to set */ public void setTel(String tel) { this.tel = tel; } /** * @return the mobileTel */ public String getMobileTel() { return mobileTel; } /** * @param mobileTel the mobileTel to set */ public void setMobileTel(String mobileTel) { this.mobileTel = mobileTel; } /** * @return the unit */ public String getUnit() { return unit; } /** * @param unit the unit to set */ public void setUnit(String unit) { this.unit = unit; } /** * @return the address */ public String getAddress() { return address; } /** * @param address the address to set */ public void setAddress(String address) { this.address = address; } /** * @return the reportNums */ public String getReportNums() { return reportNums; } /** * @param reportNums the reportNums to set */ public void setReportNums(String reportNums) { this.reportNums = reportNums; } }
UTF-8
Java
2,289
java
CustomerDto.java
Java
[]
null
[]
package com.springboot.modules.system.dto; import com.springboot.modules.system.entity.Customer; public class CustomerDto { private long id; private String name; private String tel; private String mobileTel; private String unit; private String address; private String reportNums; public CustomerDto() { super(); } public CustomerDto(long id, String name, String tel, String mobileTel, String unit, String address, String reportNums) { super(); this.id = id; this.name = name; this.tel = tel; this.mobileTel = mobileTel; this.unit = unit; this.address = address; this.reportNums = reportNums; } public CustomerDto(Customer customer) { this.id = customer.getId(); this.name = customer.getName(); this.tel = customer.getTel(); this.mobileTel = customer.getMobileTel(); this.unit = customer.getUnit(); this.address = customer.getAddress(); this.reportNums = customer.getReportNums(); } /** * @return the id */ public long getId() { return id; } /** * @param id the id to set */ public void setId(long id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the tel */ public String getTel() { return tel; } /** * @param tel the tel to set */ public void setTel(String tel) { this.tel = tel; } /** * @return the mobileTel */ public String getMobileTel() { return mobileTel; } /** * @param mobileTel the mobileTel to set */ public void setMobileTel(String mobileTel) { this.mobileTel = mobileTel; } /** * @return the unit */ public String getUnit() { return unit; } /** * @param unit the unit to set */ public void setUnit(String unit) { this.unit = unit; } /** * @return the address */ public String getAddress() { return address; } /** * @param address the address to set */ public void setAddress(String address) { this.address = address; } /** * @return the reportNums */ public String getReportNums() { return reportNums; } /** * @param reportNums the reportNums to set */ public void setReportNums(String reportNums) { this.reportNums = reportNums; } }
2,289
0.649192
0.649192
138
15.586957
15.787414
100
false
false
0
0
0
0
0
0
1.405797
false
false
3
a36c17c419269f2350e53ebd36816b3b5e6736bc
13,185,549,659,684
d308857a09c5b8c5af9ebd0f416344f554cee037
/Kata4_FirstStep/src/test/java/TestSingleLinkList.java
e847844e4a0505134480ec7c50a6d840780effd3
[]
no_license
tuananh00473/Kata5_31_07_2013
https://github.com/tuananh00473/Kata5_31_07_2013
d516497a11e1fd4d7719c597d8465dd95a30bd01
d8345f2725d8a1067d4ebe29a027070cb476b487
refs/heads/master
2021-01-10T21:23:44.394000
2013-07-31T07:37:51
2013-07-31T07:37:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import com.qsoft.kata4.business.impl.SingleLinkList; import org.junit.Before; import org.junit.Test; /** * User: anhnt * Date: 7/23/13 * Time: 1:59 PM */ public class TestSingleLinkList { @Before public void setUp(){ } @Test public void testCreateNewSingleLinkList(){ SingleLinkList singleLinkList = new SingleLinkList(); } }
UTF-8
Java
366
java
TestSingleLinkList.java
Java
[ { "context": "junit.Before;\nimport org.junit.Test;\n\n/**\n * User: anhnt\n * Date: 7/23/13\n * Time: 1:59 PM\n */\npublic clas", "end": 120, "score": 0.9996302127838135, "start": 115, "tag": "USERNAME", "value": "anhnt" } ]
null
[]
import com.qsoft.kata4.business.impl.SingleLinkList; import org.junit.Before; import org.junit.Test; /** * User: anhnt * Date: 7/23/13 * Time: 1:59 PM */ public class TestSingleLinkList { @Before public void setUp(){ } @Test public void testCreateNewSingleLinkList(){ SingleLinkList singleLinkList = new SingleLinkList(); } }
366
0.672131
0.647541
22
15.636364
17.502066
61
false
false
0
0
0
0
0
0
0.181818
false
false
3
1ba4f3d578bdf442d1c99ef3b5962ab7f6a158c9
3,582,002,781,907
3a11cb3730e854a229f5c0e6658e6fabb99e1386
/LoginApp/src/raja/nayapamu/ForwardServlet.java
bcc8e3b72ff9939ee747e2e24b6bf9904afc1db6
[]
no_license
nayrao/webappgit
https://github.com/nayrao/webappgit
25b6fbac589b0d66e9fd1beeb41d97c0952aeb89
20db1a52ec007c417afdcdd69d22b5ae988de908
refs/heads/master
2020-09-12T17:10:38.913000
2019-11-18T16:21:45
2019-11-18T16:21:45
222,489,885
0
0
null
false
2019-12-12T13:37:02
2019-11-18T16:09:38
2019-11-18T16:22:22
2019-12-12T13:35:58
5
0
0
1
Java
false
false
package raja.nayapamu; import java.io.IOException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ForwardServlet extends HttpServlet{ /** * */ private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request,HttpServletResponse response) { //response.getWriter(); } }
UTF-8
Java
441
java
ForwardServlet.java
Java
[]
null
[]
package raja.nayapamu; import java.io.IOException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ForwardServlet extends HttpServlet{ /** * */ private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request,HttpServletResponse response) { //response.getWriter(); } }
441
0.732426
0.730159
22
18.045454
22.469126
78
false
false
0
0
0
0
0
0
0.909091
false
false
3
3fbe64402e024e9410269868643234573441a00d
26,508,538,209,237
7b8aba41f248f3d92580d33d177e676e8116d1a3
/football/app/src/main/java/com/dongqiudi/news/adapter/UserinfoNotifyAdapter.java
b4c7a4acadd76f99407692e8c4bd7f56f9600918
[]
no_license
lpjhblpj/football
https://github.com/lpjhblpj/football
4a78bcb008854959ec4f1dd6ee253e7bbfa6fc7a
f6bb1e45ca74766a681284de7897f6437fd3aa70
refs/heads/master
2018-01-10T03:35:40.159000
2015-12-02T15:12:08
2015-12-02T15:12:08
47,268,680
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dongqiudi.news.adapter; import android.content.Context; import android.graphics.Color; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseAdapter; import android.widget.RelativeLayout; import android.widget.TextView; import com.dongqiudi.news.BaseApplication; import com.dongqiudi.news.R; import com.dongqiudi.news.model.gson.MsgnotifyGsonModel; import com.dongqiudi.news.universalimageloader.core.DisplayImageOptions; import com.dongqiudi.news.universalimageloader.core.ImageLoader; import com.dongqiudi.news.util.DateUtil; import com.makeramen.RoundedImageView; import java.util.List; import butterknife.ButterKnife; import butterknife.InjectView; /** * Created by akira on 2015/1/31. */ public class UserinfoNotifyAdapter extends BaseAdapter { private Context mContext; private List<MsgnotifyGsonModel> data; private LayoutInflater layoutInflater; private ImageLoader mImageLoader; private DisplayImageOptions headOption; // private int imgWidth,imgHeight; public AbsListView.OnScrollListener mScrollListener = new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case AbsListView.OnScrollListener.SCROLL_STATE_IDLE: mImageLoader.resume(); break; case AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: mImageLoader.pause(); break; } } @Override public void onScroll(AbsListView view, int i, int i2, int i3) { } }; public UserinfoNotifyAdapter(Context context, List<MsgnotifyGsonModel> data) { this.mContext = context; this.data = data; layoutInflater = LayoutInflater.from(context); mImageLoader = BaseApplication.getImageLoader(context); headOption = new DisplayImageOptions.Builder().showStubImage(R.drawable.comment_head) .showImageForEmptyUri(R.drawable.comment_head) .showImageOnFail(R.drawable.comment_head).cacheInMemory(true).cacheOnDisc(true) .build(); } @Override public int getCount() { return data == null ? 0 : data.size(); } @Override public MsgnotifyGsonModel getItem(int i) { return data.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View view, ViewGroup parent) { MsgnotifyGsonModel model = getItem(position); MsgNotifyHolder viewHolder; if (view == null) { view = layoutInflater.inflate(R.layout.item_msg_notify, null); viewHolder = new MsgNotifyHolder(view); view.setTag(viewHolder); } else { viewHolder = (MsgNotifyHolder)view.getTag(); } if (model.author != null && !TextUtils.isEmpty(model.author.username)) viewHolder.mTitle.setText(model.author.username); else { viewHolder.mTitle.setText("-"); } if (model.author != null && !TextUtils.isEmpty(model.author.avatar)) { mImageLoader.displayImage(model.author.avatar, viewHolder.mHead, headOption); } else { viewHolder.mHead.setImageResource(R.drawable.helper_icon); } if (model.is_new == 1) { // ๆ–ฐ็š„ // viewHolder.topLayout.setBackgroundColor(Color.parseColor("#ECEAD3")); viewHolder.mTopLayout.setBackgroundColor(Color.parseColor("#ecead3")); viewHolder.mContentLayout.setBackgroundColor(Color.parseColor("#f4f2da")); viewHolder.notifyItem.setBackgroundColor(R.drawable.message_unread_bg); } else { viewHolder.mTopLayout.setBackgroundColor(Color.parseColor("#f9f9f9")); viewHolder.mContentLayout.setBackgroundColor(Color.parseColor("#ffffff")); viewHolder.notifyItem.setBackgroundResource(R.drawable.thread_list_drawable); } viewHolder.mDesc.setText(model.content); viewHolder.mTime.setText(TextUtils.isEmpty(model.getCreated_at()) ? "" : DateUtil .formatMsgDate(model.getCreated_at())); return view; } static class MsgNotifyHolder { @InjectView(R.id.head) RoundedImageView mHead; @InjectView(R.id.title) TextView mTitle; @InjectView(R.id.time) TextView mTime; @InjectView(R.id.desc) TextView mDesc; @InjectView(R.id.top_layout) RelativeLayout mTopLayout; @InjectView(R.id.content_layout) RelativeLayout mContentLayout; @InjectView(R.id.notify_item) RelativeLayout notifyItem; MsgNotifyHolder(View view) { ButterKnife.inject(this, view); } } }
UTF-8
Java
5,032
java
UserinfoNotifyAdapter.java
Java
[ { "context": "\nimport butterknife.InjectView;\n\n/**\n * Created by akira on 2015/1/31.\n */\npublic class UserinfoNotifyAdap", "end": 825, "score": 0.9995636940002441, "start": 820, "tag": "USERNAME", "value": "akira" } ]
null
[]
package com.dongqiudi.news.adapter; import android.content.Context; import android.graphics.Color; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseAdapter; import android.widget.RelativeLayout; import android.widget.TextView; import com.dongqiudi.news.BaseApplication; import com.dongqiudi.news.R; import com.dongqiudi.news.model.gson.MsgnotifyGsonModel; import com.dongqiudi.news.universalimageloader.core.DisplayImageOptions; import com.dongqiudi.news.universalimageloader.core.ImageLoader; import com.dongqiudi.news.util.DateUtil; import com.makeramen.RoundedImageView; import java.util.List; import butterknife.ButterKnife; import butterknife.InjectView; /** * Created by akira on 2015/1/31. */ public class UserinfoNotifyAdapter extends BaseAdapter { private Context mContext; private List<MsgnotifyGsonModel> data; private LayoutInflater layoutInflater; private ImageLoader mImageLoader; private DisplayImageOptions headOption; // private int imgWidth,imgHeight; public AbsListView.OnScrollListener mScrollListener = new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case AbsListView.OnScrollListener.SCROLL_STATE_IDLE: mImageLoader.resume(); break; case AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: mImageLoader.pause(); break; } } @Override public void onScroll(AbsListView view, int i, int i2, int i3) { } }; public UserinfoNotifyAdapter(Context context, List<MsgnotifyGsonModel> data) { this.mContext = context; this.data = data; layoutInflater = LayoutInflater.from(context); mImageLoader = BaseApplication.getImageLoader(context); headOption = new DisplayImageOptions.Builder().showStubImage(R.drawable.comment_head) .showImageForEmptyUri(R.drawable.comment_head) .showImageOnFail(R.drawable.comment_head).cacheInMemory(true).cacheOnDisc(true) .build(); } @Override public int getCount() { return data == null ? 0 : data.size(); } @Override public MsgnotifyGsonModel getItem(int i) { return data.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View view, ViewGroup parent) { MsgnotifyGsonModel model = getItem(position); MsgNotifyHolder viewHolder; if (view == null) { view = layoutInflater.inflate(R.layout.item_msg_notify, null); viewHolder = new MsgNotifyHolder(view); view.setTag(viewHolder); } else { viewHolder = (MsgNotifyHolder)view.getTag(); } if (model.author != null && !TextUtils.isEmpty(model.author.username)) viewHolder.mTitle.setText(model.author.username); else { viewHolder.mTitle.setText("-"); } if (model.author != null && !TextUtils.isEmpty(model.author.avatar)) { mImageLoader.displayImage(model.author.avatar, viewHolder.mHead, headOption); } else { viewHolder.mHead.setImageResource(R.drawable.helper_icon); } if (model.is_new == 1) { // ๆ–ฐ็š„ // viewHolder.topLayout.setBackgroundColor(Color.parseColor("#ECEAD3")); viewHolder.mTopLayout.setBackgroundColor(Color.parseColor("#ecead3")); viewHolder.mContentLayout.setBackgroundColor(Color.parseColor("#f4f2da")); viewHolder.notifyItem.setBackgroundColor(R.drawable.message_unread_bg); } else { viewHolder.mTopLayout.setBackgroundColor(Color.parseColor("#f9f9f9")); viewHolder.mContentLayout.setBackgroundColor(Color.parseColor("#ffffff")); viewHolder.notifyItem.setBackgroundResource(R.drawable.thread_list_drawable); } viewHolder.mDesc.setText(model.content); viewHolder.mTime.setText(TextUtils.isEmpty(model.getCreated_at()) ? "" : DateUtil .formatMsgDate(model.getCreated_at())); return view; } static class MsgNotifyHolder { @InjectView(R.id.head) RoundedImageView mHead; @InjectView(R.id.title) TextView mTitle; @InjectView(R.id.time) TextView mTime; @InjectView(R.id.desc) TextView mDesc; @InjectView(R.id.top_layout) RelativeLayout mTopLayout; @InjectView(R.id.content_layout) RelativeLayout mContentLayout; @InjectView(R.id.notify_item) RelativeLayout notifyItem; MsgNotifyHolder(View view) { ButterKnife.inject(this, view); } } }
5,032
0.658313
0.654733
156
31.22436
26.895947
95
false
false
0
0
0
0
0
0
0.512821
false
false
3
5b89195cda430a0c5a1ea0d748de80ae8b13c9c0
37,280,316,148,310
8f243552b8149d0a349d2301d1aa27ff12eac7cb
/a-spring-demo/src/main/java/com/blk/sprintinit/aspringdemo/bean/Account.java
052b01295d0ca57750fbb7b19d66e35f35863f51
[]
no_license
arora-72/SpringFramework-Beginner
https://github.com/arora-72/SpringFramework-Beginner
9288e519da6734d1e65cd87b1a33f74664c57e7a
cbf0ee18a06d80d33980d930105224f60fef9362
refs/heads/master
2022-12-20T22:37:58.313000
2020-01-23T10:52:30
2020-01-23T10:52:30
227,448,418
0
0
null
false
2022-12-16T09:42:26
2019-12-11T19:54:19
2020-01-23T10:52:45
2022-12-16T09:42:23
89,141
0
0
10
JavaScript
false
false
package com.blk.sprintinit.aspringdemo.bean; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; public class Account { // @Value("10") private int id; public Account(int i) { this.id = i; } public int getId() { return id; } public void setId(int id) { this.id = id; } }
UTF-8
Java
388
java
Account.java
Java
[]
null
[]
package com.blk.sprintinit.aspringdemo.bean; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; public class Account { // @Value("10") private int id; public Account(int i) { this.id = i; } public int getId() { return id; } public void setId(int id) { this.id = id; } }
388
0.626289
0.621134
22
16.636364
16.775375
58
false
false
0
0
0
0
0
0
0.318182
false
false
3
ce859aa0753be144485479e4d6ae95023edfeb28
20,993,800,205,423
ce7d18e7d29e13ddbe7441c33e9f04512b8d7c9f
/Application/batch/src/main/java/com/batch/Application.java
f0a45d23b0246f8219b735b43f79899c06a2a906
[]
no_license
tomneozed/projet7_bibliotheque
https://github.com/tomneozed/projet7_bibliotheque
87cd7a79fa8ccc28bc417b91d46a346e3dc53178
54a9de0698dd30cbad3ac7abdf989c4e4a2ef6d9
refs/heads/master
2020-03-25T10:29:02.702000
2019-05-19T11:55:11
2019-05-19T11:55:11
143,694,404
0
0
null
false
2018-12-01T08:13:49
2018-08-06T07:49:38
2018-12-01T07:56:19
2018-12-01T08:13:49
62,821
0
0
6
Java
false
null
package com.batch; import com.batch.job.SendMailJob; import org.quartz.*; import static org.quartz.JobBuilder.newJob; import static org.quartz.TriggerBuilder.newTrigger; public class Application { public void run() throws Exception { System.out.println("Debut Application.run"); SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory(); Scheduler sched = schedFact.getScheduler(); sched.start(); // define the job and tie it to our HelloJob class JobDetail job = newJob(SendMailJob.class) .withIdentity("myJob", "group1") .build(); TriggerBuilder<SimpleTrigger> triggerBuilder = newTrigger().withIdentity("myTrigger", "group1").startNow().withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10) .repeatForever()); Trigger trigger = triggerBuilder.build(); // Tell quartz to schedule the job using our trigger sched.scheduleJob(job, trigger); } }
UTF-8
Java
962
java
Application.java
Java
[]
null
[]
package com.batch; import com.batch.job.SendMailJob; import org.quartz.*; import static org.quartz.JobBuilder.newJob; import static org.quartz.TriggerBuilder.newTrigger; public class Application { public void run() throws Exception { System.out.println("Debut Application.run"); SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory(); Scheduler sched = schedFact.getScheduler(); sched.start(); // define the job and tie it to our HelloJob class JobDetail job = newJob(SendMailJob.class) .withIdentity("myJob", "group1") .build(); TriggerBuilder<SimpleTrigger> triggerBuilder = newTrigger().withIdentity("myTrigger", "group1").startNow().withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(10) .repeatForever()); Trigger trigger = triggerBuilder.build(); // Tell quartz to schedule the job using our trigger sched.scheduleJob(job, trigger); } }
962
0.726611
0.722453
34
27.294117
34.822685
186
false
false
0
0
0
0
0
0
1.382353
false
false
3
41a4df99220de4783ab49811a7bff82c33d1a447
22,093,311,830,124
942b0db1567a9dddfed2bd3407c98c16c0c7beed
/src/main/java/com/andrewfoote/pageobjects/AccountSettingsPage.java
138e798482a8e2d5d6fe011defbbaf25d6ccca2e
[]
no_license
theandrewfoote/hudl-test-automation-sample
https://github.com/theandrewfoote/hudl-test-automation-sample
3fb4535e0321e71c4882db55cb6a9d52d4c338f1
7e2009eeeeeecf7e5ec2f72b5de93b890a2dac77
refs/heads/master
2023-05-27T14:23:05.842000
2021-06-21T16:31:43
2021-06-21T16:31:43
378,992,091
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.andrewfoote.pageobjects; import net.serenitybdd.core.annotations.findby.FindBy; import net.serenitybdd.core.pages.WebElementFacade; /** * AccountSettingsPage represents the account page shown in Hudl when navigating from the nav bar */ public class AccountSettingsPage extends HudlHome { public AccountSettingsPage() { this.getDriver(); } //LOCATORS @FindBy(id = "email") private WebElementFacade emailAddress; //ACTIONS /** * This gets the email address text from the AccountSettings page * @return email address as text */ public String getEmailAddress() { return emailAddress.getAttribute("value"); } }
UTF-8
Java
692
java
AccountSettingsPage.java
Java
[]
null
[]
package com.andrewfoote.pageobjects; import net.serenitybdd.core.annotations.findby.FindBy; import net.serenitybdd.core.pages.WebElementFacade; /** * AccountSettingsPage represents the account page shown in Hudl when navigating from the nav bar */ public class AccountSettingsPage extends HudlHome { public AccountSettingsPage() { this.getDriver(); } //LOCATORS @FindBy(id = "email") private WebElementFacade emailAddress; //ACTIONS /** * This gets the email address text from the AccountSettings page * @return email address as text */ public String getEmailAddress() { return emailAddress.getAttribute("value"); } }
692
0.708093
0.708093
27
24.629629
25.145721
97
false
false
0
0
0
0
0
0
0.222222
false
false
3
7e9ee6e4d8c9824a97166c5b4486cd33165d607c
37,684,043,085,387
ca4ace7dc4eb6ba0e419920a4a22eb65932cbcee
/src/main/java/chapter4/PriorityQueueX.java
6c2823e103d2b3dd75400f7ac9b1fe1632314efa
[]
no_license
mavy0313/lafore
https://github.com/mavy0313/lafore
6b5f150ac72d960188f9de8b8bcfff11c8aedeff
5c28746f4e1c7f4a5e3173c2c6a62608b58e276b
refs/heads/master
2022-05-21T15:11:48.497000
2022-03-21T14:19:50
2022-03-21T14:19:50
195,678,555
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package chapter4; public class PriorityQueueX { private final int maxSize; private long[] qArray; private int nItems; public PriorityQueueX(int maxSize) { this.maxSize = maxSize; this.qArray = new long[maxSize]; this.nItems = 0; } public void insert(long element) { int j; if (nItems == 0) { qArray[nItems++] = element; } else { for (j = nItems - 1; j >= 0; j--) { if (element > qArray[j]) { qArray[j + 1] = qArray[j]; } else { break; } } qArray[j + 1] = element; nItems++; } } public long remove() { return qArray[--nItems]; } public boolean isEmpty() { return nItems == 0; } public boolean isFull() { return nItems == maxSize; } }
UTF-8
Java
920
java
PriorityQueueX.java
Java
[]
null
[]
package chapter4; public class PriorityQueueX { private final int maxSize; private long[] qArray; private int nItems; public PriorityQueueX(int maxSize) { this.maxSize = maxSize; this.qArray = new long[maxSize]; this.nItems = 0; } public void insert(long element) { int j; if (nItems == 0) { qArray[nItems++] = element; } else { for (j = nItems - 1; j >= 0; j--) { if (element > qArray[j]) { qArray[j + 1] = qArray[j]; } else { break; } } qArray[j + 1] = element; nItems++; } } public long remove() { return qArray[--nItems]; } public boolean isEmpty() { return nItems == 0; } public boolean isFull() { return nItems == maxSize; } }
920
0.457609
0.448913
43
20.39535
14.611464
47
false
false
0
0
0
0
0
0
0.418605
false
false
3
77ef61b02a9dc0599a6a2804a5684ba01822cde6
39,668,317,967,725
0041421fa850c7131e473ae5c7c6a6e005efceb2
/src/blackjack/Application.java
b1b1dd6212ed10930f3e9ea55300a757ca661eb1
[]
no_license
KIMBEOMJUNG/blackjack
https://github.com/KIMBEOMJUNG/blackjack
dac0d272c9bce36e73f902ac84d6d5a1839cad42
a14473e0833ac908f8857ad2df6d511313ba8fe4
refs/heads/master
2021-05-17T12:09:33.053000
2020-03-31T12:55:34
2020-03-31T12:55:34
250,768,748
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package blackjack; import java.util.Scanner; public class Application { public static void main(String[] args) { //testtest Logic logic = new Logic(); System.out.println("์ฐธ๊ฐ€ํ•  ์œ ์ € ์ธ์› ์ˆ˜๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."); Scanner sc = new Scanner(System.in); int usersum = sc.nextInt(); if(logic.next == 0) { logic.AddUser(usersum); logic.turn(); logic.AlluserCard(); logic.gostop(); } while(logic.next > 0 || logic.next != -1) { logic.turn(); logic.AlluserCard(); logic.gostop(); } } }
UTF-8
Java
612
java
Application.java
Java
[]
null
[]
package blackjack; import java.util.Scanner; public class Application { public static void main(String[] args) { //testtest Logic logic = new Logic(); System.out.println("์ฐธ๊ฐ€ํ•  ์œ ์ € ์ธ์› ์ˆ˜๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."); Scanner sc = new Scanner(System.in); int usersum = sc.nextInt(); if(logic.next == 0) { logic.AddUser(usersum); logic.turn(); logic.AlluserCard(); logic.gostop(); } while(logic.next > 0 || logic.next != -1) { logic.turn(); logic.AlluserCard(); logic.gostop(); } } }
612
0.549828
0.544674
27
20.592592
15.134604
49
false
false
0
0
0
0
0
0
0.62963
false
false
3
de2afb27b2929573d0e67664f1df27710d5d17f1
20,246,475,898,992
d78e10b8102a7b82a060a4cecba68a72c7987007
/finalprojectcode-SPL2/src/edu/univdhaka/iit/appclub/calllog/SuggestionActivity.java
189881c797a1d140d953ccbab1a8e916b403d5bd
[ "MIT" ]
permissive
lotanahar/SPLProject
https://github.com/lotanahar/SPLProject
0c571b406618794028ccab0daff03060c602f18c
444df3490e25f75407b2ca4715405bdd6b3fea90
refs/heads/master
2021-03-13T03:25:33.854000
2017-05-16T19:15:25
2017-05-16T19:15:25
91,493,856
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.univdhaka.iit.appclub.calllog; import android.app.Activity; import android.app.LoaderManager; import android.content.Context; import android.content.CursorLoader; import android.content.Intent; import android.content.Loader; import android.database.Cursor; import android.os.Bundle; import android.provider.CallLog; import android.text.Html; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import java.lang.Character.UnicodeBlock; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public class SuggestionActivity extends Activity implements LoaderManager.LoaderCallbacks<Cursor> { private static final String TAG = "CallLog"; private static final int URL_LOADER = 1; public ListView listView; private ArrayList<CallHistory> arraylist; private ArrayList<CallHistory> arraylist2; private ArrayList<CallHistory> arraylist3; public static ArrayList<CallHistory> arraylist4; private BaseAdapter adapter; private TextView tv1; private TextView tv2; private TextView tv3; private Button next; private Button speed; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate()"); setContentView(R.layout.main); initialize(); } private void initialize() { Log.d(TAG, "initialize()"); Button btnCallLog = (Button) findViewById(R.id.btn_call_log); next = (Button) findViewById(R.id.fnfbutton); speed = (Button) findViewById(R.id.buttonspeed); btnCallLog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "initialize() >> initialise loader"); getLoaderManager().initLoader(URL_LOADER, null, SuggestionActivity.this); listView = (ListView) findViewById(R.id.listView1); arraylist = new ArrayList<CallHistory>(); arraylist2 = new ArrayList<CallHistory>(); arraylist3 = new ArrayList<CallHistory>(); arraylist4 = new ArrayList<CallHistory>(); adapter = new BaseAdapter() { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); @Override public View getView(int position, View view, ViewGroup viewGroup) { if (view == null) { view = inflater.inflate(R.layout.liststyle, null); } tv1 = (TextView) view.findViewById(R.id.textView1); tv2 = (TextView) view.findViewById(R.id.textView2); tv3 = (TextView) view.findViewById(R.id.textView3); tv1.setText(arraylist4.get(position).getName()); tv2.setText(arraylist4.get(position).getNumber()); tv3.setText(arraylist4.get(position).getDuration()); return view; } @Override public long getItemId(int position) { return 0; } @Override public Object getItem(int position) { return arraylist4.get(position); } @Override public int getCount() { return arraylist4.size(); } }; listView.setAdapter(adapter); } }); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // next.setVisibility(View.INVISIBLE); Intent intent = new Intent(SuggestionActivity.this, FnFActivity.class); // intent.putParcelableArrayListExtra("sendlist", arraylist4); startActivity(intent); } }); speed.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // next.setVisibility(View.INVISIBLE); Intent intent = new Intent(SuggestionActivity.this, FnFActivity.class); // intent.putParcelableArrayListExtra("sendlist", arraylist4); startActivity(intent); } }); // callLogsTextView = (TextView) findViewById(R.id.call_logs); } @Override public Loader<Cursor> onCreateLoader(int loaderID, Bundle args) { Log.d(TAG, "onCreateLoader() >> loaderID : " + loaderID); switch (loaderID) { case URL_LOADER: // Returns a new CursorLoader return new CursorLoader(this, // Parent activity context CallLog.Calls.CONTENT_URI, // Table to query null, // Projection to return null, // No selection clause null, // No selection arguments null // Default sort order ); default: return null; } } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor managedCursor) { Log.d(TAG, "onLoadFinished()"); int name = managedCursor.getColumnIndex(CallLog.Calls.CACHED_NAME); int number = managedCursor.getColumnIndex(CallLog.Calls.NUMBER); // int type = managedCursor.getColumnIndex(CallLog.Calls.TYPE); // int date = managedCursor.getColumnIndex(CallLog.Calls.DATE); int duration = managedCursor.getColumnIndex(CallLog.Calls.DURATION); CallHistory callHistory; while (managedCursor.moveToNext()) { String Name = managedCursor.getString(name); String phNumber = managedCursor.getString(number); // String callType = managedCursor.getString(type); // String callDate = managedCursor.getString(date); // Date callDayTime = new Date(Long.valueOf(callDate)); String callDuration = managedCursor.getString(duration); int cd = Integer.parseInt(callDuration); /* * String dir = null; int callTypeCode = Integer.parseInt(callType); * switch (callTypeCode) { case CallLog.Calls.OUTGOING_TYPE: dir = * "Outgoing"; break; * * case CallLog.Calls.INCOMING_TYPE: dir = "Incoming"; break; * * case CallLog.Calls.MISSED_TYPE: dir = "Missed"; break; } */ callHistory = new CallHistory( phNumber, cd); arraylist.add(callHistory); } // int flag= 0; /*CallHistory x = null, y; String dur1 = null, dur2, phno1 = null, phno2 = null, cname = null; int d1, d2, res; // managedCursor.close(); // Collections.sort(arraylist,new CallHistory()); for (int i = 0; i < arraylist.size(); i++) { // if (x.getFlag() == 1) // continue; for (int j = 0; j < arraylist.size(); j++) { x = arraylist.get(i); y = arraylist.get(j); dur1 = x.getDuration(); dur2 = y.getDuration(); phno1 = x.getNumber(); phno2 = y.getNumber(); cname= x.getName(); if (phno1.equals(phno2)) { // dur1=dur1+100; d1 = Integer.parseInt(dur1); d2 = Integer.parseInt(dur2); res = d1 + d2; // y.setFlag(1); // dur1 = Integer.toString(res); } } CallHistory callHistory2 = new CallHistory(cname, phno1, dur1); arraylist2.add(callHistory2); } Set<CallHistory> set = new HashSet<CallHistory>(arraylist2); arraylist3 = new ArrayList<CallHistory>(set); Collections.sort(arraylist3, new CallHistory()); CallHistory abc; //List<Integer> length = new for (int i = arraylist3.size() - 1; i >= 0; i--) { abc = arraylist3.get(i); if (abc.getDuration().length() == 3) { arraylist4.add(arraylist3.get(i)); } }*/ adapter.notifyDataSetChanged(); } @Override public void onLoaderReset(Loader<Cursor> loader) { Log.d(TAG, "onLoaderReset()"); // do nothing } }
UTF-8
Java
7,268
java
SuggestionActivity.java
Java
[]
null
[]
package edu.univdhaka.iit.appclub.calllog; import android.app.Activity; import android.app.LoaderManager; import android.content.Context; import android.content.CursorLoader; import android.content.Intent; import android.content.Loader; import android.database.Cursor; import android.os.Bundle; import android.provider.CallLog; import android.text.Html; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import java.lang.Character.UnicodeBlock; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public class SuggestionActivity extends Activity implements LoaderManager.LoaderCallbacks<Cursor> { private static final String TAG = "CallLog"; private static final int URL_LOADER = 1; public ListView listView; private ArrayList<CallHistory> arraylist; private ArrayList<CallHistory> arraylist2; private ArrayList<CallHistory> arraylist3; public static ArrayList<CallHistory> arraylist4; private BaseAdapter adapter; private TextView tv1; private TextView tv2; private TextView tv3; private Button next; private Button speed; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate()"); setContentView(R.layout.main); initialize(); } private void initialize() { Log.d(TAG, "initialize()"); Button btnCallLog = (Button) findViewById(R.id.btn_call_log); next = (Button) findViewById(R.id.fnfbutton); speed = (Button) findViewById(R.id.buttonspeed); btnCallLog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "initialize() >> initialise loader"); getLoaderManager().initLoader(URL_LOADER, null, SuggestionActivity.this); listView = (ListView) findViewById(R.id.listView1); arraylist = new ArrayList<CallHistory>(); arraylist2 = new ArrayList<CallHistory>(); arraylist3 = new ArrayList<CallHistory>(); arraylist4 = new ArrayList<CallHistory>(); adapter = new BaseAdapter() { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); @Override public View getView(int position, View view, ViewGroup viewGroup) { if (view == null) { view = inflater.inflate(R.layout.liststyle, null); } tv1 = (TextView) view.findViewById(R.id.textView1); tv2 = (TextView) view.findViewById(R.id.textView2); tv3 = (TextView) view.findViewById(R.id.textView3); tv1.setText(arraylist4.get(position).getName()); tv2.setText(arraylist4.get(position).getNumber()); tv3.setText(arraylist4.get(position).getDuration()); return view; } @Override public long getItemId(int position) { return 0; } @Override public Object getItem(int position) { return arraylist4.get(position); } @Override public int getCount() { return arraylist4.size(); } }; listView.setAdapter(adapter); } }); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // next.setVisibility(View.INVISIBLE); Intent intent = new Intent(SuggestionActivity.this, FnFActivity.class); // intent.putParcelableArrayListExtra("sendlist", arraylist4); startActivity(intent); } }); speed.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // next.setVisibility(View.INVISIBLE); Intent intent = new Intent(SuggestionActivity.this, FnFActivity.class); // intent.putParcelableArrayListExtra("sendlist", arraylist4); startActivity(intent); } }); // callLogsTextView = (TextView) findViewById(R.id.call_logs); } @Override public Loader<Cursor> onCreateLoader(int loaderID, Bundle args) { Log.d(TAG, "onCreateLoader() >> loaderID : " + loaderID); switch (loaderID) { case URL_LOADER: // Returns a new CursorLoader return new CursorLoader(this, // Parent activity context CallLog.Calls.CONTENT_URI, // Table to query null, // Projection to return null, // No selection clause null, // No selection arguments null // Default sort order ); default: return null; } } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor managedCursor) { Log.d(TAG, "onLoadFinished()"); int name = managedCursor.getColumnIndex(CallLog.Calls.CACHED_NAME); int number = managedCursor.getColumnIndex(CallLog.Calls.NUMBER); // int type = managedCursor.getColumnIndex(CallLog.Calls.TYPE); // int date = managedCursor.getColumnIndex(CallLog.Calls.DATE); int duration = managedCursor.getColumnIndex(CallLog.Calls.DURATION); CallHistory callHistory; while (managedCursor.moveToNext()) { String Name = managedCursor.getString(name); String phNumber = managedCursor.getString(number); // String callType = managedCursor.getString(type); // String callDate = managedCursor.getString(date); // Date callDayTime = new Date(Long.valueOf(callDate)); String callDuration = managedCursor.getString(duration); int cd = Integer.parseInt(callDuration); /* * String dir = null; int callTypeCode = Integer.parseInt(callType); * switch (callTypeCode) { case CallLog.Calls.OUTGOING_TYPE: dir = * "Outgoing"; break; * * case CallLog.Calls.INCOMING_TYPE: dir = "Incoming"; break; * * case CallLog.Calls.MISSED_TYPE: dir = "Missed"; break; } */ callHistory = new CallHistory( phNumber, cd); arraylist.add(callHistory); } // int flag= 0; /*CallHistory x = null, y; String dur1 = null, dur2, phno1 = null, phno2 = null, cname = null; int d1, d2, res; // managedCursor.close(); // Collections.sort(arraylist,new CallHistory()); for (int i = 0; i < arraylist.size(); i++) { // if (x.getFlag() == 1) // continue; for (int j = 0; j < arraylist.size(); j++) { x = arraylist.get(i); y = arraylist.get(j); dur1 = x.getDuration(); dur2 = y.getDuration(); phno1 = x.getNumber(); phno2 = y.getNumber(); cname= x.getName(); if (phno1.equals(phno2)) { // dur1=dur1+100; d1 = Integer.parseInt(dur1); d2 = Integer.parseInt(dur2); res = d1 + d2; // y.setFlag(1); // dur1 = Integer.toString(res); } } CallHistory callHistory2 = new CallHistory(cname, phno1, dur1); arraylist2.add(callHistory2); } Set<CallHistory> set = new HashSet<CallHistory>(arraylist2); arraylist3 = new ArrayList<CallHistory>(set); Collections.sort(arraylist3, new CallHistory()); CallHistory abc; //List<Integer> length = new for (int i = arraylist3.size() - 1; i >= 0; i--) { abc = arraylist3.get(i); if (abc.getDuration().length() == 3) { arraylist4.add(arraylist3.get(i)); } }*/ adapter.notifyDataSetChanged(); } @Override public void onLoaderReset(Loader<Cursor> loader) { Log.d(TAG, "onLoaderReset()"); // do nothing } }
7,268
0.69235
0.682168
255
27.501961
21.281101
98
false
false
0
0
0
0
0
0
3.054902
false
false
3
969b3c7a2c02425157a7660cda2d890929fb2570
34,119,220,258,476
7ab26d4bc788b5d437cb69992ea94b56a4899b6c
/jPSICS/src/org/catacomb/druid/event/ClosureListener.java
f2ba65c20b0582ce57eb4dc7b422d790b26b46d2
[]
no_license
MattNolanLab/PSICS
https://github.com/MattNolanLab/PSICS
d8e777d9a18e332231de244c23431b34c655cfa5
68b4f17e9aef2e6c7ca3c23da2a175eeaeb7251f
refs/heads/master
2021-05-27T02:01:24.747000
2014-05-13T16:19:21
2014-05-13T16:19:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.catacomb.druid.event; public interface ClosureListener { void requestClose(); void closed(); }
UTF-8
Java
123
java
ClosureListener.java
Java
[]
null
[]
package org.catacomb.druid.event; public interface ClosureListener { void requestClose(); void closed(); }
123
0.682927
0.682927
10
11.2
14.062716
34
false
false
0
0
0
0
0
0
0.3
false
false
3
46f0dbc105e7b2df770064a23d9397774fe53a75
35,476,429,914,785
fae5b7ae3a180e59d62158fb0c0ee9a03d4e2f96
/hotel-read/src/main/java/hotel/read/event/eventHandlers/HotelUpdatedEventHandler.java
08cec87fa6cdb34aad06d6ec090f3e5431c46bc1
[]
no_license
cckmit/micronaut-vuejs-cqrs
https://github.com/cckmit/micronaut-vuejs-cqrs
17e8e8002eacd55aed30c84f34eb802b9f21100a
650bc8f6a7255b7396e02f9a93206baa6dce1b7c
refs/heads/master
2020-12-10T11:02:44.302000
2019-12-10T15:19:42
2019-12-10T15:19:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hotel.read.event.eventHandlers; import hotel.read.event.events.HotelUpdated; import hotel.read.implementation.ApplicationConfiguration; import javax.inject.Singleton; import javax.persistence.EntityManager; @Singleton public class HotelUpdatedEventHandler extends AbstractEventHandler<HotelUpdated> { public HotelUpdatedEventHandler(EntityManager entityManager, ApplicationConfiguration applicationConfiguration) { super(entityManager,applicationConfiguration); } @Override public void onApplicationEvent(HotelUpdated cmd) { updateDb(cmd); } }
UTF-8
Java
594
java
HotelUpdatedEventHandler.java
Java
[]
null
[]
package hotel.read.event.eventHandlers; import hotel.read.event.events.HotelUpdated; import hotel.read.implementation.ApplicationConfiguration; import javax.inject.Singleton; import javax.persistence.EntityManager; @Singleton public class HotelUpdatedEventHandler extends AbstractEventHandler<HotelUpdated> { public HotelUpdatedEventHandler(EntityManager entityManager, ApplicationConfiguration applicationConfiguration) { super(entityManager,applicationConfiguration); } @Override public void onApplicationEvent(HotelUpdated cmd) { updateDb(cmd); } }
594
0.80303
0.80303
21
27.285715
31.362919
117
false
false
0
0
0
0
0
0
0.428571
false
false
3
8ba4ab24f20f50304e88d8903ac99b62dce15ca9
37,409,165,182,824
78d5f5eeaf82af6ae844c1d252408a3e4d29021d
/src/com/wwj/spring/jdbc/Dad.java
8a68a5ec1659485e9e69558b7becfa2355c06129
[]
no_license
djwangweijie/spring001
https://github.com/djwangweijie/spring001
c69858e9ad8dbc57adcdf679f9f6853a20378a34
ed5b1dd72c05b8befa0dbafef2881b5105f5bce5
refs/heads/master
2020-06-22T14:47:29.861000
2019-07-25T05:13:28
2019-07-25T05:13:28
197,732,140
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wwj.spring.jdbc; public class Dad { private String dname; public String getDname() { return dname; } public void setDname(String dname) { this.dname = dname; } }
UTF-8
Java
189
java
Dad.java
Java
[]
null
[]
package com.wwj.spring.jdbc; public class Dad { private String dname; public String getDname() { return dname; } public void setDname(String dname) { this.dname = dname; } }
189
0.68254
0.68254
15
11.6
12.510262
37
false
false
0
0
0
0
0
0
0.933333
false
false
3
54918f3ea9706a5432739d5d6a2f1d075fa42613
3,023,656,978,947
1ffcaaccf6b3cff3e78e1d236aa63ad594a9ad33
/src/main/java/com/internship/utils/ImageProcessing.java
d58b6f5ae3212e6841524f49e5ec0f52c6125289
[]
no_license
quynhanh-kristen/InternshipProjectV3
https://github.com/quynhanh-kristen/InternshipProjectV3
198069bde09d31ad1be822bbb8ab37ad528b9bcb
6d5daf0deeedc395299e1889fb7dc430df7c8e7f
refs/heads/Quanh
2023-07-16T10:10:08.659000
2021-08-20T09:10:29
2021-08-20T09:10:29
392,258,363
1
0
null
false
2021-08-20T09:05:26
2021-08-03T09:15:41
2021-08-20T05:17:25
2021-08-20T09:05:25
3,668
1
0
1
SCSS
false
false
package com.internship.utils; import com.google.api.client.http.AbstractInputStreamContent; import com.google.api.services.drive.Drive; import com.google.api.services.drive.model.File; import com.google.api.client.http.ByteArrayContent; import com.internship.model.Post; import org.springframework.web.multipart.MultipartFile; import javax.imageio.ImageIO; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; public class ImageProcessing { private static final java.io.File SAVED_FILE = new java.io.File(System.getProperty("user.home"), "UploadImages"); // private static final String PATH = "uploadFiles"; // private static String PATH_SAVE_UPLOAD_IMAGE = ""; public static String saveImage(MultipartFile file){ String fileName = null; OutputStream out = null; try { byte[] bytes = file.getBytes(); //Format name's image/video fileName = file.getOriginalFilename(); if(fileName != null){ Date date = Calendar.getInstance().getTime(); DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); String strDate = dateFormat.format(date); fileName = strDate + "_" + fileName; //process concat file_name // int fileNameLength = fileName.length(); // if (fileNameLength > 100 ){ // int lastIndex = fileName.lastIndexOf("."); // fileName = strDate + fileName.substring(lastIndex, fileNameLength); // } } String contentType = file.getContentType(); String idFolderParent = "1cruu-rfnAwl3e-nsOt8QywvbFnT7VQ20"; if(!SAVED_FILE.exists()){ SAVED_FILE.mkdirs(); } //save file to server // java.io.File temp = new java.io.File(SAVED_FILE.getAbsolutePath() + "\\" + fileName); // file.transferTo(new java.io.File(SAVED_FILE.getAbsolutePath() + "\\" + fileName)); //save file to uploadFiles // FileOutputStream fout = new FileOutputStream(PATH_SAVE_UPLOAD_IMAGE); // fout.write(bytes); File f = createGoogleFile(idFolderParent, contentType, fileName, bytes); fileName = f.getId(); } catch (IOException e) { e.printStackTrace(); } System.out.println(">>FileName: " + fileName); return fileName; } // public static void saveImageToLoad(String path){ // PATH_SAVE_UPLOAD_IMAGE = path; // } private static File _createGoogleFile(String googleFolderIdParent, String contentType, // String customFileName, AbstractInputStreamContent uploadStreamContent) throws IOException { File fileMetadata = new File(); fileMetadata.setName(customFileName); List<String> parents = Arrays.asList(googleFolderIdParent); fileMetadata.setParents(parents); // Drive driveService = GoogleDriveUtils.getDriveService(); File file = driveService.files().create(fileMetadata, uploadStreamContent) .setFields("id, webContentLink, webViewLink, parents").execute(); return file; } // Create Google File from byte[] public static File createGoogleFile(String googleFolderIdParent, String contentType, // String customFileName, byte[] uploadData) throws IOException { // AbstractInputStreamContent uploadStreamContent = new ByteArrayContent(contentType, uploadData); // return _createGoogleFile(googleFolderIdParent, contentType, customFileName, uploadStreamContent); } }
UTF-8
Java
3,941
java
ImageProcessing.java
Java
[]
null
[]
package com.internship.utils; import com.google.api.client.http.AbstractInputStreamContent; import com.google.api.services.drive.Drive; import com.google.api.services.drive.model.File; import com.google.api.client.http.ByteArrayContent; import com.internship.model.Post; import org.springframework.web.multipart.MultipartFile; import javax.imageio.ImageIO; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; public class ImageProcessing { private static final java.io.File SAVED_FILE = new java.io.File(System.getProperty("user.home"), "UploadImages"); // private static final String PATH = "uploadFiles"; // private static String PATH_SAVE_UPLOAD_IMAGE = ""; public static String saveImage(MultipartFile file){ String fileName = null; OutputStream out = null; try { byte[] bytes = file.getBytes(); //Format name's image/video fileName = file.getOriginalFilename(); if(fileName != null){ Date date = Calendar.getInstance().getTime(); DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); String strDate = dateFormat.format(date); fileName = strDate + "_" + fileName; //process concat file_name // int fileNameLength = fileName.length(); // if (fileNameLength > 100 ){ // int lastIndex = fileName.lastIndexOf("."); // fileName = strDate + fileName.substring(lastIndex, fileNameLength); // } } String contentType = file.getContentType(); String idFolderParent = "1cruu-rfnAwl3e-nsOt8QywvbFnT7VQ20"; if(!SAVED_FILE.exists()){ SAVED_FILE.mkdirs(); } //save file to server // java.io.File temp = new java.io.File(SAVED_FILE.getAbsolutePath() + "\\" + fileName); // file.transferTo(new java.io.File(SAVED_FILE.getAbsolutePath() + "\\" + fileName)); //save file to uploadFiles // FileOutputStream fout = new FileOutputStream(PATH_SAVE_UPLOAD_IMAGE); // fout.write(bytes); File f = createGoogleFile(idFolderParent, contentType, fileName, bytes); fileName = f.getId(); } catch (IOException e) { e.printStackTrace(); } System.out.println(">>FileName: " + fileName); return fileName; } // public static void saveImageToLoad(String path){ // PATH_SAVE_UPLOAD_IMAGE = path; // } private static File _createGoogleFile(String googleFolderIdParent, String contentType, // String customFileName, AbstractInputStreamContent uploadStreamContent) throws IOException { File fileMetadata = new File(); fileMetadata.setName(customFileName); List<String> parents = Arrays.asList(googleFolderIdParent); fileMetadata.setParents(parents); // Drive driveService = GoogleDriveUtils.getDriveService(); File file = driveService.files().create(fileMetadata, uploadStreamContent) .setFields("id, webContentLink, webViewLink, parents").execute(); return file; } // Create Google File from byte[] public static File createGoogleFile(String googleFolderIdParent, String contentType, // String customFileName, byte[] uploadData) throws IOException { // AbstractInputStreamContent uploadStreamContent = new ByteArrayContent(contentType, uploadData); // return _createGoogleFile(googleFolderIdParent, contentType, customFileName, uploadStreamContent); } }
3,941
0.637655
0.635372
104
36.89423
31.712931
133
false
false
0
0
0
0
0
0
0.692308
false
false
4
3e38dd0124ab10dac02311d52b4136be14648b6c
24,361,054,565,076
c46844c9c865fffad7d363b5cd1b279fa3741e08
/src/main/java/net/pincette/mongo/QueryOperator.java
903e573fb87c8d1d940e19af1940917b98bed8ea
[ "BSD-2-Clause" ]
permissive
wdonne/pincette-mongo
https://github.com/wdonne/pincette-mongo
6e787708419d19760303014c1fc3b613b408c736
98dd84669d13129862602a52a3f14fff3e2d3f9a
refs/heads/master
2023-08-04T05:48:55.385000
2023-07-12T07:33:18
2023-07-12T07:33:18
206,822,703
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.pincette.mongo; import java.util.function.BiFunction; import java.util.function.Predicate; import javax.json.JsonValue; /** * The interface for MongoDB query operator implementations. The argument of such a function is the * query operator expression for which an implementation should be generated. An implementation * receives the field value of a JSON object. * * @author Werner Donn\u00e9 * @since 2.0 */ public interface QueryOperator extends BiFunction<JsonValue, Features, Predicate<JsonValue>> {}
UTF-8
Java
526
java
QueryOperator.java
Java
[ { "context": "es the field value of a JSON object.\n *\n * @author Werner Donn\\u00e9\n * @since 2.0\n */\npublic interface QueryOper", "end": 405, "score": 0.9960343241691589, "start": 394, "tag": "NAME", "value": "Werner Donn" }, { "context": "value of a JSON object.\n *\n * @author Werner Donn\\u00e9\n * @since 2.0\n */\npublic interface QueryOperator ", "end": 411, "score": 0.9620000720024109, "start": 406, "tag": "USERNAME", "value": "u00e9" } ]
null
[]
package net.pincette.mongo; import java.util.function.BiFunction; import java.util.function.Predicate; import javax.json.JsonValue; /** * The interface for MongoDB query operator implementations. The argument of such a function is the * query operator expression for which an implementation should be generated. An implementation * receives the field value of a JSON object. * * @author <NAME>\u00e9 * @since 2.0 */ public interface QueryOperator extends BiFunction<JsonValue, Features, Predicate<JsonValue>> {}
521
0.785171
0.775665
15
34.066666
34.274319
99
false
false
0
0
0
0
0
0
0.4
false
false
4
afce14fca50548979d7c2121a304906999fcee5c
2,542,620,689,731
60131fb8d46a9be8760999e688dd6c599d0a2624
/signalr-client-sdk/src/main/java/microsoft/aspnet/signalr/client/http/java/NetworkThread.java
c6875c9516f63230c4c6ab22ba7f9179363baa68
[ "Apache-2.0" ]
permissive
pikob/java-client
https://github.com/pikob/java-client
08c20b1d96b78c5ff9dd8904de87813fbe11a2cf
e5e20e0f4efcaac4b69a80a8548e1b49117d41a9
refs/heads/dev
2021-04-12T10:10:26.318000
2017-07-20T07:33:06
2017-07-20T07:33:06
94,528,048
0
2
null
true
2017-06-16T09:23:13
2017-06-16T09:23:12
2017-06-05T06:18:39
2017-03-31T10:18:13
904
0
0
0
null
null
null
/* Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved See License.txt in the project root for license information. */ package microsoft.aspnet.signalr.client.http.java; /** * A thread that can release resources when stopped */ abstract class NetworkThread extends Thread { /** * Initializes the NetworkThread * * @param target runnable to execute */ public NetworkThread(Runnable target) { super(target); } /** * Releases resources and stops the thread */ abstract void releaseAndStop(); }
UTF-8
Java
571
java
NetworkThread.java
Java
[]
null
[]
/* Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved See License.txt in the project root for license information. */ package microsoft.aspnet.signalr.client.http.java; /** * A thread that can release resources when stopped */ abstract class NetworkThread extends Thread { /** * Initializes the NetworkThread * * @param target runnable to execute */ public NetworkThread(Runnable target) { super(target); } /** * Releases resources and stops the thread */ abstract void releaseAndStop(); }
571
0.677758
0.677758
27
20.148148
20.35737
60
false
false
0
0
0
0
0
0
0.148148
false
false
4
bc7db05a0652e6e5926da4aabbe0617623525832
2,542,620,689,941
c77969fbaaf8636cb859ba3cededbccaabe691ff
/src/fr/naruse/deacoudre/v1_12/util/PlayerStatistics.java
42753e81fdd32e356a64ac879382e0a3dcac8740
[]
no_license
DarkOwracle/DeACoudre
https://github.com/DarkOwracle/DeACoudre
46d756c1ed1d86d1a39a87ee4adb0b4945fa3df8
0331a946eb6250a6ca0789cdad899b568ce5b8ee
refs/heads/master
2020-12-15T00:18:25.775000
2020-01-03T14:07:54
2020-01-03T14:07:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.naruse.deacoudre.v1_12.util; import com.google.common.collect.Lists; import fr.naruse.deacoudre.main.DacPlugin; import fr.naruse.deacoudre.manager.DacPluginV1_12; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.List; public class PlayerStatistics implements Listener { private DacPluginV1_12 pl; private String name; private long perfects; private long fails; private long wins; private long loses; private long games; private long jumps; private FileConfiguration statistic; private Inventory inv; private Inventory inventoryBeforePlay; public PlayerStatistics(DacPluginV1_12 pl, String name){ this.pl = pl; this.name = name; this.statistic = pl.configurations.getStatistics().getStatistics(); this.inv = Bukkit.createInventory(null, 9*2, "ยง2ยงl"+name+"'s "+Message.STATISTICS.getMessage()); refreshStatisticFromConfig(); Bukkit.getPluginManager().registerEvents(this, pl.getDacPlugin()); } public void refreshStatisticFromConfig(){ if(statistic.getString(name+".wins") == null){ createStatistics(); } this.perfects = statistic.getLong(name+".perfects"); this.fails = statistic.getLong(name+".fails"); this.wins = statistic.getLong(name+".wins"); this.loses = statistic.getLong(name+".loses"); this.games = statistic.getLong(name+".games"); this.jumps = statistic.getLong(name+".jumps"); } private void createStatistics(){ statistic.set(name+".perfects", 0); statistic.set(name+".fails", 0); statistic.set(name+".wins", 0); statistic.set(name+".loses", 0); statistic.set(name+".games", 0); statistic.set(name+".jumps", 0); pl.configurations.getStatistics().saveConfig(); System.out.println("[DeACoudre] Statistics for "+name+" created."); } public void saveStatistics(){ statistic.set(name+".perfects", perfects); statistic.set(name+".fails", fails); statistic.set(name+".wins", wins); statistic.set(name+".loses", loses); statistic.set(name+".games", games); statistic.set(name+".jumps", jumps); pl.configurations.getStatistics().saveConfig(); } public long getFails() { return fails; } public long getGames() { return loses+wins; } public long getPerfects() { return perfects; } public long getWins() { return wins; } public long getLoses() { return loses; } public long getJumps() { return jumps; } public void addFails(int fails){ this.fails += fails; } public void addGames(int games){ this.games += games; } public void addPerfects(int perfects){ this.perfects += perfects; } public void addWins(int wins){ this.games += wins; this.wins += wins; } public void addLoses(int loses){ this.games += loses; this.loses += loses; } public void addJumps(int jumps){ this.jumps += jumps; } public void openInventory(Player target){ inv.clear(); List<String> lore = Lists.newArrayList(); ItemStack item = new ItemStack(Material.EMERALD_BLOCK); ItemMeta meta = item.getItemMeta(); meta.setDisplayName("ยงaDรฉs ร  coudre"); lore.add("ยง5-ยงa"+Message.PERFECTS.getMessage().replace("**", "ยง6").replace("!!", "ยงa").replace(":", perfects+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(2, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 14); meta = item.getItemMeta(); meta.setDisplayName("ยงcFails"); lore.add("ยง5-ยงc"+Message.FAILS.getMessage().replace("**", "ยง6").replace("!!", "ยงc").replace(":", fails+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(3, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 5); meta = item.getItemMeta(); meta.setDisplayName("ยง2Wins"); lore.add("ยง5-ยง2"+Message.WINS.getMessage().replace("**", "ยง6").replace("!!", "ยง2").replace(":", wins+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(4, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 7); meta = item.getItemMeta(); meta.setDisplayName("ยง4Loses"); lore.add("ยง5-ยง4"+Message.LOSES.getMessage().replace("**", "ยง6").replace("!!", "ยง4").replace(":", loses+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(5, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 9); meta = item.getItemMeta(); meta.setDisplayName("ยง3Games"); lore.add("ยง5-ยง3"+Message.GAMES.getMessage().replace("**", "ยง6").replace("!!", "ยง3").replace(":", games+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(6, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 13); meta = item.getItemMeta(); meta.setDisplayName("ยง2Jumps"); lore.add("ยง5-ยง2"+Message.JUMPS.getMessage().replace("**", "ยง6").replace("!!", "ยง2").replace(":", jumps+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(13, item); lore.clear(); target.openInventory(inv); } @EventHandler public void inventory(InventoryClickEvent e){ if(e.getInventory().getName() == inv.getName()){ e.setCancelled(true); } } }
UTF-8
Java
6,081
java
PlayerStatistics.java
Java
[]
null
[]
package fr.naruse.deacoudre.v1_12.util; import com.google.common.collect.Lists; import fr.naruse.deacoudre.main.DacPlugin; import fr.naruse.deacoudre.manager.DacPluginV1_12; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.List; public class PlayerStatistics implements Listener { private DacPluginV1_12 pl; private String name; private long perfects; private long fails; private long wins; private long loses; private long games; private long jumps; private FileConfiguration statistic; private Inventory inv; private Inventory inventoryBeforePlay; public PlayerStatistics(DacPluginV1_12 pl, String name){ this.pl = pl; this.name = name; this.statistic = pl.configurations.getStatistics().getStatistics(); this.inv = Bukkit.createInventory(null, 9*2, "ยง2ยงl"+name+"'s "+Message.STATISTICS.getMessage()); refreshStatisticFromConfig(); Bukkit.getPluginManager().registerEvents(this, pl.getDacPlugin()); } public void refreshStatisticFromConfig(){ if(statistic.getString(name+".wins") == null){ createStatistics(); } this.perfects = statistic.getLong(name+".perfects"); this.fails = statistic.getLong(name+".fails"); this.wins = statistic.getLong(name+".wins"); this.loses = statistic.getLong(name+".loses"); this.games = statistic.getLong(name+".games"); this.jumps = statistic.getLong(name+".jumps"); } private void createStatistics(){ statistic.set(name+".perfects", 0); statistic.set(name+".fails", 0); statistic.set(name+".wins", 0); statistic.set(name+".loses", 0); statistic.set(name+".games", 0); statistic.set(name+".jumps", 0); pl.configurations.getStatistics().saveConfig(); System.out.println("[DeACoudre] Statistics for "+name+" created."); } public void saveStatistics(){ statistic.set(name+".perfects", perfects); statistic.set(name+".fails", fails); statistic.set(name+".wins", wins); statistic.set(name+".loses", loses); statistic.set(name+".games", games); statistic.set(name+".jumps", jumps); pl.configurations.getStatistics().saveConfig(); } public long getFails() { return fails; } public long getGames() { return loses+wins; } public long getPerfects() { return perfects; } public long getWins() { return wins; } public long getLoses() { return loses; } public long getJumps() { return jumps; } public void addFails(int fails){ this.fails += fails; } public void addGames(int games){ this.games += games; } public void addPerfects(int perfects){ this.perfects += perfects; } public void addWins(int wins){ this.games += wins; this.wins += wins; } public void addLoses(int loses){ this.games += loses; this.loses += loses; } public void addJumps(int jumps){ this.jumps += jumps; } public void openInventory(Player target){ inv.clear(); List<String> lore = Lists.newArrayList(); ItemStack item = new ItemStack(Material.EMERALD_BLOCK); ItemMeta meta = item.getItemMeta(); meta.setDisplayName("ยงaDรฉs ร  coudre"); lore.add("ยง5-ยงa"+Message.PERFECTS.getMessage().replace("**", "ยง6").replace("!!", "ยงa").replace(":", perfects+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(2, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 14); meta = item.getItemMeta(); meta.setDisplayName("ยงcFails"); lore.add("ยง5-ยงc"+Message.FAILS.getMessage().replace("**", "ยง6").replace("!!", "ยงc").replace(":", fails+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(3, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 5); meta = item.getItemMeta(); meta.setDisplayName("ยง2Wins"); lore.add("ยง5-ยง2"+Message.WINS.getMessage().replace("**", "ยง6").replace("!!", "ยง2").replace(":", wins+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(4, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 7); meta = item.getItemMeta(); meta.setDisplayName("ยง4Loses"); lore.add("ยง5-ยง4"+Message.LOSES.getMessage().replace("**", "ยง6").replace("!!", "ยง4").replace(":", loses+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(5, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 9); meta = item.getItemMeta(); meta.setDisplayName("ยง3Games"); lore.add("ยง5-ยง3"+Message.GAMES.getMessage().replace("**", "ยง6").replace("!!", "ยง3").replace(":", games+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(6, item); lore.clear(); item = new ItemStack(Material.WOOL, 1, (byte) 13); meta = item.getItemMeta(); meta.setDisplayName("ยง2Jumps"); lore.add("ยง5-ยง2"+Message.JUMPS.getMessage().replace("**", "ยง6").replace("!!", "ยง2").replace(":", jumps+"")); meta.setLore(lore); item.setItemMeta(meta); inv.setItem(13, item); lore.clear(); target.openInventory(inv); } @EventHandler public void inventory(InventoryClickEvent e){ if(e.getInventory().getName() == inv.getName()){ e.setCancelled(true); } } }
6,081
0.602282
0.591698
189
30.994709
24.55024
122
false
false
0
0
0
0
0
0
0.899471
false
false
4
d932b1747894573596396e7116078e8a8e78951e
5,746,666,294,560
8dbb8f4c5e5860ba9008cdd1718344c474e6b881
/app/src/main/java/com/example/aranjuez/entidades/Historial_De_Sincronizacion.java
00ec54ac339a40e7ec4fa772b379467339b5c5a8
[]
no_license
sonjeux/Aranjuez
https://github.com/sonjeux/Aranjuez
65e34318848b51c51d7b5a23f991cbf20e4c7aea
899c1faac98a8832b5f04310e248abfbf853a9be
refs/heads/master
2020-05-24T10:48:02.963000
2019-06-17T22:11:44
2019-06-17T22:11:44
187,234,458
0
0
null
false
2019-06-17T22:11:45
2019-05-17T14:51:38
2019-05-17T14:51:45
2019-06-17T22:11:44
145
0
0
0
Java
false
false
package com.example.aranjuez.entidades; public class Historial_De_Sincronizacion { private String Id; private String Id_Dispositivo; private String Orden; private String Tabla; private String Id_Tabla; private String Fecha; private String Hora; private String Estado; public Historial_De_Sincronizacion(String id, String id_Dispositivo, String orden, String tabla, String id_Tabla, String fecha, String hora, String estado) { Id = id; Id_Dispositivo = id_Dispositivo; Orden = orden; Tabla = tabla; Id_Tabla = id_Tabla; Fecha = fecha; Hora = hora; Estado = estado; } public String getId() { return Id; } public void setId(String id) { Id = id; } public String getId_Dispositivo() { return Id_Dispositivo; } public void setId_Dispositivo(String id_Dispositivo) { Id_Dispositivo = id_Dispositivo; } public String getOrden() { return Orden; } public void setOrden(String orden) { Orden = orden; } public String getTabla() { return Tabla; } public void setTabla(String tabla) { Tabla = tabla; } public String getId_Tabla() { return Id_Tabla; } public void setId_Tabla(String id_Tabla) { Id_Tabla = id_Tabla; } public String getFecha() { return Fecha; } public void setFecha(String fecha) { Fecha = fecha; } public String getHora() { return Hora; } public void setHora(String hora) { Hora = hora; } public String getEstado() { return Estado; } public void setEstado(String estado) { Estado = estado; } }
UTF-8
Java
1,776
java
Historial_De_Sincronizacion.java
Java
[]
null
[]
package com.example.aranjuez.entidades; public class Historial_De_Sincronizacion { private String Id; private String Id_Dispositivo; private String Orden; private String Tabla; private String Id_Tabla; private String Fecha; private String Hora; private String Estado; public Historial_De_Sincronizacion(String id, String id_Dispositivo, String orden, String tabla, String id_Tabla, String fecha, String hora, String estado) { Id = id; Id_Dispositivo = id_Dispositivo; Orden = orden; Tabla = tabla; Id_Tabla = id_Tabla; Fecha = fecha; Hora = hora; Estado = estado; } public String getId() { return Id; } public void setId(String id) { Id = id; } public String getId_Dispositivo() { return Id_Dispositivo; } public void setId_Dispositivo(String id_Dispositivo) { Id_Dispositivo = id_Dispositivo; } public String getOrden() { return Orden; } public void setOrden(String orden) { Orden = orden; } public String getTabla() { return Tabla; } public void setTabla(String tabla) { Tabla = tabla; } public String getId_Tabla() { return Id_Tabla; } public void setId_Tabla(String id_Tabla) { Id_Tabla = id_Tabla; } public String getFecha() { return Fecha; } public void setFecha(String fecha) { Fecha = fecha; } public String getHora() { return Hora; } public void setHora(String hora) { Hora = hora; } public String getEstado() { return Estado; } public void setEstado(String estado) { Estado = estado; } }
1,776
0.587275
0.587275
87
19.413794
21.178253
161
false
false
0
0
0
0
0
0
0.45977
false
false
4
e86e4d36a96f76b8da4f262215d5726f602d33e2
6,983,616,888,258
7fcb0bd557d401c937215449e637c146135fb9bc
/java/Lab 5/Question 2/src/com/company/Main.java
c35a95c9895663cfc652cba07960af1466833158
[ "BSD-3-Clause" ]
permissive
woosal1337/Medipol
https://github.com/woosal1337/Medipol
b6a033d5f2444695388681f4a9d793f642e9361c
82052e5d4af16e83e8b38a70c6664bc5111a8146
refs/heads/main
2023-02-04T17:34:59.688000
2022-07-24T18:14:27
2022-07-24T18:14:27
315,582,146
1
1
null
false
2020-12-25T00:03:42
2020-11-24T09:30:29
2020-12-08T14:16:43
2020-12-25T00:03:38
51,629
1
1
1
null
false
false
package com.company; public class Main { public static void main(String[] args) { String s = "Java"; StringBuilder builder = new StringBuilder(s); change(s, builder); System.out.println(s); System.out.println(builder); } private static void change(String s, StringBuilder builder) { s = s + " and HTML"; builder.append(" and HTML"); } }
UTF-8
Java
423
java
Main.java
Java
[]
null
[]
package com.company; public class Main { public static void main(String[] args) { String s = "Java"; StringBuilder builder = new StringBuilder(s); change(s, builder); System.out.println(s); System.out.println(builder); } private static void change(String s, StringBuilder builder) { s = s + " and HTML"; builder.append(" and HTML"); } }
423
0.574468
0.574468
15
26.333334
18.369057
65
false
false
0
0
0
0
0
0
0.666667
false
false
4
9737edf6e85127fa9ca12c3a2356b9fb446c9d2e
33,706,903,380,254
7c1bfa4a46c3a6d98c29433a6763d4318681c1cb
/moe/src/main/java/com/liwei/emr/service/impl/TestServiceImpl.java
bef47c749a2c82d959f7d413b44d9b144f559b3d
[]
no_license
welleer/ewell-springboot
https://github.com/welleer/ewell-springboot
8b9c25c36890694a1eec297de855b7bbdd4211ce
ec219934856d611145db49daa8cbb90f351ff494
refs/heads/master
2020-03-14T21:52:01.035000
2018-06-11T06:51:44
2018-06-11T06:51:44
130,625,113
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.liwei.emr.service.impl; import com.liwei.emr.service.TestService; public class TestServiceImpl implements TestService { }
UTF-8
Java
136
java
TestServiceImpl.java
Java
[]
null
[]
package com.liwei.emr.service.impl; import com.liwei.emr.service.TestService; public class TestServiceImpl implements TestService { }
136
0.816176
0.816176
6
21.666666
21.982317
53
false
false
0
0
0
0
0
0
0.333333
false
false
4
60127b9e196235a9004e9019a707fe6a566e8ea5
21,560,735,871,031
8d1142c34f7ef5cb63c5e3115f4b58e19c036b51
/dump-code/panelpower/com.embrain.panelpower.vo.DeviceInfo.java
63c5555d482f3f05e27bd7051301b96a817d7355
[]
no_license
kingking888/android-auto-hack
https://github.com/kingking888/android-auto-hack
b19c979f2c39a3584ba5841c7b13b253cfc798c8
e91cb827c7ebf53ad253f965df55bfcaa9e82c32
refs/heads/master
2021-01-26T11:09:51.958000
2020-02-27T02:59:49
2020-02-27T02:59:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.embrain.panelpower.vo; import android.content.Context; import com.embrain.panelbigdata.Vo.EmBasicRequest; import com.embrain.panelbigdata.utils.DeviceUtils; import com.embrain.panelpower.utils.PanelPreferenceUtils; import com.kakao.util.helper.CommonProtocol; public class DeviceInfo extends EmBasicRequest { public String adId; public String androidVer = DeviceUtils.getOSVersion(); public String appVer; public String captchaVal; public String gcmKey; public String handphone; public String imei; public String modelNo; public String reqOsTp; public String telComp; public String telStandard; public DeviceInfo(Context context) { this.adId = PanelPreferenceUtils.getAdId(context); this.appVer = DeviceUtils.getAppVersion(context); this.captchaVal = ""; this.handphone = ""; this.imei = ""; this.modelNo = DeviceUtils.getDeviceModel(); this.reqOsTp = CommonProtocol.OS_ANDROID; this.telComp = DeviceUtils.getTelCoperation(context); this.telStandard = DeviceUtils.getTelStandard(context); this.gcmKey = PanelPreferenceUtils.getPushToken(context); if (this.gcmKey.contains("\"")) { this.gcmKey = this.gcmKey.replace("\"", ""); } } }
UTF-8
Java
1,306
java
com.embrain.panelpower.vo.DeviceInfo.java
Java
[]
null
[]
package com.embrain.panelpower.vo; import android.content.Context; import com.embrain.panelbigdata.Vo.EmBasicRequest; import com.embrain.panelbigdata.utils.DeviceUtils; import com.embrain.panelpower.utils.PanelPreferenceUtils; import com.kakao.util.helper.CommonProtocol; public class DeviceInfo extends EmBasicRequest { public String adId; public String androidVer = DeviceUtils.getOSVersion(); public String appVer; public String captchaVal; public String gcmKey; public String handphone; public String imei; public String modelNo; public String reqOsTp; public String telComp; public String telStandard; public DeviceInfo(Context context) { this.adId = PanelPreferenceUtils.getAdId(context); this.appVer = DeviceUtils.getAppVersion(context); this.captchaVal = ""; this.handphone = ""; this.imei = ""; this.modelNo = DeviceUtils.getDeviceModel(); this.reqOsTp = CommonProtocol.OS_ANDROID; this.telComp = DeviceUtils.getTelCoperation(context); this.telStandard = DeviceUtils.getTelStandard(context); this.gcmKey = PanelPreferenceUtils.getPushToken(context); if (this.gcmKey.contains("\"")) { this.gcmKey = this.gcmKey.replace("\"", ""); } } }
1,306
0.702144
0.702144
37
34.324326
19.136852
65
false
false
0
0
0
0
0
0
0.783784
false
false
4
8f57d8151700f447d1b9e15da3eeab3bdc4af9ee
19,842,748,963,316
9dc72ab720662d5a78fe8345489e0b752628533e
/src/main/java/com/neuedu/my12306/servlet/AddTicketServlet.java
c57679474fd908f829a670c90682efc2df51d3a0
[]
no_license
weicy-github/my123076
https://github.com/weicy-github/my123076
6b38f4aedcc7fc743aa46cb3cd81fb2587e9ca5e
5db91391c0ecf81b97b993bf14e20ae04560f049
refs/heads/master
2020-09-16T22:53:16.331000
2019-11-25T09:36:12
2019-11-25T09:36:12
223,911,159
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.neuedu.my12306.servlet; import java.io.IOException; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.neuedu.my12306.bean.TicketBean; import com.neuedu.my12306.service.ITicketService; import com.neuedu.my12306.service.impl.TicketServiceImpl; import com.neuedu.my12306.util.utils; @WebServlet("/AddTicketServlet.do") public class AddTicketServlet extends HttpServlet { private static final long serialVersionUID = 1L; private ITicketService iTicketService; public AddTicketServlet() { super(); iTicketService=new TicketServiceImpl(); } protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //2ใ€ๆŽฅๆ”ถ็”จๆˆท่พ“ๅ…ฅ็š„ๆ•ฐๆฎ้˜ฒๆญขไนฑ็  String startStation=request.getParameter("startStation"); String endStation=request.getParameter("endStation"); String startDate=request.getParameter("startDate"); Date startDate2=utils.parseDate(startDate); String startTime=request.getParameter("startTime"); Date startTime2=utils.parseTime(startTime); String renames=request.getParameter("renames"); System.out.println(startStation); System.out.println(endStation); System.out.println(startDate2); System.out.println(startTime2); System.out.println(renames); TicketBean ticketBean=new TicketBean(); ticketBean.setStartStation(startStation); ticketBean.setEndStation(endStation); ticketBean.setStartDate(startDate2); ticketBean.setStartTime(startTime2); ticketBean.setRenames(renames); boolean a=iTicketService.add(ticketBean); if (a) { response.sendRedirect("TicketSerlvet.do"); }else { request.getRequestDispatcher("Admin/Ticket_Add.jsp").forward(request, response); } } }
UTF-8
Java
1,938
java
AddTicketServlet.java
Java
[]
null
[]
package com.neuedu.my12306.servlet; import java.io.IOException; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.neuedu.my12306.bean.TicketBean; import com.neuedu.my12306.service.ITicketService; import com.neuedu.my12306.service.impl.TicketServiceImpl; import com.neuedu.my12306.util.utils; @WebServlet("/AddTicketServlet.do") public class AddTicketServlet extends HttpServlet { private static final long serialVersionUID = 1L; private ITicketService iTicketService; public AddTicketServlet() { super(); iTicketService=new TicketServiceImpl(); } protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //2ใ€ๆŽฅๆ”ถ็”จๆˆท่พ“ๅ…ฅ็š„ๆ•ฐๆฎ้˜ฒๆญขไนฑ็  String startStation=request.getParameter("startStation"); String endStation=request.getParameter("endStation"); String startDate=request.getParameter("startDate"); Date startDate2=utils.parseDate(startDate); String startTime=request.getParameter("startTime"); Date startTime2=utils.parseTime(startTime); String renames=request.getParameter("renames"); System.out.println(startStation); System.out.println(endStation); System.out.println(startDate2); System.out.println(startTime2); System.out.println(renames); TicketBean ticketBean=new TicketBean(); ticketBean.setStartStation(startStation); ticketBean.setEndStation(endStation); ticketBean.setStartDate(startDate2); ticketBean.setStartTime(startTime2); ticketBean.setRenames(renames); boolean a=iTicketService.add(ticketBean); if (a) { response.sendRedirect("TicketSerlvet.do"); }else { request.getRequestDispatcher("Admin/Ticket_Add.jsp").forward(request, response); } } }
1,938
0.787435
0.770157
56
33.107143
22.715382
120
false
false
0
0
0
0
0
0
1.857143
false
false
4
16f1501fa91b393b500910ffdfbc0dd6c721be26
30,777,735,695,979
270074dfc7c8a42ad24c197d5662c100c8eaa5dd
/src/com/example/dietaryapplication/CalendarActivity.java
4d493a6101da1518b1ef987d92a93daf59df5ca4
[]
no_license
neyu007/DietApp
https://github.com/neyu007/DietApp
d2d0b5f134060a6b7df52bd9f77e5ab5ae5b6759
c9ad61813c13ad4163a2ab844a34e1a81c78b285
refs/heads/master
2021-01-10T07:09:09.939000
2016-02-08T04:43:27
2016-02-08T04:43:27
51,279,420
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.dietaryapplication; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CalendarView; import android.widget.CalendarView.OnDateChangeListener; import android.widget.Toast; public class CalendarActivity extends Activity { private CalendarView calendar; private Button btnNext; private User user; private Date date; private DataBaseHelper dbHelper; private SharedPreferences.Editor sharedPrefsEditor; private SharedPreferences sharedPrefs; //private String selectedDate; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_calendar); user = getIntent().getParcelableExtra("user"); dbHelper = DataBaseHelper.getInstance(getApplicationContext()); sharedPrefsEditor = getSharedPreferences(Constants.MY_SHARED_PREFERENCES, MODE_PRIVATE).edit(); sharedPrefs = getSharedPreferences(Constants.MY_SHARED_PREFERENCES, MODE_PRIVATE); initCalendar(); initButtons(); //dbQuery(); } @SuppressLint("SimpleDateFormat") private void dbQuery(){ dbHelper.openDataBase(); ArrayList<DailyRecommendation> drList = new ArrayList<DailyRecommendation>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); drList = dbHelper.getDailyRecommendation(sdf.format(date = new Date(calendar.getDate())), 1); if(drList.size()>0){ DailyRecommendation dr = drList.get(0); Log.i("DRLIST", "DR: "+ dr.getDate() + " "+ dr.getRowid()); }else{ Log.i("DRLIST", "No recommendation"); } dbHelper.close(); } private void initButtons(){ btnNext = (Button)findViewById(R.id.btnNext); btnNext.setOnClickListener(new OnClickListener() { @SuppressWarnings("deprecation") @Override public void onClick(View v) { // TODO Auto-generated method stub date = new Date(calendar.getDate()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sharedPrefsEditor.putString(Constants.SHARED_PREFS_DATE, sdf.format(date)).commit(); // Toast.makeText(getApplicationContext(),"Date: "+ sdf.format(date), Toast.LENGTH_SHORT).show(); // dbHelper.openDataBase(); // DailyRecommendation dailyRec = new DailyRecommendation(1, sdf.format(date), 1, 1, 1, 1, 1, 1, 1, 1, 1); // // long i =0; // i= dbHelper.insertDailyRecommendation(dailyRec); // Toast.makeText(getApplicationContext(),"INSERTDB: "+ i, Toast.LENGTH_SHORT).show(); // // dbHelper.close(); Intent i = new Intent(CalendarActivity.this, BreakfastActivity.class); i.putExtra("user", user); // i.putExtra("date", sdf.format(date)); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); finish(); } }); } private void initCalendar(){ calendar = (CalendarView)findViewById(R.id.calendarView1); calendar.setFirstDayOfWeek(1); //calendar.setSelectedWeekBackgroundColor(getResources().getColor(Color.GREEN)); calendar.setOnDateChangeListener(new OnDateChangeListener() { @Override public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) { // TODO Auto-generated method stub // Toast.makeText(getApplicationContext(), dayOfMonth + "/" + month + "/" + year, Toast.LENGTH_SHORT).show(); //date = new GregorianCalendar(year, month, dayOfMonth); } }); } @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); Intent i = new Intent(CalendarActivity.this, HomeActivity.class); i.putExtra("user", user);i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } }
UTF-8
Java
4,050
java
CalendarActivity.java
Java
[]
null
[]
package com.example.dietaryapplication; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CalendarView; import android.widget.CalendarView.OnDateChangeListener; import android.widget.Toast; public class CalendarActivity extends Activity { private CalendarView calendar; private Button btnNext; private User user; private Date date; private DataBaseHelper dbHelper; private SharedPreferences.Editor sharedPrefsEditor; private SharedPreferences sharedPrefs; //private String selectedDate; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_calendar); user = getIntent().getParcelableExtra("user"); dbHelper = DataBaseHelper.getInstance(getApplicationContext()); sharedPrefsEditor = getSharedPreferences(Constants.MY_SHARED_PREFERENCES, MODE_PRIVATE).edit(); sharedPrefs = getSharedPreferences(Constants.MY_SHARED_PREFERENCES, MODE_PRIVATE); initCalendar(); initButtons(); //dbQuery(); } @SuppressLint("SimpleDateFormat") private void dbQuery(){ dbHelper.openDataBase(); ArrayList<DailyRecommendation> drList = new ArrayList<DailyRecommendation>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); drList = dbHelper.getDailyRecommendation(sdf.format(date = new Date(calendar.getDate())), 1); if(drList.size()>0){ DailyRecommendation dr = drList.get(0); Log.i("DRLIST", "DR: "+ dr.getDate() + " "+ dr.getRowid()); }else{ Log.i("DRLIST", "No recommendation"); } dbHelper.close(); } private void initButtons(){ btnNext = (Button)findViewById(R.id.btnNext); btnNext.setOnClickListener(new OnClickListener() { @SuppressWarnings("deprecation") @Override public void onClick(View v) { // TODO Auto-generated method stub date = new Date(calendar.getDate()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sharedPrefsEditor.putString(Constants.SHARED_PREFS_DATE, sdf.format(date)).commit(); // Toast.makeText(getApplicationContext(),"Date: "+ sdf.format(date), Toast.LENGTH_SHORT).show(); // dbHelper.openDataBase(); // DailyRecommendation dailyRec = new DailyRecommendation(1, sdf.format(date), 1, 1, 1, 1, 1, 1, 1, 1, 1); // // long i =0; // i= dbHelper.insertDailyRecommendation(dailyRec); // Toast.makeText(getApplicationContext(),"INSERTDB: "+ i, Toast.LENGTH_SHORT).show(); // // dbHelper.close(); Intent i = new Intent(CalendarActivity.this, BreakfastActivity.class); i.putExtra("user", user); // i.putExtra("date", sdf.format(date)); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); finish(); } }); } private void initCalendar(){ calendar = (CalendarView)findViewById(R.id.calendarView1); calendar.setFirstDayOfWeek(1); //calendar.setSelectedWeekBackgroundColor(getResources().getColor(Color.GREEN)); calendar.setOnDateChangeListener(new OnDateChangeListener() { @Override public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) { // TODO Auto-generated method stub // Toast.makeText(getApplicationContext(), dayOfMonth + "/" + month + "/" + year, Toast.LENGTH_SHORT).show(); //date = new GregorianCalendar(year, month, dayOfMonth); } }); } @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); Intent i = new Intent(CalendarActivity.this, HomeActivity.class); i.putExtra("user", user);i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } }
4,050
0.724444
0.720494
136
28.779411
27.655626
112
false
false
0
0
0
0
0
0
2.676471
false
false
4
e38f7b191e2e9fec02cb1d97dd015a2adbec11a5
30,777,735,699,708
73dcd2bd5f744886c8192de0fec4cf821d90e6e1
/src/main/java/commands/client/ClientMessage.java
157abdda40937f1ca72d4ec4d04238c748fb67d4
[]
no_license
sirajahmadzai/Machiavelli-Card-Game
https://github.com/sirajahmadzai/Machiavelli-Card-Game
242f37bea5123e5eba2cdf5a5274f8eed9592b27
383274eed38727276f3db27f1cdf203da36b10fd
refs/heads/master
2020-03-23T13:50:34.337000
2019-04-01T17:33:24
2019-04-05T20:10:25
141,641,104
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package commands.client; import java.net.URLDecoder; import java.net.URLEncoder; /** * Server tells clients to switch the turn to the next player. */ public class ClientMessage extends ClientCommand { public enum MessageTypes { ERROR, WARNING, INFO } /** * PRIVATES */ private MessageTypes messageType; private String messageText; /** * CONSTRUCTOR */ public ClientMessage() { super(CommandNames.CLIENT_MESSAGE); } /** * CONSTRUCTOR * * @param commandStr */ public ClientMessage(String commandStr) { super(commandStr); } /** * CONSTRUCTOR * * @param messageType * @param messageText */ public ClientMessage(MessageTypes messageType, String messageText) { this(); this.messageType = messageType; this.messageText = URLEncoder.encode(messageText); addParameter(this.messageType); addParameter(this.messageText); } /** * @param commandStr */ @Override public void doParse(String commandStr) { this.messageType = MessageTypes.valueOf(scanner.next()); this.messageText = scanner.next(); } /** * */ @Override public void doExecute() { manager.serverMessage(messageType, URLDecoder.decode(messageText)); } }
UTF-8
Java
1,390
java
ClientMessage.java
Java
[]
null
[]
package commands.client; import java.net.URLDecoder; import java.net.URLEncoder; /** * Server tells clients to switch the turn to the next player. */ public class ClientMessage extends ClientCommand { public enum MessageTypes { ERROR, WARNING, INFO } /** * PRIVATES */ private MessageTypes messageType; private String messageText; /** * CONSTRUCTOR */ public ClientMessage() { super(CommandNames.CLIENT_MESSAGE); } /** * CONSTRUCTOR * * @param commandStr */ public ClientMessage(String commandStr) { super(commandStr); } /** * CONSTRUCTOR * * @param messageType * @param messageText */ public ClientMessage(MessageTypes messageType, String messageText) { this(); this.messageType = messageType; this.messageText = URLEncoder.encode(messageText); addParameter(this.messageType); addParameter(this.messageText); } /** * @param commandStr */ @Override public void doParse(String commandStr) { this.messageType = MessageTypes.valueOf(scanner.next()); this.messageText = scanner.next(); } /** * */ @Override public void doExecute() { manager.serverMessage(messageType, URLDecoder.decode(messageText)); } }
1,390
0.600719
0.600719
70
18.857143
18.915817
75
false
false
0
0
0
0
0
0
0.271429
false
false
4
7f6c38f1391ab9f3b59767e6b47208c661a73107
17,781,164,659,630
47e0cabbdcbd62490417008b654ed2a64a72030f
/3rd Semester/SWE 4302/Lab1/src/Bottles.java
2c5e7e18a4854c944fa72e50e56424d7e2d5d24f
[]
no_license
afzalsiddique/Academic
https://github.com/afzalsiddique/Academic
d0519d1e879e1eb55c61febf511282863892f327
135054d33dba15072ec1f7ef2c30c1304fb0b929
refs/heads/master
2021-03-21T17:33:19.149000
2020-03-18T06:46:09
2020-03-18T06:46:09
247,316,655
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Bottles { String verse(int n) { if (n>=3){ return (n+" bottles of milk on the wall, " +n+" bottles of milk.\n" + "Take one down and pass it around, "+(n-1)+" bottles of milk on the wall."); } else if (n==2){ return (n+" bottles of milk on the wall, " +n+" bottles of milk.\n" + "Take one down and pass it around, "+(n-1)+" bottle of milk on the wall."); } else if (n==1){ return (n+" bottle of milk on the wall, " +n+" bottle of milk.\n" + "Take it down and pass it around, no more bottles of milk on the wall."); } else if (n==0){ return ("No more bottles of milk on the wall, no more bottles of milk.\n" + "Go to the store and buy some more, 99 bottles of milk on the wall."); } return null; } }
UTF-8
Java
896
java
Bottles.java
Java
[]
null
[]
public class Bottles { String verse(int n) { if (n>=3){ return (n+" bottles of milk on the wall, " +n+" bottles of milk.\n" + "Take one down and pass it around, "+(n-1)+" bottles of milk on the wall."); } else if (n==2){ return (n+" bottles of milk on the wall, " +n+" bottles of milk.\n" + "Take one down and pass it around, "+(n-1)+" bottle of milk on the wall."); } else if (n==1){ return (n+" bottle of milk on the wall, " +n+" bottle of milk.\n" + "Take it down and pass it around, no more bottles of milk on the wall."); } else if (n==0){ return ("No more bottles of milk on the wall, no more bottles of milk.\n" + "Go to the store and buy some more, 99 bottles of milk on the wall."); } return null; } }
896
0.510045
0.501116
18
48.722221
35.75193
96
false
false
0
0
0
0
0
0
0.722222
false
false
4
870846fad54c10ec658136d2c42fc43757e2863d
386,547,115,707
f94038f714b406d2b7db2d5480d4cabc8e2e888a
/ACE/src/org/ac/service/G_newsService.java
2475348e160bd41af37efc6cdbebd49687ead7be
[]
no_license
ObjectError/ACE
https://github.com/ObjectError/ACE
3c51a25f3b0e2bd544ec55c3cbd54fa1a8e80803
3cecd0249f9fc37078bf52a97ac36050f7bdfa95
refs/heads/master
2020-03-10T00:32:32.933000
2018-04-11T11:43:22
2018-04-11T11:43:22
129,084,207
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.ac.service; import java.util.List; import org.ac.beans.G_news; public interface G_newsService { abstract boolean add(G_news g_news); abstract List<G_news> findAll(); abstract G_news findContent(Integer id); abstract boolean update(G_news g_news); abstract boolean delete(G_news g_news); }
UTF-8
Java
309
java
G_newsService.java
Java
[]
null
[]
package org.ac.service; import java.util.List; import org.ac.beans.G_news; public interface G_newsService { abstract boolean add(G_news g_news); abstract List<G_news> findAll(); abstract G_news findContent(Integer id); abstract boolean update(G_news g_news); abstract boolean delete(G_news g_news); }
309
0.750809
0.750809
13
22.76923
16.091822
41
false
false
0
0
0
0
0
0
1
false
false
4
0aae8ae4aa8b410f6d584926b02a9be307f04098
30,202,210,082,887
e977e24743365697f84eb5589874a0510265b49a
/forgerock-openbanking-uk-aspsp-common/src/main/java/com/forgerock/openbanking/common/model/openbanking/obie/pain00200109/MandateRelatedInformation12.java
b62cf5be936b20d18653d66c44250da347f566a3
[ "Apache-2.0" ]
permissive
OpenBankingToolkit/openbanking-aspsp
https://github.com/OpenBankingToolkit/openbanking-aspsp
6cc8fb7428e35f70e38f3e250380b3a2e8532dd4
9469cc031d3842b5153cf0eae16231f50c68fad1
refs/heads/master
2023-04-05T10:42:50.442000
2023-03-23T15:54:54
2023-03-23T15:54:54
226,305,127
3
4
Apache-2.0
false
2023-09-06T14:24:24
2019-12-06T10:35:37
2023-01-09T15:31:26
2023-09-06T14:24:23
14,074
3
3
27
Java
false
false
/** * Copyright 2019 ForgeRock AS. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.forgerock.openbanking.common.model.openbanking.obie.pain00200109; import javax.xml.bind.annotation.*; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for MandateRelatedInformation12 complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="MandateRelatedInformation12"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="MndtId" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Max35Text" minOccurs="0"/> * &lt;element name="DtOfSgntr" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}ISODate" minOccurs="0"/> * &lt;element name="AmdmntInd" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}TrueFalseIndicator" minOccurs="0"/> * &lt;element name="AmdmntInfDtls" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}AmendmentInformationDetails12" minOccurs="0"/> * &lt;element name="ElctrncSgntr" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Max1025Text" minOccurs="0"/> * &lt;element name="FrstColltnDt" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}ISODate" minOccurs="0"/> * &lt;element name="FnlColltnDt" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}ISODate" minOccurs="0"/> * &lt;element name="Frqcy" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Frequency36Choice" minOccurs="0"/> * &lt;element name="Rsn" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}MandateSetupReason1Choice" minOccurs="0"/> * &lt;element name="TrckgDays" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Exact2NumericText" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MandateRelatedInformation12", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09", propOrder = { "mndtId", "dtOfSgntr", "amdmntInd", "amdmntInfDtls", "elctrncSgntr", "frstColltnDt", "fnlColltnDt", "frqcy", "rsn", "trckgDays" }) public class MandateRelatedInformation12 { @XmlElement(name = "MndtId", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected String mndtId; @XmlElement(name = "DtOfSgntr", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") @XmlSchemaType(name = "date") protected XMLGregorianCalendar dtOfSgntr; @XmlElement(name = "AmdmntInd", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected Boolean amdmntInd; @XmlElement(name = "AmdmntInfDtls", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected AmendmentInformationDetails12 amdmntInfDtls; @XmlElement(name = "ElctrncSgntr", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected String elctrncSgntr; @XmlElement(name = "FrstColltnDt", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") @XmlSchemaType(name = "date") protected XMLGregorianCalendar frstColltnDt; @XmlElement(name = "FnlColltnDt", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") @XmlSchemaType(name = "date") protected XMLGregorianCalendar fnlColltnDt; @XmlElement(name = "Frqcy", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected Frequency36Choice frqcy; @XmlElement(name = "Rsn", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected MandateSetupReason1Choice rsn; @XmlElement(name = "TrckgDays", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected String trckgDays; /** * Gets the value of the mndtId property. * * @return * possible object is * {@link String } * */ public String getMndtId() { return mndtId; } /** * Sets the value of the mndtId property. * * @param value * allowed object is * {@link String } * */ public void setMndtId(String value) { this.mndtId = value; } /** * Gets the value of the dtOfSgntr property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDtOfSgntr() { return dtOfSgntr; } /** * Sets the value of the dtOfSgntr property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDtOfSgntr(XMLGregorianCalendar value) { this.dtOfSgntr = value; } /** * Gets the value of the amdmntInd property. * * @return * possible object is * {@link Boolean } * */ public Boolean isAmdmntInd() { return amdmntInd; } /** * Sets the value of the amdmntInd property. * * @param value * allowed object is * {@link Boolean } * */ public void setAmdmntInd(Boolean value) { this.amdmntInd = value; } /** * Gets the value of the amdmntInfDtls property. * * @return * possible object is * {@link AmendmentInformationDetails12 } * */ public AmendmentInformationDetails12 getAmdmntInfDtls() { return amdmntInfDtls; } /** * Sets the value of the amdmntInfDtls property. * * @param value * allowed object is * {@link AmendmentInformationDetails12 } * */ public void setAmdmntInfDtls(AmendmentInformationDetails12 value) { this.amdmntInfDtls = value; } /** * Gets the value of the elctrncSgntr property. * * @return * possible object is * {@link String } * */ public String getElctrncSgntr() { return elctrncSgntr; } /** * Sets the value of the elctrncSgntr property. * * @param value * allowed object is * {@link String } * */ public void setElctrncSgntr(String value) { this.elctrncSgntr = value; } /** * Gets the value of the frstColltnDt property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getFrstColltnDt() { return frstColltnDt; } /** * Sets the value of the frstColltnDt property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setFrstColltnDt(XMLGregorianCalendar value) { this.frstColltnDt = value; } /** * Gets the value of the fnlColltnDt property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getFnlColltnDt() { return fnlColltnDt; } /** * Sets the value of the fnlColltnDt property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setFnlColltnDt(XMLGregorianCalendar value) { this.fnlColltnDt = value; } /** * Gets the value of the frqcy property. * * @return * possible object is * {@link Frequency36Choice } * */ public Frequency36Choice getFrqcy() { return frqcy; } /** * Sets the value of the frqcy property. * * @param value * allowed object is * {@link Frequency36Choice } * */ public void setFrqcy(Frequency36Choice value) { this.frqcy = value; } /** * Gets the value of the rsn property. * * @return * possible object is * {@link MandateSetupReason1Choice } * */ public MandateSetupReason1Choice getRsn() { return rsn; } /** * Sets the value of the rsn property. * * @param value * allowed object is * {@link MandateSetupReason1Choice } * */ public void setRsn(MandateSetupReason1Choice value) { this.rsn = value; } /** * Gets the value of the trckgDays property. * * @return * possible object is * {@link String } * */ public String getTrckgDays() { return trckgDays; } /** * Sets the value of the trckgDays property. * * @param value * allowed object is * {@link String } * */ public void setTrckgDays(String value) { this.trckgDays = value; } }
UTF-8
Java
9,701
java
MandateRelatedInformation12.java
Java
[]
null
[]
/** * Copyright 2019 ForgeRock AS. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.forgerock.openbanking.common.model.openbanking.obie.pain00200109; import javax.xml.bind.annotation.*; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for MandateRelatedInformation12 complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="MandateRelatedInformation12"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="MndtId" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Max35Text" minOccurs="0"/> * &lt;element name="DtOfSgntr" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}ISODate" minOccurs="0"/> * &lt;element name="AmdmntInd" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}TrueFalseIndicator" minOccurs="0"/> * &lt;element name="AmdmntInfDtls" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}AmendmentInformationDetails12" minOccurs="0"/> * &lt;element name="ElctrncSgntr" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Max1025Text" minOccurs="0"/> * &lt;element name="FrstColltnDt" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}ISODate" minOccurs="0"/> * &lt;element name="FnlColltnDt" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}ISODate" minOccurs="0"/> * &lt;element name="Frqcy" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Frequency36Choice" minOccurs="0"/> * &lt;element name="Rsn" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}MandateSetupReason1Choice" minOccurs="0"/> * &lt;element name="TrckgDays" type="{urn:iso:std:iso:20022:tech:xsd:pain.002.001.09}Exact2NumericText" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MandateRelatedInformation12", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09", propOrder = { "mndtId", "dtOfSgntr", "amdmntInd", "amdmntInfDtls", "elctrncSgntr", "frstColltnDt", "fnlColltnDt", "frqcy", "rsn", "trckgDays" }) public class MandateRelatedInformation12 { @XmlElement(name = "MndtId", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected String mndtId; @XmlElement(name = "DtOfSgntr", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") @XmlSchemaType(name = "date") protected XMLGregorianCalendar dtOfSgntr; @XmlElement(name = "AmdmntInd", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected Boolean amdmntInd; @XmlElement(name = "AmdmntInfDtls", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected AmendmentInformationDetails12 amdmntInfDtls; @XmlElement(name = "ElctrncSgntr", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected String elctrncSgntr; @XmlElement(name = "FrstColltnDt", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") @XmlSchemaType(name = "date") protected XMLGregorianCalendar frstColltnDt; @XmlElement(name = "FnlColltnDt", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") @XmlSchemaType(name = "date") protected XMLGregorianCalendar fnlColltnDt; @XmlElement(name = "Frqcy", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected Frequency36Choice frqcy; @XmlElement(name = "Rsn", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected MandateSetupReason1Choice rsn; @XmlElement(name = "TrckgDays", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.002.001.09") protected String trckgDays; /** * Gets the value of the mndtId property. * * @return * possible object is * {@link String } * */ public String getMndtId() { return mndtId; } /** * Sets the value of the mndtId property. * * @param value * allowed object is * {@link String } * */ public void setMndtId(String value) { this.mndtId = value; } /** * Gets the value of the dtOfSgntr property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDtOfSgntr() { return dtOfSgntr; } /** * Sets the value of the dtOfSgntr property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDtOfSgntr(XMLGregorianCalendar value) { this.dtOfSgntr = value; } /** * Gets the value of the amdmntInd property. * * @return * possible object is * {@link Boolean } * */ public Boolean isAmdmntInd() { return amdmntInd; } /** * Sets the value of the amdmntInd property. * * @param value * allowed object is * {@link Boolean } * */ public void setAmdmntInd(Boolean value) { this.amdmntInd = value; } /** * Gets the value of the amdmntInfDtls property. * * @return * possible object is * {@link AmendmentInformationDetails12 } * */ public AmendmentInformationDetails12 getAmdmntInfDtls() { return amdmntInfDtls; } /** * Sets the value of the amdmntInfDtls property. * * @param value * allowed object is * {@link AmendmentInformationDetails12 } * */ public void setAmdmntInfDtls(AmendmentInformationDetails12 value) { this.amdmntInfDtls = value; } /** * Gets the value of the elctrncSgntr property. * * @return * possible object is * {@link String } * */ public String getElctrncSgntr() { return elctrncSgntr; } /** * Sets the value of the elctrncSgntr property. * * @param value * allowed object is * {@link String } * */ public void setElctrncSgntr(String value) { this.elctrncSgntr = value; } /** * Gets the value of the frstColltnDt property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getFrstColltnDt() { return frstColltnDt; } /** * Sets the value of the frstColltnDt property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setFrstColltnDt(XMLGregorianCalendar value) { this.frstColltnDt = value; } /** * Gets the value of the fnlColltnDt property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getFnlColltnDt() { return fnlColltnDt; } /** * Sets the value of the fnlColltnDt property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setFnlColltnDt(XMLGregorianCalendar value) { this.fnlColltnDt = value; } /** * Gets the value of the frqcy property. * * @return * possible object is * {@link Frequency36Choice } * */ public Frequency36Choice getFrqcy() { return frqcy; } /** * Sets the value of the frqcy property. * * @param value * allowed object is * {@link Frequency36Choice } * */ public void setFrqcy(Frequency36Choice value) { this.frqcy = value; } /** * Gets the value of the rsn property. * * @return * possible object is * {@link MandateSetupReason1Choice } * */ public MandateSetupReason1Choice getRsn() { return rsn; } /** * Sets the value of the rsn property. * * @param value * allowed object is * {@link MandateSetupReason1Choice } * */ public void setRsn(MandateSetupReason1Choice value) { this.rsn = value; } /** * Gets the value of the trckgDays property. * * @return * possible object is * {@link String } * */ public String getTrckgDays() { return trckgDays; } /** * Sets the value of the trckgDays property. * * @param value * allowed object is * {@link String } * */ public void setTrckgDays(String value) { this.trckgDays = value; } }
9,701
0.607875
0.5719
334
28.04491
28.748358
144
false
false
0
0
0
0
0
0
0.230539
false
false
4
bc305cf3112a4c4c238b3e4a8a1175d2d0d8dafa
9,405,978,382,220
cfede395d85be427098d9519a99bc7972e6841b4
/src/main/com/bsuir/library/dao/implementation/authorCatalog/IAuthorCatalogDao.java
8e8e66e2f176ec2b1f6c6d3c9d862d647f196d1c
[]
no_license
balaban-sasha/LibraryProjectMPPWithSpring
https://github.com/balaban-sasha/LibraryProjectMPPWithSpring
028ab71dd55215847e70907755b7cfcaf965a373
d0fca7c25dbde3fa20706e71ababf3687589f004
refs/heads/master
2021-03-13T03:08:05.279000
2017-05-16T18:22:12
2017-05-16T18:22:12
91,490,630
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.com.bsuir.library.dao.implementation.authorCatalog; import main.com.bsuir.library.bean.AuthorCatalog; import main.com.bsuir.library.dao.DaoController; /** * Created by ะกะฐัˆะฐ on 28.03.2017. */ public interface IAuthorCatalogDao extends DaoController<AuthorCatalog,Integer> { }
UTF-8
Java
297
java
IAuthorCatalogDao.java
Java
[ { "context": "suir.library.dao.DaoController;\n\n/**\n * Created by ะกะฐัˆะฐ on 28.03.2017.\n */\npublic interface IAuthorCatalo", "end": 188, "score": 0.9996798634529114, "start": 184, "tag": "NAME", "value": "ะกะฐัˆะฐ" } ]
null
[]
package main.com.bsuir.library.dao.implementation.authorCatalog; import main.com.bsuir.library.bean.AuthorCatalog; import main.com.bsuir.library.dao.DaoController; /** * Created by ะกะฐัˆะฐ on 28.03.2017. */ public interface IAuthorCatalogDao extends DaoController<AuthorCatalog,Integer> { }
297
0.798635
0.771331
11
25.636364
28.983608
81
false
false
0
0
0
0
0
0
0.363636
false
false
4
cac9988f0c8a229c4e4ef5a2d4df70d09ad49b3b
24,386,824,354,384
5cb9476cdfd86fccbff548d5cc955fc11bf78083
/src/main/java/com/redhat/syseng/soleng/rhpam/util/MigrationUtils.java
09a891e36591ef7272ab5a972b8e5d4b6bed69ca
[]
no_license
calvinzhuca/test_rhpam_Client
https://github.com/calvinzhuca/test_rhpam_Client
6fef55ca86e6e245a65d908f66123f1e15d2c43c
590213a7d25071b74db90bddf652d3816499fe01
refs/heads/master
2018-09-18T06:18:58.577000
2018-08-14T16:39:36
2018-08-14T16:39:36
133,077,106
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.redhat.syseng.soleng.rhpam.util; import com.redhat.syseng.soleng.rhpam.model.BpmNode; import com.redhat.syseng.soleng.rhpam.model.MigrationPlan; import com.redhat.syseng.soleng.rhpam.model.ProcessInfo; import com.redhat.syseng.soleng.rhpam.model.containers.Response; import com.redhat.syseng.soleng.rhpam.model.instance.ProcessInstanceList; import com.redhat.syseng.soleng.rhpam.model.process.ProcessDefinitions; import javax.servlet.http.HttpServletRequest; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; import java.io.StringWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.FileInputStream; import java.io.IOException; import java.net.URISyntaxException; import java.security.KeyManagementException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.util.ArrayList; import java.util.Base64; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.logging.Logger; import java.util.logging.Level; import javax.servlet.ServletContext; import org.apache.commons.io.IOUtils; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; import org.apache.http.client.utils.URIBuilder; import org.drools.compiler.kie.builder.impl.KieServicesImpl; import org.eclipse.aether.artifact.Artifact; import org.jboss.resteasy.client.jaxrs.BasicAuthentication; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.kie.api.KieServices; import org.kie.api.management.GAV; import org.kie.scanner.KieMavenRepository; public class MigrationUtils { private static Logger logger = Logger.getLogger(MigrationUtils.class.getName()); //String kieHost = System.getenv("KIE_HOST"); //int kiePort = Integer.valueOf(System.getenv("KIE_PORT")); // public static String kieHost = "myapp-kieserver-calvin-test.rhdp.ocp.cloud.lab.eng.bos.redhat.com"; // public static int kiePort = 80; // public static String kieContextRoot = ""; private static String kieHost; private static String kiePort; private static String kieContextRoot; private static String kieUsername; private static String kiePassword; public static String protocol = "http"; public static String getKieHost() { if (kieHost == null) { getSystemEnvForKie(); } return kieHost; } public static String getKiePort() { if (kiePort == null) { getSystemEnvForKie(); } return kiePort; } public static String getKieUsername() { if (kieUsername == null) { getSystemEnvForKie(); } return kieUsername; } public static String getKiePassword() { if (kiePassword == null) { getSystemEnvForKie(); } return kiePassword; } public static String getKieContextRoot() { if (kieContextRoot == null) { kieContextRoot = System.getenv("KIE_CONTEXT_ROOT"); //in OCP, this won't be defined, so set to empty string. if (kieContextRoot == null) { kieContextRoot = ""; } } return kieContextRoot; } private static void getSystemEnvForKie() { kieUsername = System.getenv("KIE_SERVER_USER"); kiePassword = System.getenv("KIE_SERVER_PWD"); //because in OCP template's environment variable is in this format ${MYAPP}_KIESERVER_SERVICE_HOST //so need to loop through all and find the matching one Map<String, String> envs = System.getenv(); for (String envName : envs.keySet()) { // System.out.format("%s=%s%n", envName, envs.get(envName)); if (envName.contains("KIESERVER_SERVICE_HOST")) { kieHost = envs.get(envName); System.out.println("!!!!!!!!!!!!!!!!!!!!! kieHost " + kieHost); } else if (envName.contains("KIESERVER_SERVICE_PORT")) { kiePort = envs.get(envName); System.out.println("!!!!!!!!!!!!!!!!!!!!! kiePort " + kiePort); } } } private static ResteasyClient createRestClientWithCerts(boolean useOcpCertificate) { ResteasyClient client; if (useOcpCertificate) { //use the OCP certificate which exist here in every pod: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt try (FileInputStream in = new FileInputStream("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")) { CertificateFactory cf = CertificateFactory.getInstance("X.509"); Certificate cert = cf.generateCertificate(in); //logger.info("createRestClientWithCerts, created Certificate from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt"); // load the keystore that includes self-signed cert as a "trusted" entry KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(null, null); TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); keyStore.setCertificateEntry("ocp-cert", cert); tmf.init(keyStore); SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(null, tmf.getTrustManagers(), null); //logger.info("createRestClientWithCerts, created SSLContext"); //For proper HTTPS authentication ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder(); clientBuilder.sslContext(ctx); client = clientBuilder.build(); } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException | KeyManagementException ex) { logger.log(Level.SEVERE, null, ex); throw new IllegalStateException(ex); } //use filter to add http header //RestClientRequestFilter filter = new RestClientRequestFilter(); //client.register(filter); } else { client = new ResteasyClientBuilder().build(); } return client; } private static URIBuilder getUriBuilder(Object... path) { URIBuilder uriBuilder = new URIBuilder(); uriBuilder.setScheme(protocol); uriBuilder.setHost(getKieHost()); uriBuilder.setPort(Integer.parseInt(getKiePort())); StringWriter stringWriter = new StringWriter(); for (Object part : path) { stringWriter.append('/').append(String.valueOf(part)); } uriBuilder.setPath(stringWriter.toString()); return uriBuilder; } public static KieService getKieService() throws URISyntaxException { boolean useOcpCertificate = false; ResteasyClient client = createRestClientWithCerts(useOcpCertificate); URIBuilder uriBuilder = getUriBuilder(getKieContextRoot()); String url = uriBuilder.build().toString(); //System.out.println("kieService URL: " + url); ResteasyWebTarget webTarget = client.target(url); webTarget.register(new BasicAuthentication(getKieUsername(), getKiePassword())); return webTarget.proxy(KieService.class); } public static Response getContainersFromKieServer() throws URISyntaxException { Response response = getKieService().listContainers(); return response; /* String response = getKieService().listContainers(); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!! response: " + response); return null; */ } public static ProcessDefinitions getProcessDefinitionsFromKieServer(String containerId) throws URISyntaxException { ProcessDefinitions response = getKieService().getProcessDefinitions(containerId); return response; /* String response = getKieService().getProcessDefinitions(containerId); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!getProcessDefinitionsFromKieServer response: " + response); return null; */ } public static ProcessInstanceList getRunningInstancesFromKieServer(String containerId) throws URISyntaxException { ProcessInstanceList response = getKieService().getRunningInstances(containerId); return response; } public static MigrationPlan getMigrationPlanFromRequest(HttpServletRequest request) { MigrationPlan plan = new MigrationPlan(); plan.setContainerId(request.getParameter("containerId")); plan.setTargetContainerId(request.getParameter("targetContainerId")); plan.setTargetProcessId(request.getParameter("targetProcessId")); //plan.setUseRest(request.getParameter("useRest")); //running instance id list String[] instanceIdArray = request.getParameterValues("instanceIds"); if (null != instanceIdArray) { ArrayList<Long> instanceIds = new ArrayList<>(); for (String str : instanceIdArray) { instanceIds.add(Long.valueOf(str)); } plan.setProcessInstancesId(instanceIds); } else { System.out.println("!!!!!!!!!!!!!! have to choose a running instance for migration!"); } //node mapping section HashMap<String, String> map = new HashMap(); Enumeration<String> names = request.getParameterNames(); while (names.hasMoreElements()) { String name = names.nextElement(); int i = name.indexOf("-"); if (name.contains("targetNodeId-")) { //this parameter is for v2node mapping String sourceNodeId = name.substring(i + 1); String targetNodeId = request.getParameter(name); if (null != targetNodeId && !targetNodeId.equals("")) { map.put(sourceNodeId, targetNodeId); } } plan.setNodeMapping(map); } /* String checkBoxValue2 = request.getParameter("checkBox2"); String checkBoxValue3 = request.getParameter("checkBox3"); System.out.println("checkBox2 " + checkBoxValue2); System.out.println("checkBox3 " + checkBoxValue3); */ return plan; } public static MigrationPlan getLoginInfo(HttpServletRequest request) { MigrationPlan customer = new MigrationPlan(); return customer; } public ArrayList<BpmNode> parseBpmnFileInsideWar(String xmlFilePath) { InputStream inputStream = getClass().getResourceAsStream(xmlFilePath); return parseBpmnFile(inputStream); } public static ArrayList<BpmNode> parseBpmnFile(String xmlFilePath) throws FileNotFoundException { FileInputStream inputStream = new FileInputStream(new File(xmlFilePath)); return parseBpmnFile(inputStream); } public static ArrayList<BpmNode> parseBpmnFile(InputStream inputStream) { SAXBuilder saxBuilder = new SAXBuilder(); ArrayList<BpmNode> result = new ArrayList<>(); try { Document document = (Document) saxBuilder.build(inputStream); //root element is bpmn2:definitions Element rootElement = document.getRootElement(); /* ArrayList<Element> listElement1 = rootElement.getChildren(); for (Element v2node : listElement1) { System.out.println("v2node.getName() :" + v2node.getName()); System.out.println("v2node.getAttributeValue(\"id\") :" + v2node.getAttributeValue("id")); System.out.println("v2node.toString() :" + v2node.toString()); System.out.println(""); System.out.println(""); if (v2node.getName().equals("process")) { System.out.println("!!!!!!!!!here22"); Element processNode = rootElement.getChild("process",rootElement.getNamespace()); System.out.println("processNode.getName222() :" + processNode.getName()); } } */ Element processNode = rootElement.getChild("process", rootElement.getNamespace()); List<Element> listElement = processNode.getChildren(); for (Element node : listElement) { if (!node.getName().equals("sequenceFlow") && !node.getName().equals("startEvent") && !node.getName().equals("endEvent")) { BpmNode bpmNode = new BpmNode(); bpmNode.setType(node.getName()); bpmNode.setName(node.getAttributeValue("name")); bpmNode.setId(node.getAttributeValue("id")); result.add(bpmNode); /* System.out.println(" " + bpmNode.toString()); System.out.println(""); System.out.println(""); */ } } } catch (IOException io) { System.out.println(io.getMessage()); } catch (JDOMException jdomex) { System.out.println(jdomex.getMessage()); } return result; } public static ArrayList<String> validateMigrationPlan(MigrationPlan plan, ProcessInfo processInfo) { ArrayList<String> errors = new ArrayList(); //validate running instance id, need to have at least 1 running instance id List<Long> processIds = plan.getProcessInstancesId(); if (processIds == null || processIds.isEmpty()) { errors.add("Need to choose at least one running instance id for migration!"); } //validate the v2node mapping: //1) target id must be a valid id from existing V2 v2node ids //2) mapping must between same type of v2node Map<String, String> map = plan.getNodeMapping(); if (!map.isEmpty()) { Set<String> keys = map.keySet(); ArrayList<BpmNode> v1Nodes = processInfo.getNodeV1(); for (String sourceNodeId : keys) { String targetNodeId = map.get(sourceNodeId); ArrayList<BpmNode> v2Nodes = processInfo.getNodeV2(); boolean found = false; for (BpmNode v2node : v2Nodes) { String id = v2node.getId(); if (id.equals(targetNodeId)) { found = true; //now compare if source and target node are the same type or not. String targetNodeType = v2node.getType(); for (BpmNode v1Node : v1Nodes) { String v1NodeId = v1Node.getId(); if (sourceNodeId.equals(v1NodeId)) { String sourceNodeType = v1Node.getType(); if (!sourceNodeType.equals(targetNodeType)) { errors.add("Node Mapping can only happen in the same type of node, for node id: " + sourceNodeId + " of sourceNodeType: " + sourceNodeType + " is not the same as node id: " + targetNodeId + " of targetNodeType: " + targetNodeType); } break; } } break; } } if (!found) { errors.add("For targetNodeId, please choose from newer version node id, right now this is not a valid one: " + targetNodeId); } } } return errors; } /* public static ArrayList<BpmNode> retriveFilesFromKjar(String groupId, String artifactId, String version) throws IOException { //System.out.println("!######################################retriveFilesFromKjar started "); ArrayList<BpmNode> bpmNodes = null; KieServices ks = (KieServicesImpl) KieServices.Factory.get(); // String groupId = "com.myteam"; // String artifactId = "testProject1"; // String version = "1.0"; GAV gav = new GAV(groupId, artifactId, version); KieMavenRepository repository1 = KieMavenRepository.getKieMavenRepository(); Artifact artifact = repository1.resolveArtifact(gav); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getVersion() " + artifact.getVersion()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getArtifactId() " + artifact.getArtifactId()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getGroupId() " + artifact.getGroupId()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact " + artifact); File kjarFile = artifact.getFile(); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getName() " + kjarFile.getName()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getPath() " + kjarFile.getPath()); JarFile jarFile = new JarFile(kjarFile); Enumeration enumEntries = jarFile.entries(); while (enumEntries.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enumEntries.nextElement(); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); //File f = new File(destDir + java.io.File.separator + file.getName()); File f = new File(jarEntry.getName()); if (jarEntry.getName().contains("bpmn2")) { //System.out.println("!!!!!!!!!!!!!! found bpmn2 file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); // get the input stream InputStream is = jarFile.getInputStream(jarEntry); bpmNodes = parseBpmnFile(is); is.close(); } else if (jarEntry.getName().contains("svg")) { //This is the process diagram file //System.out.println("!!!!!!!!!!!!!! found svg file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); } } jarFile.close(); //System.out.println("!######################################retriveFilesFromKjar ended "); return bpmNodes; } */ public static void retriveProcessInfoFromKjar(String groupId, String artifactId, String version, ProcessInfo info, boolean isV1) throws IOException { //System.out.println("######################################retriveProcessInfoFromKjar started, isV1 " + isV1); KieServices ks = (KieServicesImpl) KieServices.Factory.get(); GAV gav = new GAV(groupId, artifactId, version); KieMavenRepository repository = KieMavenRepository.getKieMavenRepository(); Artifact artifact = repository.resolveArtifact(gav); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getVersion() " + artifact.getVersion()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getArtifactId() " + artifact.getArtifactId()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getGroupId() " + artifact.getGroupId()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact " + artifact); File kjarFile = artifact.getFile(); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getName() " + kjarFile.getName()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getPath() " + kjarFile.getPath()); JarFile jarFile = new JarFile(kjarFile); Enumeration enumEntries = jarFile.entries(); while (enumEntries.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enumEntries.nextElement(); //System.out.println("------------jarEntry.getName(): " + jarEntry.getName()); if (jarEntry.getName().contains("bpmn")) { //System.out.println("!!!!!!!!!!!!!! found bpmn file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); // get the input stream InputStream inputStream = jarFile.getInputStream(jarEntry); if (isV1) { info.setNodeV1(parseBpmnFile(inputStream)); } else { info.setNodeV2(parseBpmnFile(inputStream)); } inputStream.close(); } else if (jarEntry.getName().contains("svg")) { //This is the process diagram file //System.out.println("!!!!!!!!!!!!!! found svg file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); InputStream inputStream = jarFile.getInputStream(jarEntry); byte[] bytes = IOUtils.toByteArray(inputStream); String base64Image = Base64.getEncoder().encodeToString(bytes); //BufferedImage image = ImageUtil.base64ImageStringToBufferedImage(base64Image); //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>...ImageUtil.base64ImageStringToBufferedImage(base64Image) is done: " + image); //String base64Image2 = ImageUtil.bufferedImageToBase64ImageString(image, "svg"); //There might be several svg file in the jar, espeically in the newer version //so only get the svg file name match the process id if (isV1) { String tmpStrV1 = info.getProcessId(); String tmpNameV1 = tmpStrV1; int i = tmpStrV1.indexOf("."); if (i > -1){ tmpNameV1 = tmpStrV1.substring(tmpStrV1.indexOf(".")); } if (jarEntry.getName().contains(tmpNameV1)) { info.setBase64ImageV1(base64Image); } } else { String tmpStrV2 = info.getTargetProcessId(); String tmpNameV2 = tmpStrV2; int i = tmpStrV2.indexOf("."); if (i > -1){ tmpNameV2 = tmpStrV2.substring(tmpStrV2.indexOf(".")); } if (jarEntry.getName().contains(tmpNameV2)) { info.setBase64ImageV2(base64Image); } } inputStream.close(); } } jarFile.close(); //System.out.println("######################################retriveProcessInfoFromKjar ended "); //return info; } public void loadProperties(String fileName) { Properties prop = new Properties(); InputStream input = null; try { input = getClass().getResourceAsStream(fileName); //input = new FileInputStream(fileName); // load a properties file prop.load(input); // get the property value and print it out for (Entry<Object, Object> e : prop.entrySet()) { System.out.println(">>>>>>>>>>>> prop entry: " + e); } } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } } public void loadPropertiesFromWar2(String fileName, ServletContext servletContext) { Properties prop = new Properties(); InputStream input = null; try { input = servletContext.getResourceAsStream(fileName); // load a properties file prop.load(input); // get the property value and print it out for (Entry<Object, Object> e : prop.entrySet()) { System.out.println(">>>>>>>>>>>> prop entry: " + e); } } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
UTF-8
Java
24,758
java
MigrationUtils.java
Java
[]
null
[]
package com.redhat.syseng.soleng.rhpam.util; import com.redhat.syseng.soleng.rhpam.model.BpmNode; import com.redhat.syseng.soleng.rhpam.model.MigrationPlan; import com.redhat.syseng.soleng.rhpam.model.ProcessInfo; import com.redhat.syseng.soleng.rhpam.model.containers.Response; import com.redhat.syseng.soleng.rhpam.model.instance.ProcessInstanceList; import com.redhat.syseng.soleng.rhpam.model.process.ProcessDefinitions; import javax.servlet.http.HttpServletRequest; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; import java.io.StringWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.FileInputStream; import java.io.IOException; import java.net.URISyntaxException; import java.security.KeyManagementException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.util.ArrayList; import java.util.Base64; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.logging.Logger; import java.util.logging.Level; import javax.servlet.ServletContext; import org.apache.commons.io.IOUtils; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; import org.apache.http.client.utils.URIBuilder; import org.drools.compiler.kie.builder.impl.KieServicesImpl; import org.eclipse.aether.artifact.Artifact; import org.jboss.resteasy.client.jaxrs.BasicAuthentication; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.kie.api.KieServices; import org.kie.api.management.GAV; import org.kie.scanner.KieMavenRepository; public class MigrationUtils { private static Logger logger = Logger.getLogger(MigrationUtils.class.getName()); //String kieHost = System.getenv("KIE_HOST"); //int kiePort = Integer.valueOf(System.getenv("KIE_PORT")); // public static String kieHost = "myapp-kieserver-calvin-test.rhdp.ocp.cloud.lab.eng.bos.redhat.com"; // public static int kiePort = 80; // public static String kieContextRoot = ""; private static String kieHost; private static String kiePort; private static String kieContextRoot; private static String kieUsername; private static String kiePassword; public static String protocol = "http"; public static String getKieHost() { if (kieHost == null) { getSystemEnvForKie(); } return kieHost; } public static String getKiePort() { if (kiePort == null) { getSystemEnvForKie(); } return kiePort; } public static String getKieUsername() { if (kieUsername == null) { getSystemEnvForKie(); } return kieUsername; } public static String getKiePassword() { if (kiePassword == null) { getSystemEnvForKie(); } return kiePassword; } public static String getKieContextRoot() { if (kieContextRoot == null) { kieContextRoot = System.getenv("KIE_CONTEXT_ROOT"); //in OCP, this won't be defined, so set to empty string. if (kieContextRoot == null) { kieContextRoot = ""; } } return kieContextRoot; } private static void getSystemEnvForKie() { kieUsername = System.getenv("KIE_SERVER_USER"); kiePassword = System.getenv("KIE_SERVER_PWD"); //because in OCP template's environment variable is in this format ${MYAPP}_KIESERVER_SERVICE_HOST //so need to loop through all and find the matching one Map<String, String> envs = System.getenv(); for (String envName : envs.keySet()) { // System.out.format("%s=%s%n", envName, envs.get(envName)); if (envName.contains("KIESERVER_SERVICE_HOST")) { kieHost = envs.get(envName); System.out.println("!!!!!!!!!!!!!!!!!!!!! kieHost " + kieHost); } else if (envName.contains("KIESERVER_SERVICE_PORT")) { kiePort = envs.get(envName); System.out.println("!!!!!!!!!!!!!!!!!!!!! kiePort " + kiePort); } } } private static ResteasyClient createRestClientWithCerts(boolean useOcpCertificate) { ResteasyClient client; if (useOcpCertificate) { //use the OCP certificate which exist here in every pod: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt try (FileInputStream in = new FileInputStream("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")) { CertificateFactory cf = CertificateFactory.getInstance("X.509"); Certificate cert = cf.generateCertificate(in); //logger.info("createRestClientWithCerts, created Certificate from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt"); // load the keystore that includes self-signed cert as a "trusted" entry KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(null, null); TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); keyStore.setCertificateEntry("ocp-cert", cert); tmf.init(keyStore); SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(null, tmf.getTrustManagers(), null); //logger.info("createRestClientWithCerts, created SSLContext"); //For proper HTTPS authentication ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder(); clientBuilder.sslContext(ctx); client = clientBuilder.build(); } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException | KeyManagementException ex) { logger.log(Level.SEVERE, null, ex); throw new IllegalStateException(ex); } //use filter to add http header //RestClientRequestFilter filter = new RestClientRequestFilter(); //client.register(filter); } else { client = new ResteasyClientBuilder().build(); } return client; } private static URIBuilder getUriBuilder(Object... path) { URIBuilder uriBuilder = new URIBuilder(); uriBuilder.setScheme(protocol); uriBuilder.setHost(getKieHost()); uriBuilder.setPort(Integer.parseInt(getKiePort())); StringWriter stringWriter = new StringWriter(); for (Object part : path) { stringWriter.append('/').append(String.valueOf(part)); } uriBuilder.setPath(stringWriter.toString()); return uriBuilder; } public static KieService getKieService() throws URISyntaxException { boolean useOcpCertificate = false; ResteasyClient client = createRestClientWithCerts(useOcpCertificate); URIBuilder uriBuilder = getUriBuilder(getKieContextRoot()); String url = uriBuilder.build().toString(); //System.out.println("kieService URL: " + url); ResteasyWebTarget webTarget = client.target(url); webTarget.register(new BasicAuthentication(getKieUsername(), getKiePassword())); return webTarget.proxy(KieService.class); } public static Response getContainersFromKieServer() throws URISyntaxException { Response response = getKieService().listContainers(); return response; /* String response = getKieService().listContainers(); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!! response: " + response); return null; */ } public static ProcessDefinitions getProcessDefinitionsFromKieServer(String containerId) throws URISyntaxException { ProcessDefinitions response = getKieService().getProcessDefinitions(containerId); return response; /* String response = getKieService().getProcessDefinitions(containerId); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!getProcessDefinitionsFromKieServer response: " + response); return null; */ } public static ProcessInstanceList getRunningInstancesFromKieServer(String containerId) throws URISyntaxException { ProcessInstanceList response = getKieService().getRunningInstances(containerId); return response; } public static MigrationPlan getMigrationPlanFromRequest(HttpServletRequest request) { MigrationPlan plan = new MigrationPlan(); plan.setContainerId(request.getParameter("containerId")); plan.setTargetContainerId(request.getParameter("targetContainerId")); plan.setTargetProcessId(request.getParameter("targetProcessId")); //plan.setUseRest(request.getParameter("useRest")); //running instance id list String[] instanceIdArray = request.getParameterValues("instanceIds"); if (null != instanceIdArray) { ArrayList<Long> instanceIds = new ArrayList<>(); for (String str : instanceIdArray) { instanceIds.add(Long.valueOf(str)); } plan.setProcessInstancesId(instanceIds); } else { System.out.println("!!!!!!!!!!!!!! have to choose a running instance for migration!"); } //node mapping section HashMap<String, String> map = new HashMap(); Enumeration<String> names = request.getParameterNames(); while (names.hasMoreElements()) { String name = names.nextElement(); int i = name.indexOf("-"); if (name.contains("targetNodeId-")) { //this parameter is for v2node mapping String sourceNodeId = name.substring(i + 1); String targetNodeId = request.getParameter(name); if (null != targetNodeId && !targetNodeId.equals("")) { map.put(sourceNodeId, targetNodeId); } } plan.setNodeMapping(map); } /* String checkBoxValue2 = request.getParameter("checkBox2"); String checkBoxValue3 = request.getParameter("checkBox3"); System.out.println("checkBox2 " + checkBoxValue2); System.out.println("checkBox3 " + checkBoxValue3); */ return plan; } public static MigrationPlan getLoginInfo(HttpServletRequest request) { MigrationPlan customer = new MigrationPlan(); return customer; } public ArrayList<BpmNode> parseBpmnFileInsideWar(String xmlFilePath) { InputStream inputStream = getClass().getResourceAsStream(xmlFilePath); return parseBpmnFile(inputStream); } public static ArrayList<BpmNode> parseBpmnFile(String xmlFilePath) throws FileNotFoundException { FileInputStream inputStream = new FileInputStream(new File(xmlFilePath)); return parseBpmnFile(inputStream); } public static ArrayList<BpmNode> parseBpmnFile(InputStream inputStream) { SAXBuilder saxBuilder = new SAXBuilder(); ArrayList<BpmNode> result = new ArrayList<>(); try { Document document = (Document) saxBuilder.build(inputStream); //root element is bpmn2:definitions Element rootElement = document.getRootElement(); /* ArrayList<Element> listElement1 = rootElement.getChildren(); for (Element v2node : listElement1) { System.out.println("v2node.getName() :" + v2node.getName()); System.out.println("v2node.getAttributeValue(\"id\") :" + v2node.getAttributeValue("id")); System.out.println("v2node.toString() :" + v2node.toString()); System.out.println(""); System.out.println(""); if (v2node.getName().equals("process")) { System.out.println("!!!!!!!!!here22"); Element processNode = rootElement.getChild("process",rootElement.getNamespace()); System.out.println("processNode.getName222() :" + processNode.getName()); } } */ Element processNode = rootElement.getChild("process", rootElement.getNamespace()); List<Element> listElement = processNode.getChildren(); for (Element node : listElement) { if (!node.getName().equals("sequenceFlow") && !node.getName().equals("startEvent") && !node.getName().equals("endEvent")) { BpmNode bpmNode = new BpmNode(); bpmNode.setType(node.getName()); bpmNode.setName(node.getAttributeValue("name")); bpmNode.setId(node.getAttributeValue("id")); result.add(bpmNode); /* System.out.println(" " + bpmNode.toString()); System.out.println(""); System.out.println(""); */ } } } catch (IOException io) { System.out.println(io.getMessage()); } catch (JDOMException jdomex) { System.out.println(jdomex.getMessage()); } return result; } public static ArrayList<String> validateMigrationPlan(MigrationPlan plan, ProcessInfo processInfo) { ArrayList<String> errors = new ArrayList(); //validate running instance id, need to have at least 1 running instance id List<Long> processIds = plan.getProcessInstancesId(); if (processIds == null || processIds.isEmpty()) { errors.add("Need to choose at least one running instance id for migration!"); } //validate the v2node mapping: //1) target id must be a valid id from existing V2 v2node ids //2) mapping must between same type of v2node Map<String, String> map = plan.getNodeMapping(); if (!map.isEmpty()) { Set<String> keys = map.keySet(); ArrayList<BpmNode> v1Nodes = processInfo.getNodeV1(); for (String sourceNodeId : keys) { String targetNodeId = map.get(sourceNodeId); ArrayList<BpmNode> v2Nodes = processInfo.getNodeV2(); boolean found = false; for (BpmNode v2node : v2Nodes) { String id = v2node.getId(); if (id.equals(targetNodeId)) { found = true; //now compare if source and target node are the same type or not. String targetNodeType = v2node.getType(); for (BpmNode v1Node : v1Nodes) { String v1NodeId = v1Node.getId(); if (sourceNodeId.equals(v1NodeId)) { String sourceNodeType = v1Node.getType(); if (!sourceNodeType.equals(targetNodeType)) { errors.add("Node Mapping can only happen in the same type of node, for node id: " + sourceNodeId + " of sourceNodeType: " + sourceNodeType + " is not the same as node id: " + targetNodeId + " of targetNodeType: " + targetNodeType); } break; } } break; } } if (!found) { errors.add("For targetNodeId, please choose from newer version node id, right now this is not a valid one: " + targetNodeId); } } } return errors; } /* public static ArrayList<BpmNode> retriveFilesFromKjar(String groupId, String artifactId, String version) throws IOException { //System.out.println("!######################################retriveFilesFromKjar started "); ArrayList<BpmNode> bpmNodes = null; KieServices ks = (KieServicesImpl) KieServices.Factory.get(); // String groupId = "com.myteam"; // String artifactId = "testProject1"; // String version = "1.0"; GAV gav = new GAV(groupId, artifactId, version); KieMavenRepository repository1 = KieMavenRepository.getKieMavenRepository(); Artifact artifact = repository1.resolveArtifact(gav); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getVersion() " + artifact.getVersion()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getArtifactId() " + artifact.getArtifactId()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getGroupId() " + artifact.getGroupId()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact " + artifact); File kjarFile = artifact.getFile(); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getName() " + kjarFile.getName()); System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getPath() " + kjarFile.getPath()); JarFile jarFile = new JarFile(kjarFile); Enumeration enumEntries = jarFile.entries(); while (enumEntries.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enumEntries.nextElement(); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); //File f = new File(destDir + java.io.File.separator + file.getName()); File f = new File(jarEntry.getName()); if (jarEntry.getName().contains("bpmn2")) { //System.out.println("!!!!!!!!!!!!!! found bpmn2 file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); // get the input stream InputStream is = jarFile.getInputStream(jarEntry); bpmNodes = parseBpmnFile(is); is.close(); } else if (jarEntry.getName().contains("svg")) { //This is the process diagram file //System.out.println("!!!!!!!!!!!!!! found svg file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); } } jarFile.close(); //System.out.println("!######################################retriveFilesFromKjar ended "); return bpmNodes; } */ public static void retriveProcessInfoFromKjar(String groupId, String artifactId, String version, ProcessInfo info, boolean isV1) throws IOException { //System.out.println("######################################retriveProcessInfoFromKjar started, isV1 " + isV1); KieServices ks = (KieServicesImpl) KieServices.Factory.get(); GAV gav = new GAV(groupId, artifactId, version); KieMavenRepository repository = KieMavenRepository.getKieMavenRepository(); Artifact artifact = repository.resolveArtifact(gav); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getVersion() " + artifact.getVersion()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getArtifactId() " + artifact.getArtifactId()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact.getGroupId() " + artifact.getGroupId()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!artifact " + artifact); File kjarFile = artifact.getFile(); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getName() " + kjarFile.getName()); //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!kjarFile.getPath() " + kjarFile.getPath()); JarFile jarFile = new JarFile(kjarFile); Enumeration enumEntries = jarFile.entries(); while (enumEntries.hasMoreElements()) { JarEntry jarEntry = (JarEntry) enumEntries.nextElement(); //System.out.println("------------jarEntry.getName(): " + jarEntry.getName()); if (jarEntry.getName().contains("bpmn")) { //System.out.println("!!!!!!!!!!!!!! found bpmn file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); // get the input stream InputStream inputStream = jarFile.getInputStream(jarEntry); if (isV1) { info.setNodeV1(parseBpmnFile(inputStream)); } else { info.setNodeV2(parseBpmnFile(inputStream)); } inputStream.close(); } else if (jarEntry.getName().contains("svg")) { //This is the process diagram file //System.out.println("!!!!!!!!!!!!!! found svg file"); //System.out.println("jarEntry.getName(): " + jarEntry.getName()); InputStream inputStream = jarFile.getInputStream(jarEntry); byte[] bytes = IOUtils.toByteArray(inputStream); String base64Image = Base64.getEncoder().encodeToString(bytes); //BufferedImage image = ImageUtil.base64ImageStringToBufferedImage(base64Image); //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>...ImageUtil.base64ImageStringToBufferedImage(base64Image) is done: " + image); //String base64Image2 = ImageUtil.bufferedImageToBase64ImageString(image, "svg"); //There might be several svg file in the jar, espeically in the newer version //so only get the svg file name match the process id if (isV1) { String tmpStrV1 = info.getProcessId(); String tmpNameV1 = tmpStrV1; int i = tmpStrV1.indexOf("."); if (i > -1){ tmpNameV1 = tmpStrV1.substring(tmpStrV1.indexOf(".")); } if (jarEntry.getName().contains(tmpNameV1)) { info.setBase64ImageV1(base64Image); } } else { String tmpStrV2 = info.getTargetProcessId(); String tmpNameV2 = tmpStrV2; int i = tmpStrV2.indexOf("."); if (i > -1){ tmpNameV2 = tmpStrV2.substring(tmpStrV2.indexOf(".")); } if (jarEntry.getName().contains(tmpNameV2)) { info.setBase64ImageV2(base64Image); } } inputStream.close(); } } jarFile.close(); //System.out.println("######################################retriveProcessInfoFromKjar ended "); //return info; } public void loadProperties(String fileName) { Properties prop = new Properties(); InputStream input = null; try { input = getClass().getResourceAsStream(fileName); //input = new FileInputStream(fileName); // load a properties file prop.load(input); // get the property value and print it out for (Entry<Object, Object> e : prop.entrySet()) { System.out.println(">>>>>>>>>>>> prop entry: " + e); } } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } } public void loadPropertiesFromWar2(String fileName, ServletContext servletContext) { Properties prop = new Properties(); InputStream input = null; try { input = servletContext.getResourceAsStream(fileName); // load a properties file prop.load(input); // get the property value and print it out for (Entry<Object, Object> e : prop.entrySet()) { System.out.println(">>>>>>>>>>>> prop entry: " + e); } } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
24,758
0.58575
0.580984
599
40.332222
32.947746
267
false
false
0
0
0
0
0
0
0.577629
false
false
4
353fb264a2a0e476ecb811e8cf1807867f063a98
24,386,824,351,633
a4a18a37301e1d33fb693d2f39cd32410ab22ff0
/servlet/src/main/java/com/app/validation/rules/PositiveNumberValidationRule.java
a677088cda0a4857fa93c8a18b2ab769f22f0b38
[]
no_license
DottiL/GM_learning
https://github.com/DottiL/GM_learning
96d81a8311b131af8a2fec529406f59200394784
886c120e9acaf120da133214bd5bafbb7dc9ed78
refs/heads/master
2021-08-14T11:42:56.114000
2017-11-15T15:16:30
2017-11-15T15:16:30
109,398,722
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.app.validation.rules; public class PositiveNumberValidationRule implements ValidationRule { private final String errorMsg = "must be positive"; private boolean hasError; @Override public boolean validate(String field) { int value; try { value = Integer.parseInt(field); hasError = !(value >= 0); } catch(Exception e) { hasError = true; } return hasError; } @Override public String getErrorMessage() { return hasError ? errorMsg : null; } @Override public boolean hasError() { return hasError; } }
UTF-8
Java
552
java
PositiveNumberValidationRule.java
Java
[]
null
[]
package com.app.validation.rules; public class PositiveNumberValidationRule implements ValidationRule { private final String errorMsg = "must be positive"; private boolean hasError; @Override public boolean validate(String field) { int value; try { value = Integer.parseInt(field); hasError = !(value >= 0); } catch(Exception e) { hasError = true; } return hasError; } @Override public String getErrorMessage() { return hasError ? errorMsg : null; } @Override public boolean hasError() { return hasError; } }
552
0.702899
0.701087
30
17.4
17.413788
69
false
false
0
0
0
0
0
0
1.566667
false
false
4
8efce0ef7ee389207177ecae2a84ebd519f7a8bd
14,224,931,733,581
2b06677f3f8c58283195dc095d3e6aac26a6bbe7
/src/main/java/com/acupt/HospApplication.java
2d8bb794c0e83fb1270cc473ca4d3657d17ccc6c
[]
no_license
acupt/hosp
https://github.com/acupt/hosp
b91f93ab62f6ab0de2930dc284f11a06b98bc00e
19261b747476fa34a4b81eed7ca0bda9f6c6c75f
refs/heads/master
2021-07-24T03:37:42.509000
2017-11-04T13:54:17
2017-11-04T13:54:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.acupt; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; /** * Created by liujie on 2017/8/12. */ @SpringBootApplication @EnableJpaRepositories @EntityScan @ServletComponentScan public class HospApplication { public static void main(String[] args) { SpringApplication.run(HospApplication.class, args); } }
UTF-8
Java
617
java
HospApplication.java
Java
[ { "context": "y.config.EnableJpaRepositories;\n\n/**\n * Created by liujie on 2017/8/12.\n */\n@SpringBootApplication\n@EnableJ", "end": 373, "score": 0.9994413256645203, "start": 367, "tag": "USERNAME", "value": "liujie" } ]
null
[]
package com.acupt; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; /** * Created by liujie on 2017/8/12. */ @SpringBootApplication @EnableJpaRepositories @EntityScan @ServletComponentScan public class HospApplication { public static void main(String[] args) { SpringApplication.run(HospApplication.class, args); } }
617
0.811994
0.800648
21
28.380953
25.520256
76
false
false
0
0
0
0
0
0
0.380952
false
false
4
47619110daf290e49ec7716246b64f649ccf305c
14,920,716,439,902
797eb4847324b9dcc1041af51914e615f44972dd
/gxbadge/src/com/gxbadge/dao/impl/ImageDaoHibernate.java
62d4e7b875ac1c25e925c7a3de3290c760850186
[]
no_license
dalinhuang/cst-gko100
https://github.com/dalinhuang/cst-gko100
1e5a8e469d8380c1ff63da213ae0b4c062cf424b
562106b8dde86939052cc16a7d86f92a8d03dd86
refs/heads/master
2018-01-08T22:07:53.205000
2012-07-21T00:13:31
2012-07-21T00:13:31
49,006,551
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @Title: AdministratorDaoHibernate.java * @Package com.gxbadge.dao.impl * @Description: TODO(็”จไธ€ๅฅ่ฏๆ่ฟฐ่ฏฅๆ–‡ไปถๅšไป€ไนˆ) * @author CST * @version V1.0 */ package com.gxbadge.dao.impl; import java.util.List; import com.gxbadge.dao.ImageDao; import com.gxbadge.dao.base.BaseHibernateDaoSupport; import com.gxbadge.model.Article; import com.gxbadge.model.Image; import com.gxbadge.model.Navigation; public class ImageDaoHibernate extends BaseHibernateDaoSupport implements ImageDao { /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public void delete(Image image) { this.getHibernateTemplate().delete(image); } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public List<Image> findImageAll() { List<Image> imageList = this.getHibernateTemplate().find("from Image"); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageByArti(Article arti){ List<Image> imageList = this.getHibernateTemplate().find("from Image as i where i.arti=?", arti); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageAllByPage(int offset, int pageSize){ String hql = "from Image as i where i.deleteFlag=false order by i.uploadDate"; List<Image> imageList = this.findByPage(hql, offset, pageSize); hql = null; if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageListByNavListAndPage(List<Navigation> navList, int offset, int pageSize){ Object[] values = new Object[navList.size()]; for(int i=0;i<navList.size();i++){ values[i] = navList.get(i); } String hql_param = ""; for(int i=0;i<navList.size();i++){ if(i==navList.size()-1){ hql_param += "i.nav=?"; }else{ hql_param += "i.nav=? or "; } } String hql = "from Image as i where (" + hql_param + ") order by i.uploadDate desc"; List<Image> imageList = this.findByPage(hql, values, offset, pageSize); values = null; hql = null; hql_param = null; if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageListByPage(String hql, int offset, int pageSize){ List<Image> imageList = this.findByPage(hql, offset, pageSize); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public Image findImageByImageId(Integer imageId) { Image image = this.getHibernateTemplate().get(Image.class, imageId); if(image!=null){ return image; } return null; } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public void save(Image image) { this.getHibernateTemplate().save(image); } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public void update(Image image) { this.getHibernateTemplate().update(image); } public List<Image> findImageByNavAndPage(int offset, int pageSize, Navigation nav){ String hql = "from Image as i where i.nav=?"; List<Image> imageList = this.findByPage(hql, nav, offset, pageSize); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public long find_imageCountByNav(Navigation nav){ String hql = "select count(*) from Image as i where i.nav=?"; long totalCount = (Long)this.getHibernateTemplate().find(hql, nav).listIterator().next(); return totalCount; } public long find_imageAllCount(){ String hql = "select count(*) from Image"; long totalCount = (Long)this.getHibernateTemplate().find(hql).listIterator().next(); return totalCount; } public long find_imageListCountByNavList(List<Navigation> navList){ Object[] values = new Object[navList.size()]; for(int i=0;i<navList.size();i++){ values[i] = navList.get(i); } String hql_param = ""; for(int i=0;i<navList.size();i++){ if(i==navList.size()-1){ hql_param += "i.nav=?"; }else{ hql_param += "i.nav=? or "; } } String hql = "select count(*) from Image as i where (" + hql_param + ")"; long totalCount = (Long)this.getHibernateTemplate().find(hql, values).listIterator().next(); values = null; hql = null; hql_param = null; return totalCount; } /* --------------------------------ๅ›พ็‰‡ๅค„็†----------ๅ‰ๅฐ----------------------------------------- */ public List<Image> findImageByNavListAndPage(List<Navigation> navList, int offset, int pageSize){ String hql_param = ""; Object[] values = new Object[navList.size()]; int i=0; while(i<navList.size()){ values[i] = navList.get(i); if(i==navList.size()-1){ hql_param += "i.nav=?"; }else{ hql_param += "i.nav=? or "; } i++; } String hql = "from Image as i where i.deleteFlag=false and (" + hql_param + ") order by i.uploadDate desc"; List<Image> imageList = this.findByPage(hql, values, offset, pageSize); values = null; hql = null; hql_param = null; if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageByNavAndPage(Navigation nav, int offset, int pageSize){ String hql = "from Image as i where i.deleteFlag=false and i.nav=? order by i.uploadDate desc"; List<Image> imageList = this.findByPage(hql, nav, offset, pageSize); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public long f_find_imageCountByNav(Navigation nav){ String hql = "select count(*) from Image as i where i.deleteFlag=false and i.nav=?"; long totalCount = (Long)this.getHibernateTemplate().find(hql, nav).listIterator().next(); return totalCount; } }
UTF-8
Java
5,949
java
ImageDaoHibernate.java
Java
[ { "context": "\r\n* @Description: TODO(็”จไธ€ๅฅ่ฏๆ่ฟฐ่ฏฅๆ–‡ไปถๅšไป€ไนˆ) \r\n\r\n* @author CST\r\n\r\n* @version V1.0 \r\n\r\n*/ \r\n\r\npackage com.gxbadg", "end": 142, "score": 0.9987752437591553, "start": 139, "tag": "USERNAME", "value": "CST" } ]
null
[]
/** * @Title: AdministratorDaoHibernate.java * @Package com.gxbadge.dao.impl * @Description: TODO(็”จไธ€ๅฅ่ฏๆ่ฟฐ่ฏฅๆ–‡ไปถๅšไป€ไนˆ) * @author CST * @version V1.0 */ package com.gxbadge.dao.impl; import java.util.List; import com.gxbadge.dao.ImageDao; import com.gxbadge.dao.base.BaseHibernateDaoSupport; import com.gxbadge.model.Article; import com.gxbadge.model.Image; import com.gxbadge.model.Navigation; public class ImageDaoHibernate extends BaseHibernateDaoSupport implements ImageDao { /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public void delete(Image image) { this.getHibernateTemplate().delete(image); } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public List<Image> findImageAll() { List<Image> imageList = this.getHibernateTemplate().find("from Image"); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageByArti(Article arti){ List<Image> imageList = this.getHibernateTemplate().find("from Image as i where i.arti=?", arti); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageAllByPage(int offset, int pageSize){ String hql = "from Image as i where i.deleteFlag=false order by i.uploadDate"; List<Image> imageList = this.findByPage(hql, offset, pageSize); hql = null; if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageListByNavListAndPage(List<Navigation> navList, int offset, int pageSize){ Object[] values = new Object[navList.size()]; for(int i=0;i<navList.size();i++){ values[i] = navList.get(i); } String hql_param = ""; for(int i=0;i<navList.size();i++){ if(i==navList.size()-1){ hql_param += "i.nav=?"; }else{ hql_param += "i.nav=? or "; } } String hql = "from Image as i where (" + hql_param + ") order by i.uploadDate desc"; List<Image> imageList = this.findByPage(hql, values, offset, pageSize); values = null; hql = null; hql_param = null; if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageListByPage(String hql, int offset, int pageSize){ List<Image> imageList = this.findByPage(hql, offset, pageSize); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public Image findImageByImageId(Integer imageId) { Image image = this.getHibernateTemplate().get(Image.class, imageId); if(image!=null){ return image; } return null; } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public void save(Image image) { this.getHibernateTemplate().save(image); } /* * {่งๆŽฅๅฃๆ–นๆณ•่ฏดๆ˜Ž} */ public void update(Image image) { this.getHibernateTemplate().update(image); } public List<Image> findImageByNavAndPage(int offset, int pageSize, Navigation nav){ String hql = "from Image as i where i.nav=?"; List<Image> imageList = this.findByPage(hql, nav, offset, pageSize); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public long find_imageCountByNav(Navigation nav){ String hql = "select count(*) from Image as i where i.nav=?"; long totalCount = (Long)this.getHibernateTemplate().find(hql, nav).listIterator().next(); return totalCount; } public long find_imageAllCount(){ String hql = "select count(*) from Image"; long totalCount = (Long)this.getHibernateTemplate().find(hql).listIterator().next(); return totalCount; } public long find_imageListCountByNavList(List<Navigation> navList){ Object[] values = new Object[navList.size()]; for(int i=0;i<navList.size();i++){ values[i] = navList.get(i); } String hql_param = ""; for(int i=0;i<navList.size();i++){ if(i==navList.size()-1){ hql_param += "i.nav=?"; }else{ hql_param += "i.nav=? or "; } } String hql = "select count(*) from Image as i where (" + hql_param + ")"; long totalCount = (Long)this.getHibernateTemplate().find(hql, values).listIterator().next(); values = null; hql = null; hql_param = null; return totalCount; } /* --------------------------------ๅ›พ็‰‡ๅค„็†----------ๅ‰ๅฐ----------------------------------------- */ public List<Image> findImageByNavListAndPage(List<Navigation> navList, int offset, int pageSize){ String hql_param = ""; Object[] values = new Object[navList.size()]; int i=0; while(i<navList.size()){ values[i] = navList.get(i); if(i==navList.size()-1){ hql_param += "i.nav=?"; }else{ hql_param += "i.nav=? or "; } i++; } String hql = "from Image as i where i.deleteFlag=false and (" + hql_param + ") order by i.uploadDate desc"; List<Image> imageList = this.findByPage(hql, values, offset, pageSize); values = null; hql = null; hql_param = null; if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public List<Image> findImageByNavAndPage(Navigation nav, int offset, int pageSize){ String hql = "from Image as i where i.deleteFlag=false and i.nav=? order by i.uploadDate desc"; List<Image> imageList = this.findByPage(hql, nav, offset, pageSize); if(imageList!=null&&imageList.size()>=1){ return imageList; } return null; } public long f_find_imageCountByNav(Navigation nav){ String hql = "select count(*) from Image as i where i.deleteFlag=false and i.nav=?"; long totalCount = (Long)this.getHibernateTemplate().find(hql, nav).listIterator().next(); return totalCount; } }
5,949
0.614239
0.611159
254
21.003937
26.353218
109
false
false
0
0
0
0
0
0
2.137795
false
false
4
df756d28292ea15da11f693640d191aca6b4a6da
18,459,769,489,680
60ed2511f1d80cedac14481c0d4ff5e846d6fa92
/spring-boot-jpa/spring-boot-jpa/src/main/java/com/examples/spring/jpa/exceptions/EmployeeNotFoundExceptions.java
acc204e693868d04db0e274cb72d842be6e6e8a5
[]
no_license
Priyanshu55R/Spring-Boot-JPA
https://github.com/Priyanshu55R/Spring-Boot-JPA
76ef52553f6144eb5f1aaae7dc4253956120480c
0a962eaaac3fc4c2e39cddb643c89e617ec71978
refs/heads/master
2020-07-06T21:48:11.609000
2019-08-19T10:10:22
2019-08-19T10:10:22
203,147,832
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.examples.spring.jpa.exceptions; public class EmployeeNotFoundExceptions extends RuntimeException{ private static final long serialVersionUID = 1L; public EmployeeNotFoundExceptions() { super("Employee does not exist"); } }
UTF-8
Java
267
java
EmployeeNotFoundExceptions.java
Java
[]
null
[]
package com.examples.spring.jpa.exceptions; public class EmployeeNotFoundExceptions extends RuntimeException{ private static final long serialVersionUID = 1L; public EmployeeNotFoundExceptions() { super("Employee does not exist"); } }
267
0.726592
0.722846
10
24.700001
24.07509
65
false
false
0
0
0
0
0
0
0.8
false
false
4
0d5c651f868778187c3907bbe63da7e8579729e2
2,929,167,747,979
936bcb67348cc61aa78e97cdfa4cc85c4e5ea580
/image-query-worker/projects/query-worker-project/query-controller-module/src/main/java/com/irisdemo/htap/config/Config.java
cbbdc1a0c2d032b9b15cc843df64d57d41fd9f4e
[ "MIT" ]
permissive
intersystems-community/irisdemo-demo-htap
https://github.com/intersystems-community/irisdemo-demo-htap
5d53cb9258fb768e96e80216a630ac9c1b40c80c
422cf3d454e88e934619643eff7ea86ac48e119d
refs/heads/master
2023-06-24T07:38:27.625000
2023-06-12T19:46:17
2023-06-12T19:46:17
216,053,370
10
9
MIT
false
2023-03-02T03:18:37
2019-10-18T15:21:59
2023-02-22T18:11:56
2023-03-02T03:18:36
15,527
10
8
26
Java
false
false
package com.irisdemo.htap.config; import org.springframework.stereotype.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.*; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON) public class Config { Logger logger = LoggerFactory.getLogger(Config.class); /* WORKER CONFIGURATION */ private String masterHostName; private String masterPort; private String thisHostName; private int thisServerPort; private String workerNodePrefix; /* GENERAL CONFIGURATION THAT WILL BE COMING FROM THE MASTER */ private boolean startConsumers; /* INGESTION CONFIGURATION THAT WILL BE COMING FROM THE MASTER */ private String ingestionJDBCURL; private String ingestionJDBCUserName; private String ingestionJDBCPassword; private int ingestionBatchSize; private int ingestionNumThreadsPerWorker; private String insertStatement; private String queryByIdStatement; /* CONSUMPTION CONFIGURATION THAT WILL BE COMING FROM THE MASTER */ private String consumptionJDBCURL; private String consumptionJDBCUserName; private String consumptionJDBCPassword; private int consumptionNumThreadsPerWorker; private int consumptionTimeBetweenQueriesInMillis; private String queryStatement; private int consumptionNumOfKeysToFetch; public void setWorkerNodePrefix(String workerNodePrefix) { this.workerNodePrefix=workerNodePrefix; } public String getWorkerNodePrefix() { return this.workerNodePrefix; } public void setInsertStatement(String insertStatement) { logger.info("Setting INSERT statement = " + insertStatement); this.insertStatement=insertStatement; } public String getQueryStatement() { return queryStatement; } public String getQueryByIdStatement() { return queryByIdStatement; } public void setQueryStatement(String queryStatement) { logger.info("Setting QUERY statement = " + queryStatement); this.queryStatement=queryStatement; } public void setQueryByIdStatement(String queryByIdStatement) { logger.info("Setting QUERY By ID statement = " + queryByIdStatement); this.queryByIdStatement=queryByIdStatement; } public String getInsertStatement() { return insertStatement; } @Value( "${HOSTNAME}" ) public void setThisHostName(String thisHostName) { logger.info("This hostname is " + thisHostName); this.thisHostName = thisHostName; } public String getThisHostName() { return thisHostName; } public String getMasterHostName() { return masterHostName; } @Value( "${MASTER_HOSTNAME}" ) public void setMasterHostName(String masterHostName) { logger.info("Setting MASTER_HOSTNAME = " + masterHostName); this.masterHostName = masterHostName; } public String getMasterPort() { return masterPort; } @Value( "${MASTER_PORT:80}" ) public void setMasterPort(String masterPort) { logger.info("Setting MASTER_PORT = " + masterPort); this.masterPort = masterPort; } public void setThisServerPort(int thisServerPort) { logger.info("This server port is " + thisServerPort); this.thisServerPort = thisServerPort; } public int getThisServerPort() { return this.thisServerPort; } public void setConsumptionNumOfKeysToFetch(int consumptionNumOfKeysToFetch) { logger.info("Number of keys to fetch: " + consumptionNumOfKeysToFetch); this.consumptionNumOfKeysToFetch = consumptionNumOfKeysToFetch; } public int getConsumptionNumOfKeysToFetch() { return this.consumptionNumOfKeysToFetch; } public int getIngestionNumThreadsPerWorker() { return ingestionNumThreadsPerWorker; } public void setIngestionNumThreadsPerWorker(int value) { logger.info("Setting INGESTION_THREADS_PER_WORKER = " + value); ingestionNumThreadsPerWorker=value; } public boolean getStartConsumers() { return startConsumers; } public void setStartConsumers(boolean startConsumers) { logger.info("Setting START_CONSUMERS = " + startConsumers); this.startConsumers = startConsumers; } public String getIngestionJDBCURL() { return ingestionJDBCURL; } public void setIngestionJDBCURL(String ingestionJDBCURL) { logger.info("Setting INGESTION_JDBC_URL = " + ingestionJDBCURL); this.ingestionJDBCURL = ingestionJDBCURL; } public String getIngestionJDBCUserName() { return ingestionJDBCUserName; } public void setIngestionJDBCUserName(String ingestionJDBCUserName) { logger.info("Setting INGESTION_JDBC_USERNAME = " + ingestionJDBCUserName); this.ingestionJDBCUserName = ingestionJDBCUserName; } public String getIngestionJDBCPassword() { return ingestionJDBCPassword; } public void setIngestionJDBCPassword(String ingestionJDBCPassword) { logger.info("Setting INGESTION_JDBC_PASSWORD = " + ingestionJDBCPassword); this.ingestionJDBCPassword = ingestionJDBCPassword; } public int getIngestionBatchSize() { return ingestionBatchSize; } public void setIngestionBatchSize(int ingestionBatchSize) { logger.info("Setting INGESTION_BATCH_SIZE = " + ingestionBatchSize); this.ingestionBatchSize = ingestionBatchSize; } public String getConsumptionJDBCURL() { return consumptionJDBCURL; } public void setConsumptionJDBCURL(String consumptionJDBCURL) { logger.info("Setting CONSUMER_JDBC_URL = " + consumptionJDBCURL); this.consumptionJDBCURL = consumptionJDBCURL; } public String getConsumptionJDBCUserName() { return consumptionJDBCUserName; } public void setConsumptionJDBCUserName(String consumptionJDBCUserName) { logger.info("Setting CONSUMER_JDBC_USERNAME = " + consumptionJDBCUserName); this.consumptionJDBCUserName = consumptionJDBCUserName; } public String getConsumptionJDBCPassword() { return consumptionJDBCPassword; } public void setConsumptionJDBCPassword(String consumptionJDBCPassword) { logger.info("Setting CONSUMER_JDBC_PASSWORD = " + consumptionJDBCPassword); this.consumptionJDBCPassword = consumptionJDBCPassword; } public int getConsumptionNumThreadsPerWorker() { return consumptionNumThreadsPerWorker; } public void setConsumptionNumThreadsPerWorker(int consumptionNumThreadsPerWorker) { logger.info("Setting CONSUMER_THREADS_PER_WORKER = " + consumptionNumThreadsPerWorker); this.consumptionNumThreadsPerWorker = consumptionNumThreadsPerWorker; } public int getConsumptionTimeBetweenQueriesInMillis() { return consumptionTimeBetweenQueriesInMillis; } public void setConsumptionTimeBetweenQueriesInMillis(int consumptionTimeBetweenQueriesInMillis) { logger.info("Setting CONSUMER_TIME_BETWEEN_QUERIES_IN_MILLIS = " + consumptionTimeBetweenQueriesInMillis); this.consumptionTimeBetweenQueriesInMillis = consumptionTimeBetweenQueriesInMillis; } }
UTF-8
Java
6,797
java
Config.java
Java
[]
null
[]
package com.irisdemo.htap.config; import org.springframework.stereotype.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.*; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON) public class Config { Logger logger = LoggerFactory.getLogger(Config.class); /* WORKER CONFIGURATION */ private String masterHostName; private String masterPort; private String thisHostName; private int thisServerPort; private String workerNodePrefix; /* GENERAL CONFIGURATION THAT WILL BE COMING FROM THE MASTER */ private boolean startConsumers; /* INGESTION CONFIGURATION THAT WILL BE COMING FROM THE MASTER */ private String ingestionJDBCURL; private String ingestionJDBCUserName; private String ingestionJDBCPassword; private int ingestionBatchSize; private int ingestionNumThreadsPerWorker; private String insertStatement; private String queryByIdStatement; /* CONSUMPTION CONFIGURATION THAT WILL BE COMING FROM THE MASTER */ private String consumptionJDBCURL; private String consumptionJDBCUserName; private String consumptionJDBCPassword; private int consumptionNumThreadsPerWorker; private int consumptionTimeBetweenQueriesInMillis; private String queryStatement; private int consumptionNumOfKeysToFetch; public void setWorkerNodePrefix(String workerNodePrefix) { this.workerNodePrefix=workerNodePrefix; } public String getWorkerNodePrefix() { return this.workerNodePrefix; } public void setInsertStatement(String insertStatement) { logger.info("Setting INSERT statement = " + insertStatement); this.insertStatement=insertStatement; } public String getQueryStatement() { return queryStatement; } public String getQueryByIdStatement() { return queryByIdStatement; } public void setQueryStatement(String queryStatement) { logger.info("Setting QUERY statement = " + queryStatement); this.queryStatement=queryStatement; } public void setQueryByIdStatement(String queryByIdStatement) { logger.info("Setting QUERY By ID statement = " + queryByIdStatement); this.queryByIdStatement=queryByIdStatement; } public String getInsertStatement() { return insertStatement; } @Value( "${HOSTNAME}" ) public void setThisHostName(String thisHostName) { logger.info("This hostname is " + thisHostName); this.thisHostName = thisHostName; } public String getThisHostName() { return thisHostName; } public String getMasterHostName() { return masterHostName; } @Value( "${MASTER_HOSTNAME}" ) public void setMasterHostName(String masterHostName) { logger.info("Setting MASTER_HOSTNAME = " + masterHostName); this.masterHostName = masterHostName; } public String getMasterPort() { return masterPort; } @Value( "${MASTER_PORT:80}" ) public void setMasterPort(String masterPort) { logger.info("Setting MASTER_PORT = " + masterPort); this.masterPort = masterPort; } public void setThisServerPort(int thisServerPort) { logger.info("This server port is " + thisServerPort); this.thisServerPort = thisServerPort; } public int getThisServerPort() { return this.thisServerPort; } public void setConsumptionNumOfKeysToFetch(int consumptionNumOfKeysToFetch) { logger.info("Number of keys to fetch: " + consumptionNumOfKeysToFetch); this.consumptionNumOfKeysToFetch = consumptionNumOfKeysToFetch; } public int getConsumptionNumOfKeysToFetch() { return this.consumptionNumOfKeysToFetch; } public int getIngestionNumThreadsPerWorker() { return ingestionNumThreadsPerWorker; } public void setIngestionNumThreadsPerWorker(int value) { logger.info("Setting INGESTION_THREADS_PER_WORKER = " + value); ingestionNumThreadsPerWorker=value; } public boolean getStartConsumers() { return startConsumers; } public void setStartConsumers(boolean startConsumers) { logger.info("Setting START_CONSUMERS = " + startConsumers); this.startConsumers = startConsumers; } public String getIngestionJDBCURL() { return ingestionJDBCURL; } public void setIngestionJDBCURL(String ingestionJDBCURL) { logger.info("Setting INGESTION_JDBC_URL = " + ingestionJDBCURL); this.ingestionJDBCURL = ingestionJDBCURL; } public String getIngestionJDBCUserName() { return ingestionJDBCUserName; } public void setIngestionJDBCUserName(String ingestionJDBCUserName) { logger.info("Setting INGESTION_JDBC_USERNAME = " + ingestionJDBCUserName); this.ingestionJDBCUserName = ingestionJDBCUserName; } public String getIngestionJDBCPassword() { return ingestionJDBCPassword; } public void setIngestionJDBCPassword(String ingestionJDBCPassword) { logger.info("Setting INGESTION_JDBC_PASSWORD = " + ingestionJDBCPassword); this.ingestionJDBCPassword = ingestionJDBCPassword; } public int getIngestionBatchSize() { return ingestionBatchSize; } public void setIngestionBatchSize(int ingestionBatchSize) { logger.info("Setting INGESTION_BATCH_SIZE = " + ingestionBatchSize); this.ingestionBatchSize = ingestionBatchSize; } public String getConsumptionJDBCURL() { return consumptionJDBCURL; } public void setConsumptionJDBCURL(String consumptionJDBCURL) { logger.info("Setting CONSUMER_JDBC_URL = " + consumptionJDBCURL); this.consumptionJDBCURL = consumptionJDBCURL; } public String getConsumptionJDBCUserName() { return consumptionJDBCUserName; } public void setConsumptionJDBCUserName(String consumptionJDBCUserName) { logger.info("Setting CONSUMER_JDBC_USERNAME = " + consumptionJDBCUserName); this.consumptionJDBCUserName = consumptionJDBCUserName; } public String getConsumptionJDBCPassword() { return consumptionJDBCPassword; } public void setConsumptionJDBCPassword(String consumptionJDBCPassword) { logger.info("Setting CONSUMER_JDBC_PASSWORD = " + consumptionJDBCPassword); this.consumptionJDBCPassword = consumptionJDBCPassword; } public int getConsumptionNumThreadsPerWorker() { return consumptionNumThreadsPerWorker; } public void setConsumptionNumThreadsPerWorker(int consumptionNumThreadsPerWorker) { logger.info("Setting CONSUMER_THREADS_PER_WORKER = " + consumptionNumThreadsPerWorker); this.consumptionNumThreadsPerWorker = consumptionNumThreadsPerWorker; } public int getConsumptionTimeBetweenQueriesInMillis() { return consumptionTimeBetweenQueriesInMillis; } public void setConsumptionTimeBetweenQueriesInMillis(int consumptionTimeBetweenQueriesInMillis) { logger.info("Setting CONSUMER_TIME_BETWEEN_QUERIES_IN_MILLIS = " + consumptionTimeBetweenQueriesInMillis); this.consumptionTimeBetweenQueriesInMillis = consumptionTimeBetweenQueriesInMillis; } }
6,797
0.791379
0.79079
244
26.860655
26.105968
108
false
false
0
0
0
0
0
0
1.438525
false
false
4
1ca154b62cfddbfe315056e101206e890b2e77ae
7,035,156,487,517
8956f70d697c8fd69f98667ee318cc0f5f108a08
/sourcecode/quarkus/lecture3/quarkus-messaging/quarkus-customer/src/main/java/br/ufpe/cin/lecture3/Customer.java
a548fdfa016f2c3f7eb57edfd51409a5ac61ebf0
[ "MIT" ]
permissive
IF1007/if1007
https://github.com/IF1007/if1007
0bf861e9a99da21b39a2ed603831db14289df707
94a9c4fe620412b0100739879b5f0fda5939abcb
refs/heads/master
2022-11-16T08:55:58.420000
2022-07-15T18:01:10
2022-07-15T18:01:10
113,071,228
65
16
MIT
false
2022-11-16T02:57:05
2017-12-04T17:08:54
2022-11-11T12:39:29
2022-11-16T02:57:01
284,120
77
24
1
Java
false
false
package br.ufpe.cin.lecture3; import io.quarkus.hibernate.orm.panache.PanacheEntity; import javax.persistence.Entity; import javax.ws.rs.NotFoundException; import java.util.Optional; @Entity public class Customer extends PanacheEntity { private String name; private String email; protected Customer() { } public Customer(String name, String email) { this.name = name; this.email = email; } public static Optional<Customer> findByName(String name) { return Customer.find("name", name).singleResultOptional(); } public static Customer update(Long id, Customer customer) { Customer entity = (Customer) Customer.findByIdOptional(id) .orElseThrow(NotFoundException::new); entity.name = customer.name; entity.email = customer.email; entity.persist(); return entity; } @Override public String toString() { return "Customer{" + "name='" + name + '\'' + ", email='" + email + '\'' + '}'; } public String getName() { return name; } public String getEmail() { return email; } public void setName(String name) { this.name = name; } public void setEmail(String email) { this.email = email; } }
UTF-8
Java
1,348
java
Customer.java
Java
[]
null
[]
package br.ufpe.cin.lecture3; import io.quarkus.hibernate.orm.panache.PanacheEntity; import javax.persistence.Entity; import javax.ws.rs.NotFoundException; import java.util.Optional; @Entity public class Customer extends PanacheEntity { private String name; private String email; protected Customer() { } public Customer(String name, String email) { this.name = name; this.email = email; } public static Optional<Customer> findByName(String name) { return Customer.find("name", name).singleResultOptional(); } public static Customer update(Long id, Customer customer) { Customer entity = (Customer) Customer.findByIdOptional(id) .orElseThrow(NotFoundException::new); entity.name = customer.name; entity.email = customer.email; entity.persist(); return entity; } @Override public String toString() { return "Customer{" + "name='" + name + '\'' + ", email='" + email + '\'' + '}'; } public String getName() { return name; } public String getEmail() { return email; } public void setName(String name) { this.name = name; } public void setEmail(String email) { this.email = email; } }
1,348
0.597181
0.596439
61
21.09836
19.610723
66
false
false
0
0
0
0
0
0
0.393443
false
false
4
a95ffe176d7721bd7f07edd55a31d95261699d8f
6,777,458,443,263
77511beb0601a8732c4fbc9648b175993a301402
/app/src/main/java/com/iqinbao/android/songstv/adapter/MySingAdapter.java
c7a0ea62a0afea0da1c561022af3122bc98b7808
[]
no_license
yuyiwentaojia/qinbaoTV
https://github.com/yuyiwentaojia/qinbaoTV
f00a6394ad878c38a2ebb50955c477bdc71b94ad
ac950dbd9ad3a2a600d70a4770238ef8fa93513d
refs/heads/master
2021-07-18T07:33:56.022000
2017-10-25T01:20:21
2017-10-25T01:20:21
108,111,845
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.iqinbao.android.songstv.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import com.iqinbao.android.songstv.R; import com.iqinbao.android.songstv.beanstv.SongEntity; import com.iqinbao.android.songstv.utils.ImageLoaderUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by qinbao-app-1 on 2016/8/22. */ public class MySingAdapter extends RecyclerView.Adapter<VHDetail> { private Context mContext; private Map<Integer,View> map=new HashMap<>(); private View view01; private int index=0; //ๆญŒๆ›ฒ private List<SongEntity.CatContentsBean> singList = new ArrayList<SongEntity.CatContentsBean>(); private OnRecyItemClickListener onRecyItemClickListener; private OnItemSelectListener mSelectListener; public void setIndex(int index){ this.index=index; } public void setOnItemSelectListener(OnItemSelectListener listener) { mSelectListener = listener; } public void setOnRecyItemClickListener(OnRecyItemClickListener onRecyItemClickListener) { this.onRecyItemClickListener = onRecyItemClickListener; } public MySingAdapter(List<SongEntity.CatContentsBean> singList) { this.singList = singList; } /** * ๅŠ ่ฝฝ * * @param parent * @param viewType * @return */ @Override public VHDetail onCreateViewHolder(ViewGroup parent, int viewType) { View view = View.inflate(parent.getContext(), R.layout.item_mysing, null); VHDetail vh = new VHDetail(view); mContext = parent.getContext(); return vh; } /** * ๆ•ฐๆฎไธŽviewholder็š„็ป‘ๅฎš * * @param holder * @param position */ @Override public void onBindViewHolder(final VHDetail holder, final int position) { String pic_s = singList.get(position).getPic_s(); String intro = singList.get(position).getTitle(); ImageLoaderUtils.display3(mContext, holder.imageViewlist, pic_s, 272, 208); //ๅˆšๅˆš่ทณ่ฝฌ่ฟ›ๆฅ๏ผŒ่ฎพ็ฝฎๆ’ญๆ”พ่ง†้ข‘็š„้ขœ่‰ฒ if (position==index){ view01=holder.textView_name; holder.textView_name.setBackgroundResource(R.mipmap.lay04); map.put(2,holder.textView_name); }else { holder.textView_name.setBackgroundResource(R.drawable.item_list_text_bg); } holder.textView_name.setText(intro); holder.relativeLayout_text_image.setFocusable(true); holder.relativeLayout_text_image.setTag(position); holder.itemView.setFocusable(true); holder.itemView.setNextFocusLeftId(R.id.bt_onAndoff); holder.itemView.setNextFocusRightId(R.id.bt_onAndoff); holder.itemView.setTag(holder.textView_name); holder.relativeLayout_text_image.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { //ๆญคๅค„ๅฐฑๆ˜ฏ่ฎพ็ฝฎtextviewไธบ้€‰ไธญ็Šถๆ€๏ผŒๆ–นๅฏไปฅๅฎž็Žฐๆ•ˆๆžœ holder.textView_name.setSelected(true); } else { // view.setBackgroundResource(R.color.transparent); //ๆญคๅค„ๅฐฑๆ˜ฏ่ฎพ็ฝฎtextviewไธบ้€‰ไธญ็Šถๆ€๏ผŒๆ–นๅฏไปฅๅฎž็Žฐๆ•ˆๆžœ holder.textView_name.setSelected(false); } } }); holder.relativeLayout_text_image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (map.get(2)!=null){ map.put(1,map.get(2)); } map.put(2,holder.textView_name); //ๅ…ˆๆŠŠๆ‰€ๆœ‰็š„้ขœ่‰ฒๆธ…้™ค // map.get(0).setBackgroundResource(R.drawable.d28); if (map.get(1) != null) { map.get(1).setBackgroundResource(R.drawable.d28); } if (map.get(2)!=null) { map.get(2).setBackgroundResource(R.mipmap.lay04); } holder.textView_name.setBackgroundResource(R.mipmap.lay04); //็‚นๅ‡ปไน‹ๅŽๅ†่ฎพ็ฝฎ้ขœ่‰ฒ onRecyItemClickListener.onClickItem(position,holder.textView_name); } }); } /** * ่Žทๅ–ๆ•ฐๆฎ็š„ๆ€ปๆก็›ฎ * * @return */ @Override public int getItemCount() { return singList.size(); } /** * ๅ›ž่ฐƒ๏ผŒ็ป™RecycleๆทปๅŠ ็›‘ๅฌไบ‹ไปถ๏ผŒๅนถไธ”ไผ ้€’position */ public interface OnRecyItemClickListener { void onClickItem(int position,View view); } /** * ้€‰ไธญๆ—ถๅ›ž่ฐƒๆŽฅๅฃ */ public interface OnItemSelectListener { void onItemSelect(View view_sing, int position); } }
UTF-8
Java
4,969
java
MySingAdapter.java
Java
[ { "context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by qinbao-app-1 on 2016/8/22.\n */\npublic class MySingAdapter exte", "end": 466, "score": 0.9982463121414185, "start": 454, "tag": "USERNAME", "value": "qinbao-app-1" } ]
null
[]
package com.iqinbao.android.songstv.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import com.iqinbao.android.songstv.R; import com.iqinbao.android.songstv.beanstv.SongEntity; import com.iqinbao.android.songstv.utils.ImageLoaderUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by qinbao-app-1 on 2016/8/22. */ public class MySingAdapter extends RecyclerView.Adapter<VHDetail> { private Context mContext; private Map<Integer,View> map=new HashMap<>(); private View view01; private int index=0; //ๆญŒๆ›ฒ private List<SongEntity.CatContentsBean> singList = new ArrayList<SongEntity.CatContentsBean>(); private OnRecyItemClickListener onRecyItemClickListener; private OnItemSelectListener mSelectListener; public void setIndex(int index){ this.index=index; } public void setOnItemSelectListener(OnItemSelectListener listener) { mSelectListener = listener; } public void setOnRecyItemClickListener(OnRecyItemClickListener onRecyItemClickListener) { this.onRecyItemClickListener = onRecyItemClickListener; } public MySingAdapter(List<SongEntity.CatContentsBean> singList) { this.singList = singList; } /** * ๅŠ ่ฝฝ * * @param parent * @param viewType * @return */ @Override public VHDetail onCreateViewHolder(ViewGroup parent, int viewType) { View view = View.inflate(parent.getContext(), R.layout.item_mysing, null); VHDetail vh = new VHDetail(view); mContext = parent.getContext(); return vh; } /** * ๆ•ฐๆฎไธŽviewholder็š„็ป‘ๅฎš * * @param holder * @param position */ @Override public void onBindViewHolder(final VHDetail holder, final int position) { String pic_s = singList.get(position).getPic_s(); String intro = singList.get(position).getTitle(); ImageLoaderUtils.display3(mContext, holder.imageViewlist, pic_s, 272, 208); //ๅˆšๅˆš่ทณ่ฝฌ่ฟ›ๆฅ๏ผŒ่ฎพ็ฝฎๆ’ญๆ”พ่ง†้ข‘็š„้ขœ่‰ฒ if (position==index){ view01=holder.textView_name; holder.textView_name.setBackgroundResource(R.mipmap.lay04); map.put(2,holder.textView_name); }else { holder.textView_name.setBackgroundResource(R.drawable.item_list_text_bg); } holder.textView_name.setText(intro); holder.relativeLayout_text_image.setFocusable(true); holder.relativeLayout_text_image.setTag(position); holder.itemView.setFocusable(true); holder.itemView.setNextFocusLeftId(R.id.bt_onAndoff); holder.itemView.setNextFocusRightId(R.id.bt_onAndoff); holder.itemView.setTag(holder.textView_name); holder.relativeLayout_text_image.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { //ๆญคๅค„ๅฐฑๆ˜ฏ่ฎพ็ฝฎtextviewไธบ้€‰ไธญ็Šถๆ€๏ผŒๆ–นๅฏไปฅๅฎž็Žฐๆ•ˆๆžœ holder.textView_name.setSelected(true); } else { // view.setBackgroundResource(R.color.transparent); //ๆญคๅค„ๅฐฑๆ˜ฏ่ฎพ็ฝฎtextviewไธบ้€‰ไธญ็Šถๆ€๏ผŒๆ–นๅฏไปฅๅฎž็Žฐๆ•ˆๆžœ holder.textView_name.setSelected(false); } } }); holder.relativeLayout_text_image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (map.get(2)!=null){ map.put(1,map.get(2)); } map.put(2,holder.textView_name); //ๅ…ˆๆŠŠๆ‰€ๆœ‰็š„้ขœ่‰ฒๆธ…้™ค // map.get(0).setBackgroundResource(R.drawable.d28); if (map.get(1) != null) { map.get(1).setBackgroundResource(R.drawable.d28); } if (map.get(2)!=null) { map.get(2).setBackgroundResource(R.mipmap.lay04); } holder.textView_name.setBackgroundResource(R.mipmap.lay04); //็‚นๅ‡ปไน‹ๅŽๅ†่ฎพ็ฝฎ้ขœ่‰ฒ onRecyItemClickListener.onClickItem(position,holder.textView_name); } }); } /** * ่Žทๅ–ๆ•ฐๆฎ็š„ๆ€ปๆก็›ฎ * * @return */ @Override public int getItemCount() { return singList.size(); } /** * ๅ›ž่ฐƒ๏ผŒ็ป™RecycleๆทปๅŠ ็›‘ๅฌไบ‹ไปถ๏ผŒๅนถไธ”ไผ ้€’position */ public interface OnRecyItemClickListener { void onClickItem(int position,View view); } /** * ้€‰ไธญๆ—ถๅ›ž่ฐƒๆŽฅๅฃ */ public interface OnItemSelectListener { void onItemSelect(View view_sing, int position); } }
4,969
0.621286
0.612645
150
30.633333
26.1257
100
false
false
0
0
0
0
0
0
0.48
false
false
4
bbfd8f6a143c146a65ea8398ca3f23a2117a67e1
18,811,956,802,562
586087143bee881ccabb78e3f3c7dcca401294e8
/ๆŠฝ่ฑกๅทฅๅŽ‚ๆจกๅผ/SuperPorscheFactory.java
227993aba887dd63032e26ea0c161a213991956c
[ "Apache-2.0" ]
permissive
XINCGer/DesignPattern
https://github.com/XINCGer/DesignPattern
2afe54c155440c2a7f6eaea856c9ac89601ffd4c
3e35b81b9fb9e9ffb26ca54bd309e13c43ebe085
refs/heads/master
2020-12-25T02:10:05.385000
2017-05-11T12:27:36
2017-05-11T12:27:36
60,097,584
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
//็”Ÿไบงไฟๆ—ถๆทๅทฅๅŽ‚็š„ๅทฅๅŽ‚ class SuperPorscheFactory implements Provider { @Override public CarFactory creatCarFactory() { return new PorscheFactory(); } }
GB18030
Java
182
java
SuperPorscheFactory.java
Java
[]
null
[]
//็”Ÿไบงไฟๆ—ถๆทๅทฅๅŽ‚็š„ๅทฅๅŽ‚ class SuperPorscheFactory implements Provider { @Override public CarFactory creatCarFactory() { return new PorscheFactory(); } }
182
0.703704
0.703704
7
22.142857
17.291027
47
false
false
0
0
0
0
0
0
0.142857
false
false
4
7c0e116790638e57fe56a3b196f5dade9bc405e4
16,423,954,994,434
e5d5219414e429b175ac25d681e91fbcf0d39fe4
/src/dimensions/FootPlacementDim.java
575f0a1a72466ac61625b4925a02295856f04669
[]
no_license
dj-yeh/DriverAnalysis
https://github.com/dj-yeh/DriverAnalysis
9999c7e6c227fb89c10b97a560ce8124cfe116ae
16d98cbd32365d729a5e7f705ec6407cfbdac3d8
refs/heads/main
2023-07-14T23:48:03.415000
2021-08-30T17:35:41
2021-08-30T17:35:41
389,456,047
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dimensions; public class FootPlacementDim extends Dimension { public FootPlacementDim() { super(14, "FootPlacementDim"); } public int getNumVals() { return super.numVals; } public String getName() { return super.name; } }
UTF-8
Java
251
java
FootPlacementDim.java
Java
[]
null
[]
package dimensions; public class FootPlacementDim extends Dimension { public FootPlacementDim() { super(14, "FootPlacementDim"); } public int getNumVals() { return super.numVals; } public String getName() { return super.name; } }
251
0.701195
0.693227
20
11.55
13.621582
47
false
false
0
0
0
0
0
0
1.1
false
false
4
bd4801dfbd8440618e46016859e4540db560ca64
31,147,102,890,290
76e109d5aa40983807c9205c26899dfa221f470d
/spring-mybatis/src/main/java/com/example/demo/MyBatisConfig.java
e8bd453c10091eba10a9c108a1f9e2a3b86854ce
[ "Apache-2.0" ]
permissive
amiguhaamin/java-spring-boot-samples
https://github.com/amiguhaamin/java-spring-boot-samples
4d092faf009ee8767e2253ce4130e1b473807627
7dc1d66d26feafe5360b662c2390195e741cf4ba
refs/heads/master
2021-09-12T17:37:18.700000
2018-04-19T09:29:48
2018-04-19T09:29:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo; import javax.sql.DataSource; import org.apache.ibatis.type.LocalDateTimeTypeHandler; import org.apache.ibatis.type.LocalDateTypeHandler; import org.apache.ibatis.type.LocalTimeTypeHandler; import org.apache.ibatis.type.TypeHandler; import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.spring.mapper.MapperFactoryBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @Configuration public class MyBatisConfig { @Autowired @Qualifier("dataSource") private DataSource dataSource; protected <T> T getMapper(DataSource dataSource, String mapperXmlFile, Class<T> mapperClass) throws Exception { // Create session SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); // Set datasource sqlSessionFactoryBean.setDataSource(dataSource); // Set mapper file and mapper class sqlSessionFactoryBean.setMapperLocations(new Resource[] { new ClassPathResource(mapperXmlFile, mapperClass) }); // Set type handler for LocalTime and LocalDateTime sqlSessionFactoryBean.setTypeHandlers(new TypeHandler<?>[] { new LocalDateTypeHandler(), new LocalTimeTypeHandler(), new LocalDateTimeTypeHandler() }); // Create mapper bean MapperFactoryBean<T> mapperFactoryBean = new MapperFactoryBean<>(); mapperFactoryBean.setSqlSessionFactory(sqlSessionFactoryBean.getObject()); mapperFactoryBean.setMapperInterface(mapperClass); return mapperFactoryBean.getObject(); } @Bean public MyMapper getMyMapper() throws Exception { return getMapper(dataSource, "/com/example/demo/MyMapper.xml", MyMapper.class); } }
UTF-8
Java
1,999
java
MyBatisConfig.java
Java
[]
null
[]
package com.example.demo; import javax.sql.DataSource; import org.apache.ibatis.type.LocalDateTimeTypeHandler; import org.apache.ibatis.type.LocalDateTypeHandler; import org.apache.ibatis.type.LocalTimeTypeHandler; import org.apache.ibatis.type.TypeHandler; import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.spring.mapper.MapperFactoryBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @Configuration public class MyBatisConfig { @Autowired @Qualifier("dataSource") private DataSource dataSource; protected <T> T getMapper(DataSource dataSource, String mapperXmlFile, Class<T> mapperClass) throws Exception { // Create session SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); // Set datasource sqlSessionFactoryBean.setDataSource(dataSource); // Set mapper file and mapper class sqlSessionFactoryBean.setMapperLocations(new Resource[] { new ClassPathResource(mapperXmlFile, mapperClass) }); // Set type handler for LocalTime and LocalDateTime sqlSessionFactoryBean.setTypeHandlers(new TypeHandler<?>[] { new LocalDateTypeHandler(), new LocalTimeTypeHandler(), new LocalDateTimeTypeHandler() }); // Create mapper bean MapperFactoryBean<T> mapperFactoryBean = new MapperFactoryBean<>(); mapperFactoryBean.setSqlSessionFactory(sqlSessionFactoryBean.getObject()); mapperFactoryBean.setMapperInterface(mapperClass); return mapperFactoryBean.getObject(); } @Bean public MyMapper getMyMapper() throws Exception { return getMapper(dataSource, "/com/example/demo/MyMapper.xml", MyMapper.class); } }
1,999
0.765383
0.765383
52
37.442307
32.005054
119
false
false
0
0
0
0
0
0
0.596154
false
false
4
5c41c11d83b005689e72223f7f7499e3bc68cb97
30,777,735,701,972
5765c87fd41493dff2fde2a68f9dccc04c1ad2bd
/Variant Programs/1-5/25/Chiral.java
6ba5d299306a782dab4031ef036e51867aaee47c
[ "MIT" ]
permissive
hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism
https://github.com/hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism
42e4c2061c3f8da0dfce760e168bb9715063645f
a42ced1d5a92963207e3565860cac0946312e1b3
refs/heads/master
2020-08-09T08:10:08.888000
2019-11-25T01:14:23
2019-11-25T01:14:23
214,041,532
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; import archiving.Stored; import simulator.Dramatization; import java.lang.String; import maker.Produce; public class Chiral { public Produce dhfr = null; public Produce ora = null; public Produce r = null; public String q = ""; static final int ident = -1843144518; public static synchronized void main(String[] array) { int uppermostTied; String bcl; String ahn; String z; Produce electricity; Produce scud; Produce intrasentential; Produce choy; int bac; uppermostTied = (-1987114252); bcl = (""); ahn = (""); z = (""); electricity = (null); scud = (null); intrasentential = (null); choy = (null); System.out.print("\f"); bac = (0); try { bac = (System.in.available()); } catch (java.lang.Exception ye) { } if (bac <= 0) { System.out.println("ERROR: System.in is empty, no file was passed or it is empty"); } else { double redAmbit, backgroundSpiteful; int lordCacheThrottle; simulator.Dramatization mackay; redAmbit = (0); backgroundSpiteful = (0); lordCacheThrottle = (0); try { java.util.Scanner claviature; claviature = (new java.util.Scanner(System.in)); backgroundSpiteful = (claviature.nextDouble()); redAmbit = (claviature.nextDouble()); lordCacheThrottle = (claviature.nextInt()); } catch (java.lang.Exception combatants) { System.out.println( "ERROR: There are not enough values or the values passed are in the incorrect format"); System.out.println( " Values should be in the form mean (double) rng (double) storageLimit (int)"); return; } mackay = (new simulator.Dramatization(10000000, backgroundSpiteful, redAmbit)); archiving.Stored.markWarehousingRestriction(lordCacheThrottle); mackay.early(); } } }
UTF-8
Java
1,942
java
Chiral.java
Java
[]
null
[]
import java.util.Scanner; import archiving.Stored; import simulator.Dramatization; import java.lang.String; import maker.Produce; public class Chiral { public Produce dhfr = null; public Produce ora = null; public Produce r = null; public String q = ""; static final int ident = -1843144518; public static synchronized void main(String[] array) { int uppermostTied; String bcl; String ahn; String z; Produce electricity; Produce scud; Produce intrasentential; Produce choy; int bac; uppermostTied = (-1987114252); bcl = (""); ahn = (""); z = (""); electricity = (null); scud = (null); intrasentential = (null); choy = (null); System.out.print("\f"); bac = (0); try { bac = (System.in.available()); } catch (java.lang.Exception ye) { } if (bac <= 0) { System.out.println("ERROR: System.in is empty, no file was passed or it is empty"); } else { double redAmbit, backgroundSpiteful; int lordCacheThrottle; simulator.Dramatization mackay; redAmbit = (0); backgroundSpiteful = (0); lordCacheThrottle = (0); try { java.util.Scanner claviature; claviature = (new java.util.Scanner(System.in)); backgroundSpiteful = (claviature.nextDouble()); redAmbit = (claviature.nextDouble()); lordCacheThrottle = (claviature.nextInt()); } catch (java.lang.Exception combatants) { System.out.println( "ERROR: There are not enough values or the values passed are in the incorrect format"); System.out.println( " Values should be in the form mean (double) rng (double) storageLimit (int)"); return; } mackay = (new simulator.Dramatization(10000000, backgroundSpiteful, redAmbit)); archiving.Stored.markWarehousingRestriction(lordCacheThrottle); mackay.early(); } } }
1,942
0.625644
0.608651
68
27.558823
22.008276
99
false
false
0
0
0
0
0
0
0.764706
false
false
4
2632eae771f7770128e7eaf020c6a928e5a09478
5,540,507,828,115
04f9cd19645cbdadbf83cd55be99cb42a06b5475
/src/main/java/academy/mindswap/jpafirststep/JpaFirstStepApplication.java
102645990458ef730cb8ea6880933173208eaede
[]
no_license
didivassi/jpa-first-step
https://github.com/didivassi/jpa-first-step
abe3839b29a19c78e0758599cb80736d8cc186ed
a69a947048c8a671cc467d4c6e978596b7ef12c5
refs/heads/master
2023-06-20T07:26:03.319000
2021-07-15T16:50:20
2021-07-15T16:50:20
386,362,239
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package academy.mindswap.jpafirststep; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class JpaFirstStepApplication { public static void main(String[] args) { SpringApplication.run(JpaFirstStepApplication.class, args); } }
UTF-8
Java
334
java
JpaFirstStepApplication.java
Java
[]
null
[]
package academy.mindswap.jpafirststep; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class JpaFirstStepApplication { public static void main(String[] args) { SpringApplication.run(JpaFirstStepApplication.class, args); } }
334
0.832335
0.832335
13
24.692308
24.770903
68
false
false
0
0
0
0
0
0
0.692308
false
false
4
5f51c5fbd0bd712d2355c5c9869c67f7b8ee4b25
16,990,890,630,277
5bfa6e297655d211677b28275cc19c5565f8c0a4
/sandbox.db/test_src/kz/greetgo/sandbox/db/register_impl/CharmRegisterImplTest.java
31a61025b94f230d6d10d82d4a91175f148fa757
[]
no_license
akali/greetgo.sandbox
https://github.com/akali/greetgo.sandbox
c617aa02cadbaa7006ff21b09da570e782a472c1
039232238aa3f3207a5def89f4c525eb3af1533f
refs/heads/master
2020-03-19T06:02:34.345000
2018-06-01T04:15:05
2018-06-01T04:15:05
135,985,639
0
0
null
true
2018-06-04T07:15:23
2018-06-04T07:15:22
2018-06-01T04:15:17
2018-06-04T07:05:00
4,375
0
0
0
null
false
null
package kz.greetgo.sandbox.db.register_impl; import kz.greetgo.depinject.core.BeanGetter; import kz.greetgo.sandbox.controller.errors.InvalidCharmError; import kz.greetgo.sandbox.controller.model.Charm; import kz.greetgo.sandbox.controller.register.charm.CharmRegister; import kz.greetgo.sandbox.db.test.dao.CharmTestDao; import kz.greetgo.sandbox.db.test.util.ParentTestNg; import kz.greetgo.sandbox.db.util.JdbcSandbox; import kz.greetgo.util.RND; import org.testng.annotations.Test; import java.util.List; import static org.fest.assertions.api.Assertions.assertThat; public class CharmRegisterImplTest extends ParentTestNg { public BeanGetter<CharmRegister> charmRegister; public BeanGetter<CharmTestDao> charmTestDao; public BeanGetter<JdbcSandbox> jdbc; private void truncateTable() { charmTestDao.get().truncateTable(); jdbc.get().execute((connection)->{ String restartCharmSeq = "ALTER SEQUENCE charm_id_seq RESTART WITH 1;"; connection.prepareStatement(restartCharmSeq).execute(); return null; }); } @Test(expectedExceptions = InvalidCharmError.class) public void get_invalidId() { truncateTable(); int negativeId = -1 * RND.plusInt(10); int notExistingId = RND.plusInt(111); // // charmRegister.get().getCharm(negativeId); // // // // charmRegister.get().getCharm(notExistingId); // // } @Test public void get_notActive() { truncateTable(); Charm charm = new Charm(); charm.name = RND.str(10); charm.isActive = false; charmTestDao.get().insertCharmWithId(charm); // // List<Charm> list = charmRegister.get().getCharmDictionary(); // // assertThat(list).isNotNull(); assertThat(list).hasSize(0); } @Test public void get_dictionary() { truncateTable(); String expectedName = RND.str(10); Charm activeCharm = new Charm(); activeCharm.name = expectedName; activeCharm.isActive = true; Charm inActiveCharm = new Charm(); inActiveCharm.name = RND.str(10); inActiveCharm.isActive = false; charmTestDao.get().insertCharmWithId(activeCharm); charmTestDao.get().insertCharmWithId(inActiveCharm); // // List<Charm> list = charmRegister.get().getCharmDictionary(); // // assertThat(list).isNotNull(); assertThat(list).hasSize(1); assertThat(list.get(0).isActive).isTrue(); assertThat(list.get(0).name).isEqualToIgnoringCase(expectedName); } }
UTF-8
Java
2,499
java
CharmRegisterImplTest.java
Java
[]
null
[]
package kz.greetgo.sandbox.db.register_impl; import kz.greetgo.depinject.core.BeanGetter; import kz.greetgo.sandbox.controller.errors.InvalidCharmError; import kz.greetgo.sandbox.controller.model.Charm; import kz.greetgo.sandbox.controller.register.charm.CharmRegister; import kz.greetgo.sandbox.db.test.dao.CharmTestDao; import kz.greetgo.sandbox.db.test.util.ParentTestNg; import kz.greetgo.sandbox.db.util.JdbcSandbox; import kz.greetgo.util.RND; import org.testng.annotations.Test; import java.util.List; import static org.fest.assertions.api.Assertions.assertThat; public class CharmRegisterImplTest extends ParentTestNg { public BeanGetter<CharmRegister> charmRegister; public BeanGetter<CharmTestDao> charmTestDao; public BeanGetter<JdbcSandbox> jdbc; private void truncateTable() { charmTestDao.get().truncateTable(); jdbc.get().execute((connection)->{ String restartCharmSeq = "ALTER SEQUENCE charm_id_seq RESTART WITH 1;"; connection.prepareStatement(restartCharmSeq).execute(); return null; }); } @Test(expectedExceptions = InvalidCharmError.class) public void get_invalidId() { truncateTable(); int negativeId = -1 * RND.plusInt(10); int notExistingId = RND.plusInt(111); // // charmRegister.get().getCharm(negativeId); // // // // charmRegister.get().getCharm(notExistingId); // // } @Test public void get_notActive() { truncateTable(); Charm charm = new Charm(); charm.name = RND.str(10); charm.isActive = false; charmTestDao.get().insertCharmWithId(charm); // // List<Charm> list = charmRegister.get().getCharmDictionary(); // // assertThat(list).isNotNull(); assertThat(list).hasSize(0); } @Test public void get_dictionary() { truncateTable(); String expectedName = RND.str(10); Charm activeCharm = new Charm(); activeCharm.name = expectedName; activeCharm.isActive = true; Charm inActiveCharm = new Charm(); inActiveCharm.name = RND.str(10); inActiveCharm.isActive = false; charmTestDao.get().insertCharmWithId(activeCharm); charmTestDao.get().insertCharmWithId(inActiveCharm); // // List<Charm> list = charmRegister.get().getCharmDictionary(); // // assertThat(list).isNotNull(); assertThat(list).hasSize(1); assertThat(list.get(0).isActive).isTrue(); assertThat(list.get(0).name).isEqualToIgnoringCase(expectedName); } }
2,499
0.697079
0.690276
104
23.038462
22.080675
77
false
false
0
0
0
0
0
0
0.471154
false
false
4
c1834f1fc000da987725996b1e8729eb671abb11
14,602,888,867,469
071a9fa7cfee0d1bf784f6591cd8d07c6b2a2495
/corpus/norm-class/eclipse.jdt.core/1617.java
be30d563d3361f1cc2c3168c2002750e82d8e79b
[ "MIT" ]
permissive
masud-technope/ACER-Replication-Package-ASE2017
https://github.com/masud-technope/ACER-Replication-Package-ASE2017
41a7603117f01382e7e16f2f6ae899e6ff3ad6bb
cb7318a729eb1403004d451a164c851af2d81f7a
refs/heads/master
2021-06-21T02:19:43.602000
2021-02-13T20:44:09
2021-02-13T20:44:09
187,748,164
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
test test flag foo flag
UTF-8
Java
23
java
1617.java
Java
[]
null
[]
test test flag foo flag
23
0.826087
0.826087
1
23
0
23
false
false
0
0
0
0
0
0
0
false
false
4
8be46d2c9139e217b7d783e50d6b016dc1039abe
14,602,888,866,543
f840dae01d1b602a29b8e72213245dc6ec049561
/org.xtext.mda.project.browserdsl.interpreteur/src/org/xtext/mda/project/browserdsl/interpreteur/BrowserDSL.java
b273db4d58f491efbf653047699a40c48a29ab58
[]
no_license
mcartaud/BrowserDSL
https://github.com/mcartaud/BrowserDSL
7719a8c1226ccce184a08e8f9488fa793dcb0a5d
a0ed58b98f51c23cd2efaed299a08ef1eee85591
refs/heads/master
2021-01-20T07:48:26.089000
2015-02-27T16:25:02
2015-02-27T16:25:02
30,242,644
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.xtext.mda.project.browserdsl.interpreteur; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.xtext.mda.project.browserDSL.OpenBrowser; import org.xtext.mda.project.browserDSL.Program; import org.xtext.mda.project.browserdsl.interpreteur.model.ComputeBody; import org.xtext.mda.project.browserdsl.interpreteur.utils.SubroutineUtils; import org.xtext.mda.project.browserdsl.interpreteur.utils.VariableUtils; public class BrowserDSL { private static Program program; private static WebDriver driver; private BrowserDSL() { } public static void start(Program pProgram) { program = pProgram; SubroutineUtils.setSubroutineList(program.getSubroutines()); VariableUtils.setVariableList(program.getVariables()); ComputeBody body = new ComputeBody(program.getMain().getBody()); body.executeMain(); driver.close(); driver=null; } public static WebDriver getBrowser() { OpenBrowser browser = program.getBrowser(); if (driver == null) { switch (browser) { case CHROME: driver = new ChromeDriver(); break; case FIREFOX: driver = new FirefoxDriver(); break; default: driver = new HtmlUnitDriver(); break; } } return driver; } }
UTF-8
Java
1,360
java
BrowserDSL.java
Java
[]
null
[]
package org.xtext.mda.project.browserdsl.interpreteur; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.xtext.mda.project.browserDSL.OpenBrowser; import org.xtext.mda.project.browserDSL.Program; import org.xtext.mda.project.browserdsl.interpreteur.model.ComputeBody; import org.xtext.mda.project.browserdsl.interpreteur.utils.SubroutineUtils; import org.xtext.mda.project.browserdsl.interpreteur.utils.VariableUtils; public class BrowserDSL { private static Program program; private static WebDriver driver; private BrowserDSL() { } public static void start(Program pProgram) { program = pProgram; SubroutineUtils.setSubroutineList(program.getSubroutines()); VariableUtils.setVariableList(program.getVariables()); ComputeBody body = new ComputeBody(program.getMain().getBody()); body.executeMain(); driver.close(); driver=null; } public static WebDriver getBrowser() { OpenBrowser browser = program.getBrowser(); if (driver == null) { switch (browser) { case CHROME: driver = new ChromeDriver(); break; case FIREFOX: driver = new FirefoxDriver(); break; default: driver = new HtmlUnitDriver(); break; } } return driver; } }
1,360
0.755882
0.755882
53
24.660378
22.677345
75
false
false
0
0
0
0
0
0
1.924528
false
false
4
244cac168de8d9da59283fd9b4223237eb39ce4d
12,171,937,383,855
018c943191d231983023196651b931898e31a652
/src/main/java/com/terrestris/map/domain/entity/Latitude.java
41a6421ba53924018b8b45322813928e8d795493
[]
no_license
djcam/terrestris
https://github.com/djcam/terrestris
6d60a1863f92c80d6f6d64b3e6e8381509655b2d
d8f25a96b2ebdb49f74745077a2c0b1cb04b5fcb
refs/heads/master
2021-01-25T08:37:36.177000
2015-06-08T15:33:29
2015-06-08T15:33:29
37,075,339
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.terrestris.map.domain.entity; /** * Created by dcampbell2 on 2/25/2015. */ import javax.persistence.*; @Entity public class Latitude extends Road {}
UTF-8
Java
166
java
Latitude.java
Java
[ { "context": "m.terrestris.map.domain.entity;\n\n/**\n * Created by dcampbell2 on 2/25/2015.\n */\n\nimport javax.persistence.*;\n\n@", "end": 71, "score": 0.9996257424354553, "start": 61, "tag": "USERNAME", "value": "dcampbell2" } ]
null
[]
package com.terrestris.map.domain.entity; /** * Created by dcampbell2 on 2/25/2015. */ import javax.persistence.*; @Entity public class Latitude extends Road {}
166
0.728916
0.680723
10
15.6
16.900888
41
false
false
0
0
0
0
0
0
0.2
false
false
4
f881c1524d70ab4e5ee92df84b2d56283a1d713f
25,460,566,177,865
3922261a7981303681d9a843795deb064a13eaa0
/src/main/java/com/mzawadzki/candyshop/controller/CartController.java
6187b3886055def286089edde3717cd61b5c67b9
[]
no_license
mateuszzawadzki/SpringMVCShop
https://github.com/mateuszzawadzki/SpringMVCShop
989016881043f54326fd798eb370009e78d3c3b8
8ede3600b39164cf49bea541ef95150a6af72698
refs/heads/master
2016-09-13T13:09:16.808000
2016-05-08T21:06:59
2016-05-08T21:06:59
58,166,228
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mzawadzki.candyshop.controller; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.mzawadzki.candyshop.beans.Cart; import com.mzawadzki.candyshop.model.Candy; import com.mzawadzki.candyshop.model.User; import com.mzawadzki.candyshop.service.CandyService; import com.mzawadzki.candyshop.service.PurchaseService; @Controller public class CartController { @Autowired CandyService candyService; @Autowired private Cart cart; @Autowired PurchaseService purchaseService; @RequestMapping(value="/cart/add/{candyId}") public String addToCart(@PathVariable("candyId") Long candyId, @RequestHeader("referer") String referedForm){ Candy candy = candyService.findCandy(candyId); cart.addCandy(candy, 1); return "redirect:" + referedForm; } @RequestMapping(value="/cart", method=RequestMethod.GET) public String showCart(Model model){ model.addAttribute(cart); return "cart"; } @RequestMapping(value="/cart/placeOrder", method=RequestMethod.POST) public String placeOrder(HttpSession session, RedirectAttributes redirectAttributes){ if(cart.getContents().isEmpty()){ redirectAttributes.addFlashAttribute("cartMessage", "Cart is empty."); return "redirect:/cart"; } else{ User loggedInUser = (User) session.getAttribute("loggedInUser"); purchaseService.savePurchase(cart.getContents(), loggedInUser); redirectAttributes.addFlashAttribute("cartMessage", "Order placed. Total cost: " + cart.getTotalCost()); cart.clearCart(); return "redirect:/cart"; } } }
UTF-8
Java
2,048
java
CartController.java
Java
[]
null
[]
package com.mzawadzki.candyshop.controller; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.mzawadzki.candyshop.beans.Cart; import com.mzawadzki.candyshop.model.Candy; import com.mzawadzki.candyshop.model.User; import com.mzawadzki.candyshop.service.CandyService; import com.mzawadzki.candyshop.service.PurchaseService; @Controller public class CartController { @Autowired CandyService candyService; @Autowired private Cart cart; @Autowired PurchaseService purchaseService; @RequestMapping(value="/cart/add/{candyId}") public String addToCart(@PathVariable("candyId") Long candyId, @RequestHeader("referer") String referedForm){ Candy candy = candyService.findCandy(candyId); cart.addCandy(candy, 1); return "redirect:" + referedForm; } @RequestMapping(value="/cart", method=RequestMethod.GET) public String showCart(Model model){ model.addAttribute(cart); return "cart"; } @RequestMapping(value="/cart/placeOrder", method=RequestMethod.POST) public String placeOrder(HttpSession session, RedirectAttributes redirectAttributes){ if(cart.getContents().isEmpty()){ redirectAttributes.addFlashAttribute("cartMessage", "Cart is empty."); return "redirect:/cart"; } else{ User loggedInUser = (User) session.getAttribute("loggedInUser"); purchaseService.savePurchase(cart.getContents(), loggedInUser); redirectAttributes.addFlashAttribute("cartMessage", "Order placed. Total cost: " + cart.getTotalCost()); cart.clearCart(); return "redirect:/cart"; } } }
2,048
0.769043
0.768555
58
33.310345
28.089272
110
false
false
0
0
0
0
0
0
1.689655
false
false
4
2e71a93bcba3021cdf52f54f2edbb4a7a4338ea7
25,460,566,174,081
5c5a0b7e5ee55d358b8544a7991b195fe1faf304
/microservices/banking-transactions/src/main/java/io/sbailey/blog/aws/examples/microservices/transactions/services/TransactionsServiceImpl.java
4ce4740a826e305291de92a2f98e2b1c237597e5
[ "MIT" ]
permissive
sbbailey/aws-examples
https://github.com/sbbailey/aws-examples
96f493dcbd4ee71c17f3eb1917cc2c4abbd7a9b0
d06e89644cb33bafe2d8088489711364a36a6a9c
refs/heads/master
2020-03-14T22:33:19.803000
2019-04-23T14:22:10
2019-04-23T14:22:10
131,823,670
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.sbailey.blog.aws.examples.microservices.transactions.services; import io.sbailey.aws.examples.microservices.domain.Transaction; import io.sbailey.aws.examples.microservices.domain.TxType; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.springframework.stereotype.Service; @Service public class TransactionsServiceImpl implements TransactionsService { /* * replaces a repository/datastore for demo purposes * */ private HashMap<Integer, List<Transaction>> transactionStore = new HashMap<Integer, List<Transaction>>(); /** * {@inheritDoc} * */ @Override public List<Transaction> getAccountTransactions(Integer number) { return transactionStore.get(number); } /** * {@inheritDoc} * */ @Override public List<Transaction> addAccountTransaction(Integer accountNumber,TxType txType, BigDecimal amount) { Transaction newTx = new Transaction(accountNumber, txType, amount); if(transactionStore.containsKey(accountNumber)){ transactionStore.get(accountNumber).add(newTx); }else{ List<Transaction> txList = new ArrayList<Transaction>(); txList.add(newTx); transactionStore.put(accountNumber, txList); } return transactionStore.get(accountNumber); } }
UTF-8
Java
1,297
java
TransactionsServiceImpl.java
Java
[]
null
[]
package io.sbailey.blog.aws.examples.microservices.transactions.services; import io.sbailey.aws.examples.microservices.domain.Transaction; import io.sbailey.aws.examples.microservices.domain.TxType; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.springframework.stereotype.Service; @Service public class TransactionsServiceImpl implements TransactionsService { /* * replaces a repository/datastore for demo purposes * */ private HashMap<Integer, List<Transaction>> transactionStore = new HashMap<Integer, List<Transaction>>(); /** * {@inheritDoc} * */ @Override public List<Transaction> getAccountTransactions(Integer number) { return transactionStore.get(number); } /** * {@inheritDoc} * */ @Override public List<Transaction> addAccountTransaction(Integer accountNumber,TxType txType, BigDecimal amount) { Transaction newTx = new Transaction(accountNumber, txType, amount); if(transactionStore.containsKey(accountNumber)){ transactionStore.get(accountNumber).add(newTx); }else{ List<Transaction> txList = new ArrayList<Transaction>(); txList.add(newTx); transactionStore.put(accountNumber, txList); } return transactionStore.get(accountNumber); } }
1,297
0.757903
0.757903
53
23.471699
28.541664
106
false
false
0
0
0
0
0
0
1.396226
false
false
4
c4258e3c839f422e1d3cffbd82741c6734e4446a
26,482,768,392,966
1e7afd41cd988a12ecd2fdb89eb9f2b3584a45d0
/wechat-dev/src/main/java/com/d1m/wechat/model/enums/QrcodeAction.java
2d53cd0d7793bd0833362e6dd56211db1dc71ac3
[]
no_license
GSIL-Monitor/All-Java
https://github.com/GSIL-Monitor/All-Java
44383486991f02f33deb2ac27ff39a9871d360e7
072b7cfb119b5502670c71cddbcf581ae49b5bff
refs/heads/master
2020-04-19T08:24:15.147000
2018-04-04T11:18:47
2018-04-04T11:18:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.d1m.wechat.model.enums; public enum QrcodeAction { QR_SCENE((byte) 1, "ไธดๆ—ถ"), QR_LIMIT_SCENE((byte) 2, "ๆฐธไน…ๆ•ฐๅ€ผ"), QR_LIMIT_STR_SCENE((byte) 3, "ๆฐธไน…ๅญ—็ฌฆไธฒ"), ; private byte value; private String name; /** * @param value * @param name */ private QrcodeAction(byte value, String name) { this.value = value; this.name = name; } public String getName() { return name; } public byte getValue() { return value; } public void setName(String name) { this.name = name; } public void setValue(byte value) { this.value = value; } }
UTF-8
Java
595
java
QrcodeAction.java
Java
[]
null
[]
package com.d1m.wechat.model.enums; public enum QrcodeAction { QR_SCENE((byte) 1, "ไธดๆ—ถ"), QR_LIMIT_SCENE((byte) 2, "ๆฐธไน…ๆ•ฐๅ€ผ"), QR_LIMIT_STR_SCENE((byte) 3, "ๆฐธไน…ๅญ—็ฌฆไธฒ"), ; private byte value; private String name; /** * @param value * @param name */ private QrcodeAction(byte value, String name) { this.value = value; this.name = name; } public String getName() { return name; } public byte getValue() { return value; } public void setName(String name) { this.name = name; } public void setValue(byte value) { this.value = value; } }
595
0.636998
0.630017
42
12.642858
13.801003
48
false
false
0
0
0
0
0
0
1.166667
false
false
4
a53d6e8bc9d099f493ab58c5b38e5141953eeeb3
5,523,327,997,577
6230112650a3b519ac3ad3a9b0c661cd893abfaa
/src/hu/hajnaldavid/android/bkvmegallok/network/ParsingMode.java
cde8d1644dfb6f8b3adb9ba4f9ed0a79133f0b27
[]
no_license
314t0n/megallokereso
https://github.com/314t0n/megallokereso
6f5fe606178b82bac4f5327ba84f37af738a1c01
b8fa7a015cd461f0deb25ef086817e04d9f141e1
refs/heads/master
2021-01-09T22:39:39.223000
2014-07-21T19:34:28
2014-07-21T19:34:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hu.hajnaldavid.android.bkvmegallok.network; public enum ParsingMode { ParsingModeJSON; }
UTF-8
Java
99
java
ParsingMode.java
Java
[]
null
[]
package hu.hajnaldavid.android.bkvmegallok.network; public enum ParsingMode { ParsingModeJSON; }
99
0.818182
0.818182
5
18.799999
18.701872
51
false
false
0
0
0
0
0
0
0.6
false
false
4
6ffa76b0fd490a2c9d28bba94a88769af671cfc8
8,615,704,445,118
4b2bdc3d192666d6bff681a851b722b97a0f6717
/src/beans/Trading.java
3fdf4407b917f4c8197dfaf71628b98978bbabfa
[]
no_license
bmeritter/JavaForReport
https://github.com/bmeritter/JavaForReport
363557ae21781d4d83fed6dde2d063b76c482284
20aa2132d8d605ee02fd09dac80d39a7c155e63b
refs/heads/master
2017-04-23T18:54:04.087000
2016-09-06T09:19:23
2016-09-06T09:19:23
60,406,381
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package beans; public class Trading { private int trading_id; private int trading_goods_id; private int trading_user_id; private double trading_number; public int getTrading_id() { return trading_id; } public void setTrading_id(int trading_id) { this.trading_id = trading_id; } public int getTrading_goods_id() { return trading_goods_id; } public void setTrading_goods_id(int trading_goods_id) { this.trading_goods_id = trading_goods_id; } public int getTrading_user_id() { return trading_user_id; } public void setTrading_user_id(int trading_user_id) { this.trading_user_id = trading_user_id; } public double getTrading_number() { return trading_number; } public void setTrading_number(double trading_number) { this.trading_number = trading_number; } }
UTF-8
Java
799
java
Trading.java
Java
[]
null
[]
package beans; public class Trading { private int trading_id; private int trading_goods_id; private int trading_user_id; private double trading_number; public int getTrading_id() { return trading_id; } public void setTrading_id(int trading_id) { this.trading_id = trading_id; } public int getTrading_goods_id() { return trading_goods_id; } public void setTrading_goods_id(int trading_goods_id) { this.trading_goods_id = trading_goods_id; } public int getTrading_user_id() { return trading_user_id; } public void setTrading_user_id(int trading_user_id) { this.trading_user_id = trading_user_id; } public double getTrading_number() { return trading_number; } public void setTrading_number(double trading_number) { this.trading_number = trading_number; } }
799
0.718398
0.718398
40
18.975
18.309134
56
false
false
0
0
0
0
0
0
1.225
false
false
4
3767c1e43fcdc433e8106eac8fa56be845238e3b
7,490,422,965,233
23eee8c92adfa3dfed5c7c1f7755279ac0e9024d
/src/main/java/org/everit/audit/search/api/dto/EventUi.java
ac7ba09d45d960b8c656eb4ee361a67b14fbff80
[ "Apache-2.0" ]
permissive
everit-org/audit-search-api
https://github.com/everit-org/audit-search-api
7ff5fd3372c9fe72740d22f23ba01a0cc114c58e
a8bd937834c8aec8c38d2fb0b19b0b9b6a6ac2b2
refs/heads/master
2023-05-10T14:37:44.643000
2015-10-26T08:10:56
2015-10-26T08:10:56
29,901,617
0
1
null
false
2015-10-26T08:10:56
2015-01-27T06:55:49
2015-02-09T14:24:11
2015-10-26T08:10:56
199
0
1
0
Java
null
null
package org.everit.audit.search.api.dto; import java.time.Instant; import java.util.HashMap; import java.util.Map; import java.util.Objects; import org.everit.audit.dto.EventData; public class EventUi { public static class Builder { private String appName; private final Map<String, EventData> eventData = new HashMap<>(); private long eventId; private Instant saveTimestamp; private String typeName; public Builder appName(final String appName) { this.appName = appName; return this; } public Builder binaryData(final String name, final byte[] data) { eventData.put(name, new EventData(name, data)); return this; } public EventUi build() { return new EventUi(eventId, typeName, appName, saveTimestamp, eventData); } public Builder eventId(final long eventId) { this.eventId = eventId; return this; } public Builder numberData(final String name, final double number) { eventData.put(name, new EventData(name, number)); return this; } public Builder saveTimestamp(final Instant saveTimestamp) { this.saveTimestamp = saveTimestamp; return this; } public Builder stringData(final String name, final String data) { eventData.put(name, new EventData(name, data)); return this; } public Builder textData(final String name, final String data) { eventData.put(name, new EventData(name, false, data)); return this; } public Builder timestampData(final String name, final Instant data) { eventData.put(name, new EventData(name, data)); return this; } public Builder typeName(final String typeName) { this.typeName = typeName; return this; } } /** * The name of the application which the event belongs to. */ private final String applicationName; /** * Map containing the event data. */ private final Map<String, EventData> eventData; /** * Id of the event. */ private final long id; /** * Name of the event. */ private final String name; /** * TimeStamp when the event was saved. */ private final Instant saveTimeStamp; public EventUi(final long id, final String name, final String applicationName, final Instant saveTimeStamp, final Map<String, EventData> eventData) { this.id = id; this.name = Objects.requireNonNull(name, "name cannot be null"); this.applicationName = Objects.requireNonNull(applicationName, "applicationName cannot be null"); this.saveTimeStamp = Objects.requireNonNull(saveTimeStamp, "saveTimeStamp cannot be null"); this.eventData = Objects.requireNonNull(eventData, "eventData cannot be null"); } public String getApplicationName() { return applicationName; } public Map<String, EventData> getEventData() { return eventData; } public Long getId() { return id; } public String getName() { return name; } public Instant getSaveTimeStamp() { return saveTimeStamp; } }
UTF-8
Java
3,059
java
EventUi.java
Java
[]
null
[]
package org.everit.audit.search.api.dto; import java.time.Instant; import java.util.HashMap; import java.util.Map; import java.util.Objects; import org.everit.audit.dto.EventData; public class EventUi { public static class Builder { private String appName; private final Map<String, EventData> eventData = new HashMap<>(); private long eventId; private Instant saveTimestamp; private String typeName; public Builder appName(final String appName) { this.appName = appName; return this; } public Builder binaryData(final String name, final byte[] data) { eventData.put(name, new EventData(name, data)); return this; } public EventUi build() { return new EventUi(eventId, typeName, appName, saveTimestamp, eventData); } public Builder eventId(final long eventId) { this.eventId = eventId; return this; } public Builder numberData(final String name, final double number) { eventData.put(name, new EventData(name, number)); return this; } public Builder saveTimestamp(final Instant saveTimestamp) { this.saveTimestamp = saveTimestamp; return this; } public Builder stringData(final String name, final String data) { eventData.put(name, new EventData(name, data)); return this; } public Builder textData(final String name, final String data) { eventData.put(name, new EventData(name, false, data)); return this; } public Builder timestampData(final String name, final Instant data) { eventData.put(name, new EventData(name, data)); return this; } public Builder typeName(final String typeName) { this.typeName = typeName; return this; } } /** * The name of the application which the event belongs to. */ private final String applicationName; /** * Map containing the event data. */ private final Map<String, EventData> eventData; /** * Id of the event. */ private final long id; /** * Name of the event. */ private final String name; /** * TimeStamp when the event was saved. */ private final Instant saveTimeStamp; public EventUi(final long id, final String name, final String applicationName, final Instant saveTimeStamp, final Map<String, EventData> eventData) { this.id = id; this.name = Objects.requireNonNull(name, "name cannot be null"); this.applicationName = Objects.requireNonNull(applicationName, "applicationName cannot be null"); this.saveTimeStamp = Objects.requireNonNull(saveTimeStamp, "saveTimeStamp cannot be null"); this.eventData = Objects.requireNonNull(eventData, "eventData cannot be null"); } public String getApplicationName() { return applicationName; } public Map<String, EventData> getEventData() { return eventData; } public Long getId() { return id; } public String getName() { return name; } public Instant getSaveTimeStamp() { return saveTimeStamp; } }
3,059
0.675711
0.675711
127
23.086615
24.080582
95
false
false
0
0
0
0
0
0
0.606299
false
false
4
1c1fac46ef7b034a8e15c9acf4754915e2b70506
5,823,975,720,022
863acb02a064a0fc66811688a67ce3511f1b81af
/sources/com/google/android/gms/internal/ads/C9522jp.java
ee57eb14323f0865102337c9f6d3102fa461e67e
[ "MIT" ]
permissive
Game-Designing/Custom-Football-Game
https://github.com/Game-Designing/Custom-Football-Game
98d33eb0c04ca2c48620aa4a763b91bc9c1b7915
47283462b2066ad5c53b3c901182e7ae62a34fc8
refs/heads/master
2020-08-04T00:02:04.876000
2019-10-06T06:55:08
2019-10-06T06:55:08
211,914,568
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.internal.ads; /* renamed from: com.google.android.gms.internal.ads.jp */ interface C9522jp { /* renamed from: a */ boolean mo28406a(); /* renamed from: b */ zzdpk mo28407b(); /* renamed from: c */ int mo28408c(); }
UTF-8
Java
273
java
C9522jp.java
Java
[]
null
[]
package com.google.android.gms.internal.ads; /* renamed from: com.google.android.gms.internal.ads.jp */ interface C9522jp { /* renamed from: a */ boolean mo28406a(); /* renamed from: b */ zzdpk mo28407b(); /* renamed from: c */ int mo28408c(); }
273
0.626374
0.556777
13
20
16.797436
58
false
false
0
0
0
0
0
0
0.307692
false
false
4
f704b7a34f9dcb4a61a3355f4840b90451103a99
4,887,672,834,533
71b1300d51ac6dcde1089287ece9adc61c148aa5
/webfx-kit/webfx-kit-util-scene/src/main/java/dev/webfx/kit/util/scene/DeviceSceneUtil.java
8f5f33b43bbed904a3defc4fa03ca860af363181
[ "Apache-2.0" ]
permissive
webfx-project/webfx
https://github.com/webfx-project/webfx
0ab7631a69501eced95bc3c65fb9caea76965d8e
a104df9917bb0e4571f726cd28494b099d0f017a
refs/heads/main
2023-08-24T17:55:59.102000
2023-08-13T10:55:08
2023-08-21T13:27:17
44,308,813
249
20
Apache-2.0
false
2023-08-06T18:05:58
2015-10-15T09:52:32
2023-08-05T15:19:28
2023-08-06T18:05:57
66,128
240
19
0
Java
false
false
package dev.webfx.kit.util.scene; import dev.webfx.kit.launcher.WebFxKitLauncher; import dev.webfx.platform.os.OperatingSystem; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.geometry.Rectangle2D; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.paint.Paint; import javafx.scene.text.Font; import javafx.stage.Screen; import java.util.Arrays; /** * @author Bruno Salmon */ public final class DeviceSceneUtil { public static Scene newScene(Parent root, double width, double height) { return newScene(root, getFinalSceneBounds(width, height)); } public static Scene newScene(Parent root, double width, double height, Paint fill) { Scene scene = newScene(root, width, height); scene.setFill(fill); // Recommended to set a fill on the scene (ex: black) otherwise the Gluon version shows a white vertical line on the right side return scene; } public static Scene newScreenVisualBoundsScene(Parent root) { return newScene(root, getScreenVisualBounds()); } public static Scene newScreenVisualBoundsScene(Parent root, Paint fill) { Scene scene = newScreenVisualBoundsScene(root); scene.setFill(fill); // Recommended to set a fill on the scene (ex: black) otherwise the Gluon version shows a white vertical line on the right side return scene; } public static Rectangle2D getFinalSceneBounds(double width, double height) { return isAndroidOrIOS() ? getScreenVisualBounds() // Also ok if actually runs in the browser as the scene dimensions will be ignored : new Rectangle2D(0, 0, width, height); } public static Rectangle2D getSceneBoundsWithMaxPixelsCapOnDesktop(double maxPixels) { Rectangle2D screenVisualBounds = getScreenVisualBounds(); if (isAndroidOrIOS()) return screenVisualBounds; double w = screenVisualBounds.getWidth(), h = screenVisualBounds.getHeight(); // Trying full-screen double wh = w * h; if (wh <= maxPixels) return screenVisualBounds; double r = w / h; w = Math.sqrt(maxPixels * r); h = w / r; return new Rectangle2D(0, 0, w, h); } private static Rectangle2D getScreenVisualBounds() { return Screen.getPrimary().getVisualBounds(); } private static Scene newScene(Parent root, Rectangle2D finalSceneBounds) { return new Scene(root, finalSceneBounds.getWidth(), finalSceneBounds.getHeight()); } private static boolean isAndroidOrIOS() { return OperatingSystem.isMobile(); } public static void onFontsLoaded(Runnable runnable) { onObservableListEmpty(WebFxKitLauncher.loadingFonts(), runnable); } public static void onObservableListEmpty(ObservableList<Font> list, Runnable runnable) { if (!runIfObservableListEmpty(list, runnable)) list.addListener((ListChangeListener<Font>) c -> runIfObservableListEmpty(list, runnable)); } private static boolean runIfObservableListEmpty(ObservableList<Font> list, Runnable runnable) { boolean empty = list.isEmpty(); if (empty) runnable.run(); return empty; } public static void onImagesLoaded(Runnable runnable, Image... images) { if (!runIfImagesLoaded(runnable, images)) Arrays.stream(images).forEach(i -> i.progressProperty().addListener((observable, oldValue, newValue) -> runIfImagesLoaded(runnable, images))); } private static boolean runIfImagesLoaded(Runnable runnable, Image... images) { boolean loaded = Arrays.stream(images).allMatch(i -> i.getProgress() >= 1); if (loaded) runnable.run(); return loaded; } public static void onFontsAndImagesLoaded(Runnable runnable, Image... images) { onFontsLoaded(() -> onImagesLoaded(runnable, images)); } }
UTF-8
Java
4,000
java
DeviceSceneUtil.java
Java
[ { "context": ".Screen;\n\nimport java.util.Arrays;\n\n/**\n * @author Bruno Salmon\n */\npublic final class DeviceSceneUtil {\n\n pub", "end": 487, "score": 0.9998732805252075, "start": 475, "tag": "NAME", "value": "Bruno Salmon" } ]
null
[]
package dev.webfx.kit.util.scene; import dev.webfx.kit.launcher.WebFxKitLauncher; import dev.webfx.platform.os.OperatingSystem; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.geometry.Rectangle2D; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.paint.Paint; import javafx.scene.text.Font; import javafx.stage.Screen; import java.util.Arrays; /** * @author <NAME> */ public final class DeviceSceneUtil { public static Scene newScene(Parent root, double width, double height) { return newScene(root, getFinalSceneBounds(width, height)); } public static Scene newScene(Parent root, double width, double height, Paint fill) { Scene scene = newScene(root, width, height); scene.setFill(fill); // Recommended to set a fill on the scene (ex: black) otherwise the Gluon version shows a white vertical line on the right side return scene; } public static Scene newScreenVisualBoundsScene(Parent root) { return newScene(root, getScreenVisualBounds()); } public static Scene newScreenVisualBoundsScene(Parent root, Paint fill) { Scene scene = newScreenVisualBoundsScene(root); scene.setFill(fill); // Recommended to set a fill on the scene (ex: black) otherwise the Gluon version shows a white vertical line on the right side return scene; } public static Rectangle2D getFinalSceneBounds(double width, double height) { return isAndroidOrIOS() ? getScreenVisualBounds() // Also ok if actually runs in the browser as the scene dimensions will be ignored : new Rectangle2D(0, 0, width, height); } public static Rectangle2D getSceneBoundsWithMaxPixelsCapOnDesktop(double maxPixels) { Rectangle2D screenVisualBounds = getScreenVisualBounds(); if (isAndroidOrIOS()) return screenVisualBounds; double w = screenVisualBounds.getWidth(), h = screenVisualBounds.getHeight(); // Trying full-screen double wh = w * h; if (wh <= maxPixels) return screenVisualBounds; double r = w / h; w = Math.sqrt(maxPixels * r); h = w / r; return new Rectangle2D(0, 0, w, h); } private static Rectangle2D getScreenVisualBounds() { return Screen.getPrimary().getVisualBounds(); } private static Scene newScene(Parent root, Rectangle2D finalSceneBounds) { return new Scene(root, finalSceneBounds.getWidth(), finalSceneBounds.getHeight()); } private static boolean isAndroidOrIOS() { return OperatingSystem.isMobile(); } public static void onFontsLoaded(Runnable runnable) { onObservableListEmpty(WebFxKitLauncher.loadingFonts(), runnable); } public static void onObservableListEmpty(ObservableList<Font> list, Runnable runnable) { if (!runIfObservableListEmpty(list, runnable)) list.addListener((ListChangeListener<Font>) c -> runIfObservableListEmpty(list, runnable)); } private static boolean runIfObservableListEmpty(ObservableList<Font> list, Runnable runnable) { boolean empty = list.isEmpty(); if (empty) runnable.run(); return empty; } public static void onImagesLoaded(Runnable runnable, Image... images) { if (!runIfImagesLoaded(runnable, images)) Arrays.stream(images).forEach(i -> i.progressProperty().addListener((observable, oldValue, newValue) -> runIfImagesLoaded(runnable, images))); } private static boolean runIfImagesLoaded(Runnable runnable, Image... images) { boolean loaded = Arrays.stream(images).allMatch(i -> i.getProgress() >= 1); if (loaded) runnable.run(); return loaded; } public static void onFontsAndImagesLoaded(Runnable runnable, Image... images) { onFontsLoaded(() -> onImagesLoaded(runnable, images)); } }
3,994
0.695
0.69175
105
37.095238
37.42078
156
false
false
0
0
0
0
0
0
0.752381
false
false
4
39b08d98e32d9cd157bf5cc1d492cde5b04eccae
601,295,479,127
8c9e56076ec59a8d1fbca733410b974ea2c41bb9
/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/repo/ExtensionRepoExtensionMetadata.java
fde9745a3b2795356b282bf5061e28940f38fe74
[ "CC0-1.0", "Apache-2.0", "MIT", "LicenseRef-scancode-unknown" ]
permissive
apache/nifi
https://github.com/apache/nifi
70329dca21ce61a643d5fac263ab101ae9313f5a
2b330d9feea82764721e6190f7320d49c73986b0
refs/heads/main
2023-09-04T00:50:15.639000
2023-08-31T16:41:08
2023-08-31T16:41:08
27,911,088
4,182
3,345
Apache-2.0
false
2023-09-14T20:56:07
2014-12-12T08:00:05
2023-09-14T10:07:16
2023-09-14T20:56:07
236,539
3,988
2,530
30
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.nifi.registry.extension.repo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.apache.nifi.extension.ExtensionMetadata; import org.apache.nifi.registry.link.LinkAdapter; import org.apache.nifi.registry.link.LinkableDocs; import org.apache.nifi.registry.link.LinkableEntity; import javax.ws.rs.core.Link; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.util.Comparator; @ApiModel public class ExtensionRepoExtensionMetadata extends LinkableEntity implements LinkableDocs, Comparable<ExtensionRepoExtensionMetadata> { private ExtensionMetadata extensionMetadata; private Link linkDocs; public ExtensionRepoExtensionMetadata() { } public ExtensionRepoExtensionMetadata(final ExtensionMetadata extensionMetadata) { this.extensionMetadata = extensionMetadata; } @ApiModelProperty(value = "The extension metadata") public ExtensionMetadata getExtensionMetadata() { return extensionMetadata; } public void setExtensionMetadata(ExtensionMetadata extensionMetadata) { this.extensionMetadata = extensionMetadata; } @Override @XmlElement @XmlJavaTypeAdapter(LinkAdapter.class) @ApiModelProperty(value = "A WebLink to the documentation for this extension.", dataType = "org.apache.nifi.registry.link.JaxbLink", readOnly = true) public Link getLinkDocs() { return linkDocs; } @Override public void setLinkDocs(Link link) { this.linkDocs = link; } @Override public int compareTo(ExtensionRepoExtensionMetadata o) { return Comparator.comparing(ExtensionRepoExtensionMetadata::getExtensionMetadata).compare(this, o); } }
UTF-8
Java
2,610
java
ExtensionRepoExtensionMetadata.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.nifi.registry.extension.repo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.apache.nifi.extension.ExtensionMetadata; import org.apache.nifi.registry.link.LinkAdapter; import org.apache.nifi.registry.link.LinkableDocs; import org.apache.nifi.registry.link.LinkableEntity; import javax.ws.rs.core.Link; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.util.Comparator; @ApiModel public class ExtensionRepoExtensionMetadata extends LinkableEntity implements LinkableDocs, Comparable<ExtensionRepoExtensionMetadata> { private ExtensionMetadata extensionMetadata; private Link linkDocs; public ExtensionRepoExtensionMetadata() { } public ExtensionRepoExtensionMetadata(final ExtensionMetadata extensionMetadata) { this.extensionMetadata = extensionMetadata; } @ApiModelProperty(value = "The extension metadata") public ExtensionMetadata getExtensionMetadata() { return extensionMetadata; } public void setExtensionMetadata(ExtensionMetadata extensionMetadata) { this.extensionMetadata = extensionMetadata; } @Override @XmlElement @XmlJavaTypeAdapter(LinkAdapter.class) @ApiModelProperty(value = "A WebLink to the documentation for this extension.", dataType = "org.apache.nifi.registry.link.JaxbLink", readOnly = true) public Link getLinkDocs() { return linkDocs; } @Override public void setLinkDocs(Link link) { this.linkDocs = link; } @Override public int compareTo(ExtensionRepoExtensionMetadata o) { return Comparator.comparing(ExtensionRepoExtensionMetadata::getExtensionMetadata).compare(this, o); } }
2,610
0.761686
0.760153
71
35.760563
31.097513
136
false
false
0
0
0
0
0
0
0.394366
false
false
4
5a3eea3bd2cd2cac08ef6b003af8ec6f83934d43
8,203,387,537,649
732a6fa36e14baf7f828ef19a62b515312f9a109
/channels/branches/report/src/main/java/com/mindalliance/channels/command/LockManager.java
40cf81a7c7572b6afbf61437de2030a5646ef2da
[]
no_license
gauravbvt/test
https://github.com/gauravbvt/test
4e991ad3e7dd5ea670ab88f3a74fe8a42418ec20
04e48c87ff5c2209fc4bc703795be3f954909c3a
refs/heads/master
2020-11-24T02:43:32.565000
2014-10-07T23:47:39
2014-10-07T23:47:39
100,468,202
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mindalliance.channels.command; import com.mindalliance.channels.command.Lock; import com.mindalliance.channels.command.LockingException; import com.mindalliance.channels.model.Identifiable; import java.util.Collection; /** * The manager of locks on model objects. * Copyright (C) 2008 Mind-Alliance Systems. All Rights Reserved. * Proprietary and Confidential. * User: jf * Date: Feb 28, 2009 * Time: 2:20:28 PM */ public interface LockManager { /** * Grab an exclusive, write lock on a model object. * The operation is idempotent if the lock is already grabbed by the user. * Return a lock or throws an exception if it failed. * * @param id a model object id * @return a lock * @throws com.mindalliance.channels.command.LockingException if lock could not be grabbed */ Lock grabLockOn( long id ) throws LockingException; /** * Release the user's lock on a model object. * Does nothing if the lock is not active. * * @param id a model object id * @return whether the lock needed to be released. * @throws LockingException if the lock was active but could not be released */ boolean releaseLockOn( long id ) throws LockingException; /** * Grab locks on all of a list of model objects. * * @param ids a collection of model object ids * @return a collection of locks actually grabbed or upgraded * @throws LockingException if any of the locks could not be grabbed */ Collection<Lock> grabLocksOn( Collection<Long> ids ) throws LockingException; /** * Release all listed locks unconditionally, failing silently if a lock is not active. * * @param locks a collection of locks on model objects * @throws LockingException if any lock was active but could not be released */ void releaseLocks( Collection<Lock> locks ) throws LockingException; /** * Whether user has write lock on a given model object. * * @param id a model object id * @return a boolean */ boolean isUserLocking( long id ); /** * Release all locks held by named user. * * @param userName a user name * @return a boolean -- whether any lock was released */ boolean releaseAllLocks( String userName ); /** * Get name of user with a lock on model object with given id. * * @param id a model object id * @return a string or null if no lock on model object */ String getLockOwner( long id ); /** * Get the user's lock on a model object. * * @param id a model object id * @return a lock or null if none */ Lock getLock( long id ); /** * Get all locks on all model objects for a user. * * @param userName a user's name * @return a collection of locks, possibly empty */ Collection<Lock> getAllLocks( String userName ); /** * Whether all given model objects with given ids could be locked by user. * * @param ids a collection of model object ids * @return a boolean */ boolean canGrabLocksOn( Collection<Long> ids ); /** * Resets lock manager */ void reset(); /** * Whether someone other than the user has a lock on the model object with given id. * * @param identifiable an identifiable * @return a boolean */ boolean isLockedByUser( Identifiable identifiable ); /** * Attempt to get lock on identitifiable * * @param identifiable an identifiable object * @return a boolean indiciating success (true) or failure (false) */ boolean requestLockOn( Identifiable identifiable ); /** * Attempt to get lock on identitifiable * * @param id an identifiable object's id * @return a boolean indiciating success (true) or failure (false) */ boolean requestLockOn( Long id ); /** * Attempt to release lock on identifiable, failing silently. * * @param identifiable an identifiable * @return a boolean - whether a lock was released */ boolean releaseAnyLockOn( Identifiable identifiable ); /** * Attempt to release lock on identifiable, failing silently. * * @param id an identifiable's id * @return a boolean - whether a lock was released */ boolean releaseAnyLockOn( Long id ); }
UTF-8
Java
4,404
java
LockManager.java
Java
[ { "context": "eserved.\n * Proprietary and Confidential.\n * User: jf\n * Date: Feb 28, 2009\n * Time: 2:20:28 PM\n */\npub", "end": 391, "score": 0.999466061592102, "start": 389, "tag": "USERNAME", "value": "jf" }, { "context": "all locks held by named user.\n *\n * @param userName a user name\n * @return a boolean -- whether a", "end": 2190, "score": 0.5250627398490906, "start": 2182, "tag": "USERNAME", "value": "userName" }, { "context": "eld by named user.\n *\n * @param userName a user name\n * @return a boolean -- whether any lock was ", "end": 2202, "score": 0.8263330459594727, "start": 2193, "tag": "USERNAME", "value": "user name" } ]
null
[]
package com.mindalliance.channels.command; import com.mindalliance.channels.command.Lock; import com.mindalliance.channels.command.LockingException; import com.mindalliance.channels.model.Identifiable; import java.util.Collection; /** * The manager of locks on model objects. * Copyright (C) 2008 Mind-Alliance Systems. All Rights Reserved. * Proprietary and Confidential. * User: jf * Date: Feb 28, 2009 * Time: 2:20:28 PM */ public interface LockManager { /** * Grab an exclusive, write lock on a model object. * The operation is idempotent if the lock is already grabbed by the user. * Return a lock or throws an exception if it failed. * * @param id a model object id * @return a lock * @throws com.mindalliance.channels.command.LockingException if lock could not be grabbed */ Lock grabLockOn( long id ) throws LockingException; /** * Release the user's lock on a model object. * Does nothing if the lock is not active. * * @param id a model object id * @return whether the lock needed to be released. * @throws LockingException if the lock was active but could not be released */ boolean releaseLockOn( long id ) throws LockingException; /** * Grab locks on all of a list of model objects. * * @param ids a collection of model object ids * @return a collection of locks actually grabbed or upgraded * @throws LockingException if any of the locks could not be grabbed */ Collection<Lock> grabLocksOn( Collection<Long> ids ) throws LockingException; /** * Release all listed locks unconditionally, failing silently if a lock is not active. * * @param locks a collection of locks on model objects * @throws LockingException if any lock was active but could not be released */ void releaseLocks( Collection<Lock> locks ) throws LockingException; /** * Whether user has write lock on a given model object. * * @param id a model object id * @return a boolean */ boolean isUserLocking( long id ); /** * Release all locks held by named user. * * @param userName a user name * @return a boolean -- whether any lock was released */ boolean releaseAllLocks( String userName ); /** * Get name of user with a lock on model object with given id. * * @param id a model object id * @return a string or null if no lock on model object */ String getLockOwner( long id ); /** * Get the user's lock on a model object. * * @param id a model object id * @return a lock or null if none */ Lock getLock( long id ); /** * Get all locks on all model objects for a user. * * @param userName a user's name * @return a collection of locks, possibly empty */ Collection<Lock> getAllLocks( String userName ); /** * Whether all given model objects with given ids could be locked by user. * * @param ids a collection of model object ids * @return a boolean */ boolean canGrabLocksOn( Collection<Long> ids ); /** * Resets lock manager */ void reset(); /** * Whether someone other than the user has a lock on the model object with given id. * * @param identifiable an identifiable * @return a boolean */ boolean isLockedByUser( Identifiable identifiable ); /** * Attempt to get lock on identitifiable * * @param identifiable an identifiable object * @return a boolean indiciating success (true) or failure (false) */ boolean requestLockOn( Identifiable identifiable ); /** * Attempt to get lock on identitifiable * * @param id an identifiable object's id * @return a boolean indiciating success (true) or failure (false) */ boolean requestLockOn( Long id ); /** * Attempt to release lock on identifiable, failing silently. * * @param identifiable an identifiable * @return a boolean - whether a lock was released */ boolean releaseAnyLockOn( Identifiable identifiable ); /** * Attempt to release lock on identifiable, failing silently. * * @param id an identifiable's id * @return a boolean - whether a lock was released */ boolean releaseAnyLockOn( Long id ); }
4,404
0.649637
0.646231
150
28.360001
25.887522
94
false
false
0
0
0
0
0
0
0.18
false
false
4
eeb83bb1451000cae637709ad4056d1a65da4701
1,365,799,656,503
eafae636c22b5d95db19e5271d58796bd7be4a66
/app-release-unsigned/sources/kotlinx/coroutines/flow/FlowKt__DelayKt$sample$2.java
042030d560578de4a1e96b784f586bc6e932896f
[]
no_license
agustrinaldokurniawan/News_Kotlin_Native
https://github.com/agustrinaldokurniawan/News_Kotlin_Native
5fb97e9c9199c464e64a6ef901b133c88da3db55
411f2ae0c01f2cc490f9b80a6b8f40196bc74176
refs/heads/main
2023-05-31T20:59:44.356000
2021-06-15T14:43:42
2021-06-15T14:43:42
377,077,236
0
0
null
false
2021-06-15T07:44:11
2021-06-15T07:38:27
2021-06-15T07:40:00
2021-06-15T07:44:11
0
0
0
0
null
false
false
package kotlinx.coroutines.flow; import androidx.exifinterface.media.ExifInterface; import kotlin.Metadata; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.coroutines.jvm.internal.DebugMetadata; import kotlin.coroutines.jvm.internal.SuspendLambda; import kotlin.jvm.functions.Function3; import kotlinx.coroutines.CoroutineScope; /* access modifiers changed from: package-private */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\u00020\u00032\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0005HยŠ@ยข\u0006\u0004\b\u0006\u0010\u0007"}, d2 = {"<anonymous>", "", ExifInterface.GPS_DIRECTION_TRUE, "Lkotlinx/coroutines/CoroutineScope;", "downstream", "Lkotlinx/coroutines/flow/FlowCollector;", "invoke", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"}, k = 3, mv = {1, 4, 0}) @DebugMetadata(c = "kotlinx.coroutines.flow.FlowKt__DelayKt$sample$2", f = "Delay.kt", i = {0, 0, 0, 0, 0}, l = {355}, m = "invokeSuspend", n = {"$this$scopedFlow", "downstream", "values", "lastValue", "ticker"}, s = {"L$0", "L$1", "L$2", "L$3", "L$4"}) /* compiled from: Delay.kt */ public final class FlowKt__DelayKt$sample$2 extends SuspendLambda implements Function3<CoroutineScope, FlowCollector<? super T>, Continuation<? super Unit>, Object> { final /* synthetic */ long $periodMillis; final /* synthetic */ Flow $this_sample; Object L$0; Object L$1; Object L$2; Object L$3; Object L$4; Object L$5; int label; private CoroutineScope p$; private FlowCollector p$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ FlowKt__DelayKt$sample$2(Flow flow, long j, Continuation continuation) { super(3, continuation); this.$this_sample = flow; this.$periodMillis = j; } public final Continuation<Unit> create(CoroutineScope coroutineScope, FlowCollector<? super T> flowCollector, Continuation<? super Unit> continuation) { FlowKt__DelayKt$sample$2 flowKt__DelayKt$sample$2 = new FlowKt__DelayKt$sample$2(this.$this_sample, this.$periodMillis, continuation); flowKt__DelayKt$sample$2.p$ = coroutineScope; flowKt__DelayKt$sample$2.p$0 = flowCollector; return flowKt__DelayKt$sample$2; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object, java.lang.Object] */ @Override // kotlin.jvm.functions.Function3 public final Object invoke(CoroutineScope coroutineScope, Object obj, Continuation<? super Unit> continuation) { return ((FlowKt__DelayKt$sample$2) create(coroutineScope, (FlowCollector) obj, continuation)).invokeSuspend(Unit.INSTANCE); } /* JADX WARNING: Can't wrap try/catch for region: R(13:9|10|11|12|13|14|15|21|(1:23)|(1:25)|26|7|(1:27)(0)) */ /* JADX WARNING: Code restructure failed: missing block: B:16:0x00c7, code lost: r0 = th; */ /* JADX WARNING: Code restructure failed: missing block: B:17:0x00c8, code lost: r3 = r8; */ /* JADX WARNING: Code restructure failed: missing block: B:20:0x00cf, code lost: r3.handleBuilderException(r0); */ /* JADX WARNING: Removed duplicated region for block: B:23:0x00dc */ /* JADX WARNING: Removed duplicated region for block: B:25:0x00e1 A[RETURN] */ /* JADX WARNING: Removed duplicated region for block: B:9:0x0074 */ @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl /* Code decompiled incorrectly, please refer to instructions dump. */ public final java.lang.Object invokeSuspend(java.lang.Object r20) { /* // Method dump skipped, instructions count: 231 */ throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.flow.FlowKt__DelayKt$sample$2.invokeSuspend(java.lang.Object):java.lang.Object"); } }
UTF-8
Java
4,060
java
FlowKt__DelayKt$sample$2.java
Java
[]
null
[]
package kotlinx.coroutines.flow; import androidx.exifinterface.media.ExifInterface; import kotlin.Metadata; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.coroutines.jvm.internal.DebugMetadata; import kotlin.coroutines.jvm.internal.SuspendLambda; import kotlin.jvm.functions.Function3; import kotlinx.coroutines.CoroutineScope; /* access modifiers changed from: package-private */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\u00020\u00032\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0005HยŠ@ยข\u0006\u0004\b\u0006\u0010\u0007"}, d2 = {"<anonymous>", "", ExifInterface.GPS_DIRECTION_TRUE, "Lkotlinx/coroutines/CoroutineScope;", "downstream", "Lkotlinx/coroutines/flow/FlowCollector;", "invoke", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"}, k = 3, mv = {1, 4, 0}) @DebugMetadata(c = "kotlinx.coroutines.flow.FlowKt__DelayKt$sample$2", f = "Delay.kt", i = {0, 0, 0, 0, 0}, l = {355}, m = "invokeSuspend", n = {"$this$scopedFlow", "downstream", "values", "lastValue", "ticker"}, s = {"L$0", "L$1", "L$2", "L$3", "L$4"}) /* compiled from: Delay.kt */ public final class FlowKt__DelayKt$sample$2 extends SuspendLambda implements Function3<CoroutineScope, FlowCollector<? super T>, Continuation<? super Unit>, Object> { final /* synthetic */ long $periodMillis; final /* synthetic */ Flow $this_sample; Object L$0; Object L$1; Object L$2; Object L$3; Object L$4; Object L$5; int label; private CoroutineScope p$; private FlowCollector p$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ FlowKt__DelayKt$sample$2(Flow flow, long j, Continuation continuation) { super(3, continuation); this.$this_sample = flow; this.$periodMillis = j; } public final Continuation<Unit> create(CoroutineScope coroutineScope, FlowCollector<? super T> flowCollector, Continuation<? super Unit> continuation) { FlowKt__DelayKt$sample$2 flowKt__DelayKt$sample$2 = new FlowKt__DelayKt$sample$2(this.$this_sample, this.$periodMillis, continuation); flowKt__DelayKt$sample$2.p$ = coroutineScope; flowKt__DelayKt$sample$2.p$0 = flowCollector; return flowKt__DelayKt$sample$2; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object, java.lang.Object] */ @Override // kotlin.jvm.functions.Function3 public final Object invoke(CoroutineScope coroutineScope, Object obj, Continuation<? super Unit> continuation) { return ((FlowKt__DelayKt$sample$2) create(coroutineScope, (FlowCollector) obj, continuation)).invokeSuspend(Unit.INSTANCE); } /* JADX WARNING: Can't wrap try/catch for region: R(13:9|10|11|12|13|14|15|21|(1:23)|(1:25)|26|7|(1:27)(0)) */ /* JADX WARNING: Code restructure failed: missing block: B:16:0x00c7, code lost: r0 = th; */ /* JADX WARNING: Code restructure failed: missing block: B:17:0x00c8, code lost: r3 = r8; */ /* JADX WARNING: Code restructure failed: missing block: B:20:0x00cf, code lost: r3.handleBuilderException(r0); */ /* JADX WARNING: Removed duplicated region for block: B:23:0x00dc */ /* JADX WARNING: Removed duplicated region for block: B:25:0x00e1 A[RETURN] */ /* JADX WARNING: Removed duplicated region for block: B:9:0x0074 */ @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl /* Code decompiled incorrectly, please refer to instructions dump. */ public final java.lang.Object invokeSuspend(java.lang.Object r20) { /* // Method dump skipped, instructions count: 231 */ throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.flow.FlowKt__DelayKt$sample$2.invokeSuspend(java.lang.Object):java.lang.Object"); } }
4,060
0.700591
0.63036
70
56.971428
80.617256
585
false
false
0
0
30
0.013307
0
0
1.5
false
false
4
86c7bbc5f4231c0324e0b11b38a1aa61aff59b43
19,799,799,288,812
a5c2946cc283859a8afd0ef0635d3e5c94a40bb8
/src/main/java/kholod/java_challenge/task1/GNodeWalker.java
8451b3cea5ad6a51de4e688af3fbea5867545c09
[]
no_license
khdimon/JavaChallengeTasks
https://github.com/khdimon/JavaChallengeTasks
e4c04682ccf1836eadc34075ece4865a7dca6a15
502721a96678ec17d244ea22c9bd9af551f505f9
refs/heads/master
2021-09-15T09:09:09.472000
2018-05-29T14:20:39
2018-05-29T14:33:49
114,730,988
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kholod.java_challenge.task1; import java.util.ArrayList; public class GNodeWalker { public ArrayList<GNode> walkGraph(GNode node) { ArrayList<GNode> nodes = new ArrayList<>(); walkGraph(node, nodes); return nodes; } private void walkGraph(GNode node, ArrayList<GNode> nodes) { if (!nodes.contains(node)) { nodes.add(node); } for (GNode n : node.getChildren()) { walkGraph(n, nodes); } } }
UTF-8
Java
497
java
GNodeWalker.java
Java
[]
null
[]
package kholod.java_challenge.task1; import java.util.ArrayList; public class GNodeWalker { public ArrayList<GNode> walkGraph(GNode node) { ArrayList<GNode> nodes = new ArrayList<>(); walkGraph(node, nodes); return nodes; } private void walkGraph(GNode node, ArrayList<GNode> nodes) { if (!nodes.contains(node)) { nodes.add(node); } for (GNode n : node.getChildren()) { walkGraph(n, nodes); } } }
497
0.587525
0.585513
21
22.666666
19.352207
64
false
false
0
0
0
0
0
0
0.47619
false
false
4
bab4f34a9f8ef7a386f7672a19962510e99c890b
29,781,303,290,676
5694e0ee83ba7f61433b8d451f208bb9b1a617c2
/src/main/java/com/javamultiplex/dsa/array/SecondLargest.java
739519fbefc4b967f4aaa8bef44eace646e1ba24
[]
no_license
javamultiplex/dsa-workshop
https://github.com/javamultiplex/dsa-workshop
bc3bd3bbced795b0ff1252e0b260a31227cb9183
55071b8ef48aa07e2c7b2f69b6d97932ae572f06
refs/heads/master
2023-05-29T09:47:34.536000
2021-06-05T10:13:16
2021-06-05T10:13:16
320,840,105
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javamultiplex.dsa.array; /** * @author Rohit Agarwal on 02/06/21 11:43 pm * @copyright www.javamultiplex.com */ public class SecondLargest { public static int v1(int[] arr) { int n = arr.length; int largest = 0; for (int i = 1; i < n; i++) { if (arr[i] > arr[largest]) { largest = i; } } int secondLargest = -1; for (int i = 0; i < n; i++) { if (arr[i] != arr[largest]) { if (secondLargest == -1) { secondLargest = i; } if (arr[i] > arr[secondLargest]) { secondLargest = i; } } } return secondLargest; } public static int v2(int[] arr) { int n = arr.length; int largest = 0, secondLargest = -1; for (int i = 1; i < n; i++) { if (arr[i] > arr[largest]) { secondLargest = largest; largest = i; } else if (arr[i] < arr[largest]) { if (secondLargest == -1 || arr[i] > arr[secondLargest]) { secondLargest = i; } } } return secondLargest; } public static void main(String[] args) { System.out.println(v1(new int[]{10, 5, 8, 20})); System.out.println(v1(new int[]{20, 10, 20, 8, 12})); System.out.println(v1(new int[]{10, 10, 10})); System.out.println("********"); System.out.println(v2(new int[]{10, 5, 8, 20})); System.out.println(v2(new int[]{20, 10, 20, 8, 12})); System.out.println(v2(new int[]{10, 10, 10})); } }
UTF-8
Java
1,706
java
SecondLargest.java
Java
[ { "context": "ckage com.javamultiplex.dsa.array;\n\n/**\n * @author Rohit Agarwal on 02/06/21 11:43 pm\n * @copyright www.javamultip", "end": 66, "score": 0.9998568892478943, "start": 53, "tag": "NAME", "value": "Rohit Agarwal" } ]
null
[]
package com.javamultiplex.dsa.array; /** * @author <NAME> on 02/06/21 11:43 pm * @copyright www.javamultiplex.com */ public class SecondLargest { public static int v1(int[] arr) { int n = arr.length; int largest = 0; for (int i = 1; i < n; i++) { if (arr[i] > arr[largest]) { largest = i; } } int secondLargest = -1; for (int i = 0; i < n; i++) { if (arr[i] != arr[largest]) { if (secondLargest == -1) { secondLargest = i; } if (arr[i] > arr[secondLargest]) { secondLargest = i; } } } return secondLargest; } public static int v2(int[] arr) { int n = arr.length; int largest = 0, secondLargest = -1; for (int i = 1; i < n; i++) { if (arr[i] > arr[largest]) { secondLargest = largest; largest = i; } else if (arr[i] < arr[largest]) { if (secondLargest == -1 || arr[i] > arr[secondLargest]) { secondLargest = i; } } } return secondLargest; } public static void main(String[] args) { System.out.println(v1(new int[]{10, 5, 8, 20})); System.out.println(v1(new int[]{20, 10, 20, 8, 12})); System.out.println(v1(new int[]{10, 10, 10})); System.out.println("********"); System.out.println(v2(new int[]{10, 5, 8, 20})); System.out.println(v2(new int[]{20, 10, 20, 8, 12})); System.out.println(v2(new int[]{10, 10, 10})); } }
1,699
0.447245
0.4068
59
27.915255
19.181814
73
false
false
0
0
0
0
0
0
0.813559
false
false
4
d33d0175bc9ec6cef6eecf8c35e62e6c8bc9a769
33,663,953,722,148
b766f67883944f9a4ecd469aba3fc74186187c66
/src/models/ExpressionNullValue.java
cf26f995585c28d631630614189e06d322d82fce
[]
no_license
VincenzoMastandrea/DeadlockTool
https://github.com/VincenzoMastandrea/DeadlockTool
f996d78cf48bda35a1a642d3dfa1606229277ddd
450bdeef1efadbd11016d852ce90de397ff2d0bd
refs/heads/master
2020-12-31T04:56:41.942000
2016-06-03T14:31:24
2016-06-03T14:31:24
56,604,145
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package models; /** * @author Vincenzo Mastandrea * Represents the null value expression */ public class ExpressionNullValue extends ExpressionValue { /** * Creates the null value expression */ public ExpressionNullValue(){ super(null); } }
UTF-8
Java
273
java
ExpressionNullValue.java
Java
[ { "context": "package models;\r\n\r\n/**\r\n * @author Vincenzo Mastandrea\r\n * Represents the null value expression\r\n */\r\npu", "end": 54, "score": 0.999863862991333, "start": 35, "tag": "NAME", "value": "Vincenzo Mastandrea" } ]
null
[]
package models; /** * @author <NAME> * Represents the null value expression */ public class ExpressionNullValue extends ExpressionValue { /** * Creates the null value expression */ public ExpressionNullValue(){ super(null); } }
260
0.673993
0.673993
15
16.200001
17.615145
58
false
false
0
0
0
0
0
0
0.8
false
false
4
971adbb4131d8082d55efe5ac53dcd5e5b8dfa75
33,148,557,592,692
513303394e2e893f47db8c8566550cafc52f038e
/source/com.microsoft.tfs.core/src/com/microsoft/tfs/core/clients/build/internal/soapextensions/BuildRequest2010.java
b506483b136802343920c9cf9d7f0b1197d91bbe
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
microsoft/team-explorer-everywhere
https://github.com/microsoft/team-explorer-everywhere
8d925ec1932c865074fc08c062255f3d879c6a0c
ff54dc1ba266cbb8f34222e2a2b4db466a271ea1
refs/heads/master
2023-08-29T14:48:56.904000
2022-09-01T19:49:06
2022-09-01T19:49:06
52,110,673
108
76
NOASSERTION
false
2023-04-22T16:45:18
2016-02-19T19:20:02
2023-04-11T00:04:24
2023-04-22T16:45:11
46,545
287
102
76
Java
false
false
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See License.txt in the repository root. package com.microsoft.tfs.core.clients.build.internal.soapextensions; import com.microsoft.tfs.core.clients.build.flags.BuildReason2010; import com.microsoft.tfs.core.clients.build.flags.GetOption2010; import com.microsoft.tfs.core.clients.build.flags.QueuePriority2010; import com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper; import ms.tfs.build.buildservice._03._BuildRequest; public class BuildRequest2010 extends WebServiceObjectWrapper { private BuildRequest2010() { this(new _BuildRequest()); } public BuildRequest2010(final _BuildRequest value) { super(value); } public BuildRequest2010(final BuildRequest request) { this(); setBuildAgentURI(request.getBuildControllerURI()); setBuildControllerURI(request.getBuildControllerURI()); setBuildDefinitionURI(request.getBuildDefinitionURI()); setCustomGetVersion(request.getCustomGetVersion()); setDropLocation(request.getDropLocation()); setGatedCheckInTicket(request.getGatedCheckInTicket()); setGetOption(TFS2010Helper.convert(request.getGetOption())); setMaxQueuePosition(request.getMaxQueuePosition()); setPostponed(request.isPostponed()); setPriority(TFS2010Helper.convert(request.getPriority())); setProcessParameters(request.getProcessParameters()); setReason(TFS2010Helper.convert(request.getReason())); setRequestedFor(request.getRequestedFor()); setShelvesetName(request.getShelvesetName()); } public _BuildRequest getWebServiceObject() { return (_BuildRequest) webServiceObject; } public String getBuildAgentURI() { return getWebServiceObject().getBuildAgentUri(); } public String getBuildControllerURI() { return getWebServiceObject().getBuildControllerUri(); } public String getBuildDefinitionURI() { return getWebServiceObject().getBuildDefinitionUri(); } public String getCustomGetVersion() { return getWebServiceObject().getCustomGetVersion(); } public String getDropLocation() { return getWebServiceObject().getDropLocation(); } public String getGatedCheckInTicket() { return getWebServiceObject().getCheckInTicket(); } public GetOption2010 getGetOption() { return GetOption2010.fromWebServiceObject(getWebServiceObject().getGetOption()); } public int getMaxQueuePosition() { return getWebServiceObject().getMaxQueuePosition(); } public boolean isPostponed() { return getWebServiceObject().isPostponed(); } public QueuePriority2010 getPriority() { return QueuePriority2010.fromWebServiceObject(getWebServiceObject().getPriority()); } public String getProcessParameters() { return getWebServiceObject().getProcessParameters(); } public BuildReason2010 getReason() { return BuildReason2010.fromWebServiceObject(getWebServiceObject().getReason()); } public String getRequestedFor() { return getWebServiceObject().getRequestedFor(); } public String getShelvesetName() { return getWebServiceObject().getShelvesetName(); } public void setBuildAgentURI(final String value) { getWebServiceObject().setBuildAgentUri(value); } public void setBuildControllerURI(final String value) { getWebServiceObject().setBuildControllerUri(value); } public void setBuildDefinitionURI(final String value) { getWebServiceObject().setBuildDefinitionUri(value); } public void setCustomGetVersion(final String value) { getWebServiceObject().setCustomGetVersion(value); } public void setDropLocation(final String value) { getWebServiceObject().setDropLocation(value); } public void setGatedCheckInTicket(final String value) { getWebServiceObject().setCheckInTicket(value); } public void setGetOption(final GetOption2010 value) { getWebServiceObject().setGetOption(value.getWebServiceObject()); } public void setMaxQueuePosition(final int value) { getWebServiceObject().setMaxQueuePosition(value); } public void setPostponed(final boolean value) { getWebServiceObject().setPostponed(value); } public void setPriority(final QueuePriority2010 value) { getWebServiceObject().setPriority(value.getWebServiceObject()); } public void setProcessParameters(final String value) { getWebServiceObject().setProcessParameters(value); } public void setReason(final BuildReason2010 value) { getWebServiceObject().setReason(value.getWebServiceObject()); } public void setRequestedFor(final String value) { getWebServiceObject().setRequestedFor(value); } public void setShelvesetName(final String value) { getWebServiceObject().setShelvesetName(value); } }
UTF-8
Java
5,082
java
BuildRequest2010.java
Java
[]
null
[]
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See License.txt in the repository root. package com.microsoft.tfs.core.clients.build.internal.soapextensions; import com.microsoft.tfs.core.clients.build.flags.BuildReason2010; import com.microsoft.tfs.core.clients.build.flags.GetOption2010; import com.microsoft.tfs.core.clients.build.flags.QueuePriority2010; import com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper; import ms.tfs.build.buildservice._03._BuildRequest; public class BuildRequest2010 extends WebServiceObjectWrapper { private BuildRequest2010() { this(new _BuildRequest()); } public BuildRequest2010(final _BuildRequest value) { super(value); } public BuildRequest2010(final BuildRequest request) { this(); setBuildAgentURI(request.getBuildControllerURI()); setBuildControllerURI(request.getBuildControllerURI()); setBuildDefinitionURI(request.getBuildDefinitionURI()); setCustomGetVersion(request.getCustomGetVersion()); setDropLocation(request.getDropLocation()); setGatedCheckInTicket(request.getGatedCheckInTicket()); setGetOption(TFS2010Helper.convert(request.getGetOption())); setMaxQueuePosition(request.getMaxQueuePosition()); setPostponed(request.isPostponed()); setPriority(TFS2010Helper.convert(request.getPriority())); setProcessParameters(request.getProcessParameters()); setReason(TFS2010Helper.convert(request.getReason())); setRequestedFor(request.getRequestedFor()); setShelvesetName(request.getShelvesetName()); } public _BuildRequest getWebServiceObject() { return (_BuildRequest) webServiceObject; } public String getBuildAgentURI() { return getWebServiceObject().getBuildAgentUri(); } public String getBuildControllerURI() { return getWebServiceObject().getBuildControllerUri(); } public String getBuildDefinitionURI() { return getWebServiceObject().getBuildDefinitionUri(); } public String getCustomGetVersion() { return getWebServiceObject().getCustomGetVersion(); } public String getDropLocation() { return getWebServiceObject().getDropLocation(); } public String getGatedCheckInTicket() { return getWebServiceObject().getCheckInTicket(); } public GetOption2010 getGetOption() { return GetOption2010.fromWebServiceObject(getWebServiceObject().getGetOption()); } public int getMaxQueuePosition() { return getWebServiceObject().getMaxQueuePosition(); } public boolean isPostponed() { return getWebServiceObject().isPostponed(); } public QueuePriority2010 getPriority() { return QueuePriority2010.fromWebServiceObject(getWebServiceObject().getPriority()); } public String getProcessParameters() { return getWebServiceObject().getProcessParameters(); } public BuildReason2010 getReason() { return BuildReason2010.fromWebServiceObject(getWebServiceObject().getReason()); } public String getRequestedFor() { return getWebServiceObject().getRequestedFor(); } public String getShelvesetName() { return getWebServiceObject().getShelvesetName(); } public void setBuildAgentURI(final String value) { getWebServiceObject().setBuildAgentUri(value); } public void setBuildControllerURI(final String value) { getWebServiceObject().setBuildControllerUri(value); } public void setBuildDefinitionURI(final String value) { getWebServiceObject().setBuildDefinitionUri(value); } public void setCustomGetVersion(final String value) { getWebServiceObject().setCustomGetVersion(value); } public void setDropLocation(final String value) { getWebServiceObject().setDropLocation(value); } public void setGatedCheckInTicket(final String value) { getWebServiceObject().setCheckInTicket(value); } public void setGetOption(final GetOption2010 value) { getWebServiceObject().setGetOption(value.getWebServiceObject()); } public void setMaxQueuePosition(final int value) { getWebServiceObject().setMaxQueuePosition(value); } public void setPostponed(final boolean value) { getWebServiceObject().setPostponed(value); } public void setPriority(final QueuePriority2010 value) { getWebServiceObject().setPriority(value.getWebServiceObject()); } public void setProcessParameters(final String value) { getWebServiceObject().setProcessParameters(value); } public void setReason(final BuildReason2010 value) { getWebServiceObject().setReason(value.getWebServiceObject()); } public void setRequestedFor(final String value) { getWebServiceObject().setRequestedFor(value); } public void setShelvesetName(final String value) { getWebServiceObject().setShelvesetName(value); } }
5,082
0.717631
0.702283
156
31.576923
27.730858
91
false
false
0
0
0
0
0
0
0.333333
false
false
4
7ab0744068c57156d9d1d274c600f2be097703d5
15,178,414,435,576
6f672fb72caedccb841ee23f53e32aceeaf1895e
/wallmart-source/src/com/walmart/android/app/item/ItemDetailsPresenter$26.java
47d13137a32fd59fd932037616b949a568b38809
[]
no_license
cha63506/CompSecurity
https://github.com/cha63506/CompSecurity
5c69743f660b9899146ed3cf21eceabe3d5f4280
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
refs/heads/master
2018-03-23T04:15:18.480000
2015-12-19T01:29:58
2015-12-19T01:29:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.walmart.android.app.item; import com.walmartlabs.kangaroo.CallbackSameThread; import com.walmartlabs.kangaroo.Request; import com.walmartlabs.kangaroo.Result; // Referenced classes of package com.walmart.android.app.item: // ItemDetailsPresenter class val.itemId extends CallbackSameThread { final ItemDetailsPresenter this$0; final String val$itemId; public void onResultSameThread(Request request, Result result) { super.onResultSameThread(request, result); ItemDetailsPresenter.access$5200(ItemDetailsPresenter.this, request, result, val$itemId); } () { this$0 = final_itemdetailspresenter; val$itemId = String.this; super(); } }
UTF-8
Java
909
java
ItemDetailsPresenter$26.java
Java
[ { "context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus", "end": 61, "score": 0.9996864795684814, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.walmart.android.app.item; import com.walmartlabs.kangaroo.CallbackSameThread; import com.walmartlabs.kangaroo.Request; import com.walmartlabs.kangaroo.Result; // Referenced classes of package com.walmart.android.app.item: // ItemDetailsPresenter class val.itemId extends CallbackSameThread { final ItemDetailsPresenter this$0; final String val$itemId; public void onResultSameThread(Request request, Result result) { super.onResultSameThread(request, result); ItemDetailsPresenter.access$5200(ItemDetailsPresenter.this, request, result, val$itemId); } () { this$0 = final_itemdetailspresenter; val$itemId = String.this; super(); } }
899
0.722772
0.708471
32
27.40625
25.989012
97
false
false
0
0
0
0
0
0
0.5
false
false
4
77b2fa04c6c6091a35f0a1ea7802aff52cb803a3
12,386,685,696,027
5b9fe5339a689c09edfc37c228bdf4229205809d
/Acme-Demos-2.0/src/main/java/domain/Actor.java
95fa7d55b78c67191b1e394ba13115f9145bb928
[]
no_license
rrodriguezos/Demos-2.0
https://github.com/rrodriguezos/Demos-2.0
220d46b8ee36766e1340733b56c38217c216ee3c
b0661549c71a1ac00422d745c6dce0ebc2909fa9
refs/heads/master
2021-01-13T02:51:19.357000
2017-01-03T12:03:25
2017-01-03T12:03:25
77,135,594
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package domain; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.OneToOne; import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.SafeHtml; import org.hibernate.validator.constraints.SafeHtml.WhiteListType; import security.UserAccount; @Entity @Access(AccessType.PROPERTY) public abstract class Actor extends DomainEntity { private String name; private String surname; private String phone; private String emailAddress; // Constructors................... public Actor() { super(); } // Getters and Setters........ @NotBlank @SafeHtml(whitelistType = WhiteListType.NONE) public String getName() { return name; } public void setName(String name) { this.name = name; } @NotBlank @SafeHtml(whitelistType = WhiteListType.NONE) public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } @SafeHtml(whitelistType = WhiteListType.NONE) public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @SafeHtml(whitelistType = WhiteListType.NONE) @Email public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } // Relationships ---------------------------------------------------------- private UserAccount userAccount; @OneToOne(optional = false, cascade = CascadeType.ALL) @NotNull @Valid public UserAccount getUserAccount() { return userAccount; } public void setUserAccount(UserAccount userAccount) { this.userAccount = userAccount; } }
UTF-8
Java
2,011
java
Actor.java
Java
[]
null
[]
package domain; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.OneToOne; import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.SafeHtml; import org.hibernate.validator.constraints.SafeHtml.WhiteListType; import security.UserAccount; @Entity @Access(AccessType.PROPERTY) public abstract class Actor extends DomainEntity { private String name; private String surname; private String phone; private String emailAddress; // Constructors................... public Actor() { super(); } // Getters and Setters........ @NotBlank @SafeHtml(whitelistType = WhiteListType.NONE) public String getName() { return name; } public void setName(String name) { this.name = name; } @NotBlank @SafeHtml(whitelistType = WhiteListType.NONE) public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } @SafeHtml(whitelistType = WhiteListType.NONE) public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @SafeHtml(whitelistType = WhiteListType.NONE) @Email public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } // Relationships ---------------------------------------------------------- private UserAccount userAccount; @OneToOne(optional = false, cascade = CascadeType.ALL) @NotNull @Valid public UserAccount getUserAccount() { return userAccount; } public void setUserAccount(UserAccount userAccount) { this.userAccount = userAccount; } }
2,011
0.705122
0.705122
89
20.595505
19.286556
76
false
false
0
0
0
0
0
0
1.044944
false
false
4
1d46f990f9b79a824561f66ae2de829ec4564e0a
13,692,355,784,078
b4aa7339ae0dac1e4beaaaaf555c3b9d31eefb64
/RandomArtist/DiamondDingus.java
75f7aee61d335d5376f58b80fe65136c006e88b6
[]
no_license
ilseweites/DBL
https://github.com/ilseweites/DBL
d362c1db8af62ba84d9b6e9c80697c69709923bd
07711ebe8e67f5743bdc610aab0cbf73fe56fa21
refs/heads/master
2023-04-18T22:49:49.443000
2021-04-22T11:44:26
2021-04-22T11:44:26
360,167,679
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.Graphics; class DiamondDingus extends Dingus { protected int radius; protected boolean filled; //true: filled, false: outline public DiamondDingus(int maxX, int maxY) { // intialize randomly the Dingus properties, i.e., position and color super(maxX, maxY); // initialize randomly the CircleDingus properties, i.e., radius and filledness filled = random.nextBoolean(); y = 2*x; //makes the length of the triangles 2 times the width of the triangle } @Override void draw(Graphics g) { //Defines x and y coordinates of the top triangle of the diamond int[] xPoints = {(x), (x + x/2), (x + x)}; int[] yPoints = {y + y/2, y, y + y/2}; //Defines x and y coordinates of the bottom triangle of the diamond int[] xPoints2 = {(x), (x + x/2), (x + x)}; int[] yPoints2 = {y + y/2, y + y, y + y/2}; //Creates the top triangle of the diamond g.setColor(color); //Creates random color if (filled) //if the triangle is filled draws filled triangle g.fillPolygon(xPoints, yPoints, 3); else //if the triangle is not filled draws outline triangle g.drawPolygon(xPoints, yPoints, 3); //Creates the bottom triangle of the diamond g.setColor(color); //Creates random color if (filled) //if the triangle is filled draws filled triangle g.fillPolygon(xPoints2, yPoints2, 3); else //if the triangle is not filled draws outline triangle g.drawPolygon(xPoints2, yPoints2, 3); } }
UTF-8
Java
1,609
java
DiamondDingus.java
Java
[]
null
[]
import java.awt.Graphics; class DiamondDingus extends Dingus { protected int radius; protected boolean filled; //true: filled, false: outline public DiamondDingus(int maxX, int maxY) { // intialize randomly the Dingus properties, i.e., position and color super(maxX, maxY); // initialize randomly the CircleDingus properties, i.e., radius and filledness filled = random.nextBoolean(); y = 2*x; //makes the length of the triangles 2 times the width of the triangle } @Override void draw(Graphics g) { //Defines x and y coordinates of the top triangle of the diamond int[] xPoints = {(x), (x + x/2), (x + x)}; int[] yPoints = {y + y/2, y, y + y/2}; //Defines x and y coordinates of the bottom triangle of the diamond int[] xPoints2 = {(x), (x + x/2), (x + x)}; int[] yPoints2 = {y + y/2, y + y, y + y/2}; //Creates the top triangle of the diamond g.setColor(color); //Creates random color if (filled) //if the triangle is filled draws filled triangle g.fillPolygon(xPoints, yPoints, 3); else //if the triangle is not filled draws outline triangle g.drawPolygon(xPoints, yPoints, 3); //Creates the bottom triangle of the diamond g.setColor(color); //Creates random color if (filled) //if the triangle is filled draws filled triangle g.fillPolygon(xPoints2, yPoints2, 3); else //if the triangle is not filled draws outline triangle g.drawPolygon(xPoints2, yPoints2, 3); } }
1,609
0.618397
0.607209
38
41.36842
25.90308
87
false
false
0
0
0
0
0
0
1.026316
false
false
4
62b440697e43541b019f52434f6b0d8f9bbc7d9c
15,539,191,696,920
24d824d9c05517de29db90c1c4e7229915f5b0ef
/sampleapp/app/src/main/java/com/zapptitude/sampleapp/Activities/ZappActivity/Interfaces/ILoggable.java
c2e31c43df65bbf393ed3c2c17a96d02abaed46e
[]
no_license
zapptitude/android-sdk
https://github.com/zapptitude/android-sdk
525c69eceb1f9feb0860b5692c90482a7f2e058c
9a5f1c46208e25bcce155e8c81bd2d950fec6052
refs/heads/master
2021-01-17T19:01:02.725000
2018-11-02T19:33:42
2018-11-02T19:33:42
59,984,949
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zapptitude.sampleapp.Activities.ZappActivity.Interfaces; /** * Created by andrew on 11.04.16. */ public interface ILoggable { String log(); }
UTF-8
Java
163
java
ILoggable.java
Java
[ { "context": "vities.ZappActivity.Interfaces;\n\n/**\n * Created by andrew on 11.04.16.\n */\npublic interface ILoggable {\n", "end": 91, "score": 0.6201644539833069, "start": 88, "tag": "USERNAME", "value": "and" }, { "context": "es.ZappActivity.Interfaces;\n\n/**\n * Created by andrew on 11.04.16.\n */\npublic interface ILoggable {\n\n ", "end": 94, "score": 0.6059464812278748, "start": 91, "tag": "NAME", "value": "rew" } ]
null
[]
package com.zapptitude.sampleapp.Activities.ZappActivity.Interfaces; /** * Created by andrew on 11.04.16. */ public interface ILoggable { String log(); }
163
0.717791
0.680982
10
15.3
21.128416
68
false
false
0
0
0
0
0
0
0.2
false
false
4
f867a5799896edadba4b323a991baf602d8bdbc7
32,100,585,599,455
f526a005b98fbf32e5a9be3cf484466c08f81ca4
/maohx2/app/src/main/java/com/maohx2/ina/Battle/BattleRockCreater.java
48948b1b9e77ce1fe6720dc61ed0c6f543920a39
[]
no_license
team-maoh/maoh-twice
https://github.com/team-maoh/maoh-twice
971afe28fe7772ebf4f5dd8e2aca263fe0261d29
eee3d26c2394b279cd32ad365853aa6bc26166b8
refs/heads/master
2021-06-25T13:03:55.241000
2018-05-12T16:29:51
2018-05-12T16:29:51
100,003,259
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.maohx2.ina.Battle; import com.maohx2.ina.Draw.Graphic; /** * Created by user on 2018/05/06. */ public class BattleRockCreater { static Graphic graphic; private BattleRockCreater(){}; public static void setGraphic(Graphic _graphic) { graphic = _graphic; } static BattleBaseUnitData getBattleBaseUnitData(int _hp, int _defence) { BattleBaseUnitData tempBBUD = new BattleBaseUnitData(); tempBBUD.setName("ๅฒฉ");//ไปฎ tempBBUD.setDbStatus(BattleBaseUnitData.DbStatusID.InitialHP, _hp); tempBBUD.setDbStatus(BattleBaseUnitData.DbStatusID.InitialDefence, _defence); tempBBUD.setDbStatus(BattleBaseUnitData.DbStatusID.AttackFlame, 0); tempBBUD.setBitmapData(graphic.searchBitmap("rock01"));//ไปฎ tempBBUD.setRadius(70); //HPใ€defenceๆ ผ็ดใ€‚ใƒœใƒผใƒŠใ‚นใ‚„ๆˆ้•ทใฏ0ใ€‚ใƒ‰ใƒญใƒƒใƒ—ใ‚ขใ‚คใƒ†ใƒ ใฏ็„กใ—ใซใ—ใฆใŠใใ€‚ //ๅˆฅ้€”ใƒ‰ใƒญใƒƒใƒ—่จญๅฎšใŒๅฟ…่ฆ return tempBBUD; } }
UTF-8
Java
1,010
java
BattleRockCreater.java
Java
[ { "context": "rt com.maohx2.ina.Draw.Graphic;\n\n/**\n * Created by user on 2018/05/06.\n */\n\npublic class BattleRockCreate", "end": 91, "score": 0.9887563586235046, "start": 87, "tag": "USERNAME", "value": "user" } ]
null
[]
package com.maohx2.ina.Battle; import com.maohx2.ina.Draw.Graphic; /** * Created by user on 2018/05/06. */ public class BattleRockCreater { static Graphic graphic; private BattleRockCreater(){}; public static void setGraphic(Graphic _graphic) { graphic = _graphic; } static BattleBaseUnitData getBattleBaseUnitData(int _hp, int _defence) { BattleBaseUnitData tempBBUD = new BattleBaseUnitData(); tempBBUD.setName("ๅฒฉ");//ไปฎ tempBBUD.setDbStatus(BattleBaseUnitData.DbStatusID.InitialHP, _hp); tempBBUD.setDbStatus(BattleBaseUnitData.DbStatusID.InitialDefence, _defence); tempBBUD.setDbStatus(BattleBaseUnitData.DbStatusID.AttackFlame, 0); tempBBUD.setBitmapData(graphic.searchBitmap("rock01"));//ไปฎ tempBBUD.setRadius(70); //HPใ€defenceๆ ผ็ดใ€‚ใƒœใƒผใƒŠใ‚นใ‚„ๆˆ้•ทใฏ0ใ€‚ใƒ‰ใƒญใƒƒใƒ—ใ‚ขใ‚คใƒ†ใƒ ใฏ็„กใ—ใซใ—ใฆใŠใใ€‚ //ๅˆฅ้€”ใƒ‰ใƒญใƒƒใƒ—่จญๅฎšใŒๅฟ…่ฆ return tempBBUD; } }
1,010
0.693059
0.675705
35
25.342857
26.935843
85
false
false
0
0
0
0
0
0
0.485714
false
false
4
dc0dbdfa499f4e7865769c31f32b6a7a7dd49cb7
19,524,921,350,230
69aead87c37150d7cd6f02ec2a84d74bd725091f
/dynamic-datasource-sharding-jdbc-02/src/test/java/com/learn/shardingjdbc02/OrderMapperTest.java
9b66e2878df0e710bf2897599843db4596a91e2e
[]
no_license
KKsmall/springboot-demo
https://github.com/KKsmall/springboot-demo
1bc07ab4a0559690bfa3e9eba9a039ebcd06b5f4
467925ae0ad28fb071b2f7c81ed9a918a8d9bcd7
refs/heads/master
2023-08-03T09:30:17.481000
2020-03-20T07:38:26
2020-03-20T07:38:26
248,694,853
0
1
null
false
2023-07-23T09:16:14
2020-03-20T07:35:56
2020-03-20T07:38:38
2023-07-23T09:16:13
113
0
1
10
Java
false
false
package com.learn.shardingjdbc02; import com.learn.shardingjdbc02.dataobject.OrderDO; import com.learn.shardingjdbc02.mapper.OrderMapper; import org.apache.shardingsphere.api.hint.HintManager; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @author liujin * @datetime 2020/3/10 13:55 */ @RunWith(SpringRunner.class) @SpringBootTest(classes = DynamicDatasourceShardingJdbc02Application.class) public class OrderMapperTest { @Autowired private OrderMapper orderMapper; @Test public void testSelectById() { // ๆต‹่ฏ•ไปŽๅบ“็š„่ดŸ่ฝฝๅ‡่กก for (int i = 0; i < 10; i++) { OrderDO order = orderMapper.selectById(1); System.out.println(order); } } @Test public void testSelectById02() { // ๆต‹่ฏ•ๅผบๅˆถ่ฎฟ้—ฎไธปๅบ“ try (HintManager hintManager = HintManager.getInstance()) { // ่ฎพ็ฝฎๅผบๅˆถ่ฎฟ้—ฎไธปๅบ“ hintManager.setMasterRouteOnly(); // ๆ‰ง่กŒๆŸฅ่ฏข OrderDO order = orderMapper.selectById(1); System.out.println(order); } } @Test public void testInsert() { // ๆ’ๅ…ฅ OrderDO order = new OrderDO(); order.setUserId(10); orderMapper.insert(order); } }
UTF-8
Java
1,485
java
OrderMapperTest.java
Java
[ { "context": "st.context.junit4.SpringRunner;\r\n\r\n/**\r\n * @author liujin\r\n * @datetime 2020/3/10 13:55\r\n */\r\n@RunWith(Spri", "end": 469, "score": 0.9995914101600647, "start": 463, "tag": "USERNAME", "value": "liujin" } ]
null
[]
package com.learn.shardingjdbc02; import com.learn.shardingjdbc02.dataobject.OrderDO; import com.learn.shardingjdbc02.mapper.OrderMapper; import org.apache.shardingsphere.api.hint.HintManager; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @author liujin * @datetime 2020/3/10 13:55 */ @RunWith(SpringRunner.class) @SpringBootTest(classes = DynamicDatasourceShardingJdbc02Application.class) public class OrderMapperTest { @Autowired private OrderMapper orderMapper; @Test public void testSelectById() { // ๆต‹่ฏ•ไปŽๅบ“็š„่ดŸ่ฝฝๅ‡่กก for (int i = 0; i < 10; i++) { OrderDO order = orderMapper.selectById(1); System.out.println(order); } } @Test public void testSelectById02() { // ๆต‹่ฏ•ๅผบๅˆถ่ฎฟ้—ฎไธปๅบ“ try (HintManager hintManager = HintManager.getInstance()) { // ่ฎพ็ฝฎๅผบๅˆถ่ฎฟ้—ฎไธปๅบ“ hintManager.setMasterRouteOnly(); // ๆ‰ง่กŒๆŸฅ่ฏข OrderDO order = orderMapper.selectById(1); System.out.println(order); } } @Test public void testInsert() { // ๆ’ๅ…ฅ OrderDO order = new OrderDO(); order.setUserId(10); orderMapper.insert(order); } }
1,485
0.653549
0.633169
48
27.645834
21.509193
75
false
false
0
0
0
0
0
0
0.416667
false
false
4
fd4e08f24f14deb67bae6f0bef460a57aa630bc3
21,483,426,456,794
6aec22cd80295f0f327de150c3891596ddf607cd
/code/eclipse/java.sample.thread/src/sample/thread/server/SingleThreadedServer.java
0460c9fb9c7fca8e3724d3f9a9bd70362e130858
[ "MIT" ]
permissive
ksun-x/java-sample
https://github.com/ksun-x/java-sample
34bac95b0e2de34ee44a3521102e309ca45e8324
516844ec07100d26a3b0b8949071ecef21b5f0b2
refs/heads/master
2021-10-27T20:54:11.776000
2019-04-19T15:02:36
2019-04-19T15:02:36
109,862,835
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sample.thread.server; import java.net.ServerSocket; import java.net.Socket; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class SingleThreadedServer implements Runnable { protected int serverPort = 8080; protected ServerSocket serverSocket = null; protected boolean isStopped = false; protected Thread thread = null; public SingleThreadedServer (int serverPort) { this.serverPort = serverPort; } @Override public void run() { synchronized(this){ this.thread = Thread.currentThread(); } openServerSocket(); // on the same pc, the initialization of server socket must precede the client one Client client = new Client("127.0.0.1", 9000); new Thread(client).start(); while(!isStopped()){ Socket clientSocket = null; try { clientSocket = this.serverSocket.accept(); // wait for a client request } catch (IOException e) { if(isStopped()) { System.out.println("Server Stopped.") ; return; } throw new RuntimeException( "Error accepting client connection", e); } try { processClientRequest(clientSocket); } catch (Exception e) { //log exception and go on to next request. } } System.out.println("Server Stopped"); } private void processClientRequest(Socket clientSocket) throws Exception { InputStream input = clientSocket.getInputStream(); OutputStream output = clientSocket.getOutputStream(); long time = System.currentTimeMillis(); int i = 0; int counter = 0; StringBuilder inputStr = new StringBuilder(); while (counter < 4 && ((i = input.read()) != -1)) { char ch = (char) i; inputStr.append(ch); if (ch == '\n' || ch == '\r') { counter++; } else { counter = 0; } } System.out.println("Client request:" + inputStr.toString()); byte[] responseDocument = ("<html><body>" + "Hello from " + Thread.currentThread().getName() + "</body></html>").getBytes("UTF-8"); byte[] responseHeader = ("HTTP/1.1 200 OK\r\n" + "Content-Type: text/html; charset=UTF-8\r\n" + "Content-Length: " + responseDocument.length + "\r\n\r\n").getBytes("UTF-8"); output.write(responseHeader); output.write(responseDocument); // special end-of-data character output.write('#'); input.close(); output.close(); System.out.println("Request processed in time: " + time); } protected synchronized boolean isStopped() { return this.isStopped; } public synchronized void stop(){ this.isStopped = true; try { this.serverSocket.close(); } catch (IOException e) { throw new RuntimeException("Error when closing server", e); } } protected void openServerSocket() { try { this.serverSocket = new ServerSocket(this.serverPort); } catch (IOException e) { throw new RuntimeException("Cannot open port " + this.serverPort, e); } } }
UTF-8
Java
3,336
java
SingleThreadedServer.java
Java
[ { "context": "he client one\n Client client = new Client(\"127.0.0.1\", 9000);\n new Thread(client).start();\n ", "end": 832, "score": 0.9996016025543213, "start": 823, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
package sample.thread.server; import java.net.ServerSocket; import java.net.Socket; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class SingleThreadedServer implements Runnable { protected int serverPort = 8080; protected ServerSocket serverSocket = null; protected boolean isStopped = false; protected Thread thread = null; public SingleThreadedServer (int serverPort) { this.serverPort = serverPort; } @Override public void run() { synchronized(this){ this.thread = Thread.currentThread(); } openServerSocket(); // on the same pc, the initialization of server socket must precede the client one Client client = new Client("127.0.0.1", 9000); new Thread(client).start(); while(!isStopped()){ Socket clientSocket = null; try { clientSocket = this.serverSocket.accept(); // wait for a client request } catch (IOException e) { if(isStopped()) { System.out.println("Server Stopped.") ; return; } throw new RuntimeException( "Error accepting client connection", e); } try { processClientRequest(clientSocket); } catch (Exception e) { //log exception and go on to next request. } } System.out.println("Server Stopped"); } private void processClientRequest(Socket clientSocket) throws Exception { InputStream input = clientSocket.getInputStream(); OutputStream output = clientSocket.getOutputStream(); long time = System.currentTimeMillis(); int i = 0; int counter = 0; StringBuilder inputStr = new StringBuilder(); while (counter < 4 && ((i = input.read()) != -1)) { char ch = (char) i; inputStr.append(ch); if (ch == '\n' || ch == '\r') { counter++; } else { counter = 0; } } System.out.println("Client request:" + inputStr.toString()); byte[] responseDocument = ("<html><body>" + "Hello from " + Thread.currentThread().getName() + "</body></html>").getBytes("UTF-8"); byte[] responseHeader = ("HTTP/1.1 200 OK\r\n" + "Content-Type: text/html; charset=UTF-8\r\n" + "Content-Length: " + responseDocument.length + "\r\n\r\n").getBytes("UTF-8"); output.write(responseHeader); output.write(responseDocument); // special end-of-data character output.write('#'); input.close(); output.close(); System.out.println("Request processed in time: " + time); } protected synchronized boolean isStopped() { return this.isStopped; } public synchronized void stop(){ this.isStopped = true; try { this.serverSocket.close(); } catch (IOException e) { throw new RuntimeException("Error when closing server", e); } } protected void openServerSocket() { try { this.serverSocket = new ServerSocket(this.serverPort); } catch (IOException e) { throw new RuntimeException("Cannot open port " + this.serverPort, e); } } }
3,336
0.59982
0.591727
111
29.054054
23.563538
133
false
false
0
0
0
0
0
0
1.405405
false
false
4
11b83dcc19082b63b49b0fac753e9c18c6d1044c
20,332,375,184,499
fd8bd977daece1d6f23d1a1a32fc40b8f5393fe1
/titulacion/ejb/src/main/java/ec/gob/educacion/titulacion/model/ministerio/InsParalelo.java
51c8203f662045c53a0ec0a71660330663c30e82
[]
no_license
mhplur/javaEE
https://github.com/mhplur/javaEE
a47f22c13b4a630488d073b03ff0d7eec9a04515
7fcbc3f5c35a5ed678f39a32a7b286103055be36
refs/heads/master
2018-09-17T22:28:04.779000
2018-07-18T20:36:17
2018-07-18T20:36:17
134,449,310
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ec.gob.educacion.titulacion.model.ministerio; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import org.hibernate.envers.Audited; import ec.gob.educacion.titulacion.model.censo.InsParaleloCenso; /** * InsParalelo - desarrollo. */ @Entity @Table(name = "INS_PARALELO") @SequenceGenerator(name = "SEQ_INS_PARALELO_GEN", sequenceName = "SEQ_INS_PARALELO", allocationSize = 1) @Audited public class InsParalelo implements Serializable { private static final long serialVersionUID = -4233311824192750856L; private long codigo; private String descripcion; private Date fechaCreacion; private int estado; private List<InsParaleloCenso> insParaleloCensos = new ArrayList<InsParaleloCenso>( 0); private boolean seleccionado; public InsParalelo() { } public InsParalelo(long codigo, String descripcion, Date fechaCreacion, int estado) { this.codigo = codigo; this.descripcion = descripcion; this.fechaCreacion = fechaCreacion; this.estado = estado; } public InsParalelo(long codigo, String descripcion, Date fechaCreacion, int estado, List<InsParaleloCenso> insParaleloCensos) { this.codigo = codigo; this.descripcion = descripcion; this.fechaCreacion = fechaCreacion; this.estado = estado; this.insParaleloCensos = insParaleloCensos; } @Id @Column(name = "CODIGO", unique = true, nullable = false, scale = 0) @GeneratedValue(generator = "SEQ_INS_PARALELO_GEN", strategy = GenerationType.SEQUENCE) public long getCodigo() { return this.codigo; } public void setCodigo(long codigo) { this.codigo = codigo; } @Column(name = "DESCRIPCION", nullable = false, length = 1) public String getDescripcion() { return this.descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } @Temporal(TemporalType.DATE) @Column(name = "FECHA_CREACION", nullable = false, length = 7) public Date getFechaCreacion() { return this.fechaCreacion; } public void setFechaCreacion(Date fechaCreacion) { this.fechaCreacion = fechaCreacion; } @Column(name = "ESTADO", nullable = false, precision = 1, scale = 0) public int getEstado() { return this.estado; } public void setEstado(int estado) { this.estado = estado; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "insParalelo") public List<InsParaleloCenso> getInsParaleloCensos() { return this.insParaleloCensos; } public void setInsParaleloCensos(List<InsParaleloCenso> insParaleloCensos) { this.insParaleloCensos = insParaleloCensos; } @Transient public boolean isSeleccionado() { return seleccionado; } public void setSeleccionado(boolean seleccionado) { this.seleccionado = seleccionado; } }
UTF-8
Java
3,175
java
InsParalelo.java
Java
[]
null
[]
package ec.gob.educacion.titulacion.model.ministerio; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import org.hibernate.envers.Audited; import ec.gob.educacion.titulacion.model.censo.InsParaleloCenso; /** * InsParalelo - desarrollo. */ @Entity @Table(name = "INS_PARALELO") @SequenceGenerator(name = "SEQ_INS_PARALELO_GEN", sequenceName = "SEQ_INS_PARALELO", allocationSize = 1) @Audited public class InsParalelo implements Serializable { private static final long serialVersionUID = -4233311824192750856L; private long codigo; private String descripcion; private Date fechaCreacion; private int estado; private List<InsParaleloCenso> insParaleloCensos = new ArrayList<InsParaleloCenso>( 0); private boolean seleccionado; public InsParalelo() { } public InsParalelo(long codigo, String descripcion, Date fechaCreacion, int estado) { this.codigo = codigo; this.descripcion = descripcion; this.fechaCreacion = fechaCreacion; this.estado = estado; } public InsParalelo(long codigo, String descripcion, Date fechaCreacion, int estado, List<InsParaleloCenso> insParaleloCensos) { this.codigo = codigo; this.descripcion = descripcion; this.fechaCreacion = fechaCreacion; this.estado = estado; this.insParaleloCensos = insParaleloCensos; } @Id @Column(name = "CODIGO", unique = true, nullable = false, scale = 0) @GeneratedValue(generator = "SEQ_INS_PARALELO_GEN", strategy = GenerationType.SEQUENCE) public long getCodigo() { return this.codigo; } public void setCodigo(long codigo) { this.codigo = codigo; } @Column(name = "DESCRIPCION", nullable = false, length = 1) public String getDescripcion() { return this.descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } @Temporal(TemporalType.DATE) @Column(name = "FECHA_CREACION", nullable = false, length = 7) public Date getFechaCreacion() { return this.fechaCreacion; } public void setFechaCreacion(Date fechaCreacion) { this.fechaCreacion = fechaCreacion; } @Column(name = "ESTADO", nullable = false, precision = 1, scale = 0) public int getEstado() { return this.estado; } public void setEstado(int estado) { this.estado = estado; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "insParalelo") public List<InsParaleloCenso> getInsParaleloCensos() { return this.insParaleloCensos; } public void setInsParaleloCensos(List<InsParaleloCenso> insParaleloCensos) { this.insParaleloCensos = insParaleloCensos; } @Transient public boolean isSeleccionado() { return seleccionado; } public void setSeleccionado(boolean seleccionado) { this.seleccionado = seleccionado; } }
3,175
0.764724
0.756535
124
24.604839
23.516233
104
false
false
0
0
0
0
0
0
1.346774
false
false
4
aec9a9c5b6227a2a5e428a2d7aae2c399eb6b134
8,589,934,605,383
c1a5138b9cbc60147907bf8dfaf5e8f672506208
/src/java/com/threerings/msoy/game/gwt/GameInfo.java
d56156510f82f1cf5b44687cdc2b53ac71f23603
[ "BSD-3-Clause" ]
permissive
FlowShift/Flow
https://github.com/FlowShift/Flow
14eb40c90ecc85a59e3854c7285e6ad3802cdc22
0b85d2dd3c80a690316a525b9437061bfd4ef70e
refs/heads/master
2021-01-20T23:02:53.137000
2015-09-04T06:23:13
2015-09-04T06:23:13
40,071,575
1
0
null
true
2015-09-03T08:31:55
2015-08-02T06:58:13
2015-08-02T10:37:16
2015-09-03T08:31:55
1,655,652
0
0
0
HTML
null
null
// // $Id$ package com.threerings.msoy.game.gwt; import java.util.Comparator; import com.google.gwt.user.client.rpc.IsSerializable; import com.threerings.orth.data.MediaDesc; import com.threerings.msoy.data.all.MemberName; /** * Contains summary information for a game being displayed on the arcade page. */ public class GameInfo implements IsSerializable { /** Sort options for games. */ public enum Sort { BY_RATING(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { if (c2.rating == c1.rating) { return c2.ratingCount - c1.ratingCount; } else { return ((c2.rating > c1.rating) ? 1 : -1); } } }), BY_NEWEST(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c2.gameId - c1.gameId; } }), BY_NAME(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c1.name.toString().toLowerCase().compareTo(c2.name.toString().toLowerCase()); } }), BY_GENRE(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c1.genre.compareTo(c2.genre); } }), BY_ONLINE(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c2.playersOnline - c1.playersOnline; } }); public static Sort fromToken (String token) { try { return Sort.valueOf("BY_" + token.toUpperCase()); } catch (Exception e) { return BY_RATING; } } /** Returns a comparator that sorts according to this option. */ public final Comparator<GameInfo> comparator; public String toToken () { return toString().substring(3).toLowerCase(); } Sort (Comparator<GameInfo> comp) { this.comparator = comp; } }; /** The maximum allowed length for game names. */ public static final int MAX_NAME_LENGTH = 64; /** The maximum allowed length for game descriptions. */ public static final int MAX_DESCRIPTION_LENGTH = 200; /** Value of {@link #groupId} when there is no associated group. */ public static final int NO_GROUP = 0; /** Identifies the game splash media. */ public static final String SPLASH_MEDIA = "splash"; /** * Obtains the "development" version of the supplied gameId. This is used as the suiteId for * original game sub-items and in some other places. */ public static int toDevId (int gameId) { return -Math.abs(gameId); } /** The id of the game in question. */ public int gameId; /** The name of the game in question. */ public String name; /** This game's genre. */ public GameGenre genre; /** True if this is an AVRG, false if it's a parlor game. */ public boolean isAVRG; /** The name of the creator of this game. */ public MemberName creator; /** A more detailed description of the game. */ public String description; /** The game's thumbnail media (will never be null). */ public MediaDesc thumbMedia; /** The game screenshot media (will never be null). */ public MediaDesc shotMedia; /** Optional group associated with this game; 0 means no group */ public int groupId; /** The tag used to identify items in this game's shop. */ public String shopTag; /** The current rating of this item, either 0 or between 1 and 5. */ public float rating; /** The number of user ratings that went into the average rating. */ public int ratingCount; /** Whether or not we believe that this game is integrated with the Whirled API. */ public boolean integrated; /** The number of players currently playing this game. */ public int playersOnline; /** * Returns true if the specified member is the creator of this game. */ public boolean isCreator (int memberId) { return creator.getId() == memberId; } @Override // from Object public String toString () { return gameId + ", name=" + name; } }
UTF-8
Java
4,372
java
GameInfo.java
Java
[]
null
[]
// // $Id$ package com.threerings.msoy.game.gwt; import java.util.Comparator; import com.google.gwt.user.client.rpc.IsSerializable; import com.threerings.orth.data.MediaDesc; import com.threerings.msoy.data.all.MemberName; /** * Contains summary information for a game being displayed on the arcade page. */ public class GameInfo implements IsSerializable { /** Sort options for games. */ public enum Sort { BY_RATING(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { if (c2.rating == c1.rating) { return c2.ratingCount - c1.ratingCount; } else { return ((c2.rating > c1.rating) ? 1 : -1); } } }), BY_NEWEST(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c2.gameId - c1.gameId; } }), BY_NAME(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c1.name.toString().toLowerCase().compareTo(c2.name.toString().toLowerCase()); } }), BY_GENRE(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c1.genre.compareTo(c2.genre); } }), BY_ONLINE(new Comparator<GameInfo>() { public int compare (GameInfo c1, GameInfo c2) { return c2.playersOnline - c1.playersOnline; } }); public static Sort fromToken (String token) { try { return Sort.valueOf("BY_" + token.toUpperCase()); } catch (Exception e) { return BY_RATING; } } /** Returns a comparator that sorts according to this option. */ public final Comparator<GameInfo> comparator; public String toToken () { return toString().substring(3).toLowerCase(); } Sort (Comparator<GameInfo> comp) { this.comparator = comp; } }; /** The maximum allowed length for game names. */ public static final int MAX_NAME_LENGTH = 64; /** The maximum allowed length for game descriptions. */ public static final int MAX_DESCRIPTION_LENGTH = 200; /** Value of {@link #groupId} when there is no associated group. */ public static final int NO_GROUP = 0; /** Identifies the game splash media. */ public static final String SPLASH_MEDIA = "splash"; /** * Obtains the "development" version of the supplied gameId. This is used as the suiteId for * original game sub-items and in some other places. */ public static int toDevId (int gameId) { return -Math.abs(gameId); } /** The id of the game in question. */ public int gameId; /** The name of the game in question. */ public String name; /** This game's genre. */ public GameGenre genre; /** True if this is an AVRG, false if it's a parlor game. */ public boolean isAVRG; /** The name of the creator of this game. */ public MemberName creator; /** A more detailed description of the game. */ public String description; /** The game's thumbnail media (will never be null). */ public MediaDesc thumbMedia; /** The game screenshot media (will never be null). */ public MediaDesc shotMedia; /** Optional group associated with this game; 0 means no group */ public int groupId; /** The tag used to identify items in this game's shop. */ public String shopTag; /** The current rating of this item, either 0 or between 1 and 5. */ public float rating; /** The number of user ratings that went into the average rating. */ public int ratingCount; /** Whether or not we believe that this game is integrated with the Whirled API. */ public boolean integrated; /** The number of players currently playing this game. */ public int playersOnline; /** * Returns true if the specified member is the creator of this game. */ public boolean isCreator (int memberId) { return creator.getId() == memberId; } @Override // from Object public String toString () { return gameId + ", name=" + name; } }
4,372
0.593779
0.585316
148
28.540541
25.081591
100
false
false
0
0
0
0
0
0
0.351351
false
false
4
072d4fdc31b8842f30daee57a4d0a2aeba7f7660
8,589,934,602,262
899d1c53f33378e3f6354bbc3b64f675b1bdfd4d
/Chapter16Concurrency/src/com/test/Test8.java
d9bc6fc2a1529863652d43b038af89e653147aa6
[]
no_license
coolshree4u/testpythonlantesting
https://github.com/coolshree4u/testpythonlantesting
f43ce058b1405e47174a6d85460345090adf81d2
e81ddcb342133bf59bd2a6157df12802da2730ed
refs/heads/master
2021-01-01T18:18:53.972000
2017-07-25T11:17:53
2017-07-25T11:17:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; public class Test8 extends Thread { static List<Integer> myList = new CopyOnWriteArrayList<>(); public static void main(String[] args) { myList.add(11); myList.add(22); myList.add(33); myList.add(44); new Test8().start(); for (Integer i : myList) { System.out.println(i); } } public void run() { myList.add(55); myList.add(66); } }
UTF-8
Java
457
java
Test8.java
Java
[]
null
[]
package com.test; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; public class Test8 extends Thread { static List<Integer> myList = new CopyOnWriteArrayList<>(); public static void main(String[] args) { myList.add(11); myList.add(22); myList.add(33); myList.add(44); new Test8().start(); for (Integer i : myList) { System.out.println(i); } } public void run() { myList.add(55); myList.add(66); } }
457
0.671772
0.641138
28
15.321428
15.982252
60
false
false
0
0
0
0
0
0
1.357143
false
false
4
4f98636d63aa340619c27ba0d80f602d248f79d3
13,632,226,213,464
f33242afe438fb069ba688b4cc3e21b5b2fbd2e5
/JSMSServer/JSMSServices/src/main/java/com/jerotoma/services/assemblers/academic/impls/AssemblerAcademicDisciplineServiceImpl.java
0bb4cbec2ff1a60995c5599232e42f8eb717a088
[]
no_license
jerotoma/jerotoma-pms
https://github.com/jerotoma/jerotoma-pms
08d6fafdb6ac3102c530862e2a84de2d0879eb66
93ddb013b2b274e039919a786b5883157ba33d3a
refs/heads/master
2022-05-02T13:41:44.510000
2022-04-04T20:49:25
2022-04-04T20:49:25
194,174,504
0
0
null
false
2022-04-29T16:51:27
2019-06-27T23:12:29
2022-01-10T04:49:11
2022-04-29T16:51:27
100,739
0
0
3
Java
false
false
package com.jerotoma.services.assemblers.academic.impls; import java.sql.SQLException; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jerotoma.common.QueryParam; import com.jerotoma.common.viewobjects.AcademicDisciplineVO; import com.jerotoma.database.assemblers.dao.AssemblerAcademicDisciplineDao; import com.jerotoma.services.assemblers.academic.AssemblerAcademicDisciplineService; @Service public class AssemblerAcademicDisciplineServiceImpl implements AssemblerAcademicDisciplineService { @Autowired AssemblerAcademicDisciplineDao assemblerAcademicDisciplineDao; @Override public AcademicDisciplineVO findObject(Integer primaryKey) throws SQLException { return assemblerAcademicDisciplineDao.findObject(primaryKey); } @Override public AcademicDisciplineVO findObjectUniqueKey(String uniqueKey) throws SQLException { return assemblerAcademicDisciplineDao.findObjectUniqueKey(uniqueKey); } @Override public List<AcademicDisciplineVO> loadList() throws SQLException { return assemblerAcademicDisciplineDao.loadList(); } @Override public Map<String, Object> loadMapList(QueryParam queryParam) throws SQLException { return assemblerAcademicDisciplineDao.loadMapList(queryParam); } @Override public Long countObject() throws SQLException { return assemblerAcademicDisciplineDao.countObject(); } @Override public List<AcademicDisciplineVO> findAcademicDisciplinesByCourseId(Integer courseId) throws SQLException { return assemblerAcademicDisciplineDao.findAcademicDisciplinesByCourseId(courseId); } }
UTF-8
Java
1,662
java
AssemblerAcademicDisciplineServiceImpl.java
Java
[]
null
[]
package com.jerotoma.services.assemblers.academic.impls; import java.sql.SQLException; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jerotoma.common.QueryParam; import com.jerotoma.common.viewobjects.AcademicDisciplineVO; import com.jerotoma.database.assemblers.dao.AssemblerAcademicDisciplineDao; import com.jerotoma.services.assemblers.academic.AssemblerAcademicDisciplineService; @Service public class AssemblerAcademicDisciplineServiceImpl implements AssemblerAcademicDisciplineService { @Autowired AssemblerAcademicDisciplineDao assemblerAcademicDisciplineDao; @Override public AcademicDisciplineVO findObject(Integer primaryKey) throws SQLException { return assemblerAcademicDisciplineDao.findObject(primaryKey); } @Override public AcademicDisciplineVO findObjectUniqueKey(String uniqueKey) throws SQLException { return assemblerAcademicDisciplineDao.findObjectUniqueKey(uniqueKey); } @Override public List<AcademicDisciplineVO> loadList() throws SQLException { return assemblerAcademicDisciplineDao.loadList(); } @Override public Map<String, Object> loadMapList(QueryParam queryParam) throws SQLException { return assemblerAcademicDisciplineDao.loadMapList(queryParam); } @Override public Long countObject() throws SQLException { return assemblerAcademicDisciplineDao.countObject(); } @Override public List<AcademicDisciplineVO> findAcademicDisciplinesByCourseId(Integer courseId) throws SQLException { return assemblerAcademicDisciplineDao.findAcademicDisciplinesByCourseId(courseId); } }
1,662
0.847774
0.847774
51
31.588236
34.059448
108
false
false
0
0
0
0
0
0
0.980392
false
false
4
66795db7cb639f5d27827a7270c0f2ae2579606b
472,446,409,797
37463803fcc43157910cff99e71e1850d4573fec
/src/com/SSM/service/Post_transService.java
a46ff3ce41bf81d63ae493e610843b98793c8fbe
[]
no_license
fangshikai/personnel
https://github.com/fangshikai/personnel
69e6e958eb77540eedd17c8af723d8e2007e1ee8
9275e045bfcd0ab1e5ac5eb364ee641724c876f1
refs/heads/master
2020-04-11T07:22:18.865000
2018-12-13T08:37:24
2018-12-13T08:37:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.SSM.service; import java.util.List; import com.SSM.pojo.Employee; import com.SSM.pojo.Post_trans; public interface Post_transService { //ๆŸฅ่ฏข้ƒจๅˆ†ๅ‘˜ๅทฅไฟกๆฏ,ๅ‡†ๅค‡่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ List<Employee> selectSomeEmployee(); //ๆ นๆฎๅ‘˜ๅทฅ็ผ–ๅทๆฅๆŸฅ่ฏขๅฏน่ฑก๏ผŒๅ‡†ๅค‡่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public List<Employee> selectEmpIdById(int id); //ๆทปๅŠ ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏๅ‰ๅ…ˆๆŸฅๅ‘˜ๅทฅ็ผ–ๅทๅฝ“ๅ‰ๅฒ—ไฝๅ†่ฟ›่กŒไฟฎๆ”น public Employee selectNowPostById(int id); //ๆทปๅŠ ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ๏ผŒๆŸฅ่ฏขๅ‘˜ๅทฅไฟกๆฏไธญ็š„่ฐƒ่ฝฌๆŒ‰้’ฎ public void addPost_trans(Post_trans post_trans); //ๆ›ดๆ–ฐๅ‘˜ๅทฅไฟกๆฏ๏ผŒ,ๅ‡†ๅค‡่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public void updateEmployeeById(Post_trans post_trans); //ๆ นๆฎๅ‘˜ๅทฅ็ผ–ๅทๆฅๆŸฅ่ฏขๅฏน่ฑก๏ผŒๅทฒ่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public List<Post_trans> selectEmp_idById(int id); //ๆŸฅ่ฏขๆ‰€ๆœ‰ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ๏ผŒๅทฒ่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ List<Post_trans> selectAllPost_trans(); //้€š่ฟ‡ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏidๅˆ ้™คๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ๏ผŒๅทฒ่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public void deletePost_transById(int id); //ๆ นๆฎๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏidๆŸฅ่ฏขๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ public Post_trans selectPost_transById(int id); //ๆ›ดๆ–ฐๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ public void updatePost_trans(Post_trans post_trans); }
GB18030
Java
1,277
java
Post_transService.java
Java
[]
null
[]
package com.SSM.service; import java.util.List; import com.SSM.pojo.Employee; import com.SSM.pojo.Post_trans; public interface Post_transService { //ๆŸฅ่ฏข้ƒจๅˆ†ๅ‘˜ๅทฅไฟกๆฏ,ๅ‡†ๅค‡่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ List<Employee> selectSomeEmployee(); //ๆ นๆฎๅ‘˜ๅทฅ็ผ–ๅทๆฅๆŸฅ่ฏขๅฏน่ฑก๏ผŒๅ‡†ๅค‡่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public List<Employee> selectEmpIdById(int id); //ๆทปๅŠ ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏๅ‰ๅ…ˆๆŸฅๅ‘˜ๅทฅ็ผ–ๅทๅฝ“ๅ‰ๅฒ—ไฝๅ†่ฟ›่กŒไฟฎๆ”น public Employee selectNowPostById(int id); //ๆทปๅŠ ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ๏ผŒๆŸฅ่ฏขๅ‘˜ๅทฅไฟกๆฏไธญ็š„่ฐƒ่ฝฌๆŒ‰้’ฎ public void addPost_trans(Post_trans post_trans); //ๆ›ดๆ–ฐๅ‘˜ๅทฅไฟกๆฏ๏ผŒ,ๅ‡†ๅค‡่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public void updateEmployeeById(Post_trans post_trans); //ๆ นๆฎๅ‘˜ๅทฅ็ผ–ๅทๆฅๆŸฅ่ฏขๅฏน่ฑก๏ผŒๅทฒ่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public List<Post_trans> selectEmp_idById(int id); //ๆŸฅ่ฏขๆ‰€ๆœ‰ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ๏ผŒๅทฒ่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ List<Post_trans> selectAllPost_trans(); //้€š่ฟ‡ๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏidๅˆ ้™คๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ๏ผŒๅทฒ่ฐƒ่ฝฌๅฒ—ไฝไฟกๆฏ public void deletePost_transById(int id); //ๆ นๆฎๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏidๆŸฅ่ฏขๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ public Post_trans selectPost_transById(int id); //ๆ›ดๆ–ฐๅฒ—ไฝ่ฐƒ่ฝฌไฟกๆฏ public void updatePost_trans(Post_trans post_trans); }
1,277
0.735519
0.735519
39
22.461538
18.75325
58
false
false
0
0
0
0
0
0
0.794872
false
false
4
f450faec70bf68503d93394a9dff6a674bf2e709
14,474,039,816,263
9b5dd7265d1b097ee1eba823b7dddeab5e358919
/Common/src/com/yeeknet/service/mgservice/MgBonusLogService.java
e6326b0dc50214871a24c4257dae3b463d68eaf1
[]
no_license
ChanThinSan/Crawler_4lu
https://github.com/ChanThinSan/Crawler_4lu
6045d1e495435af1ae608943371b7495ba76903c
1dae5fbf276557a3c5a785ddb078e787df018633
refs/heads/master
2017-12-01T03:38:15.277000
2017-06-27T19:08:29
2017-06-27T19:08:29
95,583,404
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yeeknet.service.mgservice; import com.jfinal.aop.Duang; import com.yeeknet.framework.base.MongoService; import com.yeeknet.model.mgmodel.MgBonusLog; /** * auth:newey * date:2017/04/28 * * @api {Class} MgBonusLogService MgBonusLogService * @apiName MgBonusLogService * @apiGroup com.yeeknet.service.mgservice * @apiVersion 0.1.0 * @apiDescription MgBonusLogService ็งฏๅˆ†่ฎฐๅฝ• */ public class MgBonusLogService extends MongoService<MgBonusLog> { public static MgBonusLogService service = Duang.duang(MgBonusLogService.class); @Override public MgBonusLog getDao() { return MgBonusLog.dao; } // ๆ—ฅๅฟ—็ฑปๆ•ฐๆฎไธ้œ€่ฆๅญ˜็ผ“ๅญ˜ @Override public String save(MgBonusLog m) throws Exception { // ไฟๅญ˜ m.save(); return m.getPKValue(); } }
UTF-8
Java
826
java
MgBonusLogService.java
Java
[ { "context": "om.yeeknet.model.mgmodel.MgBonusLog;\n\n/**\n * auth:newey\n * date:2017/04/28\n *\n * @api {Class} MgBonusLogS", "end": 180, "score": 0.9996089935302734, "start": 175, "tag": "USERNAME", "value": "newey" } ]
null
[]
package com.yeeknet.service.mgservice; import com.jfinal.aop.Duang; import com.yeeknet.framework.base.MongoService; import com.yeeknet.model.mgmodel.MgBonusLog; /** * auth:newey * date:2017/04/28 * * @api {Class} MgBonusLogService MgBonusLogService * @apiName MgBonusLogService * @apiGroup com.yeeknet.service.mgservice * @apiVersion 0.1.0 * @apiDescription MgBonusLogService ็งฏๅˆ†่ฎฐๅฝ• */ public class MgBonusLogService extends MongoService<MgBonusLog> { public static MgBonusLogService service = Duang.duang(MgBonusLogService.class); @Override public MgBonusLog getDao() { return MgBonusLog.dao; } // ๆ—ฅๅฟ—็ฑปๆ•ฐๆฎไธ้œ€่ฆๅญ˜็ผ“ๅญ˜ @Override public String save(MgBonusLog m) throws Exception { // ไฟๅญ˜ m.save(); return m.getPKValue(); } }
826
0.710859
0.69697
33
23
21.214632
83
false
false
0
0
0
0
0
0
0.242424
false
false
4
0e9c8caef44f1dfe9d2c753af97c72efb4d87ba3
7,146,825,596,340
c72648857a7b55b7b578a20ff0ee76f39612db12
/src/ๅญ—็ฌฆไธฒ/Solution1436.java
bf186e9b31e0ced75bb29dcfe2f713adf06f913d
[]
no_license
ErnestW2019/Leetcode
https://github.com/ErnestW2019/Leetcode
5f978846d2837208ce01b4bd2087e9ce22d6052a
6fe0b41eb1930457cdf76516b6291265dd4f6230
refs/heads/master
2022-12-08T07:40:04.165000
2020-08-21T08:13:23
2020-08-21T08:13:23
288,124,540
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ๅญ—็ฌฆไธฒ; import java.util.HashMap; import java.util.List; /* * 1436. ๆ—…่กŒ็ปˆ็‚น็ซ™ ้šพๅบฆ ็ฎ€ๅ• ็ป™ไฝ ไธ€ไปฝๆ—…ๆธธ็บฟ่ทฏๅ›พ๏ผŒ่ฏฅ็บฟ่ทฏๅ›พไธญ็š„ๆ—…่กŒ็บฟ่ทฏ็”จๆ•ฐ็ป„ paths ่กจ็คบ๏ผŒๅ…ถไธญ paths[i] = [cityAi, cityBi] ่กจ็คบ่ฏฅ็บฟ่ทฏๅฐ†ไผšไปŽ cityAi ็›ดๆŽฅๅ‰ๅพ€ cityBi ใ€‚่ฏทไฝ ๆ‰พๅ‡บ่ฟ™ๆฌกๆ—…่กŒ็š„็ปˆ็‚น็ซ™๏ผŒๅณๆฒกๆœ‰ไปปไฝ•ๅฏไปฅ้€šๅพ€ๅ…ถไป–ๅŸŽๅธ‚็š„็บฟ่ทฏ็š„ๅŸŽๅธ‚ใ€‚ ้ข˜็›ฎๆ•ฐๆฎไฟ่ฏ็บฟ่ทฏๅ›พไผšๅฝขๆˆไธ€ๆกไธๅญ˜ๅœจๅพช็Žฏ็š„็บฟ่ทฏ๏ผŒๅ› ๆญคๅชไผšๆœ‰ไธ€ไธชๆ—…่กŒ็ปˆ็‚น็ซ™ใ€‚ ็คบไพ‹ 1๏ผš ่พ“ๅ…ฅ๏ผšpaths = [["London","New York"],["New York","Lima"],["Lima","Sao Paulo"]] ่พ“ๅ‡บ๏ผš"Sao Paulo" ่งฃ้‡Š๏ผšไปŽ "London" ๅ‡บๅ‘๏ผŒๆœ€ๅŽๆŠต่พพ็ปˆ็‚น็ซ™ "Sao Paulo" ใ€‚ๆœฌๆฌกๆ—…่กŒ็š„่ทฏ็บฟๆ˜ฏ "London" -> "New York" -> "Lima" -> "Sao Paulo" ใ€‚ ็คบไพ‹ 2๏ผš ่พ“ๅ…ฅ๏ผšpaths = [["B","C"],["D","B"],["C","A"]] ่พ“ๅ‡บ๏ผš"A" ่งฃ้‡Š๏ผšๆ‰€ๆœ‰ๅฏ่ƒฝ็š„็บฟ่ทฏๆ˜ฏ๏ผš "D" -> "B" -> "C" -> "A". "B" -> "C" -> "A". "C" -> "A". "A". ๆ˜พ็„ถ๏ผŒๆ—…่กŒ็ปˆ็‚น็ซ™ๆ˜ฏ "A" ใ€‚ ็คบไพ‹ 3๏ผš ่พ“ๅ…ฅ๏ผšpaths = [["A","Z"]] ่พ“ๅ‡บ๏ผš"Z" ๆ็คบ๏ผš 1 <= paths.length <= 100 paths[i].length == 2 1 <= cityAi.length, cityBi.length <= 10 cityAi != cityBi ๆ‰€ๆœ‰ๅญ—็ฌฆไธฒๅ‡็”ฑๅคงๅฐๅ†™่‹ฑๆ–‡ๅญ—ๆฏๅ’Œ็ฉบๆ ผๅญ—็ฌฆ็ป„ๆˆใ€‚ */ public class Solution1436 { public String destCity(List<List<String>> paths) { HashMap<String,Integer> map = new HashMap<String,Integer>(); for(int i=0;i<paths.size();i++){ for(int j=0;j<2;j++){ String temp = paths.get(i).get(j); map.put(temp,map.getOrDefault(temp,0)+1); } } String res = ""; for(int i=0;i<paths.size();i++){ res = paths.get(i).get(1); if(map.get(res)==1){ return res; } } return res; } }
UTF-8
Java
1,849
java
Solution1436.java
Java
[]
null
[]
package ๅญ—็ฌฆไธฒ; import java.util.HashMap; import java.util.List; /* * 1436. ๆ—…่กŒ็ปˆ็‚น็ซ™ ้šพๅบฆ ็ฎ€ๅ• ็ป™ไฝ ไธ€ไปฝๆ—…ๆธธ็บฟ่ทฏๅ›พ๏ผŒ่ฏฅ็บฟ่ทฏๅ›พไธญ็š„ๆ—…่กŒ็บฟ่ทฏ็”จๆ•ฐ็ป„ paths ่กจ็คบ๏ผŒๅ…ถไธญ paths[i] = [cityAi, cityBi] ่กจ็คบ่ฏฅ็บฟ่ทฏๅฐ†ไผšไปŽ cityAi ็›ดๆŽฅๅ‰ๅพ€ cityBi ใ€‚่ฏทไฝ ๆ‰พๅ‡บ่ฟ™ๆฌกๆ—…่กŒ็š„็ปˆ็‚น็ซ™๏ผŒๅณๆฒกๆœ‰ไปปไฝ•ๅฏไปฅ้€šๅพ€ๅ…ถไป–ๅŸŽๅธ‚็š„็บฟ่ทฏ็š„ๅŸŽๅธ‚ใ€‚ ้ข˜็›ฎๆ•ฐๆฎไฟ่ฏ็บฟ่ทฏๅ›พไผšๅฝขๆˆไธ€ๆกไธๅญ˜ๅœจๅพช็Žฏ็š„็บฟ่ทฏ๏ผŒๅ› ๆญคๅชไผšๆœ‰ไธ€ไธชๆ—…่กŒ็ปˆ็‚น็ซ™ใ€‚ ็คบไพ‹ 1๏ผš ่พ“ๅ…ฅ๏ผšpaths = [["London","New York"],["New York","Lima"],["Lima","Sao Paulo"]] ่พ“ๅ‡บ๏ผš"Sao Paulo" ่งฃ้‡Š๏ผšไปŽ "London" ๅ‡บๅ‘๏ผŒๆœ€ๅŽๆŠต่พพ็ปˆ็‚น็ซ™ "Sao Paulo" ใ€‚ๆœฌๆฌกๆ—…่กŒ็š„่ทฏ็บฟๆ˜ฏ "London" -> "New York" -> "Lima" -> "Sao Paulo" ใ€‚ ็คบไพ‹ 2๏ผš ่พ“ๅ…ฅ๏ผšpaths = [["B","C"],["D","B"],["C","A"]] ่พ“ๅ‡บ๏ผš"A" ่งฃ้‡Š๏ผšๆ‰€ๆœ‰ๅฏ่ƒฝ็š„็บฟ่ทฏๆ˜ฏ๏ผš "D" -> "B" -> "C" -> "A". "B" -> "C" -> "A". "C" -> "A". "A". ๆ˜พ็„ถ๏ผŒๆ—…่กŒ็ปˆ็‚น็ซ™ๆ˜ฏ "A" ใ€‚ ็คบไพ‹ 3๏ผš ่พ“ๅ…ฅ๏ผšpaths = [["A","Z"]] ่พ“ๅ‡บ๏ผš"Z" ๆ็คบ๏ผš 1 <= paths.length <= 100 paths[i].length == 2 1 <= cityAi.length, cityBi.length <= 10 cityAi != cityBi ๆ‰€ๆœ‰ๅญ—็ฌฆไธฒๅ‡็”ฑๅคงๅฐๅ†™่‹ฑๆ–‡ๅญ—ๆฏๅ’Œ็ฉบๆ ผๅญ—็ฌฆ็ป„ๆˆใ€‚ */ public class Solution1436 { public String destCity(List<List<String>> paths) { HashMap<String,Integer> map = new HashMap<String,Integer>(); for(int i=0;i<paths.size();i++){ for(int j=0;j<2;j++){ String temp = paths.get(i).get(j); map.put(temp,map.getOrDefault(temp,0)+1); } } String res = ""; for(int i=0;i<paths.size();i++){ res = paths.get(i).get(1); if(map.get(res)==1){ return res; } } return res; } }
1,849
0.520937
0.501774
57
22.719297
24.591936
126
false
false
0
0
0
0
0
0
0.578947
false
false
4
e0c1b4d127ca0e6b396adef13f8d97c4d87f0872
7,146,825,600,190
2ca6ea682ea0f7388218421bcb1789c5185909bd
/app/src/main/java/com/high_technology_software/android/pauapp/view/manage/ManageMenuActivity.java
53d488bb94f4d6b82d124bf0f764b2b9b0dc1935
[]
no_license
high-technology-software/PauApp
https://github.com/high-technology-software/PauApp
3ad3852974c6e36728da6ae14c2d65db79fa8452
91feee36b5dab81364b1961caa852faab555f48c
refs/heads/master
2021-01-10T10:02:32.542000
2016-03-15T21:36:34
2016-03-15T21:36:34
51,268,695
1
0
null
false
2016-03-14T23:55:26
2016-02-07T22:06:41
2016-02-23T10:56:42
2016-03-14T23:55:18
1,551
1
0
0
Java
null
null
package com.high_technology_software.android.pauapp.view.manage; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import com.high_technology_software.android.pauapp.ItemsCategoryActivity; import com.high_technology_software.android.pauapp.R; public class ManageMenuActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.manage_menu_activity); Button categoryCrudButton = (Button) findViewById(R.id.categoryCrud); categoryCrudButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(ManageMenuActivity.this, ManageMenuCategoryActivity.class); startActivity(i); } }); Button newItemButton = (Button) findViewById(R.id.itemCrud); newItemButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), ManageMenuNewItemActivity.class); startActivity(i); } }); Button itemButton = (Button) findViewById(R.id.itemOrder); itemButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), ManageMenuItemActivity.class); startActivity(i); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.drawable.back); actionBar.setDisplayHomeAsUpEnabled(true); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { finish(); return true; } }
UTF-8
Java
2,187
java
ManageMenuActivity.java
Java
[]
null
[]
package com.high_technology_software.android.pauapp.view.manage; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import com.high_technology_software.android.pauapp.ItemsCategoryActivity; import com.high_technology_software.android.pauapp.R; public class ManageMenuActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.manage_menu_activity); Button categoryCrudButton = (Button) findViewById(R.id.categoryCrud); categoryCrudButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(ManageMenuActivity.this, ManageMenuCategoryActivity.class); startActivity(i); } }); Button newItemButton = (Button) findViewById(R.id.itemCrud); newItemButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), ManageMenuNewItemActivity.class); startActivity(i); } }); Button itemButton = (Button) findViewById(R.id.itemOrder); itemButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), ManageMenuItemActivity.class); startActivity(i); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.drawable.back); actionBar.setDisplayHomeAsUpEnabled(true); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { finish(); return true; } }
2,187
0.671696
0.670782
65
32.646152
26.783134
97
false
false
0
0
0
0
0
0
0.538462
false
false
4
5bd922bb5b795b19dd3d3f973bc9d89ae593447d
28,887,950,058,401
1d80a6bba0fd019d59fadc223a0096cde4cfc9cf
/ktyccsdk/src/main/java/com/kty/cc/db/gen/ContentBeanDao.java
8947ad9b526ba7e46e072c0a66b0788b00bbda91
[]
no_license
zhoufeng1213/tky
https://github.com/zhoufeng1213/tky
a61ca632976107fa67b5064d92024ceeb910913c
5f0a778d8cb49c0c815e67d41b34499c00419e77
refs/heads/master
2021-07-05T10:55:01.826000
2020-02-12T06:00:16
2020-02-12T06:00:16
239,417,311
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kty.cc.db.gen; import android.database.Cursor; import android.database.sqlite.SQLiteStatement; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; import org.greenrobot.greendao.internal.DaoConfig; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseStatement; import com.xxxx.cc.model.ContentBean; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table "CONTENT_BEAN". */ public class ContentBeanDao extends AbstractDao<ContentBean, Long> { public static final String TABLENAME = "CONTENT_BEAN"; /** * Properties of entity ContentBean.<br/> * Can be used for QueryBuilder and for referencing column names. */ public static class Properties { public final static Property ContentId = new Property(0, Long.class, "contentId", true, "_id"); public final static Property AgentUnames = new Property(1, String.class, "agentUnames", false, "AGENT_UNAMES"); public final static Property AgentUserName = new Property(2, String.class, "agentUserName", false, "AGENT_USER_NAME"); public final static Property AlegQuality = new Property(3, double.class, "alegQuality", false, "ALEG_QUALITY"); public final static Property Ani = new Property(4, String.class, "ani", false, "ANI"); public final static Property Area = new Property(5, String.class, "area", false, "AREA"); public final static Property BillingInSec = new Property(6, int.class, "billingInSec", false, "BILLING_IN_SEC"); public final static Property BlegQuality = new Property(7, double.class, "blegQuality", false, "BLEG_QUALITY"); public final static Property BlegUuid = new Property(8, String.class, "blegUuid", false, "BLEG_UUID"); public final static Property Bridged = new Property(9, boolean.class, "bridged", false, "BRIDGED"); public final static Property ChargeMin = new Property(10, int.class, "chargeMin", false, "CHARGE_MIN"); public final static Property ContactName = new Property(11, String.class, "contactName", false, "CONTACT_NAME"); public final static Property CreateTime = new Property(12, String.class, "createTime", false, "CREATE_TIME"); public final static Property DaSampleCategory = new Property(13, String.class, "daSampleCategory", false, "DA_SAMPLE_CATEGORY"); public final static Property DaSampleDetail = new Property(14, String.class, "daSampleDetail", false, "DA_SAMPLE_DETAIL"); public final static Property DaSampleName = new Property(15, String.class, "daSampleName", false, "DA_SAMPLE_NAME"); public final static Property DaTone = new Property(16, String.class, "daTone", false, "DA_TONE"); public final static Property Direction = new Property(17, String.class, "direction", false, "DIRECTION"); public final static Property Dnbr = new Property(18, String.class, "dnbr", false, "DNBR"); public final static Property Dnis = new Property(19, String.class, "dnis", false, "DNIS"); public final static Property DurationInSec = new Property(20, int.class, "durationInSec", false, "DURATION_IN_SEC"); public final static Property HangupCause = new Property(21, String.class, "hangupCause", false, "HANGUP_CAUSE"); public final static Property HangupTime = new Property(22, String.class, "hangupTime", false, "HANGUP_TIME"); public final static Property Id = new Property(23, String.class, "id", false, "ID"); public final static Property IvrTime = new Property(24, String.class, "ivrTime", false, "IVR_TIME"); public final static Property Lat = new Property(25, double.class, "lat", false, "LAT"); public final static Property Lng = new Property(26, double.class, "lng", false, "LNG"); public final static Property OrgId = new Property(27, String.class, "orgId", false, "ORG_ID"); public final static Property Reserved1 = new Property(28, String.class, "reserved1", false, "RESERVED1"); public final static Property Reserved2 = new Property(29, String.class, "reserved2", false, "RESERVED2"); public final static Property Satisfy = new Property(30, int.class, "satisfy", false, "SATISFY"); public final static Property Transfered = new Property(31, boolean.class, "transfered", false, "TRANSFERED"); public final static Property Transferee = new Property(32, boolean.class, "transferee", false, "TRANSFEREE"); public final static Property UpdateTime = new Property(33, String.class, "updateTime", false, "UPDATE_TIME"); public final static Property UserId = new Property(34, String.class, "userId", false, "USER_ID"); public final static Property Uuid = new Property(35, String.class, "uuid", false, "UUID"); public final static Property RecordFile = new Property(36, String.class, "recordFile", false, "RECORD_FILE"); public final static Property Reserved5 = new Property(37, String.class, "reserved5", false, "RESERVED5"); public final static Property WaitInBillingSec = new Property(38, int.class, "waitInBillingSec", false, "WAIT_IN_BILLING_SEC"); public final static Property WaitInIvrSec = new Property(39, int.class, "waitInIvrSec", false, "WAIT_IN_IVR_SEC"); public final static Property WaitInQueueSec = new Property(40, int.class, "waitInQueueSec", false, "WAIT_IN_QUEUE_SEC"); public final static Property WaitInSec = new Property(41, int.class, "waitInSec", false, "WAIT_IN_SEC"); } public ContentBeanDao(DaoConfig config) { super(config); } public ContentBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"CONTENT_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: contentId "\"AGENT_UNAMES\" TEXT," + // 1: agentUnames "\"AGENT_USER_NAME\" TEXT," + // 2: agentUserName "\"ALEG_QUALITY\" REAL NOT NULL ," + // 3: alegQuality "\"ANI\" TEXT," + // 4: ani "\"AREA\" TEXT," + // 5: area "\"BILLING_IN_SEC\" INTEGER NOT NULL ," + // 6: billingInSec "\"BLEG_QUALITY\" REAL NOT NULL ," + // 7: blegQuality "\"BLEG_UUID\" TEXT," + // 8: blegUuid "\"BRIDGED\" INTEGER NOT NULL ," + // 9: bridged "\"CHARGE_MIN\" INTEGER NOT NULL ," + // 10: chargeMin "\"CONTACT_NAME\" TEXT," + // 11: contactName "\"CREATE_TIME\" TEXT," + // 12: createTime "\"DA_SAMPLE_CATEGORY\" TEXT," + // 13: daSampleCategory "\"DA_SAMPLE_DETAIL\" TEXT," + // 14: daSampleDetail "\"DA_SAMPLE_NAME\" TEXT," + // 15: daSampleName "\"DA_TONE\" TEXT," + // 16: daTone "\"DIRECTION\" TEXT," + // 17: direction "\"DNBR\" TEXT," + // 18: dnbr "\"DNIS\" TEXT," + // 19: dnis "\"DURATION_IN_SEC\" INTEGER NOT NULL ," + // 20: durationInSec "\"HANGUP_CAUSE\" TEXT," + // 21: hangupCause "\"HANGUP_TIME\" TEXT," + // 22: hangupTime "\"ID\" TEXT," + // 23: id "\"IVR_TIME\" TEXT," + // 24: ivrTime "\"LAT\" REAL NOT NULL ," + // 25: lat "\"LNG\" REAL NOT NULL ," + // 26: lng "\"ORG_ID\" TEXT," + // 27: orgId "\"RESERVED1\" TEXT," + // 28: reserved1 "\"RESERVED2\" TEXT," + // 29: reserved2 "\"SATISFY\" INTEGER NOT NULL ," + // 30: satisfy "\"TRANSFERED\" INTEGER NOT NULL ," + // 31: transfered "\"TRANSFEREE\" INTEGER NOT NULL ," + // 32: transferee "\"UPDATE_TIME\" TEXT," + // 33: updateTime "\"USER_ID\" TEXT," + // 34: userId "\"UUID\" TEXT," + // 35: uuid "\"RECORD_FILE\" TEXT," + // 36: recordFile "\"RESERVED5\" TEXT," + // 37: reserved5 "\"WAIT_IN_BILLING_SEC\" INTEGER NOT NULL ," + // 38: waitInBillingSec "\"WAIT_IN_IVR_SEC\" INTEGER NOT NULL ," + // 39: waitInIvrSec "\"WAIT_IN_QUEUE_SEC\" INTEGER NOT NULL ," + // 40: waitInQueueSec "\"WAIT_IN_SEC\" INTEGER NOT NULL );"); // 41: waitInSec // Add Indexes db.execSQL("CREATE UNIQUE INDEX " + constraint + "IDX_CONTENT_BEAN_ID ON CONTENT_BEAN" + " (\"ID\" ASC);"); } /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CONTENT_BEAN\""; db.execSQL(sql); } @Override protected final void bindValues(DatabaseStatement stmt, ContentBean entity) { stmt.clearBindings(); Long contentId = entity.getContentId(); if (contentId != null) { stmt.bindLong(1, contentId); } String agentUnames = entity.getAgentUnames(); if (agentUnames != null) { stmt.bindString(2, agentUnames); } String agentUserName = entity.getAgentUserName(); if (agentUserName != null) { stmt.bindString(3, agentUserName); } stmt.bindDouble(4, entity.getAlegQuality()); String ani = entity.getAni(); if (ani != null) { stmt.bindString(5, ani); } String area = entity.getArea(); if (area != null) { stmt.bindString(6, area); } stmt.bindLong(7, entity.getBillingInSec()); stmt.bindDouble(8, entity.getBlegQuality()); String blegUuid = entity.getBlegUuid(); if (blegUuid != null) { stmt.bindString(9, blegUuid); } stmt.bindLong(10, entity.getBridged() ? 1L: 0L); stmt.bindLong(11, entity.getChargeMin()); String contactName = entity.getContactName(); if (contactName != null) { stmt.bindString(12, contactName); } String createTime = entity.getCreateTime(); if (createTime != null) { stmt.bindString(13, createTime); } String daSampleCategory = entity.getDaSampleCategory(); if (daSampleCategory != null) { stmt.bindString(14, daSampleCategory); } String daSampleDetail = entity.getDaSampleDetail(); if (daSampleDetail != null) { stmt.bindString(15, daSampleDetail); } String daSampleName = entity.getDaSampleName(); if (daSampleName != null) { stmt.bindString(16, daSampleName); } String daTone = entity.getDaTone(); if (daTone != null) { stmt.bindString(17, daTone); } String direction = entity.getDirection(); if (direction != null) { stmt.bindString(18, direction); } String dnbr = entity.getDnbr(); if (dnbr != null) { stmt.bindString(19, dnbr); } String dnis = entity.getDnis(); if (dnis != null) { stmt.bindString(20, dnis); } stmt.bindLong(21, entity.getDurationInSec()); String hangupCause = entity.getHangupCause(); if (hangupCause != null) { stmt.bindString(22, hangupCause); } String hangupTime = entity.getHangupTime(); if (hangupTime != null) { stmt.bindString(23, hangupTime); } String id = entity.getId(); if (id != null) { stmt.bindString(24, id); } String ivrTime = entity.getIvrTime(); if (ivrTime != null) { stmt.bindString(25, ivrTime); } stmt.bindDouble(26, entity.getLat()); stmt.bindDouble(27, entity.getLng()); String orgId = entity.getOrgId(); if (orgId != null) { stmt.bindString(28, orgId); } String reserved1 = entity.getReserved1(); if (reserved1 != null) { stmt.bindString(29, reserved1); } String reserved2 = entity.getReserved2(); if (reserved2 != null) { stmt.bindString(30, reserved2); } stmt.bindLong(31, entity.getSatisfy()); stmt.bindLong(32, entity.getTransfered() ? 1L: 0L); stmt.bindLong(33, entity.getTransferee() ? 1L: 0L); String updateTime = entity.getUpdateTime(); if (updateTime != null) { stmt.bindString(34, updateTime); } String userId = entity.getUserId(); if (userId != null) { stmt.bindString(35, userId); } String uuid = entity.getUuid(); if (uuid != null) { stmt.bindString(36, uuid); } String recordFile = entity.getRecordFile(); if (recordFile != null) { stmt.bindString(37, recordFile); } String reserved5 = entity.getReserved5(); if (reserved5 != null) { stmt.bindString(38, reserved5); } stmt.bindLong(39, entity.getWaitInBillingSec()); stmt.bindLong(40, entity.getWaitInIvrSec()); stmt.bindLong(41, entity.getWaitInQueueSec()); stmt.bindLong(42, entity.getWaitInSec()); } @Override protected final void bindValues(SQLiteStatement stmt, ContentBean entity) { stmt.clearBindings(); Long contentId = entity.getContentId(); if (contentId != null) { stmt.bindLong(1, contentId); } String agentUnames = entity.getAgentUnames(); if (agentUnames != null) { stmt.bindString(2, agentUnames); } String agentUserName = entity.getAgentUserName(); if (agentUserName != null) { stmt.bindString(3, agentUserName); } stmt.bindDouble(4, entity.getAlegQuality()); String ani = entity.getAni(); if (ani != null) { stmt.bindString(5, ani); } String area = entity.getArea(); if (area != null) { stmt.bindString(6, area); } stmt.bindLong(7, entity.getBillingInSec()); stmt.bindDouble(8, entity.getBlegQuality()); String blegUuid = entity.getBlegUuid(); if (blegUuid != null) { stmt.bindString(9, blegUuid); } stmt.bindLong(10, entity.getBridged() ? 1L: 0L); stmt.bindLong(11, entity.getChargeMin()); String contactName = entity.getContactName(); if (contactName != null) { stmt.bindString(12, contactName); } String createTime = entity.getCreateTime(); if (createTime != null) { stmt.bindString(13, createTime); } String daSampleCategory = entity.getDaSampleCategory(); if (daSampleCategory != null) { stmt.bindString(14, daSampleCategory); } String daSampleDetail = entity.getDaSampleDetail(); if (daSampleDetail != null) { stmt.bindString(15, daSampleDetail); } String daSampleName = entity.getDaSampleName(); if (daSampleName != null) { stmt.bindString(16, daSampleName); } String daTone = entity.getDaTone(); if (daTone != null) { stmt.bindString(17, daTone); } String direction = entity.getDirection(); if (direction != null) { stmt.bindString(18, direction); } String dnbr = entity.getDnbr(); if (dnbr != null) { stmt.bindString(19, dnbr); } String dnis = entity.getDnis(); if (dnis != null) { stmt.bindString(20, dnis); } stmt.bindLong(21, entity.getDurationInSec()); String hangupCause = entity.getHangupCause(); if (hangupCause != null) { stmt.bindString(22, hangupCause); } String hangupTime = entity.getHangupTime(); if (hangupTime != null) { stmt.bindString(23, hangupTime); } String id = entity.getId(); if (id != null) { stmt.bindString(24, id); } String ivrTime = entity.getIvrTime(); if (ivrTime != null) { stmt.bindString(25, ivrTime); } stmt.bindDouble(26, entity.getLat()); stmt.bindDouble(27, entity.getLng()); String orgId = entity.getOrgId(); if (orgId != null) { stmt.bindString(28, orgId); } String reserved1 = entity.getReserved1(); if (reserved1 != null) { stmt.bindString(29, reserved1); } String reserved2 = entity.getReserved2(); if (reserved2 != null) { stmt.bindString(30, reserved2); } stmt.bindLong(31, entity.getSatisfy()); stmt.bindLong(32, entity.getTransfered() ? 1L: 0L); stmt.bindLong(33, entity.getTransferee() ? 1L: 0L); String updateTime = entity.getUpdateTime(); if (updateTime != null) { stmt.bindString(34, updateTime); } String userId = entity.getUserId(); if (userId != null) { stmt.bindString(35, userId); } String uuid = entity.getUuid(); if (uuid != null) { stmt.bindString(36, uuid); } String recordFile = entity.getRecordFile(); if (recordFile != null) { stmt.bindString(37, recordFile); } String reserved5 = entity.getReserved5(); if (reserved5 != null) { stmt.bindString(38, reserved5); } stmt.bindLong(39, entity.getWaitInBillingSec()); stmt.bindLong(40, entity.getWaitInIvrSec()); stmt.bindLong(41, entity.getWaitInQueueSec()); stmt.bindLong(42, entity.getWaitInSec()); } @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } @Override public ContentBean readEntity(Cursor cursor, int offset) { ContentBean entity = new ContentBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // contentId cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // agentUnames cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // agentUserName cursor.getDouble(offset + 3), // alegQuality cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // ani cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // area cursor.getInt(offset + 6), // billingInSec cursor.getDouble(offset + 7), // blegQuality cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // blegUuid cursor.getShort(offset + 9) != 0, // bridged cursor.getInt(offset + 10), // chargeMin cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // contactName cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // createTime cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // daSampleCategory cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // daSampleDetail cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // daSampleName cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // daTone cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // direction cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // dnbr cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // dnis cursor.getInt(offset + 20), // durationInSec cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // hangupCause cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // hangupTime cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // id cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // ivrTime cursor.getDouble(offset + 25), // lat cursor.getDouble(offset + 26), // lng cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // orgId cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // reserved1 cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // reserved2 cursor.getInt(offset + 30), // satisfy cursor.getShort(offset + 31) != 0, // transfered cursor.getShort(offset + 32) != 0, // transferee cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // updateTime cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // userId cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // uuid cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // recordFile cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // reserved5 cursor.getInt(offset + 38), // waitInBillingSec cursor.getInt(offset + 39), // waitInIvrSec cursor.getInt(offset + 40), // waitInQueueSec cursor.getInt(offset + 41) // waitInSec ); return entity; } @Override public void readEntity(Cursor cursor, ContentBean entity, int offset) { entity.setContentId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setAgentUnames(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setAgentUserName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setAlegQuality(cursor.getDouble(offset + 3)); entity.setAni(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setArea(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); entity.setBillingInSec(cursor.getInt(offset + 6)); entity.setBlegQuality(cursor.getDouble(offset + 7)); entity.setBlegUuid(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); entity.setBridged(cursor.getShort(offset + 9) != 0); entity.setChargeMin(cursor.getInt(offset + 10)); entity.setContactName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); entity.setCreateTime(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); entity.setDaSampleCategory(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); entity.setDaSampleDetail(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); entity.setDaSampleName(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); entity.setDaTone(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); entity.setDirection(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setDnbr(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setDnis(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); entity.setDurationInSec(cursor.getInt(offset + 20)); entity.setHangupCause(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); entity.setHangupTime(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); entity.setId(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); entity.setIvrTime(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); entity.setLat(cursor.getDouble(offset + 25)); entity.setLng(cursor.getDouble(offset + 26)); entity.setOrgId(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); entity.setReserved1(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); entity.setReserved2(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); entity.setSatisfy(cursor.getInt(offset + 30)); entity.setTransfered(cursor.getShort(offset + 31) != 0); entity.setTransferee(cursor.getShort(offset + 32) != 0); entity.setUpdateTime(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); entity.setUserId(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); entity.setUuid(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); entity.setRecordFile(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); entity.setReserved5(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); entity.setWaitInBillingSec(cursor.getInt(offset + 38)); entity.setWaitInIvrSec(cursor.getInt(offset + 39)); entity.setWaitInQueueSec(cursor.getInt(offset + 40)); entity.setWaitInSec(cursor.getInt(offset + 41)); } @Override protected final Long updateKeyAfterInsert(ContentBean entity, long rowId) { entity.setContentId(rowId); return rowId; } @Override public Long getKey(ContentBean entity) { if(entity != null) { return entity.getContentId(); } else { return null; } } @Override public boolean hasKey(ContentBean entity) { return entity.getContentId() != null; } @Override protected final boolean isEntityUpdateable() { return true; } }
UTF-8
Java
25,977
java
ContentBeanDao.java
Java
[]
null
[]
package com.kty.cc.db.gen; import android.database.Cursor; import android.database.sqlite.SQLiteStatement; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; import org.greenrobot.greendao.internal.DaoConfig; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseStatement; import com.xxxx.cc.model.ContentBean; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table "CONTENT_BEAN". */ public class ContentBeanDao extends AbstractDao<ContentBean, Long> { public static final String TABLENAME = "CONTENT_BEAN"; /** * Properties of entity ContentBean.<br/> * Can be used for QueryBuilder and for referencing column names. */ public static class Properties { public final static Property ContentId = new Property(0, Long.class, "contentId", true, "_id"); public final static Property AgentUnames = new Property(1, String.class, "agentUnames", false, "AGENT_UNAMES"); public final static Property AgentUserName = new Property(2, String.class, "agentUserName", false, "AGENT_USER_NAME"); public final static Property AlegQuality = new Property(3, double.class, "alegQuality", false, "ALEG_QUALITY"); public final static Property Ani = new Property(4, String.class, "ani", false, "ANI"); public final static Property Area = new Property(5, String.class, "area", false, "AREA"); public final static Property BillingInSec = new Property(6, int.class, "billingInSec", false, "BILLING_IN_SEC"); public final static Property BlegQuality = new Property(7, double.class, "blegQuality", false, "BLEG_QUALITY"); public final static Property BlegUuid = new Property(8, String.class, "blegUuid", false, "BLEG_UUID"); public final static Property Bridged = new Property(9, boolean.class, "bridged", false, "BRIDGED"); public final static Property ChargeMin = new Property(10, int.class, "chargeMin", false, "CHARGE_MIN"); public final static Property ContactName = new Property(11, String.class, "contactName", false, "CONTACT_NAME"); public final static Property CreateTime = new Property(12, String.class, "createTime", false, "CREATE_TIME"); public final static Property DaSampleCategory = new Property(13, String.class, "daSampleCategory", false, "DA_SAMPLE_CATEGORY"); public final static Property DaSampleDetail = new Property(14, String.class, "daSampleDetail", false, "DA_SAMPLE_DETAIL"); public final static Property DaSampleName = new Property(15, String.class, "daSampleName", false, "DA_SAMPLE_NAME"); public final static Property DaTone = new Property(16, String.class, "daTone", false, "DA_TONE"); public final static Property Direction = new Property(17, String.class, "direction", false, "DIRECTION"); public final static Property Dnbr = new Property(18, String.class, "dnbr", false, "DNBR"); public final static Property Dnis = new Property(19, String.class, "dnis", false, "DNIS"); public final static Property DurationInSec = new Property(20, int.class, "durationInSec", false, "DURATION_IN_SEC"); public final static Property HangupCause = new Property(21, String.class, "hangupCause", false, "HANGUP_CAUSE"); public final static Property HangupTime = new Property(22, String.class, "hangupTime", false, "HANGUP_TIME"); public final static Property Id = new Property(23, String.class, "id", false, "ID"); public final static Property IvrTime = new Property(24, String.class, "ivrTime", false, "IVR_TIME"); public final static Property Lat = new Property(25, double.class, "lat", false, "LAT"); public final static Property Lng = new Property(26, double.class, "lng", false, "LNG"); public final static Property OrgId = new Property(27, String.class, "orgId", false, "ORG_ID"); public final static Property Reserved1 = new Property(28, String.class, "reserved1", false, "RESERVED1"); public final static Property Reserved2 = new Property(29, String.class, "reserved2", false, "RESERVED2"); public final static Property Satisfy = new Property(30, int.class, "satisfy", false, "SATISFY"); public final static Property Transfered = new Property(31, boolean.class, "transfered", false, "TRANSFERED"); public final static Property Transferee = new Property(32, boolean.class, "transferee", false, "TRANSFEREE"); public final static Property UpdateTime = new Property(33, String.class, "updateTime", false, "UPDATE_TIME"); public final static Property UserId = new Property(34, String.class, "userId", false, "USER_ID"); public final static Property Uuid = new Property(35, String.class, "uuid", false, "UUID"); public final static Property RecordFile = new Property(36, String.class, "recordFile", false, "RECORD_FILE"); public final static Property Reserved5 = new Property(37, String.class, "reserved5", false, "RESERVED5"); public final static Property WaitInBillingSec = new Property(38, int.class, "waitInBillingSec", false, "WAIT_IN_BILLING_SEC"); public final static Property WaitInIvrSec = new Property(39, int.class, "waitInIvrSec", false, "WAIT_IN_IVR_SEC"); public final static Property WaitInQueueSec = new Property(40, int.class, "waitInQueueSec", false, "WAIT_IN_QUEUE_SEC"); public final static Property WaitInSec = new Property(41, int.class, "waitInSec", false, "WAIT_IN_SEC"); } public ContentBeanDao(DaoConfig config) { super(config); } public ContentBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"CONTENT_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: contentId "\"AGENT_UNAMES\" TEXT," + // 1: agentUnames "\"AGENT_USER_NAME\" TEXT," + // 2: agentUserName "\"ALEG_QUALITY\" REAL NOT NULL ," + // 3: alegQuality "\"ANI\" TEXT," + // 4: ani "\"AREA\" TEXT," + // 5: area "\"BILLING_IN_SEC\" INTEGER NOT NULL ," + // 6: billingInSec "\"BLEG_QUALITY\" REAL NOT NULL ," + // 7: blegQuality "\"BLEG_UUID\" TEXT," + // 8: blegUuid "\"BRIDGED\" INTEGER NOT NULL ," + // 9: bridged "\"CHARGE_MIN\" INTEGER NOT NULL ," + // 10: chargeMin "\"CONTACT_NAME\" TEXT," + // 11: contactName "\"CREATE_TIME\" TEXT," + // 12: createTime "\"DA_SAMPLE_CATEGORY\" TEXT," + // 13: daSampleCategory "\"DA_SAMPLE_DETAIL\" TEXT," + // 14: daSampleDetail "\"DA_SAMPLE_NAME\" TEXT," + // 15: daSampleName "\"DA_TONE\" TEXT," + // 16: daTone "\"DIRECTION\" TEXT," + // 17: direction "\"DNBR\" TEXT," + // 18: dnbr "\"DNIS\" TEXT," + // 19: dnis "\"DURATION_IN_SEC\" INTEGER NOT NULL ," + // 20: durationInSec "\"HANGUP_CAUSE\" TEXT," + // 21: hangupCause "\"HANGUP_TIME\" TEXT," + // 22: hangupTime "\"ID\" TEXT," + // 23: id "\"IVR_TIME\" TEXT," + // 24: ivrTime "\"LAT\" REAL NOT NULL ," + // 25: lat "\"LNG\" REAL NOT NULL ," + // 26: lng "\"ORG_ID\" TEXT," + // 27: orgId "\"RESERVED1\" TEXT," + // 28: reserved1 "\"RESERVED2\" TEXT," + // 29: reserved2 "\"SATISFY\" INTEGER NOT NULL ," + // 30: satisfy "\"TRANSFERED\" INTEGER NOT NULL ," + // 31: transfered "\"TRANSFEREE\" INTEGER NOT NULL ," + // 32: transferee "\"UPDATE_TIME\" TEXT," + // 33: updateTime "\"USER_ID\" TEXT," + // 34: userId "\"UUID\" TEXT," + // 35: uuid "\"RECORD_FILE\" TEXT," + // 36: recordFile "\"RESERVED5\" TEXT," + // 37: reserved5 "\"WAIT_IN_BILLING_SEC\" INTEGER NOT NULL ," + // 38: waitInBillingSec "\"WAIT_IN_IVR_SEC\" INTEGER NOT NULL ," + // 39: waitInIvrSec "\"WAIT_IN_QUEUE_SEC\" INTEGER NOT NULL ," + // 40: waitInQueueSec "\"WAIT_IN_SEC\" INTEGER NOT NULL );"); // 41: waitInSec // Add Indexes db.execSQL("CREATE UNIQUE INDEX " + constraint + "IDX_CONTENT_BEAN_ID ON CONTENT_BEAN" + " (\"ID\" ASC);"); } /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CONTENT_BEAN\""; db.execSQL(sql); } @Override protected final void bindValues(DatabaseStatement stmt, ContentBean entity) { stmt.clearBindings(); Long contentId = entity.getContentId(); if (contentId != null) { stmt.bindLong(1, contentId); } String agentUnames = entity.getAgentUnames(); if (agentUnames != null) { stmt.bindString(2, agentUnames); } String agentUserName = entity.getAgentUserName(); if (agentUserName != null) { stmt.bindString(3, agentUserName); } stmt.bindDouble(4, entity.getAlegQuality()); String ani = entity.getAni(); if (ani != null) { stmt.bindString(5, ani); } String area = entity.getArea(); if (area != null) { stmt.bindString(6, area); } stmt.bindLong(7, entity.getBillingInSec()); stmt.bindDouble(8, entity.getBlegQuality()); String blegUuid = entity.getBlegUuid(); if (blegUuid != null) { stmt.bindString(9, blegUuid); } stmt.bindLong(10, entity.getBridged() ? 1L: 0L); stmt.bindLong(11, entity.getChargeMin()); String contactName = entity.getContactName(); if (contactName != null) { stmt.bindString(12, contactName); } String createTime = entity.getCreateTime(); if (createTime != null) { stmt.bindString(13, createTime); } String daSampleCategory = entity.getDaSampleCategory(); if (daSampleCategory != null) { stmt.bindString(14, daSampleCategory); } String daSampleDetail = entity.getDaSampleDetail(); if (daSampleDetail != null) { stmt.bindString(15, daSampleDetail); } String daSampleName = entity.getDaSampleName(); if (daSampleName != null) { stmt.bindString(16, daSampleName); } String daTone = entity.getDaTone(); if (daTone != null) { stmt.bindString(17, daTone); } String direction = entity.getDirection(); if (direction != null) { stmt.bindString(18, direction); } String dnbr = entity.getDnbr(); if (dnbr != null) { stmt.bindString(19, dnbr); } String dnis = entity.getDnis(); if (dnis != null) { stmt.bindString(20, dnis); } stmt.bindLong(21, entity.getDurationInSec()); String hangupCause = entity.getHangupCause(); if (hangupCause != null) { stmt.bindString(22, hangupCause); } String hangupTime = entity.getHangupTime(); if (hangupTime != null) { stmt.bindString(23, hangupTime); } String id = entity.getId(); if (id != null) { stmt.bindString(24, id); } String ivrTime = entity.getIvrTime(); if (ivrTime != null) { stmt.bindString(25, ivrTime); } stmt.bindDouble(26, entity.getLat()); stmt.bindDouble(27, entity.getLng()); String orgId = entity.getOrgId(); if (orgId != null) { stmt.bindString(28, orgId); } String reserved1 = entity.getReserved1(); if (reserved1 != null) { stmt.bindString(29, reserved1); } String reserved2 = entity.getReserved2(); if (reserved2 != null) { stmt.bindString(30, reserved2); } stmt.bindLong(31, entity.getSatisfy()); stmt.bindLong(32, entity.getTransfered() ? 1L: 0L); stmt.bindLong(33, entity.getTransferee() ? 1L: 0L); String updateTime = entity.getUpdateTime(); if (updateTime != null) { stmt.bindString(34, updateTime); } String userId = entity.getUserId(); if (userId != null) { stmt.bindString(35, userId); } String uuid = entity.getUuid(); if (uuid != null) { stmt.bindString(36, uuid); } String recordFile = entity.getRecordFile(); if (recordFile != null) { stmt.bindString(37, recordFile); } String reserved5 = entity.getReserved5(); if (reserved5 != null) { stmt.bindString(38, reserved5); } stmt.bindLong(39, entity.getWaitInBillingSec()); stmt.bindLong(40, entity.getWaitInIvrSec()); stmt.bindLong(41, entity.getWaitInQueueSec()); stmt.bindLong(42, entity.getWaitInSec()); } @Override protected final void bindValues(SQLiteStatement stmt, ContentBean entity) { stmt.clearBindings(); Long contentId = entity.getContentId(); if (contentId != null) { stmt.bindLong(1, contentId); } String agentUnames = entity.getAgentUnames(); if (agentUnames != null) { stmt.bindString(2, agentUnames); } String agentUserName = entity.getAgentUserName(); if (agentUserName != null) { stmt.bindString(3, agentUserName); } stmt.bindDouble(4, entity.getAlegQuality()); String ani = entity.getAni(); if (ani != null) { stmt.bindString(5, ani); } String area = entity.getArea(); if (area != null) { stmt.bindString(6, area); } stmt.bindLong(7, entity.getBillingInSec()); stmt.bindDouble(8, entity.getBlegQuality()); String blegUuid = entity.getBlegUuid(); if (blegUuid != null) { stmt.bindString(9, blegUuid); } stmt.bindLong(10, entity.getBridged() ? 1L: 0L); stmt.bindLong(11, entity.getChargeMin()); String contactName = entity.getContactName(); if (contactName != null) { stmt.bindString(12, contactName); } String createTime = entity.getCreateTime(); if (createTime != null) { stmt.bindString(13, createTime); } String daSampleCategory = entity.getDaSampleCategory(); if (daSampleCategory != null) { stmt.bindString(14, daSampleCategory); } String daSampleDetail = entity.getDaSampleDetail(); if (daSampleDetail != null) { stmt.bindString(15, daSampleDetail); } String daSampleName = entity.getDaSampleName(); if (daSampleName != null) { stmt.bindString(16, daSampleName); } String daTone = entity.getDaTone(); if (daTone != null) { stmt.bindString(17, daTone); } String direction = entity.getDirection(); if (direction != null) { stmt.bindString(18, direction); } String dnbr = entity.getDnbr(); if (dnbr != null) { stmt.bindString(19, dnbr); } String dnis = entity.getDnis(); if (dnis != null) { stmt.bindString(20, dnis); } stmt.bindLong(21, entity.getDurationInSec()); String hangupCause = entity.getHangupCause(); if (hangupCause != null) { stmt.bindString(22, hangupCause); } String hangupTime = entity.getHangupTime(); if (hangupTime != null) { stmt.bindString(23, hangupTime); } String id = entity.getId(); if (id != null) { stmt.bindString(24, id); } String ivrTime = entity.getIvrTime(); if (ivrTime != null) { stmt.bindString(25, ivrTime); } stmt.bindDouble(26, entity.getLat()); stmt.bindDouble(27, entity.getLng()); String orgId = entity.getOrgId(); if (orgId != null) { stmt.bindString(28, orgId); } String reserved1 = entity.getReserved1(); if (reserved1 != null) { stmt.bindString(29, reserved1); } String reserved2 = entity.getReserved2(); if (reserved2 != null) { stmt.bindString(30, reserved2); } stmt.bindLong(31, entity.getSatisfy()); stmt.bindLong(32, entity.getTransfered() ? 1L: 0L); stmt.bindLong(33, entity.getTransferee() ? 1L: 0L); String updateTime = entity.getUpdateTime(); if (updateTime != null) { stmt.bindString(34, updateTime); } String userId = entity.getUserId(); if (userId != null) { stmt.bindString(35, userId); } String uuid = entity.getUuid(); if (uuid != null) { stmt.bindString(36, uuid); } String recordFile = entity.getRecordFile(); if (recordFile != null) { stmt.bindString(37, recordFile); } String reserved5 = entity.getReserved5(); if (reserved5 != null) { stmt.bindString(38, reserved5); } stmt.bindLong(39, entity.getWaitInBillingSec()); stmt.bindLong(40, entity.getWaitInIvrSec()); stmt.bindLong(41, entity.getWaitInQueueSec()); stmt.bindLong(42, entity.getWaitInSec()); } @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } @Override public ContentBean readEntity(Cursor cursor, int offset) { ContentBean entity = new ContentBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // contentId cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // agentUnames cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // agentUserName cursor.getDouble(offset + 3), // alegQuality cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // ani cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // area cursor.getInt(offset + 6), // billingInSec cursor.getDouble(offset + 7), // blegQuality cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // blegUuid cursor.getShort(offset + 9) != 0, // bridged cursor.getInt(offset + 10), // chargeMin cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // contactName cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // createTime cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // daSampleCategory cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // daSampleDetail cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // daSampleName cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // daTone cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // direction cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // dnbr cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // dnis cursor.getInt(offset + 20), // durationInSec cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // hangupCause cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // hangupTime cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // id cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // ivrTime cursor.getDouble(offset + 25), // lat cursor.getDouble(offset + 26), // lng cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // orgId cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // reserved1 cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // reserved2 cursor.getInt(offset + 30), // satisfy cursor.getShort(offset + 31) != 0, // transfered cursor.getShort(offset + 32) != 0, // transferee cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // updateTime cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // userId cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // uuid cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // recordFile cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // reserved5 cursor.getInt(offset + 38), // waitInBillingSec cursor.getInt(offset + 39), // waitInIvrSec cursor.getInt(offset + 40), // waitInQueueSec cursor.getInt(offset + 41) // waitInSec ); return entity; } @Override public void readEntity(Cursor cursor, ContentBean entity, int offset) { entity.setContentId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setAgentUnames(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setAgentUserName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setAlegQuality(cursor.getDouble(offset + 3)); entity.setAni(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setArea(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); entity.setBillingInSec(cursor.getInt(offset + 6)); entity.setBlegQuality(cursor.getDouble(offset + 7)); entity.setBlegUuid(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); entity.setBridged(cursor.getShort(offset + 9) != 0); entity.setChargeMin(cursor.getInt(offset + 10)); entity.setContactName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); entity.setCreateTime(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); entity.setDaSampleCategory(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); entity.setDaSampleDetail(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); entity.setDaSampleName(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); entity.setDaTone(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); entity.setDirection(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setDnbr(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setDnis(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); entity.setDurationInSec(cursor.getInt(offset + 20)); entity.setHangupCause(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); entity.setHangupTime(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); entity.setId(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); entity.setIvrTime(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); entity.setLat(cursor.getDouble(offset + 25)); entity.setLng(cursor.getDouble(offset + 26)); entity.setOrgId(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); entity.setReserved1(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); entity.setReserved2(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); entity.setSatisfy(cursor.getInt(offset + 30)); entity.setTransfered(cursor.getShort(offset + 31) != 0); entity.setTransferee(cursor.getShort(offset + 32) != 0); entity.setUpdateTime(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); entity.setUserId(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); entity.setUuid(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); entity.setRecordFile(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); entity.setReserved5(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); entity.setWaitInBillingSec(cursor.getInt(offset + 38)); entity.setWaitInIvrSec(cursor.getInt(offset + 39)); entity.setWaitInQueueSec(cursor.getInt(offset + 40)); entity.setWaitInSec(cursor.getInt(offset + 41)); } @Override protected final Long updateKeyAfterInsert(ContentBean entity, long rowId) { entity.setContentId(rowId); return rowId; } @Override public Long getKey(ContentBean entity) { if(entity != null) { return entity.getContentId(); } else { return null; } } @Override public boolean hasKey(ContentBean entity) { return entity.getContentId() != null; } @Override protected final boolean isEntityUpdateable() { return true; } }
25,977
0.594333
0.570967
572
44.414337
33.268108
136
false
false
0
0
0
0
0
0
1.047203
false
false
4
4c371d9fae8dd3f8b4db7e041274e093395c8543
14,078,902,801,899
e7c42c0cf37cbd12da99b21b6599f0eaa02f0bdc
/src/com/deliverik/infogovernor/soc/cim/vo/IGCIM20011VO.java
87d966badc37da00fd7049e53cd73226c29d661b
[]
no_license
SuPerCat323/IGCRCB
https://github.com/SuPerCat323/IGCRCB
b6c577705a0983c658301f418d05925557d2ec56
4fbe4a786e1621f6a76b716dfd73b8206f0b2e0b
refs/heads/master
2020-09-28T02:45:33.354000
2017-10-17T00:16:49
2017-10-17T00:16:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.deliverik.infogovernor.soc.cim.vo; import java.io.Serializable; import com.deliverik.framework.base.BaseVO; import com.deliverik.infogovernor.soc.cim.form.IGCIM2001Form; public class IGCIM20011VO extends BaseVO implements Serializable{ private static final long serialVersionUID = 1L; public IGCIM20011VO(){ } public IGCIM20011VO(IGCIM2001Form igcim2001Form){ this.igcim2001Form = igcim2001Form; } private IGCIM2001Form igcim2001Form; public IGCIM2001Form getIgcim2001Form() { return igcim2001Form; } public void setIgcim2001Form(IGCIM2001Form igcim2001Form) { this.igcim2001Form = igcim2001Form; } }
UTF-8
Java
648
java
IGCIM20011VO.java
Java
[]
null
[]
package com.deliverik.infogovernor.soc.cim.vo; import java.io.Serializable; import com.deliverik.framework.base.BaseVO; import com.deliverik.infogovernor.soc.cim.form.IGCIM2001Form; public class IGCIM20011VO extends BaseVO implements Serializable{ private static final long serialVersionUID = 1L; public IGCIM20011VO(){ } public IGCIM20011VO(IGCIM2001Form igcim2001Form){ this.igcim2001Form = igcim2001Form; } private IGCIM2001Form igcim2001Form; public IGCIM2001Form getIgcim2001Form() { return igcim2001Form; } public void setIgcim2001Form(IGCIM2001Form igcim2001Form) { this.igcim2001Form = igcim2001Form; } }
648
0.790123
0.67284
31
19.903225
22.626497
65
false
false
0
0
0
0
0
0
1.032258
false
false
4
9ab9b333b820656096d76435ceb6a88c0ac94b8a
30,099,130,813,299
3614e2e6bfc3aa992fee48dc9215fc189dfa19a4
/src/main/java/online/study/vcp/service/NotificationService.java
b556863f42cf73d9f9c6186cbea48ca9065af46e
[]
no_license
nedisUa/vcp
https://github.com/nedisUa/vcp
b428b2627c0bce08d2a67fdf6bcc84a4c65a72b7
006755e57cbddca8b71f9a562e018aa4d45f935a
refs/heads/master
2016-09-13T15:01:50.099000
2016-05-08T17:29:36
2016-05-08T17:29:36
56,130,103
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package online.study.vcp.service; import online.study.vcp.domain.Account; public interface NotificationService { void sendRestoreAccessLink(Account profile, String restoreLink); }
UTF-8
Java
192
java
NotificationService.java
Java
[]
null
[]
package online.study.vcp.service; import online.study.vcp.domain.Account; public interface NotificationService { void sendRestoreAccessLink(Account profile, String restoreLink); }
192
0.786458
0.786458
8
22
23.473389
65
false
false
0
0
0
0
0
0
0.625
false
false
4
14e77c52d6ed4e194d9d11a520edcdb09e7496af
2,104,534,026,972
bac6ed1f925a840ee926265a26b4539803abbec4
/QueueingSystem/src/ds/assign1/A_Counter.java
c23726fab2d015e675322bee3e10eed7e02ca66b
[]
no_license
haoshan98/PriorityQueueingSystem
https://github.com/haoshan98/PriorityQueueingSystem
0e4e8c327777ce356ee1b30234598e4d864c03ad
588b6c13ebf864b310defb72464c5852fe9fd039
refs/heads/master
2020-07-03T00:52:33.338000
2019-08-11T07:29:05
2019-08-11T07:29:05
201,732,143
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ds.assign1; import static ds.assign1.DS_Main.customerNumber; import static ds.assign1.DS_Main.customerQueue; import static ds.assign1.DS_Main.goOutOfQueue; import static ds.assign1.DS_Main.lockF; import static ds.assign1.DS_Main.systemStartTime; import java.util.PriorityQueue; import java.util.Queue; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import movingcustomer.TheCinema; public class A_Counter extends Thread { private static final Counter<Queue_.Node> a = new Counter<>(10, "A"); public static Queue<sortList> customerToA = new PriorityQueue<>(); public static Lock lockA = new ReentrantLock(); public TheCinema cin; public A_Counter(TheCinema cin) { this.cin = cin; } public A_Counter() { } @Override public void run() { progressA(); } public synchronized void progressA(){ lockA.lock(); try { while (a.isAvailable()) { // while( vip.isEmpty() && n_mem.isEmpty()){ // System.out.println("Wait for customer coming : "); // notEmpty.await(); // } Queue_.Node customer = goOutOfQueue(); int ctn = 0; if (customer == null) { Thread.sleep(100); //1000!!! ctn++; if (ctn == 5) { System.out.println("Counter A waiting..."); ctn = 0; } continue; } if (customer != null) { //System.out.println("COUNTER A " + customer); cin.dequeueToCounter(customer.getType(), "A", 500); a.setCustomer(customer); a.setAvailable(false); customer.setServeSequence(++customerNumber); customer.setStartTime((System.currentTimeMillis() - systemStartTime) / 1000); a.setStartTime(customer.getStartTime()); customer.setWaitingTime(customer.getStartTime() - customer.getArrivalTime()); customer.setProcessTime(customer.getNumTicket() * a.getSellRate()); customer.setEndTime(customer.getStartTime() + customer.getProcessTime()); customer.setRating(5); System.out.println(customer + " go Counter " + a.getCounterType() + "\n[A]Start Time : " + customer.getStartTime() + " | [A]End Time : " + customer.getEndTime() + "\n----------------------------------------------------------------------------------------------"); //map.put(customer, a); lockF.lock(); try{ customerQueue.add(new sortList(customer, a)); }finally{ lockF.unlock(); } customerToA.add(new sortList(customer, a)); Thread.sleep(customer.getProcessTime() * 100); //1000 !!! customer.setRating(3); a.setRating(5); a.setAvailable(true); } } } catch (InterruptedException ex) { ex.printStackTrace(); } finally { lockA.unlock(); } } public static Counter<Queue_.Node> getA() { return a; } }
UTF-8
Java
3,747
java
A_Counter.java
Java
[]
null
[]
package ds.assign1; import static ds.assign1.DS_Main.customerNumber; import static ds.assign1.DS_Main.customerQueue; import static ds.assign1.DS_Main.goOutOfQueue; import static ds.assign1.DS_Main.lockF; import static ds.assign1.DS_Main.systemStartTime; import java.util.PriorityQueue; import java.util.Queue; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import movingcustomer.TheCinema; public class A_Counter extends Thread { private static final Counter<Queue_.Node> a = new Counter<>(10, "A"); public static Queue<sortList> customerToA = new PriorityQueue<>(); public static Lock lockA = new ReentrantLock(); public TheCinema cin; public A_Counter(TheCinema cin) { this.cin = cin; } public A_Counter() { } @Override public void run() { progressA(); } public synchronized void progressA(){ lockA.lock(); try { while (a.isAvailable()) { // while( vip.isEmpty() && n_mem.isEmpty()){ // System.out.println("Wait for customer coming : "); // notEmpty.await(); // } Queue_.Node customer = goOutOfQueue(); int ctn = 0; if (customer == null) { Thread.sleep(100); //1000!!! ctn++; if (ctn == 5) { System.out.println("Counter A waiting..."); ctn = 0; } continue; } if (customer != null) { //System.out.println("COUNTER A " + customer); cin.dequeueToCounter(customer.getType(), "A", 500); a.setCustomer(customer); a.setAvailable(false); customer.setServeSequence(++customerNumber); customer.setStartTime((System.currentTimeMillis() - systemStartTime) / 1000); a.setStartTime(customer.getStartTime()); customer.setWaitingTime(customer.getStartTime() - customer.getArrivalTime()); customer.setProcessTime(customer.getNumTicket() * a.getSellRate()); customer.setEndTime(customer.getStartTime() + customer.getProcessTime()); customer.setRating(5); System.out.println(customer + " go Counter " + a.getCounterType() + "\n[A]Start Time : " + customer.getStartTime() + " | [A]End Time : " + customer.getEndTime() + "\n----------------------------------------------------------------------------------------------"); //map.put(customer, a); lockF.lock(); try{ customerQueue.add(new sortList(customer, a)); }finally{ lockF.unlock(); } customerToA.add(new sortList(customer, a)); Thread.sleep(customer.getProcessTime() * 100); //1000 !!! customer.setRating(3); a.setRating(5); a.setAvailable(true); } } } catch (InterruptedException ex) { ex.printStackTrace(); } finally { lockA.unlock(); } } public static Counter<Queue_.Node> getA() { return a; } }
3,747
0.464905
0.455564
102
34.735294
28.13341
130
false
false
0
0
0
0
0
0
0.568627
false
false
4
db16b98d6978c1362a36403626d89f896579908b
26,414,048,935,717
20c7fffbe654f8c655bb212bd9b4b85a227d46e8
/src/main/java/init/ViewNamesContentNegotiatingViewResolver.java
180f9a0901f3b9aad2e0cf4d8f091f2225b6478d
[]
no_license
mcrysler/bastet-webapp
https://github.com/mcrysler/bastet-webapp
2bf819a9dc49e641e28553506f9b9acb09c3a403
f73cd21c344955ae6e7223dc2d1687e490b7de7d
refs/heads/master
2016-08-08T15:09:32.429000
2015-08-27T19:34:20
2015-08-27T19:34:20
41,191,623
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package init; import java.util.Locale; import org.springframework.util.PatternMatchUtils; import org.springframework.web.servlet.View; import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; /** * @author mcrysler */ public class ViewNamesContentNegotiatingViewResolver extends ContentNegotiatingViewResolver { private String[] viewNames = null; /* * (non-Javadoc) * * @see org.springframework.web.servlet.ViewResolver#resolveViewName( * java.lang.String, java.util.Locale) */ @Override public View resolveViewName(String viewName, Locale locale) throws Exception { // If this resolver is not supposed to handle the given view, // return null to pass on to the next resolver in the chain. if (canHandle(viewName, locale)) { return super.resolveViewName(viewName, locale); } return null; } /** * Set the view names (or name patterns) that can be handled by this * {@link org.springframework.web.servlet.ViewResolver}. View names can * contain simple wildcards such that 'my*', '*Report' and '*Repo*' will all * match the view name 'myReport'. * @param viewNames String[] * @see #canHandle */ public void setViewNames(String[] viewNames) { this.viewNames = viewNames; } /** * Return the view names (or name patterns) that can be handled by this * {@link org.springframework.web.servlet.ViewResolver}. * @return String[] viewNames */ protected String[] getViewNames() { return this.viewNames; } /** * Indicates whether or not this * {@link org.springframework.web.servlet.ViewResolver} can handle the * supplied view name. If not, * {@link #resolveViewName(String, java.util.Locale)} will return * <code>null</code>. The default implementation checks against the * configured {@link #setViewNames view names}. * * @param viewName * the name of the view to retrieve * @param locale * the Locale to retrieve the view for * @return whether this resolver applies to the specified view * @see org.springframework.util.PatternMatchUtils#simpleMatch(String, * String) */ protected boolean canHandle(String viewName, Locale locale) { return (getViewNames() == null || PatternMatchUtils.simpleMatch( getViewNames(), viewName)); } }
UTF-8
Java
2,517
java
ViewNamesContentNegotiatingViewResolver.java
Java
[ { "context": "ew.ContentNegotiatingViewResolver;\n\n/**\n * @author mcrysler\n */\npublic class ViewNamesContentNegotiatingViewR", "end": 237, "score": 0.999120831489563, "start": 229, "tag": "USERNAME", "value": "mcrysler" } ]
null
[]
package init; import java.util.Locale; import org.springframework.util.PatternMatchUtils; import org.springframework.web.servlet.View; import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; /** * @author mcrysler */ public class ViewNamesContentNegotiatingViewResolver extends ContentNegotiatingViewResolver { private String[] viewNames = null; /* * (non-Javadoc) * * @see org.springframework.web.servlet.ViewResolver#resolveViewName( * java.lang.String, java.util.Locale) */ @Override public View resolveViewName(String viewName, Locale locale) throws Exception { // If this resolver is not supposed to handle the given view, // return null to pass on to the next resolver in the chain. if (canHandle(viewName, locale)) { return super.resolveViewName(viewName, locale); } return null; } /** * Set the view names (or name patterns) that can be handled by this * {@link org.springframework.web.servlet.ViewResolver}. View names can * contain simple wildcards such that 'my*', '*Report' and '*Repo*' will all * match the view name 'myReport'. * @param viewNames String[] * @see #canHandle */ public void setViewNames(String[] viewNames) { this.viewNames = viewNames; } /** * Return the view names (or name patterns) that can be handled by this * {@link org.springframework.web.servlet.ViewResolver}. * @return String[] viewNames */ protected String[] getViewNames() { return this.viewNames; } /** * Indicates whether or not this * {@link org.springframework.web.servlet.ViewResolver} can handle the * supplied view name. If not, * {@link #resolveViewName(String, java.util.Locale)} will return * <code>null</code>. The default implementation checks against the * configured {@link #setViewNames view names}. * * @param viewName * the name of the view to retrieve * @param locale * the Locale to retrieve the view for * @return whether this resolver applies to the specified view * @see org.springframework.util.PatternMatchUtils#simpleMatch(String, * String) */ protected boolean canHandle(String viewName, Locale locale) { return (getViewNames() == null || PatternMatchUtils.simpleMatch( getViewNames(), viewName)); } }
2,517
0.650775
0.650775
80
30.4625
27.104862
91
false
false
0
0
0
0
0
0
0.3
false
false
4
344cba95170dceb81100b6772eef977c05b88328
19,258,633,402,224
1c7c386483c9a16f4c9b238028bc422c811d154f
/src/main/java/pe/com/sample/presenter/ComparatorPresenter.java
d3f656d4448deaa0b899d4e13a3dfd2d11b46b91
[]
no_license
TioCoding/SampleFx
https://github.com/TioCoding/SampleFx
d22e7e899ac06f4e44a94e34294b2300f03fd83e
c2fee2af5af6d47e869f61ca606d5a343714f19c
refs/heads/master
2021-05-04T16:43:12.502000
2018-02-05T05:09:05
2018-02-05T05:09:05
120,257,632
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package pe.com.sample.presenter; import pe.com.sample.interactor.ComparatorInteractor; import pe.com.sample.view.ComparatorView; public class ComparatorPresenter { private ComparatorView comparatorView; private ComparatorInteractor comparatorInteractor; public ComparatorPresenter(ComparatorView comparatorView){ this.comparatorView = comparatorView; this.comparatorInteractor = new ComparatorInteractor(this); } public void generateExcel(){ /*CREAR LISTA DE COMPARACION*/ comparatorView.setTotalProgressBar(11); comparatorView.showDialogLoadOperation(); comparatorInteractor.generateExcel(); } public void progressBarPlus(){ comparatorView.plusProgressBar(); } public void generateSuccess() { comparatorView.closeDialogLoadOperation(); comparatorView.resetProgressBar(); comparatorView.showMessageSuccess("Se genero el Excel satisfactoriamente"); } public void generateError() { } }
UTF-8
Java
1,020
java
ComparatorPresenter.java
Java
[]
null
[]
package pe.com.sample.presenter; import pe.com.sample.interactor.ComparatorInteractor; import pe.com.sample.view.ComparatorView; public class ComparatorPresenter { private ComparatorView comparatorView; private ComparatorInteractor comparatorInteractor; public ComparatorPresenter(ComparatorView comparatorView){ this.comparatorView = comparatorView; this.comparatorInteractor = new ComparatorInteractor(this); } public void generateExcel(){ /*CREAR LISTA DE COMPARACION*/ comparatorView.setTotalProgressBar(11); comparatorView.showDialogLoadOperation(); comparatorInteractor.generateExcel(); } public void progressBarPlus(){ comparatorView.plusProgressBar(); } public void generateSuccess() { comparatorView.closeDialogLoadOperation(); comparatorView.resetProgressBar(); comparatorView.showMessageSuccess("Se genero el Excel satisfactoriamente"); } public void generateError() { } }
1,020
0.728431
0.726471
35
28.142857
23.616148
83
false
false
0
0
0
0
0
0
0.4
false
false
4
3bb51fb95cc74cc0bd5e0555021ea3bff7a8d957
30,202,210,079,154
e306f4970968eaff84a65f7df8204affd71ff94a
/src/main/java/tk/amplifiable/mc2/world/block/BlockType.java
c6aaa6769d8633faea5cee244644907c8f938354
[]
no_license
AmpTheDev/Minecraft2
https://github.com/AmpTheDev/Minecraft2
64b93d42aa6d325ed30d36941453aac506875eda
f55ec17d4ae02c772d536a049720103034f10da8
refs/heads/master
2020-03-28T02:16:09.870000
2018-09-05T18:06:53
2018-09-05T18:06:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tk.amplifiable.mc2.world.block; import lombok.Getter; import tk.amplifiable.mc2.resources.ResourceLocation; public class BlockType { @Getter private BlockData data; @Getter private ResourceLocation bottomTexture; @Getter private ResourceLocation leftTexture; @Getter private ResourceLocation rightTexture; @Getter private ResourceLocation frontTexture; @Getter private ResourceLocation backTexture; @Getter private ResourceLocation topTexture; public BlockType(String fileName, ResourceLocation texture) { data = new BlockData(fileName); this.bottomTexture = texture; this.leftTexture = texture; this.rightTexture = texture; this.frontTexture = texture; this.backTexture = texture; this.topTexture = texture; } public BlockType setBottomTexture(ResourceLocation bottomTexture) { this.bottomTexture = bottomTexture; return this; } public BlockType setLeftTexture(ResourceLocation leftTexture) { this.leftTexture = leftTexture; return this; } public BlockType setRightTexture(ResourceLocation rightTexture) { this.rightTexture = rightTexture; return this; } public BlockType setFrontTexture(ResourceLocation frontTexture) { this.frontTexture = frontTexture; return this; } public BlockType setBackTexture(ResourceLocation backTexture) { this.backTexture = backTexture; return this; } public BlockType setTopTexture(ResourceLocation topTexture) { this.topTexture = topTexture; return this; } }
UTF-8
Java
1,539
java
BlockType.java
Java
[]
null
[]
package tk.amplifiable.mc2.world.block; import lombok.Getter; import tk.amplifiable.mc2.resources.ResourceLocation; public class BlockType { @Getter private BlockData data; @Getter private ResourceLocation bottomTexture; @Getter private ResourceLocation leftTexture; @Getter private ResourceLocation rightTexture; @Getter private ResourceLocation frontTexture; @Getter private ResourceLocation backTexture; @Getter private ResourceLocation topTexture; public BlockType(String fileName, ResourceLocation texture) { data = new BlockData(fileName); this.bottomTexture = texture; this.leftTexture = texture; this.rightTexture = texture; this.frontTexture = texture; this.backTexture = texture; this.topTexture = texture; } public BlockType setBottomTexture(ResourceLocation bottomTexture) { this.bottomTexture = bottomTexture; return this; } public BlockType setLeftTexture(ResourceLocation leftTexture) { this.leftTexture = leftTexture; return this; } public BlockType setRightTexture(ResourceLocation rightTexture) { this.rightTexture = rightTexture; return this; } public BlockType setFrontTexture(ResourceLocation frontTexture) { this.frontTexture = frontTexture; return this; } public BlockType setBackTexture(ResourceLocation backTexture) { this.backTexture = backTexture; return this; } public BlockType setTopTexture(ResourceLocation topTexture) { this.topTexture = topTexture; return this; } }
1,539
0.755036
0.753736
60
24.65
20.879675
69
false
false
0
0
0
0
0
0
0.5
false
false
4
10a1bca1820a28eb858a957f4130f44f0ecbca23
446,676,645,887
0290d8c10e7d2aacffa92278676c7a8beaadf07a
/VIAC/src/main/java/com/vanderlande/viac/userManagement/UserProfilePage.java
1f0656cd50b2f248d90c8a8d63aee62078b03353
[]
no_license
JoshuaHillmann/viac-viup
https://github.com/JoshuaHillmann/viac-viup
53107cd65602ab47fcf279868222529ed34a0a32
2200e666409efec0f8d802b66f17aab03033dcbc
refs/heads/master
2021-07-23T03:49:59.123000
2017-11-02T14:39:02
2017-11-02T14:39:02
109,266,804
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vanderlande.viac.userManagement; import java.util.Date; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.PasswordTextField; import org.apache.wicket.markup.html.form.RequiredTextField; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; import org.apache.wicket.validation.validator.EmailAddressValidator; import com.vanderlande.util.DatabaseProvider; import com.vanderlande.viac.VIACBasePage; import com.vanderlande.viac.model.VIACUser; import com.vanderlande.viac.session.VIACSession; /** * The Class UserProfilePage. * * @author dedhor * * The user profile page. The user can change his name (must be an email) and his password. */ public class UserProfilePage extends VIACBasePage { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 8093804776788134968L; /** The user model. */ private VIACUser userModel; /** The last page. */ private WebPage lastPage; /** The repeat password. */ private String password, repeatPassword; /** The success change. */ private WebMarkupContainer errorPassword; /** The error change. */ private WebMarkupContainer errorChange; /** The error password compare. */ private WebMarkupContainer errorPasswordCompare; /** The success change. */ private WebMarkupContainer successChange; /** * Instantiates a new user profile page. * * @param user * the user */ public UserProfilePage(VIACUser user) { userModel = user; init(); } /** * Instantiates a new user profile page. * * @param user * the user * @param lastPage * the last page */ public UserProfilePage(VIACUser user, WebPage lastPage) { this(user); this.lastPage = lastPage; } /** * Inits the. */ private void init() { this.setOutputMarkupId(true); Form<?> form = new Form<>("form"); errorPassword = new WebMarkupContainer("errorPassword"); errorPassword.setVisible(false); errorPasswordCompare = new WebMarkupContainer("errorPasswordCompare"); errorPasswordCompare.setVisible(false); errorChange = new WebMarkupContainer("errorChange"); errorChange.setVisible(false); successChange = new WebMarkupContainer("successChange"); successChange.setVisible(false); Label usernameLabel = new Label("usernameLabel", new Model<String>("Neuer Benutzername:")); TextField<String> usernameField = new RequiredTextField<>("username", new PropertyModel<String>(userModel, "name")); usernameField.add(EmailAddressValidator.getInstance()); Label firstnameLabel = new Label("firstnameLabel", new Model<String>(userModel.getFirstname())); Label lastnameLabel = new Label("lastnameLabel", new Model<String>(userModel.getLastname())); Label passwordLabel = new Label("passwordLabel", new Model<String>("Neues Passwort:")); PasswordTextField passwordField = new PasswordTextField("password", new PropertyModel<String>(this, "password")); passwordField.setRequired(false); Label repeatPasswordLabel = new Label("repeatPasswordLabel", new Model<String>("Neues Passwort wiederholen:")); PasswordTextField repeatPasswordField = new PasswordTextField("repeatPassword", new PropertyModel<String>(this, "repeatPassword")); repeatPasswordField.setRequired(false); form.add(errorPassword); form.add(errorChange); form.add(errorPasswordCompare); form.add(successChange); form.add(usernameLabel); form.add(usernameField); form.add(firstnameLabel); form.add(lastnameLabel); form.add(passwordLabel); form.add(passwordField); form.add(repeatPasswordLabel); form.add(repeatPasswordField); Button submitButton = new Button("submit") { private static final long serialVersionUID = -6945656790341817258L; @Override public void onSubmit() { errorPassword.setVisible(false); errorChange.setVisible(false); errorPasswordCompare.setVisible(false); successChange.setVisible(false); changeUser(); } }; form.add(submitButton); Link<String> backButton = new Link<String>("back") { /** * */ private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(lastPage); } }; form.add(backButton); add(form); } /** * Change user. */ private void changeUser() { // set changed values userModel.setChangedBy(VIACSession.getInstance().getUserModel()); userModel.setChangedOn(new Date()); // set password if (password == null) { password = ""; } if (password.length() >= 8) { if (password.equals(repeatPassword)) { userModel.setPassword(password); } else { errorPasswordCompare.setVisible(true); return; } } else if (password.length() < 8 && password.length() > 0) { errorPassword.setVisible(true); return; } // save try { DatabaseProvider.getInstance().mergeUser(userModel); //setResponsePage(VIACHomepage.class); } catch (Exception ex) { errorChange.setVisible(true); return; } successChange.setVisible(true); } }
UTF-8
Java
6,540
java
UserProfilePage.java
Java
[ { "context": "**\r\n * The Class UserProfilePage.\r\n * \r\n * @author dedhor\r\n * \r\n * The user profile page. The user ", "end": 960, "score": 0.9996438026428223, "start": 954, "tag": "USERNAME", "value": "dedhor" }, { "context": "lse);\r\n\r\n Label usernameLabel = new Label(\"usernameLabel\", new Model<String>(\"Neuer Benutzername:\"));", "end": 2978, "score": 0.742010772228241, "start": 2970, "tag": "USERNAME", "value": "username" }, { "context": "nameField =\r\n new RequiredTextField<>(\"username\", new PropertyModel<String>(userModel, \"name\"));\r", "end": 3118, "score": 0.9407172799110413, "start": 3110, "tag": "USERNAME", "value": "username" }, { "context": "= new Label(\"passwordLabel\", new Model<String>(\"Neues Passwort:\"));\r\n PasswordTextField passwordField", "end": 3535, "score": 0.6311168670654297, "start": 3527, "tag": "PASSWORD", "value": "ues Pass" } ]
null
[]
package com.vanderlande.viac.userManagement; import java.util.Date; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.PasswordTextField; import org.apache.wicket.markup.html.form.RequiredTextField; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; import org.apache.wicket.validation.validator.EmailAddressValidator; import com.vanderlande.util.DatabaseProvider; import com.vanderlande.viac.VIACBasePage; import com.vanderlande.viac.model.VIACUser; import com.vanderlande.viac.session.VIACSession; /** * The Class UserProfilePage. * * @author dedhor * * The user profile page. The user can change his name (must be an email) and his password. */ public class UserProfilePage extends VIACBasePage { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 8093804776788134968L; /** The user model. */ private VIACUser userModel; /** The last page. */ private WebPage lastPage; /** The repeat password. */ private String password, repeatPassword; /** The success change. */ private WebMarkupContainer errorPassword; /** The error change. */ private WebMarkupContainer errorChange; /** The error password compare. */ private WebMarkupContainer errorPasswordCompare; /** The success change. */ private WebMarkupContainer successChange; /** * Instantiates a new user profile page. * * @param user * the user */ public UserProfilePage(VIACUser user) { userModel = user; init(); } /** * Instantiates a new user profile page. * * @param user * the user * @param lastPage * the last page */ public UserProfilePage(VIACUser user, WebPage lastPage) { this(user); this.lastPage = lastPage; } /** * Inits the. */ private void init() { this.setOutputMarkupId(true); Form<?> form = new Form<>("form"); errorPassword = new WebMarkupContainer("errorPassword"); errorPassword.setVisible(false); errorPasswordCompare = new WebMarkupContainer("errorPasswordCompare"); errorPasswordCompare.setVisible(false); errorChange = new WebMarkupContainer("errorChange"); errorChange.setVisible(false); successChange = new WebMarkupContainer("successChange"); successChange.setVisible(false); Label usernameLabel = new Label("usernameLabel", new Model<String>("Neuer Benutzername:")); TextField<String> usernameField = new RequiredTextField<>("username", new PropertyModel<String>(userModel, "name")); usernameField.add(EmailAddressValidator.getInstance()); Label firstnameLabel = new Label("firstnameLabel", new Model<String>(userModel.getFirstname())); Label lastnameLabel = new Label("lastnameLabel", new Model<String>(userModel.getLastname())); Label passwordLabel = new Label("passwordLabel", new Model<String>("Ne<PASSWORD>wort:")); PasswordTextField passwordField = new PasswordTextField("password", new PropertyModel<String>(this, "password")); passwordField.setRequired(false); Label repeatPasswordLabel = new Label("repeatPasswordLabel", new Model<String>("Neues Passwort wiederholen:")); PasswordTextField repeatPasswordField = new PasswordTextField("repeatPassword", new PropertyModel<String>(this, "repeatPassword")); repeatPasswordField.setRequired(false); form.add(errorPassword); form.add(errorChange); form.add(errorPasswordCompare); form.add(successChange); form.add(usernameLabel); form.add(usernameField); form.add(firstnameLabel); form.add(lastnameLabel); form.add(passwordLabel); form.add(passwordField); form.add(repeatPasswordLabel); form.add(repeatPasswordField); Button submitButton = new Button("submit") { private static final long serialVersionUID = -6945656790341817258L; @Override public void onSubmit() { errorPassword.setVisible(false); errorChange.setVisible(false); errorPasswordCompare.setVisible(false); successChange.setVisible(false); changeUser(); } }; form.add(submitButton); Link<String> backButton = new Link<String>("back") { /** * */ private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(lastPage); } }; form.add(backButton); add(form); } /** * Change user. */ private void changeUser() { // set changed values userModel.setChangedBy(VIACSession.getInstance().getUserModel()); userModel.setChangedOn(new Date()); // set password if (password == null) { password = ""; } if (password.length() >= 8) { if (password.equals(repeatPassword)) { userModel.setPassword(password); } else { errorPasswordCompare.setVisible(true); return; } } else if (password.length() < 8 && password.length() > 0) { errorPassword.setVisible(true); return; } // save try { DatabaseProvider.getInstance().mergeUser(userModel); //setResponsePage(VIACHomepage.class); } catch (Exception ex) { errorChange.setVisible(true); return; } successChange.setVisible(true); } }
6,542
0.596636
0.590214
216
28.277779
25.110804
119
false
false
0
0
0
0
0
0
0.472222
false
false
4
8341c04a517b1dcb2086b652e5264385a76aacb2
9,964,324,167,007
2dc0cd0df5fd1235dfdcd339dfc7234533627635
/o-eye-common/src/main/java/com/lxf/eye/common/domain/RabbitMqQueueConfig.java
4e35f6c70cb844eec1e0533b073848d04560fbe0
[ "MIT" ]
permissive
liflife/o-eye
https://github.com/liflife/o-eye
92ea346c1c19fa70f04c3155389e7afc3334560e
ce2ffc3253c60f137d404350ed8b375dca750eef
refs/heads/master
2022-12-23T07:06:10.848000
2022-08-28T09:25:12
2022-08-28T09:25:12
206,907,921
6
3
MIT
false
2022-12-10T05:29:59
2019-09-07T03:04:58
2022-06-24T07:54:08
2022-12-10T05:29:58
2,013
3
2
4
JavaScript
false
false
package com.lxf.eye.common.domain; public class RabbitMqQueueConfig { /** * ๅฎšไน‰้˜Ÿๅˆ—ๅ */ public final static String STRING = "canal.test"; }
UTF-8
Java
166
java
RabbitMqQueueConfig.java
Java
[]
null
[]
package com.lxf.eye.common.domain; public class RabbitMqQueueConfig { /** * ๅฎšไน‰้˜Ÿๅˆ—ๅ */ public final static String STRING = "canal.test"; }
166
0.647436
0.647436
8
18.5
18.11767
53
false
false
0
0
0
0
0
0
0.25
false
false
4
c1f3163c22d7a784aa618576686145c2322dc18f
15,058,155,386,305
dd0e199ee7fde99d9d1960074b9b89c018847954
/java/116-populating-next-right-pointers-in-each-node/Main.java
348b364c07d37c963ef5936946a52d4a1f3af333
[]
no_license
aurorax/leetcode
https://github.com/aurorax/leetcode
a79c7e840dda2f565cd7920b50244016a4e762cc
c7b535a9f857b0dbb47fc38babeb6c6629ee45d3
refs/heads/master
2021-01-20T12:37:31.549000
2020-01-19T11:26:11
2020-01-19T11:26:11
82,663,214
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// start 2019-12-30 15:16:43 // finish 2019-12-30 16:08:29 import java.util.*; class Solution { public Node connect(Node root) { //iterative(root); recursive(root); return root; } void recursive(Node root) { if ( root == null || root.left == null ) return; root.left.next = root.right; if ( root.next != null ) root.right.next = root.next.left; recursive(root.left); recursive(root.right); } void iterative(Node n) { while ( n != null && n.left != null ) { Node p = n; while ( p != null ) { p.left.next = p.right; if ( p.next != null ) p.right.next = p.next.left; p = p.next; } n = n.left; } } } public class Main { public static void main(String[] args) { Node n = new Node(1); check(n); } static void check(Node n) { Solution s = new Solution(); System.out.printf("\n"); } } class Node { public int val; public Node left; public Node right; public Node next; public Node() {} public Node(int _val) { val = _val; } public Node(int _val, Node _left, Node _right, Node _next) { val = _val; left = _left; right = _right; next = _next; } }
UTF-8
Java
1,381
java
Main.java
Java
[]
null
[]
// start 2019-12-30 15:16:43 // finish 2019-12-30 16:08:29 import java.util.*; class Solution { public Node connect(Node root) { //iterative(root); recursive(root); return root; } void recursive(Node root) { if ( root == null || root.left == null ) return; root.left.next = root.right; if ( root.next != null ) root.right.next = root.next.left; recursive(root.left); recursive(root.right); } void iterative(Node n) { while ( n != null && n.left != null ) { Node p = n; while ( p != null ) { p.left.next = p.right; if ( p.next != null ) p.right.next = p.next.left; p = p.next; } n = n.left; } } } public class Main { public static void main(String[] args) { Node n = new Node(1); check(n); } static void check(Node n) { Solution s = new Solution(); System.out.printf("\n"); } } class Node { public int val; public Node left; public Node right; public Node next; public Node() {} public Node(int _val) { val = _val; } public Node(int _val, Node _left, Node _right, Node _next) { val = _val; left = _left; right = _right; next = _next; } }
1,381
0.485156
0.464156
65
20.246155
16.757116
66
false
false
0
0
0
0
0
0
0.492308
false
false
4
e9910c328e164232545338782fb472f197650753
4,252,017,683,588
4584ccf574c81bbfb5876dbe09839a6881a3b81a
/src/test/java/com/github/mygreen/supercsv/cellprocessor/constraint/EqualsTest.java
0997a46b9ac15ee9e693947305bccb51bd9890a4
[ "Apache-2.0" ]
permissive
mygreen/super-csv-annotation
https://github.com/mygreen/super-csv-annotation
78a834966dc78297982f4a05a8ac2d8bc107b53f
949ab5d524178dbdc1d1c9e2c39536f4fdfb7856
refs/heads/master
2022-10-30T09:03:08.423000
2022-10-22T04:34:30
2022-10-22T04:34:30
8,684,179
30
10
Apache-2.0
false
2022-10-22T04:34:33
2013-03-10T11:20:06
2022-07-16T02:01:29
2022-10-22T04:34:30
22,168
30
6
2
Java
false
false
package com.github.mygreen.supercsv.cellprocessor.constraint; import static org.junit.Assert.*; import static org.assertj.core.api.Assertions.*; import static com.github.mygreen.supercsv.tool.TestUtils.*; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.junit.Before; import org.junit.Test; import org.supercsv.cellprocessor.ift.CellProcessor; import org.supercsv.exception.SuperCsvCellProcessorException; import com.github.mygreen.supercsv.annotation.CsvBean; import com.github.mygreen.supercsv.annotation.CsvColumn; import com.github.mygreen.supercsv.cellprocessor.format.NumberFormatWrapper; import com.github.mygreen.supercsv.exception.SuperCsvValidationException; /** * {@link Equals}ใฎใƒ†ใ‚นใ‚ฟ * * @since 2.0 * @author T.TSUCHIE * */ public class EqualsTest { private CellProcessor processor; private CellProcessor processorChain; private CellProcessor processorValuesEmpty; private NumberFormatWrapper<Integer> formatter = new NumberFormatWrapper<>(new DecimalFormat("#,###"), Integer.class); private List<Integer> VALUES = Arrays.asList(1000, -1000); @Before public void setUp() throws Exception { this.processor = new Equals<>(Integer.class, VALUES, formatter); this.processorChain = new Equals<>(Integer.class, VALUES, formatter, new NextCellProcessor()); this.processorValuesEmpty = new Equals<>(Integer.class, Collections.emptyList(), formatter); } @Test(expected=NullPointerException.class) public void testConstuctor_typeNull() { new Equals<Integer>(null, VALUES, formatter); fail(); } @Test(expected=NullPointerException.class) public void testConstuctor_valuesNull() { new Equals<Integer>(Integer.class, null, formatter); fail(); } @Test(expected=NullPointerException.class) public void testConstuctor_printerNull() { new Equals<Integer>(Integer.class, VALUES, null); fail(); } @Test(expected=NullPointerException.class) public void testConstuctor_nextNull() { new Equals<Integer>(Integer.class, VALUES, formatter, null); fail(); } /** * ๅ…ฅๅŠ›ๅ€คใŒnullใฎๅ ดๅˆ */ @Test public void testExecute_inputNull() { assertThat((Object)processor.execute(null, ANONYMOUS_CSVCONTEXT)).isNull(); } /** * ๅ…ฅๅŠ›ๅ€คใฎใ‚ฏใƒฉใ‚นใ‚ฟใ‚คใƒ—ใŒไธๆญฃใชๅ ดๅˆ */ @Test(expected=SuperCsvCellProcessorException.class) public void testExecute_inputNonSameInstance() { processor.execute("abc", ANONYMOUS_CSVCONTEXT); fail(); } @Test public void testExecute_inputValid() { { int input = 1000; assertThat((Object)processor.execute(input, ANONYMOUS_CSVCONTEXT)).isEqualTo(input); assertThat((Object)processorChain.execute(input, ANONYMOUS_CSVCONTEXT)).isEqualTo(input); } } @Test public void testExecute_inputInvalid() { int input = 9999; try { processor.execute(input, ANONYMOUS_CSVCONTEXT); } catch(Exception e) { assertThat(e).isInstanceOf(SuperCsvValidationException.class); SuperCsvValidationException exception = (SuperCsvValidationException)e; assertThat(exception.getMessageVariables()) .containsEntry("equalsValues", VALUES) .containsEntry("printer", formatter); assertThat(exception.getRejectedValue()).isEqualTo(input); assertThat(exception.getValidationMessage()).isEqualTo(String.format("{%s.violated}", Equals.class.getName())); } } /** * ็™ป้Œฒใ•ใ‚Œใฆใ„ใ‚‹ๅ€คใŒ0ไปถใฎๅ ดๅˆ */ @Test public void testExecute_valueEmpty() { { int input = 1000; assertThat((Object)processorValuesEmpty.execute(input, ANONYMOUS_CSVCONTEXT)).isEqualTo(input); } } @CsvBean private static class TestCsv { @CsvColumn(number=1) Integer column1; } }
UTF-8
Java
4,555
java
EqualsTest.java
Java
[ { "context": " {@link Equals}ใฎใƒ†ใ‚นใ‚ฟ\r\n *\r\n * @since 2.0\r\n * @author T.TSUCHIE\r\n *\r\n */\r\npublic class EqualsTest {\r\n \r\n pr", "end": 834, "score": 0.9998059272766113, "start": 825, "tag": "NAME", "value": "T.TSUCHIE" } ]
null
[]
package com.github.mygreen.supercsv.cellprocessor.constraint; import static org.junit.Assert.*; import static org.assertj.core.api.Assertions.*; import static com.github.mygreen.supercsv.tool.TestUtils.*; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.junit.Before; import org.junit.Test; import org.supercsv.cellprocessor.ift.CellProcessor; import org.supercsv.exception.SuperCsvCellProcessorException; import com.github.mygreen.supercsv.annotation.CsvBean; import com.github.mygreen.supercsv.annotation.CsvColumn; import com.github.mygreen.supercsv.cellprocessor.format.NumberFormatWrapper; import com.github.mygreen.supercsv.exception.SuperCsvValidationException; /** * {@link Equals}ใฎใƒ†ใ‚นใ‚ฟ * * @since 2.0 * @author T.TSUCHIE * */ public class EqualsTest { private CellProcessor processor; private CellProcessor processorChain; private CellProcessor processorValuesEmpty; private NumberFormatWrapper<Integer> formatter = new NumberFormatWrapper<>(new DecimalFormat("#,###"), Integer.class); private List<Integer> VALUES = Arrays.asList(1000, -1000); @Before public void setUp() throws Exception { this.processor = new Equals<>(Integer.class, VALUES, formatter); this.processorChain = new Equals<>(Integer.class, VALUES, formatter, new NextCellProcessor()); this.processorValuesEmpty = new Equals<>(Integer.class, Collections.emptyList(), formatter); } @Test(expected=NullPointerException.class) public void testConstuctor_typeNull() { new Equals<Integer>(null, VALUES, formatter); fail(); } @Test(expected=NullPointerException.class) public void testConstuctor_valuesNull() { new Equals<Integer>(Integer.class, null, formatter); fail(); } @Test(expected=NullPointerException.class) public void testConstuctor_printerNull() { new Equals<Integer>(Integer.class, VALUES, null); fail(); } @Test(expected=NullPointerException.class) public void testConstuctor_nextNull() { new Equals<Integer>(Integer.class, VALUES, formatter, null); fail(); } /** * ๅ…ฅๅŠ›ๅ€คใŒnullใฎๅ ดๅˆ */ @Test public void testExecute_inputNull() { assertThat((Object)processor.execute(null, ANONYMOUS_CSVCONTEXT)).isNull(); } /** * ๅ…ฅๅŠ›ๅ€คใฎใ‚ฏใƒฉใ‚นใ‚ฟใ‚คใƒ—ใŒไธๆญฃใชๅ ดๅˆ */ @Test(expected=SuperCsvCellProcessorException.class) public void testExecute_inputNonSameInstance() { processor.execute("abc", ANONYMOUS_CSVCONTEXT); fail(); } @Test public void testExecute_inputValid() { { int input = 1000; assertThat((Object)processor.execute(input, ANONYMOUS_CSVCONTEXT)).isEqualTo(input); assertThat((Object)processorChain.execute(input, ANONYMOUS_CSVCONTEXT)).isEqualTo(input); } } @Test public void testExecute_inputInvalid() { int input = 9999; try { processor.execute(input, ANONYMOUS_CSVCONTEXT); } catch(Exception e) { assertThat(e).isInstanceOf(SuperCsvValidationException.class); SuperCsvValidationException exception = (SuperCsvValidationException)e; assertThat(exception.getMessageVariables()) .containsEntry("equalsValues", VALUES) .containsEntry("printer", formatter); assertThat(exception.getRejectedValue()).isEqualTo(input); assertThat(exception.getValidationMessage()).isEqualTo(String.format("{%s.violated}", Equals.class.getName())); } } /** * ็™ป้Œฒใ•ใ‚Œใฆใ„ใ‚‹ๅ€คใŒ0ไปถใฎๅ ดๅˆ */ @Test public void testExecute_valueEmpty() { { int input = 1000; assertThat((Object)processorValuesEmpty.execute(input, ANONYMOUS_CSVCONTEXT)).isEqualTo(input); } } @CsvBean private static class TestCsv { @CsvColumn(number=1) Integer column1; } }
4,555
0.608268
0.602682
155
26.870968
27.853003
123
false
false
0
0
0
0
0
0
0.490323
false
false
4
d16a3c552fb70d8e0bcb8ffd17fc668558ef56ec
16,432,544,929,864
74afed96b70d7032d2dee3e1e515d3ea471c068c
/Gradle/multi-project/gradle-build-tool-fundamentals-m6/p2/groovy/jacket/JacketRepository/src/main/java/com/pluralsight/jacket/models/Entry.java
4072ece557044c657ffb8aff630ea337b441340f
[]
no_license
sagarrao1/Maven_Eclipse_Junit_Mockito
https://github.com/sagarrao1/Maven_Eclipse_Junit_Mockito
f3e4c64c2673b011e69a36033363adebf79a9357
593e57d5add3ffb4f9ad8588d1b52e448131efe9
refs/heads/master
2023-08-18T22:03:18.712000
2023-08-18T16:38:03
2023-08-18T16:45:59
211,867,784
0
0
null
false
2022-01-26T06:31:38
2019-09-30T13:35:25
2021-12-18T03:42:38
2022-01-26T06:31:38
42,987
0
0
0
Java
false
false
package com.pluralsight.jacket.models; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * Created by kevin on 30/06/2015. */ @Entity @Table(name="Entries") public class Entry { int id; String url; boolean isArchived; boolean isFavourite; @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public boolean getArchived() { return isArchived; } public void setArchived(boolean isArchived) { this.isArchived = isArchived; } public boolean getFavourite() { return isFavourite; } public void setFavourite(boolean isFavourite) { this.isFavourite = isFavourite; } }
UTF-8
Java
887
java
Entry.java
Java
[ { "context": "import javax.persistence.Table;\n\n/**\n * Created by kevin on 30/06/2015.\n */\n\n@Entity\n@Table(name=\"Entries\"", "end": 158, "score": 0.8998110294342041, "start": 153, "tag": "USERNAME", "value": "kevin" } ]
null
[]
package com.pluralsight.jacket.models; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * Created by kevin on 30/06/2015. */ @Entity @Table(name="Entries") public class Entry { int id; String url; boolean isArchived; boolean isFavourite; @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public boolean getArchived() { return isArchived; } public void setArchived(boolean isArchived) { this.isArchived = isArchived; } public boolean getFavourite() { return isFavourite; } public void setFavourite(boolean isFavourite) { this.isFavourite = isFavourite; } }
887
0.616685
0.607666
53
15.735849
14.915044
51
false
false
0
0
0
0
0
0
0.320755
false
false
4
1a0cc5658da41c5b5e1639edd490f3dbb1115644
4,818,953,350,070
a57b75226cf32f9b4980427c089932ad8e03cf6e
/src/cntbn/terms_factors/SimpleGaussian.java
9197d79b9da29adeb6474c84ec7540d147776f9a
[]
no_license
mgkim1013/pai-trip-planner-server
https://github.com/mgkim1013/pai-trip-planner-server
b1a525ab273a160c7504cfa7bd0596fe645a9758
5ab04abef3d446c048f2cde4ab02ec594f139580
refs/heads/master
2018-11-11T14:55:32.315000
2018-08-22T18:39:32
2018-08-22T18:39:32
140,753,222
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cntbn.terms_factors; import cntbn.common.GlobalParameters; import cntbn.common.NodeDictionary; import cntbn.exception.NoSuchVariableException; import javolution.util.FastSet; import org.apache.log4j.Logger; import util.Erf; import java.text.DecimalFormat; import java.util.Set; public class SimpleGaussian implements GaussianFunction { private static Logger logger = Logger.getLogger(SimpleGaussian.class); private double variance; private double mean; private double weight; private int variableIdx; FastSet<Integer> paramSet; public SimpleGaussian(double weight, String variableName) { int variableIdx = NodeDictionary.getInstance().nodeIdx(variableName); if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } } public SimpleGaussian(double weight, String variableName, double mean, double variance) { // logger.debug("Create " + variableName); int variableIdx = NodeDictionary.getInstance().nodeIdx(variableName); if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } setMeanAndVariance(mean, variance); } public SimpleGaussian(double weight, int variableIdx) { if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } } public SimpleGaussian(double weight, int variableIdx, double mean, double variance) { // logger.debug("Create " + variableName); if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } setMeanAndVariance(mean, variance); } public double culminativeProbability(double referenceValue) { return 0.5 * (1 + Erf.erf((referenceValue - mean) / Math.sqrt(2 * variance))); } public void setVariable(String variable) { this.variableIdx = NodeDictionary.getInstance().nodeIdx(variable); } public void setMeanAndVariance(double mean, double variance) { if (Double.isNaN(variance)) { throw new RuntimeException("NaN variance error" + this); } if (Double.isNaN(mean)) { throw new RuntimeException("NaN mean error:" + this); } if (variance > GlobalParameters.THRESHOLD_INF) { this.variance = GlobalParameters.NEAR_INF; } else { this.variance = variance; } this.mean = mean; } public double getVariance() { return variance; } public double getMean() { return mean; } @Override public double getWeight() { return weight; } @Override public int getArgument() { return variableIdx; } public String toString() { try { String variableName = NodeDictionary.getInstance().nodeName( variableIdx); if (variance > GlobalParameters.THRESHOLD_INF) { DecimalFormat df = new DecimalFormat("#.###"); return df.format(weight) + "N(" + variableName + ";" + df.format(mean) + ", INF)"; } else { DecimalFormat df = new DecimalFormat("#.###"); return df.format(weight) + "N(" + variableName + ";" + df.format(mean) + "," + df.format(variance) + ")"; } } catch (NoSuchVariableException e) { e.printStackTrace(); } return null; } @Override public void setWeight(double weight) { this.weight = weight; } @Override public SimpleGaussian deepCopy() { SimpleGaussian newG = new SimpleGaussian(this.weight, this.variableIdx); newG.setMeanAndVariance(this.mean, this.variance); return newG; } @Override public boolean isSameForm(GaussianFunction tFunction) { if (!(tFunction instanceof SimpleGaussian)) { return false; } SimpleGaussian g = (SimpleGaussian) tFunction; if (g.getArgument() != this.getArgument()) { return false; } if (Math.abs(mean - g.getMean()) > GlobalParameters.SAMEFORM_ERROR_BOUND) { return false; } return !(Math.abs(variance - g.getVariance()) > GlobalParameters.SAMEFORM_ERROR_BOUND); } @Override public GaussianType type() { return GaussianType.SimpleGaussian; } @Override public Set<Integer> getParameters() { return paramSet; } @Override public int compareTo(SimpleTerm arg) { if (weight < arg.getWeight()) { return 1; } else if (weight > arg.getWeight()) { return -1; } return 0; } @Override public void normalize(double basis) { this.weight = basis; } @Override public boolean hasMixture() { return false; } @Override public void shift(double offset) { this.mean += offset; } public static SimpleGaussian dummy(String variableName) { NodeDictionary nd = NodeDictionary.getInstance(); if (!nd.containNode(variableName)) { nd.putValues(variableName, "true"); } SimpleGaussian sg = new SimpleGaussian(1.0, variableName, 1.5, 2.5); return sg; } }
UTF-8
Java
7,292
java
SimpleGaussian.java
Java
[]
null
[]
package cntbn.terms_factors; import cntbn.common.GlobalParameters; import cntbn.common.NodeDictionary; import cntbn.exception.NoSuchVariableException; import javolution.util.FastSet; import org.apache.log4j.Logger; import util.Erf; import java.text.DecimalFormat; import java.util.Set; public class SimpleGaussian implements GaussianFunction { private static Logger logger = Logger.getLogger(SimpleGaussian.class); private double variance; private double mean; private double weight; private int variableIdx; FastSet<Integer> paramSet; public SimpleGaussian(double weight, String variableName) { int variableIdx = NodeDictionary.getInstance().nodeIdx(variableName); if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } } public SimpleGaussian(double weight, String variableName, double mean, double variance) { // logger.debug("Create " + variableName); int variableIdx = NodeDictionary.getInstance().nodeIdx(variableName); if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } setMeanAndVariance(mean, variance); } public SimpleGaussian(double weight, int variableIdx) { if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } } public SimpleGaussian(double weight, int variableIdx, double mean, double variance) { // logger.debug("Create " + variableName); if (weight < 0) { try { throw new RuntimeException(" minus weight(" + NodeDictionary.getInstance().nodeName(variableIdx) + ")=" + weight); } catch (NoSuchVariableException e) { e.printStackTrace(); } } this.variableIdx = variableIdx; this.weight = weight; paramSet = new FastSet<Integer>(); paramSet.add(variableIdx); if (Double.isNaN(weight)) { throw new RuntimeException("NaN error:" + this); } setMeanAndVariance(mean, variance); } public double culminativeProbability(double referenceValue) { return 0.5 * (1 + Erf.erf((referenceValue - mean) / Math.sqrt(2 * variance))); } public void setVariable(String variable) { this.variableIdx = NodeDictionary.getInstance().nodeIdx(variable); } public void setMeanAndVariance(double mean, double variance) { if (Double.isNaN(variance)) { throw new RuntimeException("NaN variance error" + this); } if (Double.isNaN(mean)) { throw new RuntimeException("NaN mean error:" + this); } if (variance > GlobalParameters.THRESHOLD_INF) { this.variance = GlobalParameters.NEAR_INF; } else { this.variance = variance; } this.mean = mean; } public double getVariance() { return variance; } public double getMean() { return mean; } @Override public double getWeight() { return weight; } @Override public int getArgument() { return variableIdx; } public String toString() { try { String variableName = NodeDictionary.getInstance().nodeName( variableIdx); if (variance > GlobalParameters.THRESHOLD_INF) { DecimalFormat df = new DecimalFormat("#.###"); return df.format(weight) + "N(" + variableName + ";" + df.format(mean) + ", INF)"; } else { DecimalFormat df = new DecimalFormat("#.###"); return df.format(weight) + "N(" + variableName + ";" + df.format(mean) + "," + df.format(variance) + ")"; } } catch (NoSuchVariableException e) { e.printStackTrace(); } return null; } @Override public void setWeight(double weight) { this.weight = weight; } @Override public SimpleGaussian deepCopy() { SimpleGaussian newG = new SimpleGaussian(this.weight, this.variableIdx); newG.setMeanAndVariance(this.mean, this.variance); return newG; } @Override public boolean isSameForm(GaussianFunction tFunction) { if (!(tFunction instanceof SimpleGaussian)) { return false; } SimpleGaussian g = (SimpleGaussian) tFunction; if (g.getArgument() != this.getArgument()) { return false; } if (Math.abs(mean - g.getMean()) > GlobalParameters.SAMEFORM_ERROR_BOUND) { return false; } return !(Math.abs(variance - g.getVariance()) > GlobalParameters.SAMEFORM_ERROR_BOUND); } @Override public GaussianType type() { return GaussianType.SimpleGaussian; } @Override public Set<Integer> getParameters() { return paramSet; } @Override public int compareTo(SimpleTerm arg) { if (weight < arg.getWeight()) { return 1; } else if (weight > arg.getWeight()) { return -1; } return 0; } @Override public void normalize(double basis) { this.weight = basis; } @Override public boolean hasMixture() { return false; } @Override public void shift(double offset) { this.mean += offset; } public static SimpleGaussian dummy(String variableName) { NodeDictionary nd = NodeDictionary.getInstance(); if (!nd.containNode(variableName)) { nd.putValues(variableName, "true"); } SimpleGaussian sg = new SimpleGaussian(1.0, variableName, 1.5, 2.5); return sg; } }
7,292
0.566511
0.564043
251
28.051792
23.976942
95
false
false
0
0
0
0
0
0
0.434263
false
false
4
cfe6168cbb50c0a1feca80b70ba64be13a3f300e
1,271,310,323,265
859b6e3d67060d5d59c86ab914c6abc9a4bb3a77
/src/com/gabe/uyen/game/level/tile/spawn_level/SpawnWallTile.java
282124489799363ffa5a157fec5dbf06fa95a01a
[]
no_license
andergrx/gamedev101
https://github.com/andergrx/gamedev101
a9dca3cce9244c742f7009301984fa3158e8ef12
95ef6921cea1e553f09cd9125c4cb82b2064dcf8
refs/heads/master
2016-09-05T13:50:52.073000
2015-08-05T04:54:37
2015-08-05T04:54:37
39,971,399
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gabe.uyen.game.level.tile.spawn_level; import com.gabe.uyen.game.graphics.Sprite; import com.gabe.uyen.game.level.tile.Tile; public class SpawnWallTile extends Tile { public SpawnWallTile(Sprite sprite) { super(sprite); } public boolean solid() { return true; } }
UTF-8
Java
289
java
SpawnWallTile.java
Java
[]
null
[]
package com.gabe.uyen.game.level.tile.spawn_level; import com.gabe.uyen.game.graphics.Sprite; import com.gabe.uyen.game.level.tile.Tile; public class SpawnWallTile extends Tile { public SpawnWallTile(Sprite sprite) { super(sprite); } public boolean solid() { return true; } }
289
0.743945
0.743945
16
17.0625
18.676418
50
false
false
0
0
0
0
0
0
0.8125
false
false
4
5ee863774a7a930fe2e5a9846f89ea2c36979761
13,872,744,428,506
c2f88ea5d4951ffd8ba387db884da0077fffeedd
/metaphysic/ndart/src/metaphysic/mindmapping/ProcessorMessageListenerAdapter.java
906500234eb8284383e0bc7f220f0cac7c4e5dc5
[]
no_license
rustintabel/metaphysic
https://github.com/rustintabel/metaphysic
b50c2b6f917031737da86680f5f4bbc89db14559
b0855fc5ce34d8bb80ab56cb863acc3e436efbdd
refs/heads/master
2021-03-12T23:15:26.706000
2013-07-24T17:51:30
2013-07-24T17:51:30
39,644,938
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package metaphysic.mindmapping; /** * * @author justin */ public class ProcessorMessageListenerAdapter implements ProcessorMessageListener { /** * * @param e */ public void messageSent(ProcessorMessageEvent e) { System.out.println(e.message); } }
UTF-8
Java
281
java
ProcessorMessageListenerAdapter.java
Java
[ { "context": "package metaphysic.mindmapping;\n\n/**\n *\n * @author justin\n */\npublic class ProcessorMessageListenerAdapter ", "end": 57, "score": 0.7656040191650391, "start": 51, "tag": "NAME", "value": "justin" } ]
null
[]
package metaphysic.mindmapping; /** * * @author justin */ public class ProcessorMessageListenerAdapter implements ProcessorMessageListener { /** * * @param e */ public void messageSent(ProcessorMessageEvent e) { System.out.println(e.message); } }
281
0.672598
0.672598
18
14.611111
17.336983
55
false
false
0
0
0
0
0
0
0.611111
false
false
4
ebbd1c0dd8e7b17b1fb04504748b94b121ad6fc7
31,516,470,026,212
6fe3d8687bfa870930dd94edd64f0d842eb1acb3
/hr/src/test/java/com/example/hr/HrServiceTest.java
a2050b3d5b72a1a3a1eaf5d96549b5ba83ba189c
[]
no_license
MaksymKutsos/HR
https://github.com/MaksymKutsos/HR
e85755e2c5d75b4466ffa82ddf0987009eeb8fa7
7743b489e0c15a4469acb09104f80a744253e878
refs/heads/master
2020-05-19T14:28:28.978000
2014-05-23T19:50:35
2014-05-23T19:50:35
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.hr; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.*; import java.util.Arrays; import java.util.Random; import java.util.UUID; import org.junit.Before; import org.junit.Test; public class HrServiceTest { private EmployeeRepository employeeRepository; private HrService service; private Employee oldestEmployee; @Before public void configure() throws Exception { employeeRepository = mock(EmployeeRepository.class); service = new HrService(employeeRepository); } @Test public void determinesYearsTillRetirement() throws Exception { createEmployees(); Employee result = service.getOldestEmployee(); assertThat(result, is(oldestEmployee)); } private void createEmployees() { Employee employee = new Employee("Alex", "Panov", 1989); oldestEmployee = new Employee("Max", "Kutsos", 1901); when(employeeRepository.getAllEmployees()).thenReturn(Arrays.asList(oldestEmployee, employee)); } @Test public void randomDataShowcase() throws Exception { Random random = new Random(); System.out.println(random.nextInt()); System.out.println(UUID.randomUUID().toString()); } }
UTF-8
Java
1,313
java
HrServiceTest.java
Java
[ { "context": "ees() {\n Employee employee = new Employee(\"Alex\", \"Panov\", 1989);\n oldestEmployee = new Em", "end": 904, "score": 0.9998337030410767, "start": 900, "tag": "NAME", "value": "Alex" }, { "context": " Employee employee = new Employee(\"Alex\", \"Panov\", 1989);\n oldestEmployee = new Employee(\"M", "end": 913, "score": 0.9996817111968994, "start": 908, "tag": "NAME", "value": "Panov" }, { "context": "v\", 1989);\n oldestEmployee = new Employee(\"Max\", \"Kutsos\", 1901);\n when(employeeRepositor", "end": 965, "score": 0.9998059868812561, "start": 962, "tag": "NAME", "value": "Max" }, { "context": "9);\n oldestEmployee = new Employee(\"Max\", \"Kutsos\", 1901);\n when(employeeRepository.getAllEm", "end": 975, "score": 0.9997894167900085, "start": 969, "tag": "NAME", "value": "Kutsos" } ]
null
[]
package com.example.hr; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.*; import java.util.Arrays; import java.util.Random; import java.util.UUID; import org.junit.Before; import org.junit.Test; public class HrServiceTest { private EmployeeRepository employeeRepository; private HrService service; private Employee oldestEmployee; @Before public void configure() throws Exception { employeeRepository = mock(EmployeeRepository.class); service = new HrService(employeeRepository); } @Test public void determinesYearsTillRetirement() throws Exception { createEmployees(); Employee result = service.getOldestEmployee(); assertThat(result, is(oldestEmployee)); } private void createEmployees() { Employee employee = new Employee("Alex", "Panov", 1989); oldestEmployee = new Employee("Max", "Kutsos", 1901); when(employeeRepository.getAllEmployees()).thenReturn(Arrays.asList(oldestEmployee, employee)); } @Test public void randomDataShowcase() throws Exception { Random random = new Random(); System.out.println(random.nextInt()); System.out.println(UUID.randomUUID().toString()); } }
1,313
0.701447
0.695354
50
25.26
24.520041
103
false
false
0
0
0
0
0
0
0.58
false
false
4
9b8a5df65979acb845549507e69e2874ca8b573b
16,217,796,522,683
eb5f925b2560c4d34ff2c4d789227c22d0b3e1a8
/app/src/main/java/com/yun/opernv2/ui/dialog/BaseDialog.java
209b9483ba0c95d5646605316791a719e9111824
[]
no_license
ChenYunerer/OpernAppV2
https://github.com/ChenYunerer/OpernAppV2
24d29fdb5dbddabbb7c7036fdf323002a947fd15
8211e453a2cccd5bff064e1477dd95072edbabd6
refs/heads/master
2021-01-25T13:18:57.081000
2019-03-08T16:24:31
2019-03-08T16:24:31
123,556,867
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yun.opernv2.ui.dialog; import android.app.Dialog; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.FrameLayout; import android.widget.TextView; import com.yun.opernv2.R; /** * Created by Yun on 2018/1/7. * base dialog */ public abstract class BaseDialog extends Dialog { protected TextView tvTitle; private FrameLayout flContent; protected Button btnNegative; protected Button btnPositive; protected View btnButton; protected View divider; private OnNegativeButtonClickListener onNegativeButtonClickListener; private OnPositiveButtonClickListener onPositiveButtonClickListener; protected String titleStr; protected String positiveButtonStr; protected String negativeButtonStr; private View contentView; public interface OnNegativeButtonClickListener { void onClick(Dialog dialog, View view); } public interface OnPositiveButtonClickListener { void onClick(Dialog dialog, View view); } public void setOnNegativeButtonClickListener(OnNegativeButtonClickListener onNegativeButtonClickListener) { this.onNegativeButtonClickListener = onNegativeButtonClickListener; } public void setOnPositiveButtonClickListener(OnPositiveButtonClickListener onPositiveButtonClickListener) { this.onPositiveButtonClickListener = onPositiveButtonClickListener; } public void setTitleText(String titleStr) { this.titleStr = titleStr; } public void setPositiveButtonText(String positiveButtonStr) { this.positiveButtonStr = positiveButtonStr; } public void setNegativeButtonText(String negativeButtonStr) { this.negativeButtonStr = negativeButtonStr; } protected abstract View setContentView(); protected abstract void initContentView(View contentView); public BaseDialog(Context context) { super(context); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Window window = getWindow(); if (window != null) { window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); } setTitle(null); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.layout_base_dialog); setCanceledOnTouchOutside(false); setCancelable(false); initView(); } private void initView() { contentView = setContentView(); tvTitle = findViewById(R.id.tv_title); flContent = findViewById(R.id.fl_content); btnNegative = findViewById(R.id.btn_negative); btnPositive = findViewById(R.id.btn_positive); btnButton = findViewById(R.id.button_btn); divider = findViewById(R.id.divider); btnNegative.setOnClickListener(v -> { if (onNegativeButtonClickListener != null) { onNegativeButtonClickListener.onClick(this, v); } dismiss(); }); btnPositive.setOnClickListener(v -> { if (onPositiveButtonClickListener != null) { onPositiveButtonClickListener.onClick(this, v); } }); initContentView(contentView); if (titleStr != null && !titleStr.equals("")) { tvTitle.setText(titleStr); } if (positiveButtonStr != null && !positiveButtonStr.equals("")) { btnPositive.setText(positiveButtonStr); } if (negativeButtonStr != null && !negativeButtonStr.equals("")) { btnNegative.setText(negativeButtonStr); } if (contentView != null) { flContent.removeAllViews(); flContent.addView(contentView); } } }
UTF-8
Java
3,939
java
BaseDialog.java
Java
[ { "context": "ew;\n\nimport com.yun.opernv2.R;\n\n\n/**\n * Created by Yun on 2018/1/7.\n * base dialog\n */\npublic abstract", "end": 400, "score": 0.575369656085968, "start": 399, "tag": "NAME", "value": "Y" }, { "context": ";\n\nimport com.yun.opernv2.R;\n\n\n/**\n * Created by Yun on 2018/1/7.\n * base dialog\n */\npublic abstract c", "end": 402, "score": 0.8513588905334473, "start": 400, "tag": "USERNAME", "value": "un" } ]
null
[]
package com.yun.opernv2.ui.dialog; import android.app.Dialog; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.FrameLayout; import android.widget.TextView; import com.yun.opernv2.R; /** * Created by Yun on 2018/1/7. * base dialog */ public abstract class BaseDialog extends Dialog { protected TextView tvTitle; private FrameLayout flContent; protected Button btnNegative; protected Button btnPositive; protected View btnButton; protected View divider; private OnNegativeButtonClickListener onNegativeButtonClickListener; private OnPositiveButtonClickListener onPositiveButtonClickListener; protected String titleStr; protected String positiveButtonStr; protected String negativeButtonStr; private View contentView; public interface OnNegativeButtonClickListener { void onClick(Dialog dialog, View view); } public interface OnPositiveButtonClickListener { void onClick(Dialog dialog, View view); } public void setOnNegativeButtonClickListener(OnNegativeButtonClickListener onNegativeButtonClickListener) { this.onNegativeButtonClickListener = onNegativeButtonClickListener; } public void setOnPositiveButtonClickListener(OnPositiveButtonClickListener onPositiveButtonClickListener) { this.onPositiveButtonClickListener = onPositiveButtonClickListener; } public void setTitleText(String titleStr) { this.titleStr = titleStr; } public void setPositiveButtonText(String positiveButtonStr) { this.positiveButtonStr = positiveButtonStr; } public void setNegativeButtonText(String negativeButtonStr) { this.negativeButtonStr = negativeButtonStr; } protected abstract View setContentView(); protected abstract void initContentView(View contentView); public BaseDialog(Context context) { super(context); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Window window = getWindow(); if (window != null) { window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); } setTitle(null); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.layout_base_dialog); setCanceledOnTouchOutside(false); setCancelable(false); initView(); } private void initView() { contentView = setContentView(); tvTitle = findViewById(R.id.tv_title); flContent = findViewById(R.id.fl_content); btnNegative = findViewById(R.id.btn_negative); btnPositive = findViewById(R.id.btn_positive); btnButton = findViewById(R.id.button_btn); divider = findViewById(R.id.divider); btnNegative.setOnClickListener(v -> { if (onNegativeButtonClickListener != null) { onNegativeButtonClickListener.onClick(this, v); } dismiss(); }); btnPositive.setOnClickListener(v -> { if (onPositiveButtonClickListener != null) { onPositiveButtonClickListener.onClick(this, v); } }); initContentView(contentView); if (titleStr != null && !titleStr.equals("")) { tvTitle.setText(titleStr); } if (positiveButtonStr != null && !positiveButtonStr.equals("")) { btnPositive.setText(positiveButtonStr); } if (negativeButtonStr != null && !negativeButtonStr.equals("")) { btnNegative.setText(negativeButtonStr); } if (contentView != null) { flContent.removeAllViews(); flContent.addView(contentView); } } }
3,939
0.684692
0.682661
127
30.015749
24.837103
111
false
false
0
0
0
0
0
0
0.511811
false
false
4
1c2e1e1f69429853986de214c9ff91fe16c8d684
16,217,796,520,368
bf2759ff78102c92b878211b4a8eabbceed03954
/NailCoreLibrary/src/com/nail/core/imageloader/ImageLoader.java
0361c85a7d9c881fb68d404928155e6a6c0acffd
[]
no_license
lihaifeng14/nail
https://github.com/lihaifeng14/nail
11f9ba8eba738e9cfd7aef3621f5387e3a1f3089
145f52cb3d6d79f378fecfb4f73bdfdc2e48e4a2
refs/heads/master
2016-09-06T02:55:36.316000
2015-02-28T10:49:22
2015-02-28T10:49:22
22,705,690
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nail.core.imageloader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.lang.ref.SoftReference; import java.util.EmptyStackException; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Stack; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; import com.nail.core.http.AsyncHttpHandler; import com.nail.core.http.IHttpHandler; import com.nail.core.utils.CommonUtils; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Bitmap.CompressFormat; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; import android.os.Build; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.support.v4.util.LruCache; import android.util.Log; import android.widget.ImageView; public class ImageLoader { private static final int MEMORY_CACHE_SIZE = 1024 * 1024 * 10; private static final int BITMAP_MAX_PIXELS = 800*600; private static final int SECOND_CAPACITY = 64; public static final int IMAGELOADER_WORK_QUEUE_MAX_COUNT = 8; public static final int IMAGELOADER_THREAD_MAX_WORKER_COUNT = 5; public static final int IMAGELOADER_THREAD_DEF_WORDER_COUNT = 4; public static final int IMAGELOADER_THREAD_KEEP_ALIVE_TIME = 1; public static final int MSG_REQUEST = 1; public static final int MSG_REPLY = 2; private Context mContext; private Handler mMainHandler; private LruCache<String, Bitmap> mMemoryCache; private LinkedHashMap<String, SoftReference<Bitmap>> mSecondaryCache; private DiskLruCache mDiskLruCache; private IHttpHandler mHttpHandler; private Stack<ImageLoadInfo> mImageStack; private ImageLoaderHandler mImageLoaderHandler; private BlockingQueue<Runnable> mWorkQueue; private ThreadPoolExecutor mExecutor; private static ImageLoader gInstance; public static ImageLoader getInstance(Context context) { if (gInstance == null ) { gInstance = new ImageLoader(context); } return gInstance; } public interface BitmapLoadCallback { public void onLoadFinished(ImageView imageView, Bitmap bitmap); } public interface BitmapDownLoadCallback { public void onDownLoadComplete(String tag, String url); } public ImageLoader(Context context) { mContext = context; mMainHandler = new Handler(Looper.getMainLooper()); mMemoryCache = new LruCache<String, Bitmap>(MEMORY_CACHE_SIZE) { @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @Override protected int sizeOf(String key, Bitmap bitmap) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); } else { return bitmap.getRowBytes()*bitmap.getHeight(); } } @Override protected void entryRemoved(boolean evicted, String key, Bitmap oldValue, Bitmap newValue) { if (oldValue != null) { mSecondaryCache.put(key, new SoftReference<Bitmap>(oldValue)); } } }; mSecondaryCache = new LinkedHashMap<String, SoftReference<Bitmap>>(SECOND_CAPACITY, .75f, true) { private static final long serialVersionUID = 1L; protected boolean removeEldestEntry( Entry<String, SoftReference<Bitmap>> eldest) { if (size() > SECOND_CAPACITY) { return true; } return false; } }; mDiskLruCache = DiskLruCache.openCache(context, -1); mImageStack = new Stack<ImageLoader.ImageLoadInfo>(); mWorkQueue = new LinkedBlockingQueue<Runnable>(IMAGELOADER_WORK_QUEUE_MAX_COUNT); mExecutor = new ThreadPoolExecutor( IMAGELOADER_THREAD_DEF_WORDER_COUNT, IMAGELOADER_THREAD_MAX_WORKER_COUNT, IMAGELOADER_THREAD_KEEP_ALIVE_TIME, TimeUnit.SECONDS, mWorkQueue, new ThreadFactory() { private final AtomicInteger mCount = new AtomicInteger(1); public Thread newThread(Runnable r) { return new Thread(r, "ImageLoader" + " #" + mCount.getAndIncrement()); } }, new RejectedExecutionHandler() { public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { Log.e("lihaifeng", "reject " + ((ImageLoadRunnable)r).mImageLoadInfo.mUrl); } }); HandlerThread thread = new HandlerThread("ImageLoad HandlerThread"); thread.start(); mImageLoaderHandler = new ImageLoaderHandler(thread.getLooper()); mHttpHandler = new AsyncHttpHandler(mContext); } public void destory() { mImageStack.clear(); mWorkQueue.clear(); mMemoryCache.evictAll(); mSecondaryCache.clear(); mImageLoaderHandler.getLooper().quit(); } public class ImageLoaderHandler extends Handler { public ImageLoaderHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { switch(msg.what) { case MSG_REQUEST: if (mWorkQueue.size() >= IMAGELOADER_WORK_QUEUE_MAX_COUNT || mImageStack.isEmpty()) { return; } ImageLoadInfo info = null; try { synchronized (mImageStack) { Log.d("lihaifeng", "stack size " + mImageStack.size()); info = mImageStack.pop(); } } catch (EmptyStackException e) { Log.e("lihaifeng", "stack null"); } if (info == null) { return; } Log.d("lihaifeng", "pop from stack " + info.mUrl); Log.d("lihaifeng", "mWorkQueue.size() " + mWorkQueue.size()); mExecutor.execute(new ImageLoadRunnable(info)); break; } } } public void downloadImage(String url, String tag, BitmapDownLoadCallback callback) { Bitmap bitmap = getFromDiskCache(url); if (bitmap != null) { callback.onDownLoadComplete(tag, url); return; } ImageLoadInfo info = new ImageLoadInfo(tag, url, callback); pushToStack(info); sendLoadRequest(); } public File getImageFile(String url) { return mDiskLruCache.getFile(url); } public void displayImage(String url, ImageView imageView, int defaultResId, BitmapLoadCallback callback) { String tag = (String)imageView.getTag(); if (tag != null && url.compareTo(tag) == 0) { return; } else { imageView.setTag(url); } if (defaultResId > 0) { imageView.setImageResource(defaultResId); } Bitmap bitmap = getFromImageCache(url); if (bitmap != null) { setBitmapImage(imageView, bitmap, true, callback); return; } bitmap = getFromDiskCache(url); if (bitmap != null) { mMemoryCache.put(url, bitmap); setBitmapImage(imageView, bitmap, true, callback); return; } ImageLoadInfo info = new ImageLoadInfo(imageView, url, callback); pushToStack(info); sendLoadRequest(); } private void sendLoadRequest() { Message message = mImageLoaderHandler.obtainMessage(MSG_REQUEST); mImageLoaderHandler.removeMessages(MSG_REQUEST); mImageLoaderHandler.sendMessage(message); } private void pushToStack(ImageLoadInfo info) { synchronized(mImageStack) { Iterator<ImageLoadInfo> iterator = mImageStack.iterator(); while (iterator.hasNext()) { if (iterator.next().mImageView == info.mImageView) { iterator.remove(); } } Log.d("lihaifeng", "push to stack " + info.mUrl); mImageStack.push(info); } } private void showBitmapInThread(final ImageView imageView, final Bitmap bitmap, final boolean showAnim, final BitmapLoadCallback callback) { mMainHandler.post(new Runnable() { @Override public void run() { setBitmapImage(imageView, bitmap, true, callback); } }); } private void completeDownload(final String tag, final String url, final BitmapDownLoadCallback callback) { mMainHandler.post(new Runnable() { @Override public void run() { callback.onDownLoadComplete(tag, url); } }); } private void setBitmapImage(ImageView imageView, Bitmap bitmap, boolean showAnim, BitmapLoadCallback callback) { if (callback != null) { callback.onLoadFinished(imageView, bitmap); imageView.setImageBitmap(bitmap); return; } if (showAnim) { TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(bitmap) }); td.setCrossFadeEnabled(true); imageView.setImageDrawable(td); td.startTransition(300); } else { imageView.setImageBitmap(bitmap); } } private Bitmap getFromImageCache(String url) { Bitmap bitmap = mMemoryCache.get(url); if (bitmap != null) { return bitmap; } SoftReference<Bitmap> refrence = mSecondaryCache.get(url); if (refrence != null) { bitmap = refrence.get(); if (bitmap != null) { mMemoryCache.put(url, bitmap); mSecondaryCache.remove(url); return bitmap; } else { mSecondaryCache.remove(url); } } return null; } private void putToDiskCache(String url, Bitmap bitmap) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { bitmap.compress(CompressFormat.PNG, 75, bos); byte[] data = bos.toByteArray(); mDiskLruCache.put(url, data); } finally { if (bos != null) { try { bos.close(); } catch (IOException e) { e.printStackTrace(); } } } } private Bitmap getFromDiskCache(String url) { File file = mDiskLruCache.get(url); if (file == null) { return null; } // BitmapFactory.Options opt = new BitmapFactory.Options(); // opt.inSampleSize = 1; // opt.inInputShareable = true; // opt.inPurgeable = true; // opt.inJustDecodeBounds = true; return BitmapFactory.decodeFile(file.getAbsolutePath(), null); } public static class ImageLoadInfo { public static int IMAGELOAD_TYPE_IMAGEVIEW = 0; public static int IMAGELOAD_TYPE_DOWNLOAD = 1; public int mImageLoadType; public ImageView mImageView; public String mUrl; public BitmapLoadCallback mCallback; public String mTag; public BitmapDownLoadCallback mCallback1; public ImageLoadInfo(ImageView imageView, String url, BitmapLoadCallback callback) { mImageLoadType = IMAGELOAD_TYPE_IMAGEVIEW; mImageView = imageView; mUrl = url; mCallback = callback; } public ImageLoadInfo(String tag, String url, BitmapDownLoadCallback callback) { mImageLoadType = IMAGELOAD_TYPE_DOWNLOAD; mTag = tag; mUrl = url; mCallback1 = callback; } } public class ImageLoadRunnable implements Runnable { private ImageLoadInfo mImageLoadInfo; public ImageLoadRunnable(ImageLoadInfo info) { mImageLoadInfo = info; Log.d("lihaifeng", "ImageLoadRunnable construct " + mImageLoadInfo.mUrl); } private byte[] loadByteArrayFromNetwork(String url) { try { HttpGet method = new HttpGet(url); HttpResponse response = mHttpHandler.excuteRequest(method); if (response == null) { return null; } HttpEntity entity = response.getEntity(); return EntityUtils.toByteArray(entity); } catch (java.net.UnknownHostException e) { } catch (java.net.SocketTimeoutException e) { } catch (Exception e) { e.printStackTrace(); } return null; } @Override public void run() { Log.d("lihaifeng", "ImageLoadRunnable run " + mImageLoadInfo.mUrl); byte[] data = loadByteArrayFromNetwork(mImageLoadInfo.mUrl); if (data == null) { Log.e("lihaifeng", "ImageLoadRunnable failed"); return; } BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inSampleSize = 1; opt.inInputShareable = true; opt.inPurgeable = true; opt.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(data, 0, data.length, opt); int bitmapPixels = opt.outHeight * opt.outWidth; if (bitmapPixels > BITMAP_MAX_PIXELS) { opt.inSampleSize = CommonUtils.getSampleSize(bitmapPixels, BITMAP_MAX_PIXELS); } opt.inJustDecodeBounds = false; Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, opt); if (bitmap != null) { putToDiskCache(mImageLoadInfo.mUrl, bitmap); if (mImageLoadInfo.mImageLoadType == ImageLoadInfo.IMAGELOAD_TYPE_IMAGEVIEW) { mMemoryCache.put(mImageLoadInfo.mUrl, bitmap); Log.e("lihaifeng", "ImageLoadRunnable finish ImageView " + mImageLoadInfo.mImageView + " " + mImageLoadInfo.mUrl); showBitmapInThread(mImageLoadInfo.mImageView, bitmap, true, mImageLoadInfo.mCallback); } else { completeDownload(mImageLoadInfo.mTag, mImageLoadInfo.mUrl, mImageLoadInfo.mCallback1); } sendLoadRequest(); } } } }
UTF-8
Java
15,932
java
ImageLoader.java
Java
[ { "context": "d (mImageStack) {\r\n Log.d(\"lihaifeng\", \"stack size \" + mImageStack.size());\r\n ", "end": 6568, "score": 0.9384077787399292, "start": 6559, "tag": "USERNAME", "value": "lihaifeng" }, { "context": " }\r\n }\r\n Log.d(\"lihaifeng\", \"push to stack \" + info.mUrl);\r\n mIm", "end": 9190, "score": 0.9794057607650757, "start": 9181, "tag": "USERNAME", "value": "lihaifeng" }, { "context": " mImageLoadInfo = info;\r\n Log.d(\"lihaifeng\", \"ImageLoadRunnable construct \" + mImageLoadInfo", "end": 13438, "score": 0.9988308548927307, "start": 13429, "tag": "USERNAME", "value": "lihaifeng" }, { "context": "\r\n public void run() {\r\n Log.d(\"lihaifeng\", \"ImageLoadRunnable run \" + mImageLoadInfo.mUrl)", "end": 14253, "score": 0.9466862678527832, "start": 14244, "tag": "USERNAME", "value": "lihaifeng" }, { "context": " if (data == null) {\r\n Log.e(\"lihaifeng\", \"ImageLoadRunnable failed\");\r\n r", "end": 14445, "score": 0.7647493481636047, "start": 14438, "tag": "USERNAME", "value": "haifeng" }, { "context": "adInfo.mUrl, bitmap);\r\n Log.e(\"lihaifeng\", \"ImageLoadRunnable finish ImageView \" + mImageL", "end": 15499, "score": 0.9131746292114258, "start": 15490, "tag": "USERNAME", "value": "lihaifeng" } ]
null
[]
package com.nail.core.imageloader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.lang.ref.SoftReference; import java.util.EmptyStackException; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Stack; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; import com.nail.core.http.AsyncHttpHandler; import com.nail.core.http.IHttpHandler; import com.nail.core.utils.CommonUtils; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Bitmap.CompressFormat; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; import android.os.Build; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.support.v4.util.LruCache; import android.util.Log; import android.widget.ImageView; public class ImageLoader { private static final int MEMORY_CACHE_SIZE = 1024 * 1024 * 10; private static final int BITMAP_MAX_PIXELS = 800*600; private static final int SECOND_CAPACITY = 64; public static final int IMAGELOADER_WORK_QUEUE_MAX_COUNT = 8; public static final int IMAGELOADER_THREAD_MAX_WORKER_COUNT = 5; public static final int IMAGELOADER_THREAD_DEF_WORDER_COUNT = 4; public static final int IMAGELOADER_THREAD_KEEP_ALIVE_TIME = 1; public static final int MSG_REQUEST = 1; public static final int MSG_REPLY = 2; private Context mContext; private Handler mMainHandler; private LruCache<String, Bitmap> mMemoryCache; private LinkedHashMap<String, SoftReference<Bitmap>> mSecondaryCache; private DiskLruCache mDiskLruCache; private IHttpHandler mHttpHandler; private Stack<ImageLoadInfo> mImageStack; private ImageLoaderHandler mImageLoaderHandler; private BlockingQueue<Runnable> mWorkQueue; private ThreadPoolExecutor mExecutor; private static ImageLoader gInstance; public static ImageLoader getInstance(Context context) { if (gInstance == null ) { gInstance = new ImageLoader(context); } return gInstance; } public interface BitmapLoadCallback { public void onLoadFinished(ImageView imageView, Bitmap bitmap); } public interface BitmapDownLoadCallback { public void onDownLoadComplete(String tag, String url); } public ImageLoader(Context context) { mContext = context; mMainHandler = new Handler(Looper.getMainLooper()); mMemoryCache = new LruCache<String, Bitmap>(MEMORY_CACHE_SIZE) { @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @Override protected int sizeOf(String key, Bitmap bitmap) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); } else { return bitmap.getRowBytes()*bitmap.getHeight(); } } @Override protected void entryRemoved(boolean evicted, String key, Bitmap oldValue, Bitmap newValue) { if (oldValue != null) { mSecondaryCache.put(key, new SoftReference<Bitmap>(oldValue)); } } }; mSecondaryCache = new LinkedHashMap<String, SoftReference<Bitmap>>(SECOND_CAPACITY, .75f, true) { private static final long serialVersionUID = 1L; protected boolean removeEldestEntry( Entry<String, SoftReference<Bitmap>> eldest) { if (size() > SECOND_CAPACITY) { return true; } return false; } }; mDiskLruCache = DiskLruCache.openCache(context, -1); mImageStack = new Stack<ImageLoader.ImageLoadInfo>(); mWorkQueue = new LinkedBlockingQueue<Runnable>(IMAGELOADER_WORK_QUEUE_MAX_COUNT); mExecutor = new ThreadPoolExecutor( IMAGELOADER_THREAD_DEF_WORDER_COUNT, IMAGELOADER_THREAD_MAX_WORKER_COUNT, IMAGELOADER_THREAD_KEEP_ALIVE_TIME, TimeUnit.SECONDS, mWorkQueue, new ThreadFactory() { private final AtomicInteger mCount = new AtomicInteger(1); public Thread newThread(Runnable r) { return new Thread(r, "ImageLoader" + " #" + mCount.getAndIncrement()); } }, new RejectedExecutionHandler() { public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { Log.e("lihaifeng", "reject " + ((ImageLoadRunnable)r).mImageLoadInfo.mUrl); } }); HandlerThread thread = new HandlerThread("ImageLoad HandlerThread"); thread.start(); mImageLoaderHandler = new ImageLoaderHandler(thread.getLooper()); mHttpHandler = new AsyncHttpHandler(mContext); } public void destory() { mImageStack.clear(); mWorkQueue.clear(); mMemoryCache.evictAll(); mSecondaryCache.clear(); mImageLoaderHandler.getLooper().quit(); } public class ImageLoaderHandler extends Handler { public ImageLoaderHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { switch(msg.what) { case MSG_REQUEST: if (mWorkQueue.size() >= IMAGELOADER_WORK_QUEUE_MAX_COUNT || mImageStack.isEmpty()) { return; } ImageLoadInfo info = null; try { synchronized (mImageStack) { Log.d("lihaifeng", "stack size " + mImageStack.size()); info = mImageStack.pop(); } } catch (EmptyStackException e) { Log.e("lihaifeng", "stack null"); } if (info == null) { return; } Log.d("lihaifeng", "pop from stack " + info.mUrl); Log.d("lihaifeng", "mWorkQueue.size() " + mWorkQueue.size()); mExecutor.execute(new ImageLoadRunnable(info)); break; } } } public void downloadImage(String url, String tag, BitmapDownLoadCallback callback) { Bitmap bitmap = getFromDiskCache(url); if (bitmap != null) { callback.onDownLoadComplete(tag, url); return; } ImageLoadInfo info = new ImageLoadInfo(tag, url, callback); pushToStack(info); sendLoadRequest(); } public File getImageFile(String url) { return mDiskLruCache.getFile(url); } public void displayImage(String url, ImageView imageView, int defaultResId, BitmapLoadCallback callback) { String tag = (String)imageView.getTag(); if (tag != null && url.compareTo(tag) == 0) { return; } else { imageView.setTag(url); } if (defaultResId > 0) { imageView.setImageResource(defaultResId); } Bitmap bitmap = getFromImageCache(url); if (bitmap != null) { setBitmapImage(imageView, bitmap, true, callback); return; } bitmap = getFromDiskCache(url); if (bitmap != null) { mMemoryCache.put(url, bitmap); setBitmapImage(imageView, bitmap, true, callback); return; } ImageLoadInfo info = new ImageLoadInfo(imageView, url, callback); pushToStack(info); sendLoadRequest(); } private void sendLoadRequest() { Message message = mImageLoaderHandler.obtainMessage(MSG_REQUEST); mImageLoaderHandler.removeMessages(MSG_REQUEST); mImageLoaderHandler.sendMessage(message); } private void pushToStack(ImageLoadInfo info) { synchronized(mImageStack) { Iterator<ImageLoadInfo> iterator = mImageStack.iterator(); while (iterator.hasNext()) { if (iterator.next().mImageView == info.mImageView) { iterator.remove(); } } Log.d("lihaifeng", "push to stack " + info.mUrl); mImageStack.push(info); } } private void showBitmapInThread(final ImageView imageView, final Bitmap bitmap, final boolean showAnim, final BitmapLoadCallback callback) { mMainHandler.post(new Runnable() { @Override public void run() { setBitmapImage(imageView, bitmap, true, callback); } }); } private void completeDownload(final String tag, final String url, final BitmapDownLoadCallback callback) { mMainHandler.post(new Runnable() { @Override public void run() { callback.onDownLoadComplete(tag, url); } }); } private void setBitmapImage(ImageView imageView, Bitmap bitmap, boolean showAnim, BitmapLoadCallback callback) { if (callback != null) { callback.onLoadFinished(imageView, bitmap); imageView.setImageBitmap(bitmap); return; } if (showAnim) { TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(bitmap) }); td.setCrossFadeEnabled(true); imageView.setImageDrawable(td); td.startTransition(300); } else { imageView.setImageBitmap(bitmap); } } private Bitmap getFromImageCache(String url) { Bitmap bitmap = mMemoryCache.get(url); if (bitmap != null) { return bitmap; } SoftReference<Bitmap> refrence = mSecondaryCache.get(url); if (refrence != null) { bitmap = refrence.get(); if (bitmap != null) { mMemoryCache.put(url, bitmap); mSecondaryCache.remove(url); return bitmap; } else { mSecondaryCache.remove(url); } } return null; } private void putToDiskCache(String url, Bitmap bitmap) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { bitmap.compress(CompressFormat.PNG, 75, bos); byte[] data = bos.toByteArray(); mDiskLruCache.put(url, data); } finally { if (bos != null) { try { bos.close(); } catch (IOException e) { e.printStackTrace(); } } } } private Bitmap getFromDiskCache(String url) { File file = mDiskLruCache.get(url); if (file == null) { return null; } // BitmapFactory.Options opt = new BitmapFactory.Options(); // opt.inSampleSize = 1; // opt.inInputShareable = true; // opt.inPurgeable = true; // opt.inJustDecodeBounds = true; return BitmapFactory.decodeFile(file.getAbsolutePath(), null); } public static class ImageLoadInfo { public static int IMAGELOAD_TYPE_IMAGEVIEW = 0; public static int IMAGELOAD_TYPE_DOWNLOAD = 1; public int mImageLoadType; public ImageView mImageView; public String mUrl; public BitmapLoadCallback mCallback; public String mTag; public BitmapDownLoadCallback mCallback1; public ImageLoadInfo(ImageView imageView, String url, BitmapLoadCallback callback) { mImageLoadType = IMAGELOAD_TYPE_IMAGEVIEW; mImageView = imageView; mUrl = url; mCallback = callback; } public ImageLoadInfo(String tag, String url, BitmapDownLoadCallback callback) { mImageLoadType = IMAGELOAD_TYPE_DOWNLOAD; mTag = tag; mUrl = url; mCallback1 = callback; } } public class ImageLoadRunnable implements Runnable { private ImageLoadInfo mImageLoadInfo; public ImageLoadRunnable(ImageLoadInfo info) { mImageLoadInfo = info; Log.d("lihaifeng", "ImageLoadRunnable construct " + mImageLoadInfo.mUrl); } private byte[] loadByteArrayFromNetwork(String url) { try { HttpGet method = new HttpGet(url); HttpResponse response = mHttpHandler.excuteRequest(method); if (response == null) { return null; } HttpEntity entity = response.getEntity(); return EntityUtils.toByteArray(entity); } catch (java.net.UnknownHostException e) { } catch (java.net.SocketTimeoutException e) { } catch (Exception e) { e.printStackTrace(); } return null; } @Override public void run() { Log.d("lihaifeng", "ImageLoadRunnable run " + mImageLoadInfo.mUrl); byte[] data = loadByteArrayFromNetwork(mImageLoadInfo.mUrl); if (data == null) { Log.e("lihaifeng", "ImageLoadRunnable failed"); return; } BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inSampleSize = 1; opt.inInputShareable = true; opt.inPurgeable = true; opt.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(data, 0, data.length, opt); int bitmapPixels = opt.outHeight * opt.outWidth; if (bitmapPixels > BITMAP_MAX_PIXELS) { opt.inSampleSize = CommonUtils.getSampleSize(bitmapPixels, BITMAP_MAX_PIXELS); } opt.inJustDecodeBounds = false; Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, opt); if (bitmap != null) { putToDiskCache(mImageLoadInfo.mUrl, bitmap); if (mImageLoadInfo.mImageLoadType == ImageLoadInfo.IMAGELOAD_TYPE_IMAGEVIEW) { mMemoryCache.put(mImageLoadInfo.mUrl, bitmap); Log.e("lihaifeng", "ImageLoadRunnable finish ImageView " + mImageLoadInfo.mImageView + " " + mImageLoadInfo.mUrl); showBitmapInThread(mImageLoadInfo.mImageView, bitmap, true, mImageLoadInfo.mCallback); } else { completeDownload(mImageLoadInfo.mTag, mImageLoadInfo.mUrl, mImageLoadInfo.mCallback1); } sendLoadRequest(); } } } }
15,932
0.580341
0.577329
433
34.799076
25.608057
134
false
false
0
0
0
0
0
0
0.692841
false
false
4
160c5fe9a9566d696e7270a5470518fb131ba3c9
18,949,395,719,511
3b27696d3370e3f45f97f9368e3daf4576d97c41
/a008_practice/src/main/java/com/lec/android/a008_practice/MainActivity.java
c12301e8329216ada2d3051c1ff50a53f3172aab
[]
no_license
kimbogyeum/MyAndroidWork
https://github.com/kimbogyeum/MyAndroidWork
8f58cb75a2d0be0543e8c16696f61b7601fb8952
10e4105975948905e10ceb9b6b30357621d23af4
refs/heads/master
2022-05-31T06:28:29.017000
2020-05-06T02:52:38
2020-05-06T02:52:38
255,477,900
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lec.android.a008_practice; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { InfobookAdapter adapter; //Adapter ๊ฐ์ฒด RecyclerView rv; EditText name,age,address; Button btnadd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name= findViewById(R.id.name); age=findViewById(R.id.age); address=findViewById(R.id.address); rv=findViewById(R.id.rv); RecyclerView.LayoutManager layoutManager =new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false); rv.setLayoutManager(layoutManager); adapter=new InfobookAdapter(); btnadd=findViewById(R.id.btnadd); btnadd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { insertData(v); rv.setAdapter(adapter);//RecyclerView์— Adapter ์žฅ์ฐฉ! } }); }//end onCreate() protected void insertData(View v) { String a = name.getText().toString(); String b = age.getText().toString(); String c= address.getText().toString(); adapter.addItem(0,new Infobook(a,b,c)); adapter.notifyDataSetChanged(); }//end insertData() }//end Activity
UTF-8
Java
1,757
java
MainActivity.java
Java
[]
null
[]
package com.lec.android.a008_practice; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { InfobookAdapter adapter; //Adapter ๊ฐ์ฒด RecyclerView rv; EditText name,age,address; Button btnadd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name= findViewById(R.id.name); age=findViewById(R.id.age); address=findViewById(R.id.address); rv=findViewById(R.id.rv); RecyclerView.LayoutManager layoutManager =new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false); rv.setLayoutManager(layoutManager); adapter=new InfobookAdapter(); btnadd=findViewById(R.id.btnadd); btnadd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { insertData(v); rv.setAdapter(adapter);//RecyclerView์— Adapter ์žฅ์ฐฉ! } }); }//end onCreate() protected void insertData(View v) { String a = name.getText().toString(); String b = age.getText().toString(); String c= address.getText().toString(); adapter.addItem(0,new Infobook(a,b,c)); adapter.notifyDataSetChanged(); }//end insertData() }//end Activity
1,757
0.689181
0.686892
65
25.876923
20.658028
82
false
false
0
0
0
0
0
0
0.630769
false
false
4