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
list
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
list
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
fc5b11ec2efe0421f24f1b6bd7df49a781acf690
36,481,452,227,872
6d371310b35ead5d1a54ded5fc7f97d9760f67ae
/src/main/java/cpackageee/Class_1070.java
6fb90d1e5b38829224e0dfcbe2e65cbaff768ed6
[]
no_license
vbozh/a_project_test
https://github.com/vbozh/a_project_test
fd4dbd4baaffcc4ba5d2669e10cac3c32a6dd055
289f263cfdbdee37fd896669f204e49950b38e79
refs/heads/master
2021-02-12T20:27:10.848000
2020-03-04T10:26:40
2020-03-04T10:28:01
244,627,143
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cpackageee; public class Class_1070{public void foo1070(){}}
UTF-8
Java
69
java
Class_1070.java
Java
[]
null
[]
package cpackageee; public class Class_1070{public void foo1070(){}}
69
0.782609
0.666667
1
68
0
68
false
false
0
0
0
0
0
0
1
false
false
9
3f3659e02695e7ef33b5459e925dc426d89a6447
8,538,395,044,611
5c6280449e534c82fc2858d66e25fb3db4f6ab07
/DazzleAlbum/src/cn/ancore/dazzlealbum/commons/Constants.java
b0d916e7d213a3b25bd51aace682b53064d94728
[]
no_license
yucemahmut/ruanzijie-android-dazzlealbum
https://github.com/yucemahmut/ruanzijie-android-dazzlealbum
c08a7c6de59ec573cd10e351f1cb49abd4331e4b
3ba86a58609709042cbd666cb0c21dd976bc3681
refs/heads/master
2021-01-20T05:08:21.911000
2012-12-25T08:53:35
2012-12-25T08:53:35
33,425,536
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.ancore.dazzlealbum.commons; /** * ๅธธ้‡ * @author magicruan * @version 1.0 2012-12-14 */ public class Constants { //ๅŠ ่งฃๅฏ†KEY public static final String AUTH_CRYPT_KEY = "magic_ruan"; }
UTF-8
Java
227
java
Constants.java
Java
[ { "context": "ore.dazzlealbum.commons;\r\n\r\n/**\r\n * ๅธธ้‡\r\n * @author magicruan\r\n * @version 1.0 2012-12-14\r\n */\r\npublic class Co", "end": 74, "score": 0.9995954036712646, "start": 65, "tag": "USERNAME", "value": "magicruan" }, { "context": "\n public static final String AUTH_CRYPT_KEY = \"magic_ruan\";\r\n\t\r\n}\r\n", "end": 207, "score": 0.997039794921875, "start": 197, "tag": "KEY", "value": "magic_ruan" } ]
null
[]
package cn.ancore.dazzlealbum.commons; /** * ๅธธ้‡ * @author magicruan * @version 1.0 2012-12-14 */ public class Constants { //ๅŠ ่งฃๅฏ†KEY public static final String AUTH_CRYPT_KEY = "magic_ruan"; }
227
0.631336
0.585253
13
14.692307
17.838526
61
false
false
0
0
0
0
0
0
0.307692
false
false
9
07904205f4728c84c83ef081e7a165f50375cd82
18,485,539,279,570
4b5f9125b38670acb72ab515c97839195d049ac6
/src/main/java/com/hee/JpaMain.java
e0ae7d737a25b7ee3e5cec0f8c18a75ebb4c8ab1
[]
no_license
gmlwjd9405/orm-jpa-basic
https://github.com/gmlwjd9405/orm-jpa-basic
9d1ada7fad4692fe9ac349f78e4e8e21db34f0b1
4ea23c5ad57c9241f8d712027be6eb1eb5b5089a
refs/heads/master
2022-02-03T04:44:39.070000
2019-09-16T05:09:56
2019-09-16T05:09:56
200,048,383
7
1
null
false
2022-01-21T23:28:02
2019-08-01T12:40:49
2022-01-13T05:38:16
2022-01-21T23:27:59
17
4
0
1
Java
false
false
package com.hee; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import java.util.List; public class JpaMain { public static void main(String[] args) { /* EntityManagerFactory * application(WebServer) loading ์‹œ์ ์— DB ๋‹น ๋”ฑ ํ•˜๋‚˜๋งŒ ์ƒ์„ฑ๋˜์–ด์•ผ ํ•จ. */ EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("hello"); /* EntityManager * ์‹ค์ œ Transaction ๋‹จ์œ„๋ฅผ ์ˆ˜ํ–‰ํ•  ๋•Œ๋งˆ๋‹ค ์ƒ์„ฑ (๊ณ ๊ฐ์˜ ์š”์ฒญ์ด ์˜ฌ ๋•Œ๋งˆ๋‹ค ์‚ฌ์šฉํ–ˆ๋‹ค๊ฐ€ ๋‹ซ์Œ) * thread ๊ฐ„์— ๊ณต์œ ํ•˜๋ฉด ์•ˆ ๋จ. (์‚ฌ์šฉํ•˜๊ณ  ๋ฒ„๋ ค์•ผ ํ•จ) */ EntityManager entityManager = entityManagerFactory.createEntityManager(); // Data ๋ฅผ "๋ณ€๊ฒฝ"ํ•˜๋Š” ๋ชจ๋“  ์ž‘์—…์€ ๋ฐ˜๋“œ์‹œ Transaction ์•ˆ์—์„œ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•จ. EntityTransaction tx = entityManager.getTransaction(); tx.begin(); try { // ์˜์† ์ƒํƒœ (Persistence Context ์— ์˜ํ•ด Entity ๊ฐ€ ๊ด€๋ฆฌ๋˜๋Š” ์ƒํƒœ) Member findMember = entityManager.find(Member.class, 150L); findMember.setName("AAAAA"); entityManager.clear(); // ์˜์†์„ฑ ์ปจํ…์ŠคํŠธ๋ฅผ ์™„์ „ํžˆ ์ดˆ๊ธฐํ™” Member findMember2 = entityManager.find(Member.class, 150L); // ๊ฐ™์€ Entity ๋ฅผ ๋‹ค์‹œ ์กฐํšŒ tx.commit(); // DB์— insert query ๊ฐ€ ๋‚ ๋ผ๊ฐ€๋Š” ์‹œ์  (์•„๋ฌด์ผ๋„ ๋ฐœ์ƒํ•˜์ง€ ์•Š์Œ.) } catch (Exception e) { tx.rollback(); } finally { entityManager.close(); // ์ค‘์š”! } entityManagerFactory.close(); } }
UTF-8
Java
1,715
java
JpaMain.java
Java
[ { "context": "ber.class, 150L);\n findMember.setName(\"AAAAA\");\n\n entityManager.clear(); // ์˜์†์„ฑ ์ปจํ…์Šค", "end": 1036, "score": 0.9191703200340271, "start": 1031, "tag": "NAME", "value": "AAAAA" } ]
null
[]
package com.hee; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import java.util.List; public class JpaMain { public static void main(String[] args) { /* EntityManagerFactory * application(WebServer) loading ์‹œ์ ์— DB ๋‹น ๋”ฑ ํ•˜๋‚˜๋งŒ ์ƒ์„ฑ๋˜์–ด์•ผ ํ•จ. */ EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("hello"); /* EntityManager * ์‹ค์ œ Transaction ๋‹จ์œ„๋ฅผ ์ˆ˜ํ–‰ํ•  ๋•Œ๋งˆ๋‹ค ์ƒ์„ฑ (๊ณ ๊ฐ์˜ ์š”์ฒญ์ด ์˜ฌ ๋•Œ๋งˆ๋‹ค ์‚ฌ์šฉํ–ˆ๋‹ค๊ฐ€ ๋‹ซ์Œ) * thread ๊ฐ„์— ๊ณต์œ ํ•˜๋ฉด ์•ˆ ๋จ. (์‚ฌ์šฉํ•˜๊ณ  ๋ฒ„๋ ค์•ผ ํ•จ) */ EntityManager entityManager = entityManagerFactory.createEntityManager(); // Data ๋ฅผ "๋ณ€๊ฒฝ"ํ•˜๋Š” ๋ชจ๋“  ์ž‘์—…์€ ๋ฐ˜๋“œ์‹œ Transaction ์•ˆ์—์„œ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•จ. EntityTransaction tx = entityManager.getTransaction(); tx.begin(); try { // ์˜์† ์ƒํƒœ (Persistence Context ์— ์˜ํ•ด Entity ๊ฐ€ ๊ด€๋ฆฌ๋˜๋Š” ์ƒํƒœ) Member findMember = entityManager.find(Member.class, 150L); findMember.setName("AAAAA"); entityManager.clear(); // ์˜์†์„ฑ ์ปจํ…์ŠคํŠธ๋ฅผ ์™„์ „ํžˆ ์ดˆ๊ธฐํ™” Member findMember2 = entityManager.find(Member.class, 150L); // ๊ฐ™์€ Entity ๋ฅผ ๋‹ค์‹œ ์กฐํšŒ tx.commit(); // DB์— insert query ๊ฐ€ ๋‚ ๋ผ๊ฐ€๋Š” ์‹œ์  (์•„๋ฌด์ผ๋„ ๋ฐœ์ƒํ•˜์ง€ ์•Š์Œ.) } catch (Exception e) { tx.rollback(); } finally { entityManager.close(); // ์ค‘์š”! } entityManagerFactory.close(); } }
1,715
0.641915
0.637058
41
34.146343
27.811703
100
false
false
0
0
0
0
0
0
0.487805
false
false
9
e0cadb55893ab16a48855778c7312e9310267aab
20,667,382,632,712
0520fc1c797dfaaea9c49891b93dd7e8f5b77cb3
/app/src/main/java/com/example/justdo/MainActivity.java
cb7083bd2ef581e29ee2e7f9e2e466af2a6e9d22
[]
no_license
shivamkrs89/Simple-MIles-to-Km-converter
https://github.com/shivamkrs89/Simple-MIles-to-Km-converter
abc895987a382ed0c8bc52cac015e6fdc3c9a8b8
5ec06f49b1160c37f1b44c06addcaaabc3612023
refs/heads/master
2022-12-05T18:06:56.912000
2020-08-23T18:18:06
2020-08-23T18:18:06
289,742,834
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.justdo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.text.DecimalFormat; import static com.example.justdo.R.*; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(layout.activity_main); Button m2k= (Button)findViewById(id.m2k); m2k.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText textq1 = (EditText)findViewById(id.editTextqn); EditText texta1 = (EditText)findViewById(id.editTextans); Double vmiles=Double.valueOf(textq1.getText().toString()); Double rkm= (Double) vmiles/0.62137; DecimalFormat formatval= new DecimalFormat("##.###"); texta1.setText(formatval.format(rkm)); } }); Button k2m= (Button)findViewById(id.k2m); k2m.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText textqn = (EditText)findViewById(id.editTextqn); EditText textan = (EditText)findViewById(id.editTextans); Double vkm=Double.valueOf(textqn.getText().toString()); Double rm= vkm*0.62137; DecimalFormat formatval= new DecimalFormat("##.###"); textan.setText(formatval.format(rm)); } } ) ; } }
UTF-8
Java
1,683
java
MainActivity.java
Java
[]
null
[]
package com.example.justdo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.text.DecimalFormat; import static com.example.justdo.R.*; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(layout.activity_main); Button m2k= (Button)findViewById(id.m2k); m2k.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText textq1 = (EditText)findViewById(id.editTextqn); EditText texta1 = (EditText)findViewById(id.editTextans); Double vmiles=Double.valueOf(textq1.getText().toString()); Double rkm= (Double) vmiles/0.62137; DecimalFormat formatval= new DecimalFormat("##.###"); texta1.setText(formatval.format(rkm)); } }); Button k2m= (Button)findViewById(id.k2m); k2m.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText textqn = (EditText)findViewById(id.editTextqn); EditText textan = (EditText)findViewById(id.editTextans); Double vkm=Double.valueOf(textqn.getText().toString()); Double rm= vkm*0.62137; DecimalFormat formatval= new DecimalFormat("##.###"); textan.setText(formatval.format(rm)); } } ) ; } }
1,683
0.620321
0.606655
45
36.400002
24.329588
74
false
false
0
0
0
0
0
0
0.577778
false
false
9
f3fdc3b12a405e2d99431dfc748bc4ee977989e3
23,407,571,808,878
a20db737a3a1a7eb656db434373c27b79cdf3fbc
/Java/76_Minimum_Window_Substring.java
17e5ace8e7af48ba0969ed8b294cbf1d674b9b3f
[]
no_license
hjhjw1991/leetcode
https://github.com/hjhjw1991/leetcode
70169c340f1288b3495fada255f5cca0937b0ea5
839b2277b4068d74867280273fa5dc10ab9b5ff3
refs/heads/master
2021-01-13T14:36:49.758000
2020-04-19T13:01:49
2020-04-19T13:01:49
40,118,530
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; import dutil.*; public class Solution { public String minWindow(String s, String L){ int min=s.length(),start=0; if(s==null || s.length()==0 || L==null || L.length()==0) return ""; char[] str = s.toCharArray(); char[] temp = L.toCharArray(); int[] map = new int[128]; int[] find = new int[128];// used as HashMap int minL=0; int minR=str.length; for(int i=0;i<temp.length;i++) { map[temp[i]]++; } int left=0,right=0,count=0;// two pointer while(right<str.length){ if(map[str[right]]==0){ right++; continue; } find[str[right]]++; if(find[str[right]] <= map[str[right]]){ count++; } if(count==temp.length){ while(left<right){ if(map[str[left]]==0){ left++; continue; } if(find[str[left]]>map[str[left]]){ find[str[left]]--; left++; continue; }else{ break; } } if(right-left<minR - minL){ minL=left; minR=right; } } right++; } if(minR==str.length){ return ""; } return s.substring(minL, minR+1); } public static void main(String[] args) { Solution so = new Solution(); Print p=new Print(); String[] cases = { "ADOBECODEBANC", }; for(String s:cases){ p.print(so.minWindow(s, "COD")); } } }
UTF-8
Java
1,871
java
76_Minimum_Window_Substring.java
Java
[]
null
[]
import java.util.*; import dutil.*; public class Solution { public String minWindow(String s, String L){ int min=s.length(),start=0; if(s==null || s.length()==0 || L==null || L.length()==0) return ""; char[] str = s.toCharArray(); char[] temp = L.toCharArray(); int[] map = new int[128]; int[] find = new int[128];// used as HashMap int minL=0; int minR=str.length; for(int i=0;i<temp.length;i++) { map[temp[i]]++; } int left=0,right=0,count=0;// two pointer while(right<str.length){ if(map[str[right]]==0){ right++; continue; } find[str[right]]++; if(find[str[right]] <= map[str[right]]){ count++; } if(count==temp.length){ while(left<right){ if(map[str[left]]==0){ left++; continue; } if(find[str[left]]>map[str[left]]){ find[str[left]]--; left++; continue; }else{ break; } } if(right-left<minR - minL){ minL=left; minR=right; } } right++; } if(minR==str.length){ return ""; } return s.substring(minL, minR+1); } public static void main(String[] args) { Solution so = new Solution(); Print p=new Print(); String[] cases = { "ADOBECODEBANC", }; for(String s:cases){ p.print(so.minWindow(s, "COD")); } } }
1,871
0.378407
0.369321
66
27.363636
14.066547
66
false
false
0
0
0
0
0
0
0.69697
false
false
9
5d2c715da0c829df977123c6559a34da566b3ac8
27,994,596,889,603
473b76b1043df2f09214f8c335d4359d3a8151e0
/benchmark/bigclonebenchdata_completed/4502456.java
15daba6b3931e978b4ff5bfe09c9ea43c823cc6c
[]
no_license
whatafree/JCoffee
https://github.com/whatafree/JCoffee
08dc47f79f8369af32e755de01c52d9a8479d44c
fa7194635a5bd48259d325e5b0a190780a53c55f
refs/heads/master
2022-11-16T01:58:04.254000
2020-07-13T20:11:17
2020-07-13T20:11:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class c4502456 { public MyHelperClass pass; public MyHelperClass FTPTransferType; public MyHelperClass user; public MyHelperClass FTPConnectMode; public MyHelperClass cl; public MyHelperClass getPosition(){ return null; } public MyHelperClass getURL(){ return null; } public void initGet() throws Exception { FTPClient cl;// = new FTPClient(); cl = new FTPClient(); URL url = new URL(getURL()); cl.setRemoteHost(url.getHost()); cl.connect(); cl.login(user, pass); cl.setType(FTPTransferType.BINARY); cl.setConnectMode(FTPConnectMode.PASV); cl.restart(getPosition()); } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass BINARY; public MyHelperClass PASV; public MyHelperClass setRemoteHost(MyHelperClass o0){ return null; } public MyHelperClass setType(MyHelperClass o0){ return null; } public MyHelperClass login(MyHelperClass o0, MyHelperClass o1){ return null; } public MyHelperClass restart(MyHelperClass o0){ return null; } public MyHelperClass connect(){ return null; } public MyHelperClass setConnectMode(MyHelperClass o0){ return null; }} class URL { URL(){} URL(MyHelperClass o0){} public MyHelperClass getHost(){ return null; }} class FTPClient { public MyHelperClass restart(MyHelperClass o0){ return null; } public MyHelperClass setType(MyHelperClass o0){ return null; } public MyHelperClass login(MyHelperClass o0, MyHelperClass o1){ return null; } public MyHelperClass setRemoteHost(MyHelperClass o0){ return null; } public MyHelperClass connect(){ return null; } public MyHelperClass setConnectMode(MyHelperClass o0){ return null; }}
UTF-8
Java
1,708
java
4502456.java
Java
[]
null
[]
class c4502456 { public MyHelperClass pass; public MyHelperClass FTPTransferType; public MyHelperClass user; public MyHelperClass FTPConnectMode; public MyHelperClass cl; public MyHelperClass getPosition(){ return null; } public MyHelperClass getURL(){ return null; } public void initGet() throws Exception { FTPClient cl;// = new FTPClient(); cl = new FTPClient(); URL url = new URL(getURL()); cl.setRemoteHost(url.getHost()); cl.connect(); cl.login(user, pass); cl.setType(FTPTransferType.BINARY); cl.setConnectMode(FTPConnectMode.PASV); cl.restart(getPosition()); } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass BINARY; public MyHelperClass PASV; public MyHelperClass setRemoteHost(MyHelperClass o0){ return null; } public MyHelperClass setType(MyHelperClass o0){ return null; } public MyHelperClass login(MyHelperClass o0, MyHelperClass o1){ return null; } public MyHelperClass restart(MyHelperClass o0){ return null; } public MyHelperClass connect(){ return null; } public MyHelperClass setConnectMode(MyHelperClass o0){ return null; }} class URL { URL(){} URL(MyHelperClass o0){} public MyHelperClass getHost(){ return null; }} class FTPClient { public MyHelperClass restart(MyHelperClass o0){ return null; } public MyHelperClass setType(MyHelperClass o0){ return null; } public MyHelperClass login(MyHelperClass o0, MyHelperClass o1){ return null; } public MyHelperClass setRemoteHost(MyHelperClass o0){ return null; } public MyHelperClass connect(){ return null; } public MyHelperClass setConnectMode(MyHelperClass o0){ return null; }}
1,708
0.740047
0.728337
48
34.520832
23.721464
79
false
false
0
0
0
0
0
0
1.125
false
false
9
3ec287814225e2cebb1d8b774a39dd9afeeff4ca
27,994,596,889,040
baa6f906567c9e075e0c1d3e25556f3629d4f026
/app/src/main/java/model/FragmentListener.java
04647d3d5db908ec47f9016dc0d82b2abad9fc3b
[]
no_license
doccocsb88/phimbandroid
https://github.com/doccocsb88/phimbandroid
d8017810a517fd74cd3268a87136a8c1b2e43413
b553cc4aed84a635e01bd501e514c652474d29d1
refs/heads/master
2017-12-22T12:56:23.246000
2016-11-03T09:29:38
2016-11-03T09:29:38
72,728,804
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; import java.util.ArrayList; /** * Created by macbook on 9/10/16. */ public interface FragmentListener { public void didloadData(ArrayList<PhimbObject> data); }
UTF-8
Java
183
java
FragmentListener.java
Java
[ { "context": "l;\n\nimport java.util.ArrayList;\n\n/**\n * Created by macbook on 9/10/16.\n */\npublic interface FragmentListener", "end": 70, "score": 0.9990336894989014, "start": 63, "tag": "USERNAME", "value": "macbook" } ]
null
[]
package model; import java.util.ArrayList; /** * Created by macbook on 9/10/16. */ public interface FragmentListener { public void didloadData(ArrayList<PhimbObject> data); }
183
0.73224
0.704918
10
17.299999
18.745934
57
false
false
0
0
0
0
0
0
0.3
false
false
9
843e4655e4cea3b61058dae69810faf8c9929b0a
6,305,011,992,294
5bc72030ac6d24bfaf2e96b3cdf4a4d6a091ff86
/app/src/main/java/com/example/bishe/cet4/tabs/PersonalFragment.java
1682a5d539efe5d31903bcb3e96f8d11230ea19b
[]
no_license
z1908144712/Cet4
https://github.com/z1908144712/Cet4
802b4ad90087fd7e18d210d4d5bfd951e4d93ed6
294aeb9593822022834de9e903af65f1739ec3b4
refs/heads/master
2021-05-10T07:41:46.566000
2018-05-22T11:18:45
2018-05-22T11:18:45
118,850,933
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bishe.cet4.tabs; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.CardView; import android.text.InputType; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import com.example.bishe.cet4.R; import com.example.bishe.cet4.activity.LearnInfoActivity; import com.example.bishe.cet4.activity.LoadingRateOfLearning; import com.example.bishe.cet4.activity.LoadingUserInfoActivity; import com.example.bishe.cet4.activity.LoadingSyncActivity; import com.example.bishe.cet4.activity.LoginActivity; import com.example.bishe.cet4.activity.WordCollectionActivity; import com.example.bishe.cet4.database.AssetsDatabaseManager; import com.example.bishe.cet4.database.DBHelper; import com.example.bishe.cet4.function.MyToast; import com.example.bishe.cet4.object.WordPlanNum; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by Skywilling on 2018/1/2. */ public class PersonalFragment extends Fragment implements AdapterView.OnItemClickListener{ private ListView listView_personal_item=null; private SimpleAdapter simpleAdapter=null; private List<Map<String,Object>> personal_items=null; private LinearLayout ll_login=null; private String user_id=null; private int plandays; private int learneddays; private int words_count; private int learned_words_num; private int plandays_min; private int plandays_max; private int last_words_num; private SQLiteDatabase db=null; private DBHelper dbHelper=null; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.activity_tab_personal,container,false); //ๅˆๅง‹ๅŒ–ๆ•ฐๆฎๅบ“ initDataBase(); //ๅˆๅง‹ๅŒ–ๆŽงไปถ initViews(view); //ๅˆๅง‹ๅŒ–็›‘ๅฌๅ™จ initEvents(); return view; } private void initDataBase(){ AssetsDatabaseManager assetsDatabaseManager=AssetsDatabaseManager.getAssetsDatabaseManager(); db=assetsDatabaseManager.getDatabase("dict.db"); dbHelper=new DBHelper(db); } private void initData(){ SharedPreferences sharedPreferences=getContext().getSharedPreferences("plandays",Context.MODE_PRIVATE); plandays=sharedPreferences.getInt("plandays",-1); words_count=dbHelper.selectCountFromWords(); learneddays=dbHelper.selectCountFromWordsPlan(); learned_words_num=dbHelper.select_learned_words_num(); last_words_num=words_count-learned_words_num; plandays_min=(last_words_num% WordPlanNum.max==0?last_words_num/WordPlanNum.max:(last_words_num/WordPlanNum.max+1))+learneddays; plandays_max=(last_words_num%WordPlanNum.min==0?last_words_num/WordPlanNum.min:(last_words_num/WordPlanNum.min+1))+learneddays; personal_items=new ArrayList<>(); Map<String,Object> map=new HashMap<>(); map.put("icon",R.drawable.ic_assignment_turned); map.put("name","ๅ•่ฏ่ฎกๅˆ’"); map.put("value",plandays+"ๅคฉ"); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_insert_chart); map.put("name","ๅญฆไน ่ฟ›ๅบฆ"); map.put("value",""); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_date_range); map.put("name","ๅญฆไน ๆƒ…ๅ†ต"); map.put("value",""); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_receip); map.put("name","ๅ•่ฏๆ”ถ่—"); map.put("value",""); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_cloud_queue); map.put("name","ๆ•ฐๆฎๅŒๆญฅ"); map.put("value",""); personal_items.add(map); simpleAdapter=new SimpleAdapter(getContext(),personal_items,R.layout.personal_item_layout,new String[]{"icon","name","value"},new int[]{R.id.id_personal_item_icon,R.id.id_personal_item_name,R.id.id_personal_item_value}); listView_personal_item.setAdapter(simpleAdapter); } private void initViews(View view){ ll_login=view.findViewById(R.id.id_login_icon); listView_personal_item=view.findViewById(R.id.id_personal_item); } private void initEvents(){ listView_personal_item.setOnItemClickListener(this); } private void changeView1(){ ll_login.removeAllViews(); user_id=null; SharedPreferences sharedPreferences=getContext().getSharedPreferences("login",Context.MODE_PRIVATE); SharedPreferences.Editor editor=sharedPreferences.edit(); editor.putString("username",null); editor.putLong("login_time",-1); editor.putBoolean("isLogin",false); editor.putString("user_id",null); editor.commit(); View view=LayoutInflater.from(getContext()).inflate(R.layout.login_layout,null); ImageView iv_login=view.findViewById(R.id.id_login); iv_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getContext(),LoginActivity.class)); } }); ll_login.addView(view); } private void changeView2(){ ll_login.removeAllViews(); CardView cardView=new CardView(getContext()); View view=LayoutInflater.from(getContext()).inflate(R.layout.logined_layout,null); TextView tv_username=view.findViewById(R.id.id_tv_username); TextView tv_id=view.findViewById(R.id.id_tv_id); SharedPreferences sharedPreferences=getContext().getSharedPreferences("login",Context.MODE_PRIVATE); user_id=sharedPreferences.getString("user_id",null); String username=sharedPreferences.getString("username",null); tv_username.setText(username); tv_id.setText("ID:"+user_id); cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(getContext(), LoadingUserInfoActivity.class); intent.putExtra("user_id",user_id); startActivity(intent); } }); cardView.addView(view); ll_login.addView(cardView); } private void reViews(){ if(isLogin()){ changeView2(); }else{ changeView1(); } } private boolean isLogin(){ SharedPreferences sharedPreferences=getContext().getSharedPreferences("login", Context.MODE_PRIVATE); long login_time=sharedPreferences.getLong("login_time",-1); boolean isLogin=sharedPreferences.getBoolean("isLogin",false); if(login_time==-1||isLogin==false){ return false; }else{ Date date=new Date(); if(date.getTime()-login_time>24*60*60*1000){ SharedPreferences.Editor editor=sharedPreferences.edit(); editor.putString("username",null); editor.putLong("login_time",-1); editor.putBoolean("isLogin",false); editor.putString("user_id",null); editor.commit(); return false; }else{ return true; } } } private void updateSharePreferences(){ SharedPreferences sharedPreferences=getContext().getSharedPreferences("plandays",Context.MODE_PRIVATE); SharedPreferences.Editor editor=sharedPreferences.edit(); editor.putInt("plandays",plandays); editor.putInt("plannum",last_words_num%(plandays-learneddays)==0?last_words_num/(plandays-learneddays):(last_words_num/(plandays-learneddays))+1); editor.commit(); } private void updatePlanDays() { new AlertDialog.Builder(getContext()) .setMessage("็กฎๅฎšไฟฎๆ”นๅ•่ฏ่ฎกๅˆ’") .setNegativeButton("ๅ–ๆถˆ", null) .setPositiveButton("็กฎๅฎš", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle("ๅ•่ฏ่ฎกๅˆ’"); final EditText my_input = new EditText(builder.getContext()); my_input.setHint("่พ“ๅ…ฅ"+plandays_min+"-"+plandays_max+"ไน‹้—ด็š„ๆ•ฐๅญ—"); my_input.setBackgroundResource(R.drawable.word_plan_input_bg); my_input.setInputType(InputType.TYPE_CLASS_NUMBER); my_input.setBackgroundColor(getResources().getColor(R.color.gray_white)); my_input.setWidth(800); LinearLayout linearLayout = new LinearLayout(builder.getContext()); linearLayout.setGravity(Gravity.CENTER); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); linearLayout.setLayoutParams(layoutParams); linearLayout.addView(my_input); builder.setView(linearLayout); builder.setCancelable(false); builder.setPositiveButton("็กฎๅฎš", null); builder.setNegativeButton("ๅ–ๆถˆ", null); final AlertDialog alertDialog = builder.create(); alertDialog.show(); alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String input = my_input.getText().toString().trim(); if (input.equals("")) { new MyToast(getContext(), MyToast.EMPTY).show(); } else { int days = Integer.valueOf(my_input.getText().toString()); if (days >= plandays_min && days <= plandays_max) { if (days != plandays) { plandays = days; updateSharePreferences(); alertDialog.dismiss(); new AlertDialog.Builder(getContext()) .setMessage("่ฎกๅˆ’ๅฐ†ไบŽๆ˜Žๅคฉ็”Ÿๆ•ˆ") .setPositiveButton("็กฎๅฎš", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onStart(); } }) .setCancelable(false) .create().show(); } else { new MyToast(getContext(), MyToast.NUMBER_SAME).show(); } } else { new MyToast(getContext(), "ๆ•ฐๅญ—ๅบ”ๅœจ"+plandays_min+"-"+plandays_max+"ไน‹้—ด").show(); } } } }); } }).create().show(); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position){ case 0: updatePlanDays(); break; case 1: startActivity(new Intent(getContext(),LoadingRateOfLearning.class)); break; case 2: startActivity(new Intent(getContext(),LearnInfoActivity.class)); break; case 3: startActivity(new Intent(getContext(),WordCollectionActivity.class)); break; case 4: if(user_id==null){ startActivity(new Intent(getContext(), LoginActivity.class)); }else{ startActivity(new Intent(getContext(), LoadingSyncActivity.class)); } break; } } @Override public void onStart() { //ๅˆๅง‹ๅŒ–ๆ•ฐๆฎ initData(); reViews(); super.onStart(); } @Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); if(!hidden){ //ๅˆๅง‹ๅŒ–ๆ•ฐๆฎ initData(); reViews(); } } }
UTF-8
Java
13,873
java
PersonalFragment.java
Java
[ { "context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by Skywilling on 2018/1/2.\n */\n\npublic class PersonalFragment e", "end": 1561, "score": 0.9996092915534973, "start": 1551, "tag": "USERNAME", "value": "Skywilling" }, { "context": " String username=sharedPreferences.getString(\"username\",null);\n tv_username.setText(username);\n ", "end": 6459, "score": 0.8979644775390625, "start": 6451, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.example.bishe.cet4.tabs; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.CardView; import android.text.InputType; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import com.example.bishe.cet4.R; import com.example.bishe.cet4.activity.LearnInfoActivity; import com.example.bishe.cet4.activity.LoadingRateOfLearning; import com.example.bishe.cet4.activity.LoadingUserInfoActivity; import com.example.bishe.cet4.activity.LoadingSyncActivity; import com.example.bishe.cet4.activity.LoginActivity; import com.example.bishe.cet4.activity.WordCollectionActivity; import com.example.bishe.cet4.database.AssetsDatabaseManager; import com.example.bishe.cet4.database.DBHelper; import com.example.bishe.cet4.function.MyToast; import com.example.bishe.cet4.object.WordPlanNum; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by Skywilling on 2018/1/2. */ public class PersonalFragment extends Fragment implements AdapterView.OnItemClickListener{ private ListView listView_personal_item=null; private SimpleAdapter simpleAdapter=null; private List<Map<String,Object>> personal_items=null; private LinearLayout ll_login=null; private String user_id=null; private int plandays; private int learneddays; private int words_count; private int learned_words_num; private int plandays_min; private int plandays_max; private int last_words_num; private SQLiteDatabase db=null; private DBHelper dbHelper=null; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.activity_tab_personal,container,false); //ๅˆๅง‹ๅŒ–ๆ•ฐๆฎๅบ“ initDataBase(); //ๅˆๅง‹ๅŒ–ๆŽงไปถ initViews(view); //ๅˆๅง‹ๅŒ–็›‘ๅฌๅ™จ initEvents(); return view; } private void initDataBase(){ AssetsDatabaseManager assetsDatabaseManager=AssetsDatabaseManager.getAssetsDatabaseManager(); db=assetsDatabaseManager.getDatabase("dict.db"); dbHelper=new DBHelper(db); } private void initData(){ SharedPreferences sharedPreferences=getContext().getSharedPreferences("plandays",Context.MODE_PRIVATE); plandays=sharedPreferences.getInt("plandays",-1); words_count=dbHelper.selectCountFromWords(); learneddays=dbHelper.selectCountFromWordsPlan(); learned_words_num=dbHelper.select_learned_words_num(); last_words_num=words_count-learned_words_num; plandays_min=(last_words_num% WordPlanNum.max==0?last_words_num/WordPlanNum.max:(last_words_num/WordPlanNum.max+1))+learneddays; plandays_max=(last_words_num%WordPlanNum.min==0?last_words_num/WordPlanNum.min:(last_words_num/WordPlanNum.min+1))+learneddays; personal_items=new ArrayList<>(); Map<String,Object> map=new HashMap<>(); map.put("icon",R.drawable.ic_assignment_turned); map.put("name","ๅ•่ฏ่ฎกๅˆ’"); map.put("value",plandays+"ๅคฉ"); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_insert_chart); map.put("name","ๅญฆไน ่ฟ›ๅบฆ"); map.put("value",""); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_date_range); map.put("name","ๅญฆไน ๆƒ…ๅ†ต"); map.put("value",""); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_receip); map.put("name","ๅ•่ฏๆ”ถ่—"); map.put("value",""); personal_items.add(map); map=new HashMap<>(); map.put("icon",R.drawable.ic_cloud_queue); map.put("name","ๆ•ฐๆฎๅŒๆญฅ"); map.put("value",""); personal_items.add(map); simpleAdapter=new SimpleAdapter(getContext(),personal_items,R.layout.personal_item_layout,new String[]{"icon","name","value"},new int[]{R.id.id_personal_item_icon,R.id.id_personal_item_name,R.id.id_personal_item_value}); listView_personal_item.setAdapter(simpleAdapter); } private void initViews(View view){ ll_login=view.findViewById(R.id.id_login_icon); listView_personal_item=view.findViewById(R.id.id_personal_item); } private void initEvents(){ listView_personal_item.setOnItemClickListener(this); } private void changeView1(){ ll_login.removeAllViews(); user_id=null; SharedPreferences sharedPreferences=getContext().getSharedPreferences("login",Context.MODE_PRIVATE); SharedPreferences.Editor editor=sharedPreferences.edit(); editor.putString("username",null); editor.putLong("login_time",-1); editor.putBoolean("isLogin",false); editor.putString("user_id",null); editor.commit(); View view=LayoutInflater.from(getContext()).inflate(R.layout.login_layout,null); ImageView iv_login=view.findViewById(R.id.id_login); iv_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getContext(),LoginActivity.class)); } }); ll_login.addView(view); } private void changeView2(){ ll_login.removeAllViews(); CardView cardView=new CardView(getContext()); View view=LayoutInflater.from(getContext()).inflate(R.layout.logined_layout,null); TextView tv_username=view.findViewById(R.id.id_tv_username); TextView tv_id=view.findViewById(R.id.id_tv_id); SharedPreferences sharedPreferences=getContext().getSharedPreferences("login",Context.MODE_PRIVATE); user_id=sharedPreferences.getString("user_id",null); String username=sharedPreferences.getString("username",null); tv_username.setText(username); tv_id.setText("ID:"+user_id); cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(getContext(), LoadingUserInfoActivity.class); intent.putExtra("user_id",user_id); startActivity(intent); } }); cardView.addView(view); ll_login.addView(cardView); } private void reViews(){ if(isLogin()){ changeView2(); }else{ changeView1(); } } private boolean isLogin(){ SharedPreferences sharedPreferences=getContext().getSharedPreferences("login", Context.MODE_PRIVATE); long login_time=sharedPreferences.getLong("login_time",-1); boolean isLogin=sharedPreferences.getBoolean("isLogin",false); if(login_time==-1||isLogin==false){ return false; }else{ Date date=new Date(); if(date.getTime()-login_time>24*60*60*1000){ SharedPreferences.Editor editor=sharedPreferences.edit(); editor.putString("username",null); editor.putLong("login_time",-1); editor.putBoolean("isLogin",false); editor.putString("user_id",null); editor.commit(); return false; }else{ return true; } } } private void updateSharePreferences(){ SharedPreferences sharedPreferences=getContext().getSharedPreferences("plandays",Context.MODE_PRIVATE); SharedPreferences.Editor editor=sharedPreferences.edit(); editor.putInt("plandays",plandays); editor.putInt("plannum",last_words_num%(plandays-learneddays)==0?last_words_num/(plandays-learneddays):(last_words_num/(plandays-learneddays))+1); editor.commit(); } private void updatePlanDays() { new AlertDialog.Builder(getContext()) .setMessage("็กฎๅฎšไฟฎๆ”นๅ•่ฏ่ฎกๅˆ’") .setNegativeButton("ๅ–ๆถˆ", null) .setPositiveButton("็กฎๅฎš", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle("ๅ•่ฏ่ฎกๅˆ’"); final EditText my_input = new EditText(builder.getContext()); my_input.setHint("่พ“ๅ…ฅ"+plandays_min+"-"+plandays_max+"ไน‹้—ด็š„ๆ•ฐๅญ—"); my_input.setBackgroundResource(R.drawable.word_plan_input_bg); my_input.setInputType(InputType.TYPE_CLASS_NUMBER); my_input.setBackgroundColor(getResources().getColor(R.color.gray_white)); my_input.setWidth(800); LinearLayout linearLayout = new LinearLayout(builder.getContext()); linearLayout.setGravity(Gravity.CENTER); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); linearLayout.setLayoutParams(layoutParams); linearLayout.addView(my_input); builder.setView(linearLayout); builder.setCancelable(false); builder.setPositiveButton("็กฎๅฎš", null); builder.setNegativeButton("ๅ–ๆถˆ", null); final AlertDialog alertDialog = builder.create(); alertDialog.show(); alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String input = my_input.getText().toString().trim(); if (input.equals("")) { new MyToast(getContext(), MyToast.EMPTY).show(); } else { int days = Integer.valueOf(my_input.getText().toString()); if (days >= plandays_min && days <= plandays_max) { if (days != plandays) { plandays = days; updateSharePreferences(); alertDialog.dismiss(); new AlertDialog.Builder(getContext()) .setMessage("่ฎกๅˆ’ๅฐ†ไบŽๆ˜Žๅคฉ็”Ÿๆ•ˆ") .setPositiveButton("็กฎๅฎš", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onStart(); } }) .setCancelable(false) .create().show(); } else { new MyToast(getContext(), MyToast.NUMBER_SAME).show(); } } else { new MyToast(getContext(), "ๆ•ฐๅญ—ๅบ”ๅœจ"+plandays_min+"-"+plandays_max+"ไน‹้—ด").show(); } } } }); } }).create().show(); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position){ case 0: updatePlanDays(); break; case 1: startActivity(new Intent(getContext(),LoadingRateOfLearning.class)); break; case 2: startActivity(new Intent(getContext(),LearnInfoActivity.class)); break; case 3: startActivity(new Intent(getContext(),WordCollectionActivity.class)); break; case 4: if(user_id==null){ startActivity(new Intent(getContext(), LoginActivity.class)); }else{ startActivity(new Intent(getContext(), LoadingSyncActivity.class)); } break; } } @Override public void onStart() { //ๅˆๅง‹ๅŒ–ๆ•ฐๆฎ initData(); reViews(); super.onStart(); } @Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); if(!hidden){ //ๅˆๅง‹ๅŒ–ๆ•ฐๆฎ initData(); reViews(); } } }
13,873
0.579432
0.575561
317
42.189274
31.410313
228
false
false
0
0
0
0
0
0
0.861199
false
false
9
54086f36a56f2c901a967d9716c6696ca13e7d06
15,298,673,561,965
248ed478e406a7eac509967d2ee91589860f8fff
/stu_a0004/test01/asg_a2247/AsgA2247.java
8ac9bda8c449f34bbb012d3517c0287faa62fbf6
[]
no_license
rishiba/jfs01
https://github.com/rishiba/jfs01
bc2670c3e04ddf3c1aaa15baed19137545a57c98
9aff383865a8ed957b0387679bde1695c316e1be
refs/heads/master
2021-06-16T18:19:29.540000
2017-05-05T05:04:37
2017-05-05T05:04:37
61,169,762
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class AsgA2247 { public static int find_nth_prime(int n) { int num=1,count=0,i; while (count < n){ num=num+1; for (i = 2; i <= num; i++){ if (num % i == 0) { break; } } if ( i == num){ count = count+1; } } return(num); } }
UTF-8
Java
269
java
AsgA2247.java
Java
[]
null
[]
class AsgA2247 { public static int find_nth_prime(int n) { int num=1,count=0,i; while (count < n){ num=num+1; for (i = 2; i <= num; i++){ if (num % i == 0) { break; } } if ( i == num){ count = count+1; } } return(num); } }
269
0.460967
0.423792
21
11.809524
10.839167
40
false
false
0
0
0
0
0
0
2.523809
false
false
9
796ace247f19b8b8aea0216349949c3da943240b
7,593,502,243,006
96ecd1e2d4399b07b186ce2a5180ff4ac3016abf
/SAMLProject/src/main/java/com/sample/demo/QueryController.java
7f5c98baecb04d552cbf1f25d4ef04bb25f6ee57
[]
no_license
sbyman/progettoTesi
https://github.com/sbyman/progettoTesi
b03471da06b1a3e1d4bd7b1b18bffb782e9f2010
0025b6e314491e1f12a3001eb7e2b594dcc315cb
refs/heads/master
2020-04-08T21:13:49.601000
2019-01-08T10:43:12
2019-01-08T10:43:12
159,735,573
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sample.demo; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.net.URLEncoder; import org.apache.tomcat.util.codec.binary.Base64; import org.opensaml.saml2.core.AttributeQuery; import org.opensaml.saml2.core.impl.AttributeQueryMarshaller; import org.opensaml.ws.soap.common.SOAPException; import org.opensaml.xml.ConfigurationException; import org.opensaml.xml.io.MarshallingException; import org.opensaml.xml.security.SecurityException; import org.opensaml.xml.util.XMLHelper; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.view.RedirectView; import org.w3c.dom.Element; @Controller public class QueryController { private String encodePOSTFormat(String samlXML) throws IOException { String base64 = Base64.encodeBase64String(samlXML.getBytes()); // Codifico in base 64 return URLEncoder.encode(base64, "UTF-8"); // Codifico in URL } @RequestMapping("/query") public RedirectView query(@RequestParam("user") String nameIdUser) { SAMLInputContainer input = new SAMLInputContainer(); input.setDestination("https://gluu-server.us-east1-b.c.test1-212904.internal/idp/profile/SAML2/SOAP/AttributeQuery"); input.setIssuer("https://192.168.43.87:8443/metadata"); SAMLAttributeQuery req = new SAMLAttributeQuery(); RedirectView redirectView = new RedirectView(); byte[] decNameId = Base64.decodeBase64(nameIdUser); String decodedNameId = new String(decNameId); try { AttributeQuery attributeQuery = req.createQuery(input, decodedNameId); //Converto la richiesta in stringa AttributeQueryMarshaller marsh = new AttributeQueryMarshaller(); Element plainTextElement = marsh.marshall(attributeQuery); String originalAttributeQuery = XMLHelper.nodeToString(plainTextElement); //(DEBUG) Scrivo la richista su file try { BufferedWriter writer = new BufferedWriter(new FileWriter("query.xml")); String stringResponse = XMLHelper.nodeToString(plainTextElement); writer.write(stringResponse); writer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //(DEBUG) Stampa la richiesta sulla console System.out.println("AttributeQuery:\n" + originalAttributeQuery); //Crea una nuova richiesta per inviare un artefatto come SOAP SendSOAPArtifact sea = new SendSOAPArtifact(); String responseString = sea.createAttributeEnvelope(attributeQuery, input); //Codifica la richiesta String encodedResponseString = encodePOSTFormat(responseString); //Redirect verso la pagina che gestisce la response redirectView.setUrl("https://localhost:8443/user?SAMLResponseQuery=" + encodedResponseString); return redirectView; } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MarshallingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SOAPException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } redirectView.setUrl("https://localhost:8443/errors?error=blabla"); return redirectView; } }
UTF-8
Java
3,702
java
QueryController.java
Java
[ { "context": "OAP/AttributeQuery\");\r\n\t\tinput.setIssuer(\"https://192.168.43.87:8443/metadata\");\r\n\t\t\r\n\t\tSAMLAttributeQuery req = ", "end": 1424, "score": 0.9997577667236328, "start": 1411, "tag": "IP_ADDRESS", "value": "192.168.43.87" } ]
null
[]
package com.sample.demo; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.net.URLEncoder; import org.apache.tomcat.util.codec.binary.Base64; import org.opensaml.saml2.core.AttributeQuery; import org.opensaml.saml2.core.impl.AttributeQueryMarshaller; import org.opensaml.ws.soap.common.SOAPException; import org.opensaml.xml.ConfigurationException; import org.opensaml.xml.io.MarshallingException; import org.opensaml.xml.security.SecurityException; import org.opensaml.xml.util.XMLHelper; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.view.RedirectView; import org.w3c.dom.Element; @Controller public class QueryController { private String encodePOSTFormat(String samlXML) throws IOException { String base64 = Base64.encodeBase64String(samlXML.getBytes()); // Codifico in base 64 return URLEncoder.encode(base64, "UTF-8"); // Codifico in URL } @RequestMapping("/query") public RedirectView query(@RequestParam("user") String nameIdUser) { SAMLInputContainer input = new SAMLInputContainer(); input.setDestination("https://gluu-server.us-east1-b.c.test1-212904.internal/idp/profile/SAML2/SOAP/AttributeQuery"); input.setIssuer("https://192.168.43.87:8443/metadata"); SAMLAttributeQuery req = new SAMLAttributeQuery(); RedirectView redirectView = new RedirectView(); byte[] decNameId = Base64.decodeBase64(nameIdUser); String decodedNameId = new String(decNameId); try { AttributeQuery attributeQuery = req.createQuery(input, decodedNameId); //Converto la richiesta in stringa AttributeQueryMarshaller marsh = new AttributeQueryMarshaller(); Element plainTextElement = marsh.marshall(attributeQuery); String originalAttributeQuery = XMLHelper.nodeToString(plainTextElement); //(DEBUG) Scrivo la richista su file try { BufferedWriter writer = new BufferedWriter(new FileWriter("query.xml")); String stringResponse = XMLHelper.nodeToString(plainTextElement); writer.write(stringResponse); writer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //(DEBUG) Stampa la richiesta sulla console System.out.println("AttributeQuery:\n" + originalAttributeQuery); //Crea una nuova richiesta per inviare un artefatto come SOAP SendSOAPArtifact sea = new SendSOAPArtifact(); String responseString = sea.createAttributeEnvelope(attributeQuery, input); //Codifica la richiesta String encodedResponseString = encodePOSTFormat(responseString); //Redirect verso la pagina che gestisce la response redirectView.setUrl("https://localhost:8443/user?SAMLResponseQuery=" + encodedResponseString); return redirectView; } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MarshallingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SOAPException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } redirectView.setUrl("https://localhost:8443/errors?error=blabla"); return redirectView; } }
3,702
0.736089
0.722312
105
33.257141
26.147577
119
false
false
0
0
0
0
0
0
2.371428
false
false
9
548ee823a4b197cd899947d8f89b0a641c0017d0
14,817,637,224,489
1074ce1bc8e95e5054c8df5a9a14a4b40938a6ca
/457/src/Solution.java
792009273d0e6fff5b8fe5d3d596ba91c488b2a0
[]
no_license
ryan87ly/leetcode
https://github.com/ryan87ly/leetcode
1049ada73448e83fe3be8f580214dee48906978a
32080bc9e9ce22d82a6c23f266c3111efabab8c4
refs/heads/master
2021-01-19T22:17:02.892000
2017-04-10T14:19:50
2017-04-10T14:19:50
75,139,221
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Solution { public boolean circularArrayLoop(int[] nums) { int numLength = nums.length; if (numLength <= 1) return false; for (int i = 0; i < numLength; ++ i) { int currentNum = nums[i]; if (currentNum == 0) continue; int direction = currentNum > 0 ? 1 : -1; int oneStepPointer = nextIndex(i, nums, numLength); int twoStepsPointer = nextIndex(oneStepPointer, nums, numLength); while(true) { if ((oneStepPointer == twoStepsPointer) && (nextIndex(oneStepPointer, nums, numLength) != oneStepPointer)) return true; int oneStepNum = nums[oneStepPointer]; if (oneStepNum == 0 || (oneStepNum ^ direction) < 0 || (oneStepNum % numLength == 0)) { clean(i, nums, numLength, direction); break; } int twoStepsNum = nums[twoStepsPointer]; if (twoStepsNum == 0 || (twoStepsNum ^ direction) < 0 || (twoStepsNum % numLength == 0)) { clean(i, nums, numLength, direction); break; } oneStepPointer = nextIndex(oneStepPointer, nums, numLength); twoStepsPointer = nextIndex(nextIndex(twoStepsPointer, nums, numLength), nums, numLength); } } return false; } private void clean(int startIndex, int[] nums, int length, int direction) { for (int i = startIndex; i < length; ++ i) { int currentNum = nums[i]; if((currentNum != 0 && (currentNum ^ direction) > 0) || (currentNum % length == 0)) nums[i] = 0; else return; } } private int nextIndex(int currentIndex, int[] nums, int length) { int currentNum = nums[currentIndex]; return circularMod(currentIndex + currentNum, length); } private int circularMod(int num, int length) { int r = num % length; if (r < 0) return r + length; else return r; } }
UTF-8
Java
2,061
java
Solution.java
Java
[]
null
[]
public class Solution { public boolean circularArrayLoop(int[] nums) { int numLength = nums.length; if (numLength <= 1) return false; for (int i = 0; i < numLength; ++ i) { int currentNum = nums[i]; if (currentNum == 0) continue; int direction = currentNum > 0 ? 1 : -1; int oneStepPointer = nextIndex(i, nums, numLength); int twoStepsPointer = nextIndex(oneStepPointer, nums, numLength); while(true) { if ((oneStepPointer == twoStepsPointer) && (nextIndex(oneStepPointer, nums, numLength) != oneStepPointer)) return true; int oneStepNum = nums[oneStepPointer]; if (oneStepNum == 0 || (oneStepNum ^ direction) < 0 || (oneStepNum % numLength == 0)) { clean(i, nums, numLength, direction); break; } int twoStepsNum = nums[twoStepsPointer]; if (twoStepsNum == 0 || (twoStepsNum ^ direction) < 0 || (twoStepsNum % numLength == 0)) { clean(i, nums, numLength, direction); break; } oneStepPointer = nextIndex(oneStepPointer, nums, numLength); twoStepsPointer = nextIndex(nextIndex(twoStepsPointer, nums, numLength), nums, numLength); } } return false; } private void clean(int startIndex, int[] nums, int length, int direction) { for (int i = startIndex; i < length; ++ i) { int currentNum = nums[i]; if((currentNum != 0 && (currentNum ^ direction) > 0) || (currentNum % length == 0)) nums[i] = 0; else return; } } private int nextIndex(int currentIndex, int[] nums, int length) { int currentNum = nums[currentIndex]; return circularMod(currentIndex + currentNum, length); } private int circularMod(int num, int length) { int r = num % length; if (r < 0) return r + length; else return r; } }
2,061
0.54294
0.534692
48
41.958332
32.500614
135
false
false
0
0
0
0
0
0
1.333333
false
false
9
fb65af8e2e222285e58d7ee907f73510eb45cc80
14,817,637,227,532
9596a8e80fb7e901b436bcbaf44f54948af4ecd2
/src/test/java/com/romanceabroad/ui/PhotosPageTest.java
1fbfe3eaed7e01792d0f2519b6e3e762f6018a53
[ "Apache-2.0" ]
permissive
imasheva/romancepractice
https://github.com/imasheva/romancepractice
e63a92dcc7614cb19c4949e77963062a39d7828f
b79a827861f5249c50ff865544eb5ea59e3f229e
refs/heads/master
2023-05-25T22:02:01.864000
2020-06-09T19:09:51
2020-06-09T19:09:51
261,919,975
0
0
Apache-2.0
false
2023-05-09T18:41:00
2020-05-07T01:29:39
2020-06-09T19:24:32
2023-05-09T18:40:59
45,372
0
0
2
HTML
false
false
package com.romanceabroad.ui; import com.automation.remarks.testng.VideoListener; import com.automation.remarks.video.annotations.Video; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.testng.Assert; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import java.util.List; @Listeners(VideoListener.class) public class PhotosPageTest extends BaseUI { String actualTitle; String actualUrlPhotos; String name; public static final boolean testCase8 = true; public static final boolean testCase9 = true; public static final boolean testCase32 = true; public static final boolean testCase33 = true; public static final boolean testCase34 = true; public static final boolean testCase35 = true; @Video(name = "PhotosPage Tests") @Test(priority = 1, enabled = testCase8, groups = {"user", "admin"}) public void testPhotosPageTestCase8() { photosPage.javaWaitSec(3); photosPage.openPhotosPage(); actualTitle = photosPage.getAnyTitle(); actualUrlPhotos = driver.getCurrentUrl(); Assert.assertEquals(Data.expectedTitlePhotos, actualTitle); Assert.assertEquals(Data.expectedUrlPhotos, actualUrlPhotos); if (actualUrlPhotos.contains("#")) { Assert.fail("It contains restricted #"); } else { System.out.println("No special character. It is good url!"); } } @Test(priority = 2, enabled = testCase9, groups = {"admin"}) public void checkPhotosListTestCase9() { photosPage.openPhotosPage(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> photosList = photosPage.collectPhotosList(); System.out.println("Print size of photos list: " + photosList.size()); for (int i = 0; i < photosList.size(); i++) { name = photosList.get(i).getText(); if (name.contains(Data.nameOnPhoto) || name.contains(Data.nameOnPhoto2)) { System.out.println(name); mainPage.ajaxClick(photosList.get(i)); System.out.println("Found!!!"); break; } } } @Test(priority = 3, enabled = testCase32, groups = {"admin"}) public void testUserTabs() { //Vid 22 54:00 photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (i == 0) { Assert.assertEquals(actualTitle, Data.expectedTitleGallery); } else if (i == 1) { Assert.assertEquals(actualTitle, Data.expectedTitlePhotoGallery); } else if (i == 2) { Assert.assertEquals(actualTitle, Data.expectedTitleVideoGallery); } else if (i == 3) { Assert.assertEquals(actualTitle, Data.expectedTitleGalleryAlbums); } //refresh the list inside of a loop userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } @Test(priority = 4, enabled = testCase33, groups = {"admin"}) public void testUserTabsWithMoreVerifications() { //Vid 23 photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (actualTitle.contains(Data.expectedTitleGallery) || actualTitle.contains(Data.expectedTitlePhotoGallery) || actualTitle.contains(Data.expectedTitleVideoGallery) || actualTitle.contains(Data.expectedTitleGalleryAlbums)) { System.out.println("Title is valid: " + actualTitle); } else { Assert.fail("Title is not valid"); } //refresh the list inside of a loop userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } @Test(priority = 5, enabled = testCase34, groups = {"admin"}) //Vid 22 54:00, Vid 23 public void testUserTabs2() { //Vid 22 54:00 photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (i == 0) { Assert.assertEquals(actualTitle, Data.expectedTitleGallery); } else if (i == 1) { Assert.assertEquals(actualTitle, Data.expectedTitlePhotoGallery); } else if (i == 2) { Assert.assertEquals(actualTitle, Data.expectedTitleVideoGallery); photosPage.ajaxClick(Locators.VIDEO_GALLERY_FLATTY_BLOCK); String textMedia = driver.findElement (Locators.VIDEO_GALLERY_FLATTY_BLOCK).getText(); System.out.println(textMedia); if (textMedia.contains(Data.textPhotoInAlbums)) { System.out.println("Text media is correct"); } } else if (i == 3) { Assert.assertEquals(actualTitle, Data.expectedTitleGalleryAlbums); photosPage.ajaxClick(Locators.GALLERY_ALBUMS_MAIN_INNER_CONTAINER); photosPage.javaWaitSec(2); Assert.assertTrue(driver.findElement (Locators.GALLERY_ALBUMS_DATA_CLICK_ALBUM).isDisplayed()); } //refresh the list inside of a loop userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } @Test(priority = 6, enabled = testCase35, groups = {"admin"}) // Home Work 23 (vid 23) public void testUserTabs3() { photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (i == 0) { Assert.assertEquals(actualTitle, Data.expectedTitleGallery); photosPage.ajaxClick(Locators.GALLERY_CONTAINER); Assert.assertTrue(driver.findElement(Locators.GALLERY_TAB_NAMES).isDisplayed()); String tabNames = driver.findElement(Locators.GALLERY_CONTAINER).getText(); System.out.println("Tab names for first tab verification: " + tabNames); } else if (i == 1) { Assert.assertEquals(actualTitle, Data.expectedTitlePhotoGallery); photosPage.ajaxClick(Locators.PHOTO_GALLERY_FLATTY_BLOCK); WebElement text_align = driver.findElement(Locators.PHOTO_GALLERY_TEXT_ALIGN); String textInside = text_align.getText(); System.out.println("TextInside for second tab verification: " + textInside); } else if (i == 2) { Assert.assertEquals(actualTitle, Data.expectedTitleVideoGallery); photosPage.ajaxClick(Locators.VIDEO_GALLERY_FLATTY_BLOCK); String textMedia = driver.findElement (Locators.VIDEO_GALLERY_FLATTY_BLOCK).getText(); System.out.println(textMedia); if (textMedia.contains(Data.textPhotoInAlbums)) { System.out.println("Text media is correct"); } } else if (i == 3) { Assert.assertEquals(actualTitle, Data.expectedTitleGalleryAlbums); photosPage.ajaxClick(Locators.GALLERY_ALBUMS_MAIN_INNER_CONTAINER); photosPage.javaWaitSec(3); Assert.assertTrue(driver.findElement (Locators.GALLERY_ALBUMS_DATA_CLICK_ALBUM).isDisplayed()); //Removed dropdown assertion with pictures } //refresh the list inside of a loop photosPage.javaWaitSec(3); userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } }
UTF-8
Java
9,192
java
PhotosPageTest.java
Java
[]
null
[]
package com.romanceabroad.ui; import com.automation.remarks.testng.VideoListener; import com.automation.remarks.video.annotations.Video; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.testng.Assert; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import java.util.List; @Listeners(VideoListener.class) public class PhotosPageTest extends BaseUI { String actualTitle; String actualUrlPhotos; String name; public static final boolean testCase8 = true; public static final boolean testCase9 = true; public static final boolean testCase32 = true; public static final boolean testCase33 = true; public static final boolean testCase34 = true; public static final boolean testCase35 = true; @Video(name = "PhotosPage Tests") @Test(priority = 1, enabled = testCase8, groups = {"user", "admin"}) public void testPhotosPageTestCase8() { photosPage.javaWaitSec(3); photosPage.openPhotosPage(); actualTitle = photosPage.getAnyTitle(); actualUrlPhotos = driver.getCurrentUrl(); Assert.assertEquals(Data.expectedTitlePhotos, actualTitle); Assert.assertEquals(Data.expectedUrlPhotos, actualUrlPhotos); if (actualUrlPhotos.contains("#")) { Assert.fail("It contains restricted #"); } else { System.out.println("No special character. It is good url!"); } } @Test(priority = 2, enabled = testCase9, groups = {"admin"}) public void checkPhotosListTestCase9() { photosPage.openPhotosPage(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> photosList = photosPage.collectPhotosList(); System.out.println("Print size of photos list: " + photosList.size()); for (int i = 0; i < photosList.size(); i++) { name = photosList.get(i).getText(); if (name.contains(Data.nameOnPhoto) || name.contains(Data.nameOnPhoto2)) { System.out.println(name); mainPage.ajaxClick(photosList.get(i)); System.out.println("Found!!!"); break; } } } @Test(priority = 3, enabled = testCase32, groups = {"admin"}) public void testUserTabs() { //Vid 22 54:00 photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (i == 0) { Assert.assertEquals(actualTitle, Data.expectedTitleGallery); } else if (i == 1) { Assert.assertEquals(actualTitle, Data.expectedTitlePhotoGallery); } else if (i == 2) { Assert.assertEquals(actualTitle, Data.expectedTitleVideoGallery); } else if (i == 3) { Assert.assertEquals(actualTitle, Data.expectedTitleGalleryAlbums); } //refresh the list inside of a loop userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } @Test(priority = 4, enabled = testCase33, groups = {"admin"}) public void testUserTabsWithMoreVerifications() { //Vid 23 photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (actualTitle.contains(Data.expectedTitleGallery) || actualTitle.contains(Data.expectedTitlePhotoGallery) || actualTitle.contains(Data.expectedTitleVideoGallery) || actualTitle.contains(Data.expectedTitleGalleryAlbums)) { System.out.println("Title is valid: " + actualTitle); } else { Assert.fail("Title is not valid"); } //refresh the list inside of a loop userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } @Test(priority = 5, enabled = testCase34, groups = {"admin"}) //Vid 22 54:00, Vid 23 public void testUserTabs2() { //Vid 22 54:00 photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (i == 0) { Assert.assertEquals(actualTitle, Data.expectedTitleGallery); } else if (i == 1) { Assert.assertEquals(actualTitle, Data.expectedTitlePhotoGallery); } else if (i == 2) { Assert.assertEquals(actualTitle, Data.expectedTitleVideoGallery); photosPage.ajaxClick(Locators.VIDEO_GALLERY_FLATTY_BLOCK); String textMedia = driver.findElement (Locators.VIDEO_GALLERY_FLATTY_BLOCK).getText(); System.out.println(textMedia); if (textMedia.contains(Data.textPhotoInAlbums)) { System.out.println("Text media is correct"); } } else if (i == 3) { Assert.assertEquals(actualTitle, Data.expectedTitleGalleryAlbums); photosPage.ajaxClick(Locators.GALLERY_ALBUMS_MAIN_INNER_CONTAINER); photosPage.javaWaitSec(2); Assert.assertTrue(driver.findElement (Locators.GALLERY_ALBUMS_DATA_CLICK_ALBUM).isDisplayed()); } //refresh the list inside of a loop userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } @Test(priority = 6, enabled = testCase35, groups = {"admin"}) // Home Work 23 (vid 23) public void testUserTabs3() { photosPage.clickPhotosTab(); wait.until(ExpectedConditions.visibilityOfElementLocated(Locators.LIST_PHOTOS)); List<WebElement> userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); actualTitle = photosPage.getAnyTitle(); Assert.assertEquals(actualTitle, Data.expectedTitlePhotos); for (int i = 0; i < userTabs.size(); i++) { userTabs.get(i).click(); actualTitle = photosPage.getAnyTitle(); if (i == 0) { Assert.assertEquals(actualTitle, Data.expectedTitleGallery); photosPage.ajaxClick(Locators.GALLERY_CONTAINER); Assert.assertTrue(driver.findElement(Locators.GALLERY_TAB_NAMES).isDisplayed()); String tabNames = driver.findElement(Locators.GALLERY_CONTAINER).getText(); System.out.println("Tab names for first tab verification: " + tabNames); } else if (i == 1) { Assert.assertEquals(actualTitle, Data.expectedTitlePhotoGallery); photosPage.ajaxClick(Locators.PHOTO_GALLERY_FLATTY_BLOCK); WebElement text_align = driver.findElement(Locators.PHOTO_GALLERY_TEXT_ALIGN); String textInside = text_align.getText(); System.out.println("TextInside for second tab verification: " + textInside); } else if (i == 2) { Assert.assertEquals(actualTitle, Data.expectedTitleVideoGallery); photosPage.ajaxClick(Locators.VIDEO_GALLERY_FLATTY_BLOCK); String textMedia = driver.findElement (Locators.VIDEO_GALLERY_FLATTY_BLOCK).getText(); System.out.println(textMedia); if (textMedia.contains(Data.textPhotoInAlbums)) { System.out.println("Text media is correct"); } } else if (i == 3) { Assert.assertEquals(actualTitle, Data.expectedTitleGalleryAlbums); photosPage.ajaxClick(Locators.GALLERY_ALBUMS_MAIN_INNER_CONTAINER); photosPage.javaWaitSec(3); Assert.assertTrue(driver.findElement (Locators.GALLERY_ALBUMS_DATA_CLICK_ALBUM).isDisplayed()); //Removed dropdown assertion with pictures } //refresh the list inside of a loop photosPage.javaWaitSec(3); userTabs = driver.findElements(Locators.LINK_TAB_USER_PROFILE); } } }
9,192
0.622933
0.614447
211
42.554501
30.5546
135
false
false
0
0
0
0
0
0
0.734597
false
false
9
9564b18c1df80fa54c51280fc490af03bcea7979
3,753,801,481,037
976b21f2b2f3651dc85fca9535cf71930923c5ac
/demo/src/main/java/com/jy/moudles/exp/entity/Exp.java
48c2686d89e63a490f6bf8d8a6cea43c4fc4112a
[]
no_license
souky/SVN
https://github.com/souky/SVN
4dc2277cb94cf519ccb1fcad1493881387a20745
a57a0636953928913bfc88158ab395a3fc2fcb26
refs/heads/master
2023-02-02T16:22:34.479000
2019-05-26T03:15:14
2019-05-26T03:15:14
188,634,503
0
2
null
false
2023-01-12T10:00:51
2019-05-26T03:08:29
2019-05-26T03:15:46
2023-01-12T10:00:44
11,089
0
2
129
JavaScript
false
false
package com.jy.moudles.exp.entity; import java.util.Date; import com.jy.common.entity.BaseEntity; /** *ๅฎžไพ‹ */ public class Exp extends BaseEntity{ private static final long serialVersionUID = -1L; /** * ๅง“ๅ */ private String names; /** * ๅนด้พ„ */ private int ages; /** * ๆ—ถ้—ด */ private Date times; public String getNames() { return names; } public void setNames(String names) { this.names = names; } public int getAges() { return ages; } public void setAges(int ages) { this.ages = ages; } public Date getTimes() { return times; } public void setTimes(Date times) { this.times = times; } }
UTF-8
Java
670
java
Exp.java
Java
[]
null
[]
package com.jy.moudles.exp.entity; import java.util.Date; import com.jy.common.entity.BaseEntity; /** *ๅฎžไพ‹ */ public class Exp extends BaseEntity{ private static final long serialVersionUID = -1L; /** * ๅง“ๅ */ private String names; /** * ๅนด้พ„ */ private int ages; /** * ๆ—ถ้—ด */ private Date times; public String getNames() { return names; } public void setNames(String names) { this.names = names; } public int getAges() { return ages; } public void setAges(int ages) { this.ages = ages; } public Date getTimes() { return times; } public void setTimes(Date times) { this.times = times; } }
670
0.629969
0.62844
53
11.283019
13.080848
50
false
false
0
0
0
0
0
0
1.132075
false
false
9
58681c0fdca5692df762cfb02c17f6c4ec8d0d5e
8,478,265,510,446
e53c6b52ef0e8efce1c3f1f95354c565b3de4368
/labs/lab3/src/main/java/com/oop/lab/models/ShelfFurniture.java
c4abbbc651c43412e2fcfd1a442ec2d055d0fcbf
[]
no_license
wellini/oop3s
https://github.com/wellini/oop3s
82d4db60b95b58ff477fe13f5a8c687f6e947694
3fec4296935e4b241fa017bebf1b2e5eff1d8491
refs/heads/master
2022-11-29T08:45:32.149000
2019-12-08T16:35:01
2019-12-08T16:35:01
219,523,329
0
0
null
false
2022-11-16T11:59:24
2019-11-04T14:39:40
2019-12-08T16:35:20
2022-11-16T11:59:21
64
0
0
4
Java
false
false
package com.oop.lab.models; public class ShelfFurniture extends Furniture { private final int THING_MARGIN = 1; private final int BORDER_WIDTH = 1; private int shelfWidth = 1; private int getShelfWidth() { return shelfWidth; } private void setShelfWidth(int shelfWidth) { this.shelfWidth = shelfWidth; } private String makeShelf(int width) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < width; i++) { stringBuilder.append("-"); } stringBuilder.append("\n"); return stringBuilder.toString(); } @Override public String showStuff() { if (stuff.size() == 0) return ""; stuff.forEach(thing -> setShelfWidth(getShelfWidth() + thing.length() + 2 * THING_MARGIN + BORDER_WIDTH)); final String SHELF = makeShelf(shelfWidth); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(SHELF); for (String s : stuff) { stringBuilder.append("| " + s + " "); } stringBuilder.append("|\n"); stringBuilder.append(SHELF); return stringBuilder.toString(); } }
UTF-8
Java
1,200
java
ShelfFurniture.java
Java
[]
null
[]
package com.oop.lab.models; public class ShelfFurniture extends Furniture { private final int THING_MARGIN = 1; private final int BORDER_WIDTH = 1; private int shelfWidth = 1; private int getShelfWidth() { return shelfWidth; } private void setShelfWidth(int shelfWidth) { this.shelfWidth = shelfWidth; } private String makeShelf(int width) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < width; i++) { stringBuilder.append("-"); } stringBuilder.append("\n"); return stringBuilder.toString(); } @Override public String showStuff() { if (stuff.size() == 0) return ""; stuff.forEach(thing -> setShelfWidth(getShelfWidth() + thing.length() + 2 * THING_MARGIN + BORDER_WIDTH)); final String SHELF = makeShelf(shelfWidth); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(SHELF); for (String s : stuff) { stringBuilder.append("| " + s + " "); } stringBuilder.append("|\n"); stringBuilder.append(SHELF); return stringBuilder.toString(); } }
1,200
0.601667
0.596667
44
26.272728
23.330982
114
false
false
0
0
0
0
0
0
0.522727
false
false
9
00cd583e67683c7918a5346f42cf42baf5f3f572
12,850,542,206,386
b7892d170806f3e6cc2a16f4163fcd68e8478205
/src/com/cognizant/practiceinrarfile/MoveZeroToEnd.java
f8d2105aa7efed59b3e4438fed32b819a56ef680
[]
no_license
abhayraju90/cts_Training
https://github.com/abhayraju90/cts_Training
6422062891f2b71ad458dea326dd29ba7714abc0
4a43e0e5aea9269a670b63d66f9d0c5e5c4a7a09
refs/heads/master
2022-06-23T20:21:30.631000
2020-05-11T09:23:17
2020-05-11T09:23:17
262,986,646
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cognizant.practiceinrarfile; public class MoveZeroToEnd { public static void moveZeroToEnd(int arr[],int n){ int boundary=arr.length-1; for(int i=arr.length-1;i>=0;i--){ if(arr[i]==0){ swap(arr,i,boundary); boundary--; } } for(int i=0;i<n;i++){ System.out.println(+arr[i]); } } public static void swap(int a[],int i,int j){ int temp=a[i]; a[i]=a[j]; a[j]=temp; } public static void main(String[] args) { int arr[]={4,2,0,1,0,3,0}; int n=arr.length; moveZeroToEnd(arr, n); } }
UTF-8
Java
540
java
MoveZeroToEnd.java
Java
[]
null
[]
package com.cognizant.practiceinrarfile; public class MoveZeroToEnd { public static void moveZeroToEnd(int arr[],int n){ int boundary=arr.length-1; for(int i=arr.length-1;i>=0;i--){ if(arr[i]==0){ swap(arr,i,boundary); boundary--; } } for(int i=0;i<n;i++){ System.out.println(+arr[i]); } } public static void swap(int a[],int i,int j){ int temp=a[i]; a[i]=a[j]; a[j]=temp; } public static void main(String[] args) { int arr[]={4,2,0,1,0,3,0}; int n=arr.length; moveZeroToEnd(arr, n); } }
540
0.603704
0.581481
30
17
15.347095
51
false
false
0
0
0
0
0
0
2.466667
false
false
9
a2d7c87a59a6060112e1dc66f81445afd9902bef
841,813,654,475
d81b32ccf8d58ac5613e8bb8d91a40a1dbe64ded
/src/main/java/id/ac/tazkia/smilemahasiswa/service/NotifikasiService.java
178866b90bfe27d6e09e13153d9b868e8f868556
[ "Apache-2.0" ]
permissive
idtazkia/aplikasi-akademik
https://github.com/idtazkia/aplikasi-akademik
53b9617181edd04b65ec340283fa237cc8002e6d
e9845e35d611fe6ea3bed53ed0e7934108ba212d
refs/heads/master
2022-10-18T00:38:14.463000
2022-10-12T02:59:24
2022-10-12T02:59:24
126,960,117
4
18
Apache-2.0
false
2022-10-12T03:48:33
2018-03-27T09:12:26
2021-02-06T03:41:23
2022-10-12T03:48:33
31,752
3
16
3
HTML
false
false
package id.ac.tazkia.smilemahasiswa.service; import com.fasterxml.jackson.databind.ObjectMapper; import id.ac.tazkia.smilemahasiswa.dao.HariDao; import id.ac.tazkia.smilemahasiswa.dto.notifikasi.DataNotifikasiTerlambat; import id.ac.tazkia.smilemahasiswa.dto.notifikasi.NotifikasiSmile; import id.ac.tazkia.smilemahasiswa.entity.PresensiDosen; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @Service public class NotifikasiService { private static final Logger LOGGER = LoggerFactory.getLogger(NotifikasiService.class); @Value("${kafka.topic.notifikasi}") private String topicNotifikasi; @Value("${notifikasi.smile.konfigurasi.telat}") private String konfigurasiTelat; @Autowired private KafkaTemplate<String, String> kafkaTemplate; @Autowired private ObjectMapper objectMapper; @Autowired private HariDao hariDao; @Async public void kirimNotifikasiTelat(PresensiDosen presensiDosen){ NotifikasiSmile notif = NotifikasiSmile.builder() .konfigurasi(konfigurasiTelat) .email(presensiDosen.getDosen().getKaryawan().getEmail()) .mobile("") .data(DataNotifikasiTerlambat.builder() .hariMasuk(hariDao.findByNamaHariEngContainingIgnoreCase(presensiDosen.getWaktuMasuk().toLocalDate().getDayOfWeek().toString()).getNamaHari()) .hari(presensiDosen.getJadwal().getHari().getNamaHari()) .jam(presensiDosen.getJadwal().getJamMulai()) .jamMasuk(presensiDosen.getWaktuMasuk().toLocalTime()) .nama(presensiDosen.getDosen().getKaryawan().getNamaKaryawan()) .matakuliah(presensiDosen.getJadwal().getMatakuliahKurikulum().getMatakuliah().getNamaMatakuliah()) .tanggalMasuk(presensiDosen.getWaktuMasuk().toLocalDate()) .build()) .build(); try { kafkaTemplate.send(topicNotifikasi, objectMapper.writeValueAsString(notif)); } catch (Exception err) { LOGGER.warn(err.getMessage(), err); } NotifikasiSmile notifikasiSmile = NotifikasiSmile.builder() .konfigurasi(konfigurasiTelat) .email("akademik@tazkia.ac.id") .mobile("") .data(DataNotifikasiTerlambat.builder() .hariMasuk(presensiDosen.getJadwal().getHari().getNamaHari()) .hari(presensiDosen.getJadwal().getHari().getNamaHari()) .jam(presensiDosen.getJadwal().getJamMulai()) .jamMasuk(presensiDosen.getWaktuMasuk().toLocalTime()) .nama(presensiDosen.getDosen().getKaryawan().getNamaKaryawan()) .matakuliah(presensiDosen.getJadwal().getMatakuliahKurikulum().getMatakuliah().getNamaMatakuliah()) .tanggalMasuk(presensiDosen.getWaktuMasuk().toLocalDate()) .build()) .build(); try { kafkaTemplate.send(topicNotifikasi, objectMapper.writeValueAsString(notifikasiSmile)); } catch (Exception err) { LOGGER.warn(err.getMessage(), err); } } }
UTF-8
Java
3,571
java
NotifikasiService.java
Java
[ { "context": "igurasi(konfigurasiTelat)\n .email(\"akademik@tazkia.ac.id\")\n .mobile(\"\")\n .da", "end": 2597, "score": 0.9999310970306396, "start": 2576, "tag": "EMAIL", "value": "akademik@tazkia.ac.id" } ]
null
[]
package id.ac.tazkia.smilemahasiswa.service; import com.fasterxml.jackson.databind.ObjectMapper; import id.ac.tazkia.smilemahasiswa.dao.HariDao; import id.ac.tazkia.smilemahasiswa.dto.notifikasi.DataNotifikasiTerlambat; import id.ac.tazkia.smilemahasiswa.dto.notifikasi.NotifikasiSmile; import id.ac.tazkia.smilemahasiswa.entity.PresensiDosen; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @Service public class NotifikasiService { private static final Logger LOGGER = LoggerFactory.getLogger(NotifikasiService.class); @Value("${kafka.topic.notifikasi}") private String topicNotifikasi; @Value("${notifikasi.smile.konfigurasi.telat}") private String konfigurasiTelat; @Autowired private KafkaTemplate<String, String> kafkaTemplate; @Autowired private ObjectMapper objectMapper; @Autowired private HariDao hariDao; @Async public void kirimNotifikasiTelat(PresensiDosen presensiDosen){ NotifikasiSmile notif = NotifikasiSmile.builder() .konfigurasi(konfigurasiTelat) .email(presensiDosen.getDosen().getKaryawan().getEmail()) .mobile("") .data(DataNotifikasiTerlambat.builder() .hariMasuk(hariDao.findByNamaHariEngContainingIgnoreCase(presensiDosen.getWaktuMasuk().toLocalDate().getDayOfWeek().toString()).getNamaHari()) .hari(presensiDosen.getJadwal().getHari().getNamaHari()) .jam(presensiDosen.getJadwal().getJamMulai()) .jamMasuk(presensiDosen.getWaktuMasuk().toLocalTime()) .nama(presensiDosen.getDosen().getKaryawan().getNamaKaryawan()) .matakuliah(presensiDosen.getJadwal().getMatakuliahKurikulum().getMatakuliah().getNamaMatakuliah()) .tanggalMasuk(presensiDosen.getWaktuMasuk().toLocalDate()) .build()) .build(); try { kafkaTemplate.send(topicNotifikasi, objectMapper.writeValueAsString(notif)); } catch (Exception err) { LOGGER.warn(err.getMessage(), err); } NotifikasiSmile notifikasiSmile = NotifikasiSmile.builder() .konfigurasi(konfigurasiTelat) .email("<EMAIL>") .mobile("") .data(DataNotifikasiTerlambat.builder() .hariMasuk(presensiDosen.getJadwal().getHari().getNamaHari()) .hari(presensiDosen.getJadwal().getHari().getNamaHari()) .jam(presensiDosen.getJadwal().getJamMulai()) .jamMasuk(presensiDosen.getWaktuMasuk().toLocalTime()) .nama(presensiDosen.getDosen().getKaryawan().getNamaKaryawan()) .matakuliah(presensiDosen.getJadwal().getMatakuliahKurikulum().getMatakuliah().getNamaMatakuliah()) .tanggalMasuk(presensiDosen.getWaktuMasuk().toLocalDate()) .build()) .build(); try { kafkaTemplate.send(topicNotifikasi, objectMapper.writeValueAsString(notifikasiSmile)); } catch (Exception err) { LOGGER.warn(err.getMessage(), err); } } }
3,557
0.654439
0.653878
79
44.20253
34.981144
166
false
false
0
0
0
0
0
0
0.379747
false
false
9
ffbcf63ee91d50e033db780aa93560e87c4abcca
27,797,028,344,159
f61c8c646a8d551d4d1cc64f841ab759b8bd08d7
/src/Test.java
222680b165189e97dc2d631acf5c18ca8a7bfd43
[]
no_license
GuitarmonYz/AlgoProj
https://github.com/GuitarmonYz/AlgoProj
ddc91cc71031072c7f8f9f8a30dd9516e9d65439
c150be71e9b6185d474fee8c844c9c3171bf8851
refs/heads/master
2021-08-23T18:23:27.414000
2017-12-06T02:00:00
2017-12-06T02:00:00
109,404,418
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import Algorigthms.BranchAndBound.BBMain; import FileUtil.SolWriter; import Graph.Edge; import Graph.GraphUtil; import Graph.Graph; import Graph.VertexCover; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; /** * Test class to experiment, free to modify */ public class Test { public static void main(String[] args) { // Edge e1 = new Edge(1 , 0); // Edge e2 = new Edge(0, 1); // HashSet<Edge> testSet = new HashSet<>(); // testSet.add(e1); // testSet.add(e2); // ArrayList<Edge> testList = new ArrayList<>(); // Test test = new Test(); // test.testFinal(testList); // System.out.println(testList.size()); //test.testFinal(); SolWriter solWriter = SolWriter.getInstance(); solWriter.input_Filename = "karate.graph"; solWriter.algorithm_name = "bnb"; solWriter.cut_off_time = 5; try{ Graph testGraph = GraphUtil.loadGraph("./Data/karate.graph"); BBMain bnb = new BBMain(testGraph, 5); bnb.getVertexCover(); }catch (IOException ex){ }catch (OutOfMemoryError e){ System.out.println("out of memory, need more memory to get opt solution"); } // String test = "data"; // System.out.println(test.split("/").length); } public void testFinal(ArrayList<Edge> testList){ testList.add(new Edge(0,1)); testList.add(new Edge(1,2)); //System.out.println(testList.size()); } }
UTF-8
Java
1,559
java
Test.java
Java
[]
null
[]
import Algorigthms.BranchAndBound.BBMain; import FileUtil.SolWriter; import Graph.Edge; import Graph.GraphUtil; import Graph.Graph; import Graph.VertexCover; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; /** * Test class to experiment, free to modify */ public class Test { public static void main(String[] args) { // Edge e1 = new Edge(1 , 0); // Edge e2 = new Edge(0, 1); // HashSet<Edge> testSet = new HashSet<>(); // testSet.add(e1); // testSet.add(e2); // ArrayList<Edge> testList = new ArrayList<>(); // Test test = new Test(); // test.testFinal(testList); // System.out.println(testList.size()); //test.testFinal(); SolWriter solWriter = SolWriter.getInstance(); solWriter.input_Filename = "karate.graph"; solWriter.algorithm_name = "bnb"; solWriter.cut_off_time = 5; try{ Graph testGraph = GraphUtil.loadGraph("./Data/karate.graph"); BBMain bnb = new BBMain(testGraph, 5); bnb.getVertexCover(); }catch (IOException ex){ }catch (OutOfMemoryError e){ System.out.println("out of memory, need more memory to get opt solution"); } // String test = "data"; // System.out.println(test.split("/").length); } public void testFinal(ArrayList<Edge> testList){ testList.add(new Edge(0,1)); testList.add(new Edge(1,2)); //System.out.println(testList.size()); } }
1,559
0.608082
0.599102
50
30.18
19.138119
86
false
false
0
0
0
0
0
0
0.8
false
false
9
b6e66547dcb8028a50ba7e16d3846750114a7ec9
15,582,141,410,855
a76b4b76c7c04f5b25538c8a5dc35098660b7ea7
/src/main/java/org/launchcode/andrewgroupa/data/ItemRepository.java
9ac4d2112bd23a791a9b6b84e01d9611198ce330
[]
no_license
LaunchCodeLiftoffProjects/andrew-group-a
https://github.com/LaunchCodeLiftoffProjects/andrew-group-a
d9400b450b82cd8a9919915e8b4eabcd99794f3c
703dc73b49fa13e5a90bc10051e66c607cc936f2
refs/heads/main
2023-08-05T08:26:27.616000
2021-09-27T23:49:11
2021-09-27T23:49:11
392,122,519
3
2
null
false
2021-09-27T21:15:13
2021-08-02T23:22:43
2021-09-27T21:09:08
2021-09-27T21:10:56
236
3
2
1
Java
false
false
package org.launchcode.andrewgroupa.data; import org.launchcode.andrewgroupa.models.Item; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface ItemRepository extends CrudRepository<Item, Integer> { }
UTF-8
Java
288
java
ItemRepository.java
Java
[]
null
[]
package org.launchcode.andrewgroupa.data; import org.launchcode.andrewgroupa.models.Item; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface ItemRepository extends CrudRepository<Item, Integer> { }
288
0.847222
0.847222
10
27.799999
26.626303
71
false
false
0
0
0
0
0
0
0.5
false
false
9
ae2a614b7f1a7bb1a116a8fd019addd06471a0eb
17,411,797,480,287
4cf480148ca0f00dafe4b34f8b2b5f89eab114e9
/app/src/main/java/com/github/isogash/ecstargetgame/GameActivity.java
f97530331e8e26e1f88babe37ea156ce953e65a8
[ "MIT" ]
permissive
Isogash/ecs-target-game
https://github.com/Isogash/ecs-target-game
2e9a1e1b7e2d246bfb69363d7088b506803b29fa
a846d55edb3d0209904b961cd8e5c9ec173756d1
refs/heads/master
2018-04-02T07:04:29.936000
2017-04-17T14:04:29
2017-04-17T14:04:29
88,511,182
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.isogash.ecstargetgame; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class GameActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); Intent intent = getIntent(); int level = intent.getIntExtra(MainActivity.EXTRA_LEVEL, 1); TextView text = (TextView) findViewById(R.id.textView); text.setText("Level: " + level); } }
UTF-8
Java
620
java
GameActivity.java
Java
[ { "context": "package com.github.isogash.ecstargetgame;\n\nimport android.content.Intent;\nim", "end": 26, "score": 0.9988465309143066, "start": 19, "tag": "USERNAME", "value": "isogash" } ]
null
[]
package com.github.isogash.ecstargetgame; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class GameActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); Intent intent = getIntent(); int level = intent.getIntExtra(MainActivity.EXTRA_LEVEL, 1); TextView text = (TextView) findViewById(R.id.textView); text.setText("Level: " + level); } }
620
0.724194
0.720968
20
30
22.536636
68
false
false
0
0
0
0
0
0
0.6
false
false
9
76a975a54d1ae6e3daa67ba3908afb849679b0c5
14,937,896,309,611
1f07a675ed2cf86a0d9aa6dda44f2f912d901271
/app/src/main/java/ly/pp/addsongs/DeletePartners.java
0ebbd3288b13f9a81113c6ab301e4e1221db615b
[]
no_license
2953298096/JPapplication
https://github.com/2953298096/JPapplication
f6d0287e629a64ebc4869c9253aecdbebfc0be29
e1425acac26b588d75483c70ec51bdce12a281ce
refs/heads/master
2020-07-01T07:03:18.963000
2019-05-03T04:37:46
2019-05-03T04:37:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ly.pp.addsongs; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import org.json.JSONException; import org.json.JSONObject; /* renamed from: ly.pp.addsongs.fu */ final class DeletePartners implements OnClickListener { private final OLPlayHallRoom f5462a; DeletePartners(OLPlayHallRoom oLPlayHallRoom) { f5462a = oLPlayHallRoom; } public final void onClick(DialogInterface dialogInterface, int i) { JSONObject jSONObject = new JSONObject(); try { jSONObject.put("F", ""); jSONObject.put("T", 3); f5462a.mo2839a((byte) 31, (byte) 0, jSONObject.toString()); } catch (JSONException e) { e.printStackTrace(); } dialogInterface.dismiss(); } }
UTF-8
Java
841
java
DeletePartners.java
Java
[]
null
[]
package ly.pp.addsongs; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import org.json.JSONException; import org.json.JSONObject; /* renamed from: ly.pp.addsongs.fu */ final class DeletePartners implements OnClickListener { private final OLPlayHallRoom f5462a; DeletePartners(OLPlayHallRoom oLPlayHallRoom) { f5462a = oLPlayHallRoom; } public final void onClick(DialogInterface dialogInterface, int i) { JSONObject jSONObject = new JSONObject(); try { jSONObject.put("F", ""); jSONObject.put("T", 3); f5462a.mo2839a((byte) 31, (byte) 0, jSONObject.toString()); } catch (JSONException e) { e.printStackTrace(); } dialogInterface.dismiss(); } }
841
0.643282
0.619501
28
28.035715
21.567968
71
false
false
0
0
0
0
0
0
0.642857
false
false
9
603eb72856354da06ff2692c3d29e42dd0db0757
31,945,966,768,197
4536078b4070fc3143086ff48f088e2bc4b4c681
/v1.1.2/decompiled/l/b/a/r0.java
b300543f3588083ff3463aff95429a4aa802fdc3
[]
no_license
olealgoritme/smittestopp_src
https://github.com/olealgoritme/smittestopp_src
485b81422752c3d1e7980fbc9301f4f0e0030d16
52080d5b7613cb9279bc6cda5b469a5c84e34f6a
refs/heads/master
2023-05-27T21:25:17.564000
2023-05-02T14:24:31
2023-05-02T14:24:31
262,846,147
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package l.b.a; import e.a.a.a.a; import java.io.OutputStream; public class r0 extends b { public r0(e parame) { super(parame.b().a("DER"), 0); } public r0(byte[] paramArrayOfByte) { super(paramArrayOfByte, 0); } public r0(byte[] paramArrayOfByte, int paramInt) { super(paramArrayOfByte, paramInt); } public static r0 a(Object paramObject) { if ((paramObject != null) && (!(paramObject instanceof r0))) { if ((paramObject instanceof n1)) { paramObject = (n1)paramObject; return new r0(x, y); } if ((paramObject instanceof byte[])) { try { paramObject = (r0)t.a((byte[])paramObject); return (r0)paramObject; } catch (Exception paramObject) { throw new IllegalArgumentException(a.a((Exception)paramObject, a.a("encoding error in getInstance: "))); } } throw new IllegalArgumentException(a.a(paramObject, a.a("illegal object in getInstance: "))); } return (r0)paramObject; } public static r0 a(b0 paramb0, boolean paramBoolean) { paramb0 = paramb0.j(); if ((!paramBoolean) && (!(paramb0 instanceof r0))) { paramb0 = p.a(paramb0).j(); if (paramb0.length >= 1) { int i = paramb0[0]; int j = paramb0.length - 1; byte[] arrayOfByte = new byte[j]; if (j != 0) { System.arraycopy(paramb0, 1, arrayOfByte, 0, paramb0.length - 1); } return new r0(arrayOfByte, i); } throw new IllegalArgumentException("truncated BIT STRING detected"); } return a(paramb0); } public void a(r paramr, boolean paramBoolean) { byte[] arrayOfByte = x; int i = arrayOfByte.length; if (i != 0) { int j = y; if (j != 0) { i--; if (arrayOfByte[i] != (byte)(arrayOfByte[i] & 255 << j)) { int k = (byte)(arrayOfByte[i] & 255 << j); j = (byte)j; if (paramBoolean) { a.write(3); } paramr.a(i + 2); a.write(j); a.write(arrayOfByte, 0, i); a.write(k); return; } } } paramr.a(paramBoolean, 3, (byte)y, x); } public int f() { return d2.a(x.length + 1) + 1 + x.length + 1; } public boolean g() { return false; } public t h() { return this; } public t i() { return this; } } /* Location: * Qualified Name: l.b.a.r0 * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
2,592
java
r0.java
Java
[]
null
[]
package l.b.a; import e.a.a.a.a; import java.io.OutputStream; public class r0 extends b { public r0(e parame) { super(parame.b().a("DER"), 0); } public r0(byte[] paramArrayOfByte) { super(paramArrayOfByte, 0); } public r0(byte[] paramArrayOfByte, int paramInt) { super(paramArrayOfByte, paramInt); } public static r0 a(Object paramObject) { if ((paramObject != null) && (!(paramObject instanceof r0))) { if ((paramObject instanceof n1)) { paramObject = (n1)paramObject; return new r0(x, y); } if ((paramObject instanceof byte[])) { try { paramObject = (r0)t.a((byte[])paramObject); return (r0)paramObject; } catch (Exception paramObject) { throw new IllegalArgumentException(a.a((Exception)paramObject, a.a("encoding error in getInstance: "))); } } throw new IllegalArgumentException(a.a(paramObject, a.a("illegal object in getInstance: "))); } return (r0)paramObject; } public static r0 a(b0 paramb0, boolean paramBoolean) { paramb0 = paramb0.j(); if ((!paramBoolean) && (!(paramb0 instanceof r0))) { paramb0 = p.a(paramb0).j(); if (paramb0.length >= 1) { int i = paramb0[0]; int j = paramb0.length - 1; byte[] arrayOfByte = new byte[j]; if (j != 0) { System.arraycopy(paramb0, 1, arrayOfByte, 0, paramb0.length - 1); } return new r0(arrayOfByte, i); } throw new IllegalArgumentException("truncated BIT STRING detected"); } return a(paramb0); } public void a(r paramr, boolean paramBoolean) { byte[] arrayOfByte = x; int i = arrayOfByte.length; if (i != 0) { int j = y; if (j != 0) { i--; if (arrayOfByte[i] != (byte)(arrayOfByte[i] & 255 << j)) { int k = (byte)(arrayOfByte[i] & 255 << j); j = (byte)j; if (paramBoolean) { a.write(3); } paramr.a(i + 2); a.write(j); a.write(arrayOfByte, 0, i); a.write(k); return; } } } paramr.a(paramBoolean, 3, (byte)y, x); } public int f() { return d2.a(x.length + 1) + 1 + x.length + 1; } public boolean g() { return false; } public t h() { return this; } public t i() { return this; } } /* Location: * Qualified Name: l.b.a.r0 * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
2,592
0.524306
0.500772
123
20.081301
20.676994
114
false
false
0
0
0
0
0
0
0.471545
false
false
9
7f0de77f4ff0aa522671d7460cb9fee3281b7f14
32,950,989,155,676
3632e75f96ee846003fceeaf523f81abb3770d5f
/src/main/java/com/example/demo/util/ValidatorUtil.java
e2e47b1f0e632491b82cfcfaa68e277c09f477f4
[]
no_license
SxunS/miaosha
https://github.com/SxunS/miaosha
8f6b87238e7327c1abd77a424994c6c24c0d58be
a96e42226f477abdbd34972e98a59e86ce052ff2
refs/heads/master
2020-03-28T17:35:02.970000
2018-10-12T00:47:20
2018-10-12T00:47:20
148,804,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.util; import org.apache.commons.lang3.StringUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ValidatorUtil { /** * ๆ‰‹ๆœบๅทๆญฃๅˆ™ */ private static final String MOBILE_REG = "^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$"; public static boolean isMobileNum(String mobileNum){ if (StringUtils.isBlank(mobileNum)) { return false; } Pattern mobilePattern = Pattern.compile(MOBILE_REG); Matcher matcher = mobilePattern.matcher(mobileNum); return matcher.matches(); } public static void main(String[] args) { System.out.println(isMobileNum("12333333333")); } }
UTF-8
Java
745
java
ValidatorUtil.java
Java
[]
null
[]
package com.example.demo.util; import org.apache.commons.lang3.StringUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ValidatorUtil { /** * ๆ‰‹ๆœบๅทๆญฃๅˆ™ */ private static final String MOBILE_REG = "^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$"; public static boolean isMobileNum(String mobileNum){ if (StringUtils.isBlank(mobileNum)) { return false; } Pattern mobilePattern = Pattern.compile(MOBILE_REG); Matcher matcher = mobilePattern.matcher(mobileNum); return matcher.matches(); } public static void main(String[] args) { System.out.println(isMobileNum("12333333333")); } }
745
0.651701
0.576871
26
27.26923
27.999392
122
false
false
0
0
0
0
0
0
0.653846
false
false
9
59a2504a257968ceda1a1b6cfda9c8edc4367a30
33,586,644,257,965
2cfd7d0c183f11c2a08ef0db6abc63699d274892
/wear/src/main/java/arnold/example/com/watchface/ui/canvas/DateObject.java
46474f660ecb7056e13ba53bb498fd0f871904cf
[ "Apache-2.0" ]
permissive
Arnold00/DigiFace
https://github.com/Arnold00/DigiFace
d80845feea1f612ab7c461a38d85f2a23bae7f40
e227fda5797784d920123162d363e078ef2ef6f6
refs/heads/master
2020-04-18T11:51:37.689000
2015-06-08T15:49:21
2015-06-08T15:49:21
31,810,185
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package arnold.example.com.watchface.ui.canvas; import android.graphics.Canvas; import android.graphics.Paint; import arnold.example.com.watchface.ui.AbstractCanvasObject; import arnold.example.com.watchface.utils.DigitalFaceHelper; /** * Created by arnold on 28.02.2015. */ public class DateObject extends AbstractCanvasObject { private int x; private int y; public DateObject(Paint paint, int background, int accent) { super(paint, background, accent); } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } @Override public void onDraw(Canvas canvas) { String dateString = DigitalFaceHelper.DateTimeHelper.getDateFormat(time); updateText(dateString); if (y != 0) { y = y + (getTextHeight()); } int textWidth = getTextWidth(); int textHeight = getTextHeight(); int x = (this.x == 0 ? getCanvasWidth(canvas) / 2 : this.x) - (textWidth / 2); int y = (this.y == 0 ? getCanvasHeight(canvas) / 2 : this.y) + (textHeight / 2); canvas.drawText(dateString, x, y, paint); } }
UTF-8
Java
1,160
java
DateObject.java
Java
[ { "context": "chface.utils.DigitalFaceHelper;\n\n/**\n * Created by arnold on 28.02.2015.\n */\npublic class DateObject extend", "end": 260, "score": 0.9994761943817139, "start": 254, "tag": "USERNAME", "value": "arnold" } ]
null
[]
package arnold.example.com.watchface.ui.canvas; import android.graphics.Canvas; import android.graphics.Paint; import arnold.example.com.watchface.ui.AbstractCanvasObject; import arnold.example.com.watchface.utils.DigitalFaceHelper; /** * Created by arnold on 28.02.2015. */ public class DateObject extends AbstractCanvasObject { private int x; private int y; public DateObject(Paint paint, int background, int accent) { super(paint, background, accent); } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } @Override public void onDraw(Canvas canvas) { String dateString = DigitalFaceHelper.DateTimeHelper.getDateFormat(time); updateText(dateString); if (y != 0) { y = y + (getTextHeight()); } int textWidth = getTextWidth(); int textHeight = getTextHeight(); int x = (this.x == 0 ? getCanvasWidth(canvas) / 2 : this.x) - (textWidth / 2); int y = (this.y == 0 ? getCanvasHeight(canvas) / 2 : this.y) + (textHeight / 2); canvas.drawText(dateString, x, y, paint); } }
1,160
0.62931
0.616379
44
25.363636
25.214617
88
false
false
0
0
0
0
0
0
0.568182
false
false
9
fa92ad30ea0a064daf2bc2101cfc62221f403ddf
8,263,517,135,796
5a3a45660cc4cb0365855e7eb61f3482dfe7624a
/src/com/company/TempConversion.java
1ce2673deb3bb0611616772579e4b0d82082ee15
[]
no_license
Rileybr/unit_1
https://github.com/Rileybr/unit_1
fee53ab68e5be77c1ceb33fb15cedfa658ca6c4f
309a922688c46c285ca95c65f8519ac596f080bc
refs/heads/master
2020-07-22T23:37:13.273000
2019-09-23T12:48:05
2019-09-23T12:48:05
207,369,636
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.util.Scanner; public class TempConversion { public static void main(String[] args){ Scanner scan = new Scanner(System.in); System.out.println("Enter the temperature in ยฐF"); double fahrenheit = scan.nextDouble() ; double celsius; celsius = (fahrenheit - 32) * 5 / 9; System.out.println(Math.round(fahrenheit) + "ยฐF = " + Math.round(celsius) + "ยฐC"); } }
UTF-8
Java
450
java
TempConversion.java
Java
[]
null
[]
package com.company; import java.util.Scanner; public class TempConversion { public static void main(String[] args){ Scanner scan = new Scanner(System.in); System.out.println("Enter the temperature in ยฐF"); double fahrenheit = scan.nextDouble() ; double celsius; celsius = (fahrenheit - 32) * 5 / 9; System.out.println(Math.round(fahrenheit) + "ยฐF = " + Math.round(celsius) + "ยฐC"); } }
450
0.619687
0.610738
16
26.9375
25.476629
90
false
false
0
0
0
0
0
0
0.5
false
false
9
d708d41c51c351314bf267d48e778f2d6cdc0979
13,546,326,887,950
74333b359faaec66b306f5e864c1d7c04a03e1c9
/srm/codegen/java/sync/runtime/src/test/java/com/th3l4b/srm/codegen/java/sync/runtime/junit/TestAllCasesOfEntityStatusSyncTool.java
de53a530e7eb2d2233434ad7af9a19e425f82a6b
[]
no_license
ramongilmoreno/th3l4b.old
https://github.com/ramongilmoreno/th3l4b.old
783198e292fa83ede91aee29580cf0e0dbe52e55
e322a7b69ff1087149db00c5cb61f8b97f4201a6
refs/heads/master
2021-03-13T00:01:53.396000
2014-08-29T09:46:36
2014-08-29T09:46:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.th3l4b.srm.codegen.java.sync.runtime.junit; import org.junit.Test; import com.th3l4b.srm.codegen.java.sync.runtime.EntityStatusSyncTool; import com.th3l4b.srm.runtime.EntityStatus; public class TestAllCasesOfEntityStatusSyncTool { @Test public void test() throws Exception { for (EntityStatus a : EntityStatus.values()) { if (!a.isTransitional()) { for (EntityStatus b : EntityStatus.values()) { if (!b.isTransitional()) { EntityStatusSyncTool.howToGet(a, b); } } } } } }
UTF-8
Java
525
java
TestAllCasesOfEntityStatusSyncTool.java
Java
[]
null
[]
package com.th3l4b.srm.codegen.java.sync.runtime.junit; import org.junit.Test; import com.th3l4b.srm.codegen.java.sync.runtime.EntityStatusSyncTool; import com.th3l4b.srm.runtime.EntityStatus; public class TestAllCasesOfEntityStatusSyncTool { @Test public void test() throws Exception { for (EntityStatus a : EntityStatus.values()) { if (!a.isTransitional()) { for (EntityStatus b : EntityStatus.values()) { if (!b.isTransitional()) { EntityStatusSyncTool.howToGet(a, b); } } } } } }
525
0.706667
0.695238
22
22.863636
22.320589
69
false
false
0
0
0
0
0
0
1.954545
false
false
9
ea004a5ca43812c6c7a6e60c860b8e69ac176f31
31,937,376,854,960
095cc708c6a602c3e80f1ee1e0d0be17e559a6bc
/src/controller/UserSettingController.java
1f4bfc2f829e71bc982841c2c360468b6ad07d8a
[]
no_license
LATHX/NetWorkDisk
https://github.com/LATHX/NetWorkDisk
ab1614092c3184407d17067d70c622590e099f98
c997554b29c219c91ab637244f6a3ea9eaf427fb
refs/heads/master
2020-05-29T23:13:11.647000
2019-05-30T14:49:45
2019-05-30T14:49:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import model.User; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import util.ImgTool; import util.UploadHelper; import dao.UserDao; @Controller @RequestMapping("/u") public class UserSettingController extends Support{ private static final String UPLOADPATH = "/user/temp_portrait/"; private static final String PORTRAITPATH = "/user/portrait/"; /** * ๆ›ดๆ”น็”จๆˆทๅ * @param username * @return */ @ResponseBody @RequestMapping(value="/change_username",method=RequestMethod.POST) public String changeUsername(String username){ User user = (User)session.getAttribute("user"); if(user != null){ user.setUsername(username); UserDao.updateUsername(user); return "1"; } return "0"; } /** * ๆ›ดๆ”นemail * @param password * @param email * @return */ @ResponseBody @RequestMapping(value="/change_email",method=RequestMethod.POST) public String changeEmail(String password,String email){ User user = (User)session.getAttribute("user"); user.setPassword(password); if(UserDao.confirm(user)!=null){ user.setEmail(email); UserDao.updateEmail(user); System.out.println(((User)session.getAttribute("user")).getEmail()); return "1"; } return "0"; } /** * ๆ›ดๆ”นๅฏ†็  * @param oldPwd * @param newPwd * @return */ @ResponseBody @RequestMapping(value="/change_pwd",method=RequestMethod.POST) public String changePassword(String oldPwd,String newPwd){ User user = (User)session.getAttribute("user"); user.setPassword(oldPwd); if(UserDao.confirm(user)!=null){ user.setPassword(newPwd); UserDao.updatePassword(user); return "1"; } return "0"; } @ResponseBody @RequestMapping(value="/change_portrait",method=RequestMethod.POST) public String changePortrait(int x,int y,int width,int height,String imgName){ User user = (User) session.getAttribute("user"); if(imgName.trim().equals("")) return ""; String realPath = session.getServletContext().getRealPath("/"); ImgTool imgT = new ImgTool(); imgT.cut(realPath+UPLOADPATH+imgName, x, y, width, height); imgT.save("jpg", user.getId()+".jpg", realPath+PORTRAITPATH, 120, 120); if(user.getPortrait().equals("portrait")){ UserDao.updatePortrait(user.getId()); user.setPortrait(user.getId()+""); } return user.getId()+".jpg"; } @ResponseBody @RequestMapping(value="/upload_portrait",method=RequestMethod.POST) public String uploadPortrait(HttpServletRequest request){ UploadHelper upload = new UploadHelper(); MultipartFile file = upload.getFiles(request).get(0); User user = (User) session.getAttribute("user"); String realPath = session.getServletContext().getRealPath(UPLOADPATH); String fileName = file.getOriginalFilename(); String suffix = fileName.substring(fileName.lastIndexOf(".")+1).toLowerCase(); String imgName = user.getId()+"."+suffix; try { upload.upload(file, realPath+"/"+imgName); } catch (IOException e) { e.printStackTrace(); } return imgName; } @RequestMapping("/setting") public String userSetting(){ return "user_setting"; } }
UTF-8
Java
3,429
java
UserSettingController.java
Java
[ { "context": "r\");\t\t\n\t\t\n\t\tif(user != null){\n\t\t\tuser.setUsername(username);\n\t\t\tUserDao.updateUsername(user);\n\t\t\treturn \"1\";", "end": 982, "score": 0.5609611868858337, "start": 974, "tag": "USERNAME", "value": "username" }, { "context": ")session.getAttribute(\"user\");\n\t\tuser.setPassword(oldPwd);\n\t\tif(UserDao.confirm(user)!=null){\n\t\t\tuser.setP", "end": 1834, "score": 0.998329758644104, "start": 1828, "tag": "PASSWORD", "value": "oldPwd" }, { "context": "UserDao.confirm(user)!=null){\n\t\t\tuser.setPassword(newPwd);\n\t\t\tUserDao.updatePassword(user);\n\t\t\treturn \"1\";", "end": 1898, "score": 0.9966562390327454, "start": 1892, "tag": "PASSWORD", "value": "newPwd" } ]
null
[]
package controller; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import model.User; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import util.ImgTool; import util.UploadHelper; import dao.UserDao; @Controller @RequestMapping("/u") public class UserSettingController extends Support{ private static final String UPLOADPATH = "/user/temp_portrait/"; private static final String PORTRAITPATH = "/user/portrait/"; /** * ๆ›ดๆ”น็”จๆˆทๅ * @param username * @return */ @ResponseBody @RequestMapping(value="/change_username",method=RequestMethod.POST) public String changeUsername(String username){ User user = (User)session.getAttribute("user"); if(user != null){ user.setUsername(username); UserDao.updateUsername(user); return "1"; } return "0"; } /** * ๆ›ดๆ”นemail * @param password * @param email * @return */ @ResponseBody @RequestMapping(value="/change_email",method=RequestMethod.POST) public String changeEmail(String password,String email){ User user = (User)session.getAttribute("user"); user.setPassword(password); if(UserDao.confirm(user)!=null){ user.setEmail(email); UserDao.updateEmail(user); System.out.println(((User)session.getAttribute("user")).getEmail()); return "1"; } return "0"; } /** * ๆ›ดๆ”นๅฏ†็  * @param oldPwd * @param newPwd * @return */ @ResponseBody @RequestMapping(value="/change_pwd",method=RequestMethod.POST) public String changePassword(String oldPwd,String newPwd){ User user = (User)session.getAttribute("user"); user.setPassword(<PASSWORD>); if(UserDao.confirm(user)!=null){ user.setPassword(<PASSWORD>); UserDao.updatePassword(user); return "1"; } return "0"; } @ResponseBody @RequestMapping(value="/change_portrait",method=RequestMethod.POST) public String changePortrait(int x,int y,int width,int height,String imgName){ User user = (User) session.getAttribute("user"); if(imgName.trim().equals("")) return ""; String realPath = session.getServletContext().getRealPath("/"); ImgTool imgT = new ImgTool(); imgT.cut(realPath+UPLOADPATH+imgName, x, y, width, height); imgT.save("jpg", user.getId()+".jpg", realPath+PORTRAITPATH, 120, 120); if(user.getPortrait().equals("portrait")){ UserDao.updatePortrait(user.getId()); user.setPortrait(user.getId()+""); } return user.getId()+".jpg"; } @ResponseBody @RequestMapping(value="/upload_portrait",method=RequestMethod.POST) public String uploadPortrait(HttpServletRequest request){ UploadHelper upload = new UploadHelper(); MultipartFile file = upload.getFiles(request).get(0); User user = (User) session.getAttribute("user"); String realPath = session.getServletContext().getRealPath(UPLOADPATH); String fileName = file.getOriginalFilename(); String suffix = fileName.substring(fileName.lastIndexOf(".")+1).toLowerCase(); String imgName = user.getId()+"."+suffix; try { upload.upload(file, realPath+"/"+imgName); } catch (IOException e) { e.printStackTrace(); } return imgName; } @RequestMapping("/setting") public String userSetting(){ return "user_setting"; } }
3,437
0.717934
0.713824
129
25.410852
23.186007
80
false
false
0
0
0
0
0
0
1.953488
false
false
9
6f2a20562107aed6488a89a90422dcc93182dc36
31,937,376,852,695
f9b3587882b29d79dc64212e966cd6c483c5d0ae
/src/test/java/no/mnemonic/account/demo/AccountDemoApplicationIntegrationTest.java
d3c15af4a527ae12b4372da65ca5c78c79b56f01
[]
no_license
tanel-tiits/account-demo
https://github.com/tanel-tiits/account-demo
8b05375f1e4347afe5623834403d2c1cf4c5bd4f
abd621f22155fe3ff1dc9ab9d201e5218fdff288
refs/heads/master
2022-12-21T14:02:04.664000
2020-09-22T09:21:31
2020-09-22T09:21:31
297,358,062
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package no.mnemonic.account.demo; import static org.junit.Assert.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import java.math.BigDecimal; import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import no.mnemonic.account.demo.config.ApplicationTestConfig; import no.mnemonic.account.demo.model.Account; import no.mnemonic.account.demo.model.ErrorData; import no.mnemonic.account.demo.model.Transaction; import no.mnemonic.account.demo.service.TransactionService; @SpringBootTest @AutoConfigureMockMvc @ContextConfiguration(classes = {ApplicationTestConfig.class}) @TestPropertySource(locations = {"classpath:application-test.properties"}) class AccountDemoApplicationIntegrationTest { static final String ACCOUNT_EXT_ID_1 = "NO0312340000001"; // account has 1000.0 initially static final String ACCOUNT_EXT_ID_2 = "NO7312340000002"; // account has 2000.0 initially static final String TRANSACTION_EXT_ID_1 = "ee73c29d-eca2-4cdf-b240-c035fdc765e6"; static final String TRANSACTION_EXT_ID_2 = "10e157d1-a170-418e-8754-50d67e65c5c7"; @Autowired MockMvc mockMvc; @Autowired TransactionService txService; @Autowired ObjectMapper objectMapper; @Test void testGetAllAccounts() throws Exception { MvcResult result = mockMvc .perform(MockMvcRequestBuilders .get(ApiConstants.ACCOUNT_CONTROLLER_ENDPOINT) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); List<Account> accounts = objectMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<List<Account>>() {}); assertNotNull(accounts); assertFalse(accounts.isEmpty()); } @Test void testAccountNotFound() throws Exception { MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.ACCOUNT_CONTROLLER_ENDPOINT + "/{extId}", "XYZ") .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNotFound()) .andReturn(); ErrorData errorData = objectMapper.readValue(result.getResponse().getContentAsString(), ErrorData.class); assertNotNull(errorData); } @Test void testGetAllTransactions() throws Exception { MvcResult result = mockMvc .perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); List<Transaction> transactions = objectMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<List<Transaction>>() {}); assertNotNull(transactions); assertFalse(transactions.isEmpty()); } @Test void testTransactionNotFound() throws Exception { MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", "XYZ") .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNotFound()) .andReturn(); ErrorData errorData = objectMapper.readValue(result.getResponse().getContentAsString(), ErrorData.class); assertNotNull(errorData); } @Test void testSuccessfulTransaction() throws Exception { BigDecimal amount = new BigDecimal("500.0"); Account srcAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertNotNull(srcAccountBefore); assertNotNull(dstAccountBefore); assertNotNull(srcAccountBefore.getAvailableCash()); assertNotNull(dstAccountBefore.getAvailableCash()); assertTrue(srcAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); assertTrue(dstAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); Transaction tx = new Transaction.Builder() .withCashAmount(amount) .withExternalId(TRANSACTION_EXT_ID_1) .withSourceAccountExtId(ACCOUNT_EXT_ID_1) .withDestinationAccountExtId(ACCOUNT_EXT_ID_2) .build(); MvcResult resultBeforeProcessing = mockMvc.perform(MockMvcRequestBuilders .put(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_1) .content(objectMapper.writeValueAsString(tx)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); Transaction txBeforeProcessing = objectMapper.readValue(resultBeforeProcessing.getResponse().getContentAsString(), Transaction.class); assertNotNull(txBeforeProcessing); assertEquals(TRANSACTION_EXT_ID_1, txBeforeProcessing.getExternalId()); assertNotNull(txBeforeProcessing.getRegisteredTime()); assertNull(txBeforeProcessing.getExecutedTime()); assertNull(txBeforeProcessing.isSuccess()); txService.processUnexecutedTransactions(); MvcResult resultAfterProcessing = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_1) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); Transaction txAfterProcessing = objectMapper.readValue(resultAfterProcessing.getResponse().getContentAsString(), Transaction.class); assertNotNull(txAfterProcessing); assertEquals(TRANSACTION_EXT_ID_1, txAfterProcessing.getExternalId()); assertNotNull(txAfterProcessing.getRegisteredTime()); assertNotNull(txAfterProcessing.getExecutedTime()); assertEquals(Boolean.TRUE, txAfterProcessing.isSuccess()); Account srcAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertEquals(srcAccountBefore.getAvailableCash().subtract(amount), srcAccountAfter.getAvailableCash()); assertEquals(dstAccountBefore.getAvailableCash().add(amount), dstAccountAfter.getAvailableCash()); assertTrue(srcAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); assertTrue(dstAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); } @Test void testUnsuccessfulTransaction() throws Exception { BigDecimal amount = new BigDecimal("1500.0"); Account srcAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertNotNull(srcAccountBefore); assertNotNull(dstAccountBefore); assertNotNull(srcAccountBefore.getAvailableCash()); assertNotNull(dstAccountBefore.getAvailableCash()); assertTrue(srcAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); assertTrue(dstAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); Transaction tx = new Transaction.Builder() .withCashAmount(amount) .withExternalId(TRANSACTION_EXT_ID_2) .withSourceAccountExtId(ACCOUNT_EXT_ID_1) .withDestinationAccountExtId(ACCOUNT_EXT_ID_2) .build(); mockMvc.perform(MockMvcRequestBuilders .put(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_2) .content(objectMapper.writeValueAsString(tx)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); txService.processUnexecutedTransactions(); MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_2) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); Transaction txFromResult = objectMapper.readValue(result.getResponse().getContentAsString(), Transaction.class); assertNotNull(txFromResult); assertEquals(TRANSACTION_EXT_ID_2, txFromResult.getExternalId()); assertEquals(Boolean.FALSE, txFromResult.isSuccess()); Account srcAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertEquals(srcAccountBefore.getAvailableCash(), srcAccountAfter.getAvailableCash()); assertEquals(dstAccountBefore.getAvailableCash(), dstAccountAfter.getAvailableCash()); } protected Account getAccountByExternalId(String accExtId) throws Exception { MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.ACCOUNT_CONTROLLER_ENDPOINT + "/{extId}", accExtId) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); return objectMapper.readValue(result.getResponse().getContentAsString(), Account.class); } }
UTF-8
Java
10,426
java
AccountDemoApplicationIntegrationTest.java
Java
[]
null
[]
package no.mnemonic.account.demo; import static org.junit.Assert.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import java.math.BigDecimal; import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import no.mnemonic.account.demo.config.ApplicationTestConfig; import no.mnemonic.account.demo.model.Account; import no.mnemonic.account.demo.model.ErrorData; import no.mnemonic.account.demo.model.Transaction; import no.mnemonic.account.demo.service.TransactionService; @SpringBootTest @AutoConfigureMockMvc @ContextConfiguration(classes = {ApplicationTestConfig.class}) @TestPropertySource(locations = {"classpath:application-test.properties"}) class AccountDemoApplicationIntegrationTest { static final String ACCOUNT_EXT_ID_1 = "NO0312340000001"; // account has 1000.0 initially static final String ACCOUNT_EXT_ID_2 = "NO7312340000002"; // account has 2000.0 initially static final String TRANSACTION_EXT_ID_1 = "ee73c29d-eca2-4cdf-b240-c035fdc765e6"; static final String TRANSACTION_EXT_ID_2 = "10e157d1-a170-418e-8754-50d67e65c5c7"; @Autowired MockMvc mockMvc; @Autowired TransactionService txService; @Autowired ObjectMapper objectMapper; @Test void testGetAllAccounts() throws Exception { MvcResult result = mockMvc .perform(MockMvcRequestBuilders .get(ApiConstants.ACCOUNT_CONTROLLER_ENDPOINT) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); List<Account> accounts = objectMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<List<Account>>() {}); assertNotNull(accounts); assertFalse(accounts.isEmpty()); } @Test void testAccountNotFound() throws Exception { MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.ACCOUNT_CONTROLLER_ENDPOINT + "/{extId}", "XYZ") .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNotFound()) .andReturn(); ErrorData errorData = objectMapper.readValue(result.getResponse().getContentAsString(), ErrorData.class); assertNotNull(errorData); } @Test void testGetAllTransactions() throws Exception { MvcResult result = mockMvc .perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); List<Transaction> transactions = objectMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<List<Transaction>>() {}); assertNotNull(transactions); assertFalse(transactions.isEmpty()); } @Test void testTransactionNotFound() throws Exception { MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", "XYZ") .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNotFound()) .andReturn(); ErrorData errorData = objectMapper.readValue(result.getResponse().getContentAsString(), ErrorData.class); assertNotNull(errorData); } @Test void testSuccessfulTransaction() throws Exception { BigDecimal amount = new BigDecimal("500.0"); Account srcAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertNotNull(srcAccountBefore); assertNotNull(dstAccountBefore); assertNotNull(srcAccountBefore.getAvailableCash()); assertNotNull(dstAccountBefore.getAvailableCash()); assertTrue(srcAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); assertTrue(dstAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); Transaction tx = new Transaction.Builder() .withCashAmount(amount) .withExternalId(TRANSACTION_EXT_ID_1) .withSourceAccountExtId(ACCOUNT_EXT_ID_1) .withDestinationAccountExtId(ACCOUNT_EXT_ID_2) .build(); MvcResult resultBeforeProcessing = mockMvc.perform(MockMvcRequestBuilders .put(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_1) .content(objectMapper.writeValueAsString(tx)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); Transaction txBeforeProcessing = objectMapper.readValue(resultBeforeProcessing.getResponse().getContentAsString(), Transaction.class); assertNotNull(txBeforeProcessing); assertEquals(TRANSACTION_EXT_ID_1, txBeforeProcessing.getExternalId()); assertNotNull(txBeforeProcessing.getRegisteredTime()); assertNull(txBeforeProcessing.getExecutedTime()); assertNull(txBeforeProcessing.isSuccess()); txService.processUnexecutedTransactions(); MvcResult resultAfterProcessing = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_1) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); Transaction txAfterProcessing = objectMapper.readValue(resultAfterProcessing.getResponse().getContentAsString(), Transaction.class); assertNotNull(txAfterProcessing); assertEquals(TRANSACTION_EXT_ID_1, txAfterProcessing.getExternalId()); assertNotNull(txAfterProcessing.getRegisteredTime()); assertNotNull(txAfterProcessing.getExecutedTime()); assertEquals(Boolean.TRUE, txAfterProcessing.isSuccess()); Account srcAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertEquals(srcAccountBefore.getAvailableCash().subtract(amount), srcAccountAfter.getAvailableCash()); assertEquals(dstAccountBefore.getAvailableCash().add(amount), dstAccountAfter.getAvailableCash()); assertTrue(srcAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); assertTrue(dstAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); } @Test void testUnsuccessfulTransaction() throws Exception { BigDecimal amount = new BigDecimal("1500.0"); Account srcAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountBefore = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertNotNull(srcAccountBefore); assertNotNull(dstAccountBefore); assertNotNull(srcAccountBefore.getAvailableCash()); assertNotNull(dstAccountBefore.getAvailableCash()); assertTrue(srcAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); assertTrue(dstAccountBefore.getAvailableCash().compareTo(BigDecimal.ZERO) >= 0); Transaction tx = new Transaction.Builder() .withCashAmount(amount) .withExternalId(TRANSACTION_EXT_ID_2) .withSourceAccountExtId(ACCOUNT_EXT_ID_1) .withDestinationAccountExtId(ACCOUNT_EXT_ID_2) .build(); mockMvc.perform(MockMvcRequestBuilders .put(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_2) .content(objectMapper.writeValueAsString(tx)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); txService.processUnexecutedTransactions(); MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.TRANSACTION_CONTROLLER_ENDPOINT + "/{extId}", TRANSACTION_EXT_ID_2) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); Transaction txFromResult = objectMapper.readValue(result.getResponse().getContentAsString(), Transaction.class); assertNotNull(txFromResult); assertEquals(TRANSACTION_EXT_ID_2, txFromResult.getExternalId()); assertEquals(Boolean.FALSE, txFromResult.isSuccess()); Account srcAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_1); Account dstAccountAfter = getAccountByExternalId(ACCOUNT_EXT_ID_2); assertEquals(srcAccountBefore.getAvailableCash(), srcAccountAfter.getAvailableCash()); assertEquals(dstAccountBefore.getAvailableCash(), dstAccountAfter.getAvailableCash()); } protected Account getAccountByExternalId(String accExtId) throws Exception { MvcResult result = mockMvc.perform(MockMvcRequestBuilders .get(ApiConstants.ACCOUNT_CONTROLLER_ENDPOINT + "/{extId}", accExtId) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); return objectMapper.readValue(result.getResponse().getContentAsString(), Account.class); } }
10,426
0.695089
0.683963
238
42.806725
32.2827
122
false
false
0
0
0
0
0
0
0.508403
false
false
9
d418ac1693905875aa9170b36a7db83e289f8363
3,633,542,393,211
ecff6bfb2a2c2ff3482e1d7b2b28d31428e1791b
/src/Client/Client.java
f7cf42268df8f939486bebdeb653d9a46896c34d
[]
no_license
colin27091/Communication
https://github.com/colin27091/Communication
a383d5a5a2c5b529a51a3b2e26c37157e98b060c
58d959c73cb869e9f0c1bc9c722080ce102096b1
refs/heads/master
2021-06-26T20:48:35.032000
2020-10-23T12:31:35
2020-10-23T12:31:35
160,954,723
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Client; import java.awt.RenderingHints.Key; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.net.Socket; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.CipherOutputStream; import javax.crypto.IllegalBlockSizeException; import javax.crypto.KeyGenerator; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.xml.bind.DatatypeConverter; import serveur.Serveur; /** * * @author c */ public class Client { public static void main(String[] args) throws IOException, NoSuchAlgorithmException { String serverName; int port; Socket socket; final InputStream in;//reception message du serveur final OutputStream out;//envoie message au serveur final Scanner scan = new Scanner(System.in);//lecture clavier final Scanner word = new Scanner(System.in);//lecture clavier pour message SecretKey key;//clรฉ gรฉnรฉrรฉ ObjectInputStream inKey;//outter permettant de lire la cl๏ฟฝ dans un fichier try{ System.out.print("Nom du serveur : ");//nom de serveur serverName = scan.nextLine(); System.out.println(); System.out.print("Port : ");//port port = scan.nextInt(); System.out.println(); socket = new Socket(serverName, port);//information serveur System.out.println("Connection etablished"); //lecture importation de la cl๏ฟฝ depuis un fichier inKey = new ObjectInputStream(new FileInputStream("KeyFile.xx")); key = (SecretKey) inKey.readObject();//stockage de la cl๏ฟฝ //fin d'importation System.out.println(key); //definition des outils d'echange avec le serveur out = socket.getOutputStream(); in = socket.getInputStream(); //fin definition //Crรฉation du processus d'envoi de message Thread send = new Thread(new Runnable() { @Override public void run() { while(true){ //boucle infini pour lecture de clavier et envoie en continu String message = word.nextLine();//lecture du clavier, enregistrement du message if(message.equals("bye")){//si le client envoie bye System.out.println("Deconnexion"); break; } try { Cipher cipher;//outils de cryptage et de decryptage cipher = Cipher.getInstance("AES");//clรฉ symetrique AES byte[] toCrypt = message.getBytes();//transformation du message en byte[] avant cryptage cipher.init(Cipher.ENCRYPT_MODE, key);//preparation du cipher pour crypter byte[] crypted = cipher.doFinal(toCrypt);//byte[] cryptรฉ out.write(crypted.length);//envoie de la longueur du cryptage out.write(crypted);//envoie du message cryptรฉ au serveur out.flush(); System.out.println("( "+ new String(toCrypt) + " -> "+ new String(crypted) +" )"); } catch (Exception ex) { System.out.println("Send error : "+ex); break; } }System.exit(0); } }); send.start(); //Creation du processus de reception de message Thread receive = new Thread(new Runnable() { @Override public void run() { while(true){ try{ int longueur = in.read();//reconstitution du byte[] cryptรฉ byte[] crypted = new byte[longueur]; for(int i=0; i < longueur; i++){ in.read(crypted, i, 1); } Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] uncrypted = cipher.doFinal(crypted); System.out.println("( " + new String(crypted) + " -> " + new String(uncrypted) +" )"); String message = new String(uncrypted); System.out.println("Serveur : " + message); } catch (Exception ex){ System.out.println("Receive error : "+ex); break; } }System.exit(0); } }); receive.start(); } catch (Exception ex){ System.out.println(ex); } } }
UTF-8
Java
6,193
java
Client.java
Java
[ { "context": "erter;\n\nimport serveur.Serveur;\n\n/**\n *\n * @author c\n */\npublic class Client {\n \n public static ", "end": 1020, "score": 0.9915576577186584, "start": 1019, "tag": "USERNAME", "value": "c" } ]
null
[]
package Client; import java.awt.RenderingHints.Key; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.net.Socket; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.CipherOutputStream; import javax.crypto.IllegalBlockSizeException; import javax.crypto.KeyGenerator; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.xml.bind.DatatypeConverter; import serveur.Serveur; /** * * @author c */ public class Client { public static void main(String[] args) throws IOException, NoSuchAlgorithmException { String serverName; int port; Socket socket; final InputStream in;//reception message du serveur final OutputStream out;//envoie message au serveur final Scanner scan = new Scanner(System.in);//lecture clavier final Scanner word = new Scanner(System.in);//lecture clavier pour message SecretKey key;//clรฉ gรฉnรฉrรฉ ObjectInputStream inKey;//outter permettant de lire la cl๏ฟฝ dans un fichier try{ System.out.print("Nom du serveur : ");//nom de serveur serverName = scan.nextLine(); System.out.println(); System.out.print("Port : ");//port port = scan.nextInt(); System.out.println(); socket = new Socket(serverName, port);//information serveur System.out.println("Connection etablished"); //lecture importation de la cl๏ฟฝ depuis un fichier inKey = new ObjectInputStream(new FileInputStream("KeyFile.xx")); key = (SecretKey) inKey.readObject();//stockage de la cl๏ฟฝ //fin d'importation System.out.println(key); //definition des outils d'echange avec le serveur out = socket.getOutputStream(); in = socket.getInputStream(); //fin definition //Crรฉation du processus d'envoi de message Thread send = new Thread(new Runnable() { @Override public void run() { while(true){ //boucle infini pour lecture de clavier et envoie en continu String message = word.nextLine();//lecture du clavier, enregistrement du message if(message.equals("bye")){//si le client envoie bye System.out.println("Deconnexion"); break; } try { Cipher cipher;//outils de cryptage et de decryptage cipher = Cipher.getInstance("AES");//clรฉ symetrique AES byte[] toCrypt = message.getBytes();//transformation du message en byte[] avant cryptage cipher.init(Cipher.ENCRYPT_MODE, key);//preparation du cipher pour crypter byte[] crypted = cipher.doFinal(toCrypt);//byte[] cryptรฉ out.write(crypted.length);//envoie de la longueur du cryptage out.write(crypted);//envoie du message cryptรฉ au serveur out.flush(); System.out.println("( "+ new String(toCrypt) + " -> "+ new String(crypted) +" )"); } catch (Exception ex) { System.out.println("Send error : "+ex); break; } }System.exit(0); } }); send.start(); //Creation du processus de reception de message Thread receive = new Thread(new Runnable() { @Override public void run() { while(true){ try{ int longueur = in.read();//reconstitution du byte[] cryptรฉ byte[] crypted = new byte[longueur]; for(int i=0; i < longueur; i++){ in.read(crypted, i, 1); } Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] uncrypted = cipher.doFinal(crypted); System.out.println("( " + new String(crypted) + " -> " + new String(uncrypted) +" )"); String message = new String(uncrypted); System.out.println("Serveur : " + message); } catch (Exception ex){ System.out.println("Receive error : "+ex); break; } }System.exit(0); } }); receive.start(); } catch (Exception ex){ System.out.println(ex); } } }
6,193
0.485918
0.48527
167
35.994011
26.010706
116
false
false
0
0
0
0
0
0
0.556886
false
false
9
7b236cd8e9d33a4b73035a12a3b5001a12bddef3
5,248,450,041,674
fbaa02e1c290621f9a05851bd90e7db3ba8ecf95
/backend_main/java/com/opensysnet/paperless/model/KakaoGeoRes.java
dcfb714bc167b271bc2f1d8d9da562d9e7bec017
[]
no_license
OPENSYSNETCOM/Paperless
https://github.com/OPENSYSNETCOM/Paperless
166b1a0248a8756eb735f96402392549f6575b05
f2f88a2efbb40f92473d15ef3ae1e1724d1c0e77
refs/heads/master
2023-07-28T03:53:59.156000
2021-09-15T08:07:34
2021-09-15T08:07:34
406,641,723
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.opensysnet.paperless.model; import lombok.Data; import java.io.Serializable; import java.util.HashMap; import java.util.List; @Data public class KakaoGeoRes implements Serializable { private static final long serialVersionUID = 1L; private HashMap<String, Object> meta; private List<Documents> documents; @Data public static class Documents { private HashMap<String, Object> address; private String address_type; private Double x; private Double y; private String address_name; private HashMap<String, Object> road_address; } }
UTF-8
Java
644
java
KakaoGeoRes.java
Java
[]
null
[]
package com.opensysnet.paperless.model; import lombok.Data; import java.io.Serializable; import java.util.HashMap; import java.util.List; @Data public class KakaoGeoRes implements Serializable { private static final long serialVersionUID = 1L; private HashMap<String, Object> meta; private List<Documents> documents; @Data public static class Documents { private HashMap<String, Object> address; private String address_type; private Double x; private Double y; private String address_name; private HashMap<String, Object> road_address; } }
644
0.677019
0.675466
26
22.76923
18.539579
53
false
false
0
0
0
0
0
0
0.653846
false
false
9
effceeb3fbc790ddeee05c897b86c57e9f5465f4
3,839,700,769,587
9b1524e9e4925f5c2d0d813c5b0e8e827175acca
/src/main/java/br/com/generator/genpdfcsv/type/ReportFormatType.java
1ccd4ef3760813152eddb54d7ace44d3c21dc73d
[]
no_license
brunosc/report-pdf-csv-spring
https://github.com/brunosc/report-pdf-csv-spring
2b5ac0af780afbe0e2fc0d98c9f682f18c0d1fe3
6b4fd0527a0f707833439236becd16c560ceaa06
refs/heads/master
2021-07-23T17:05:59.439000
2017-11-05T20:34:30
2017-11-05T20:34:30
108,450,228
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.generator.genpdfcsv.type; import br.com.generator.genpdfcsv.format.*; public enum ReportFormatType { DEFAULT(new FormatReportDefault()), INTEGER(new FormatReportInteger()), BIG_DECIMAL(new FormatReportBigDecimal()), CNPJ(new FormatReportCNPJ()); private FormatReportValue format; ReportFormatType(FormatReportValue format) { this.format = format; } public String format(Object value) { return this.format.format(value); } }
UTF-8
Java
497
java
ReportFormatType.java
Java
[]
null
[]
package br.com.generator.genpdfcsv.type; import br.com.generator.genpdfcsv.format.*; public enum ReportFormatType { DEFAULT(new FormatReportDefault()), INTEGER(new FormatReportInteger()), BIG_DECIMAL(new FormatReportBigDecimal()), CNPJ(new FormatReportCNPJ()); private FormatReportValue format; ReportFormatType(FormatReportValue format) { this.format = format; } public String format(Object value) { return this.format.format(value); } }
497
0.70825
0.70825
21
22.666666
19.089596
48
false
false
0
0
0
0
0
0
0.428571
false
false
9
8c2ca5f4c1a39f5203ff8333234b264bce9ce1bb
19,533,511,297,399
46266e8acaf9d245d933ddffb704f2d63af58442
/Vector Paint/src/eg/edu/alexu/csd/oop/draw/cs60/view/EditPluginShape.java
5b8d4bdd49192a05f9fc62318c038e167c7359c7
[]
no_license
mohamedmashaal/Vector-Based-Drawing-Application
https://github.com/mohamedmashaal/Vector-Based-Drawing-Application
10543b6756ba479a37d31346b354e9f9dfbc8599
e6c5cc8cd514482a63c9aa6c58730a4783f71c07
refs/heads/master
2021-08-18T20:10:39.154000
2017-11-23T19:41:47
2017-11-23T19:41:47
107,889,672
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package eg.edu.alexu.csd.oop.draw.cs60.view; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import eg.edu.alexu.csd.oop.draw.Shape; public class EditPluginShape extends CreateDialogue { public EditPluginShape(Shape shape, String title, View view, ArrayList<String> filters) { super(shape, title, view, filters); } @Override public void addPosition() { JPanel panel = new JPanel(); JLabel label = new JLabel("Position - X"); JTextField textfield = new JTextField(new Double(get_Shape().getPosition().getX()).toString(), 5); getLabels().add(label); panel.add(label); getTextFields().add(textfield); panel.add(textfield); getContentPane().add(panel); panel = new JPanel(); label = new JLabel("Position - Y"); textfield = new JTextField(new Double(get_Shape().getPosition().getY()).toString(), 5); getLabels().add(label); panel.add(label); getTextFields().add(textfield); panel.add(textfield); getContentPane().add(panel); } @Override public void addButtonListener() { getDraw().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Shape newShape = null; try { newShape = (Shape) get_Shape().clone(); } catch (CloneNotSupportedException e1) { e1.printStackTrace(); } int i = 2; if (newShape != null) { newShape.setPosition( new Point(new Double(Double.parseDouble(getTextFields().get(0).getText())).intValue(), new Double(Double.parseDouble(getTextFields().get(1).getText())).intValue())); newShape.getProperties().put("position-x", new Double(Double.parseDouble(getTextFields().get(0).getText()))); newShape.getProperties().put("position-y", new Double(Double.parseDouble(getTextFields().get(1).getText()))); for (i = 2; i < getLabels().size() - 1; i++) { newShape.getProperties().put(getLabels().get(i).getText(), Double.parseDouble(getTextFields().get(i).getText())); } } newShape.setColor(getColor()); newShape.setFillColor(getFill_color()); newShape.getProperties().put("color", getColor().getRGB() * 1.0); newShape.getProperties().put("fill_color", getFill_color().getRGB() * 1.0); getView().getController().updateShape(get_Shape(), newShape); dispose(); } }); } @Override public void setupKeySetandShape() { setSet(get_Shape().getProperties().keySet()); } }
UTF-8
Java
2,565
java
EditPluginShape.java
Java
[]
null
[]
package eg.edu.alexu.csd.oop.draw.cs60.view; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import eg.edu.alexu.csd.oop.draw.Shape; public class EditPluginShape extends CreateDialogue { public EditPluginShape(Shape shape, String title, View view, ArrayList<String> filters) { super(shape, title, view, filters); } @Override public void addPosition() { JPanel panel = new JPanel(); JLabel label = new JLabel("Position - X"); JTextField textfield = new JTextField(new Double(get_Shape().getPosition().getX()).toString(), 5); getLabels().add(label); panel.add(label); getTextFields().add(textfield); panel.add(textfield); getContentPane().add(panel); panel = new JPanel(); label = new JLabel("Position - Y"); textfield = new JTextField(new Double(get_Shape().getPosition().getY()).toString(), 5); getLabels().add(label); panel.add(label); getTextFields().add(textfield); panel.add(textfield); getContentPane().add(panel); } @Override public void addButtonListener() { getDraw().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Shape newShape = null; try { newShape = (Shape) get_Shape().clone(); } catch (CloneNotSupportedException e1) { e1.printStackTrace(); } int i = 2; if (newShape != null) { newShape.setPosition( new Point(new Double(Double.parseDouble(getTextFields().get(0).getText())).intValue(), new Double(Double.parseDouble(getTextFields().get(1).getText())).intValue())); newShape.getProperties().put("position-x", new Double(Double.parseDouble(getTextFields().get(0).getText()))); newShape.getProperties().put("position-y", new Double(Double.parseDouble(getTextFields().get(1).getText()))); for (i = 2; i < getLabels().size() - 1; i++) { newShape.getProperties().put(getLabels().get(i).getText(), Double.parseDouble(getTextFields().get(i).getText())); } } newShape.setColor(getColor()); newShape.setFillColor(getFill_color()); newShape.getProperties().put("color", getColor().getRGB() * 1.0); newShape.getProperties().put("fill_color", getFill_color().getRGB() * 1.0); getView().getController().updateShape(get_Shape(), newShape); dispose(); } }); } @Override public void setupKeySetandShape() { setSet(get_Shape().getProperties().keySet()); } }
2,565
0.682651
0.676023
79
31.468355
25.497995
100
false
false
0
0
0
0
0
0
3.164557
false
false
9
da881e175a1e8af6781900a77d2cb10529628721
2,637,109,929,007
8c87a5d8fcc74a84ef2716442a1d8585c3fb31c0
/Home/src/main/java/com/stv/android/home/fragment/contentFragment/FragmentTwo.java
4ce954afc9a2190f0b9d7c2ba54b0e8859742feb
[]
no_license
psmaoalove/let-sgo
https://github.com/psmaoalove/let-sgo
abf3b96702e795423f44c672b65c874d0148659b
0fe047b4c438a9bc33f02927d6901d5d6ed75770
refs/heads/master
2021-08-22T04:51:44.906000
2017-11-29T10:10:48
2017-11-29T10:10:48
112,459,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stv.android.home.fragment.contentFragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.android.stv.com.home.R; import com.stv.android.home.fragment.BaseFragment; public class FragmentTwo extends BaseFragment { TextView mtext; public static FragmentTwo newInstance() { FragmentTwo fragment = new FragmentTwo(); return fragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.layout_navigation_header, container, false); mtext = (TextView) view.findViewById(R.id.text); return view; } }
UTF-8
Java
995
java
FragmentTwo.java
Java
[]
null
[]
package com.stv.android.home.fragment.contentFragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.android.stv.com.home.R; import com.stv.android.home.fragment.BaseFragment; public class FragmentTwo extends BaseFragment { TextView mtext; public static FragmentTwo newInstance() { FragmentTwo fragment = new FragmentTwo(); return fragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.layout_navigation_header, container, false); mtext = (TextView) view.findViewById(R.id.text); return view; } }
995
0.738693
0.738693
33
29.121212
27.803158
123
false
false
0
0
0
0
0
0
0.606061
false
false
9
293f97185be51fc5c4a136d29c66bdc6e93d362a
29,729,763,641,476
3aed7fb65fb30db95e7f454796763c4e50c6adda
/DED/src/uoc/ei/practica/Repository.java
71e4b1226e4f7335041827c94c7e14b7461b306a
[]
no_license
MarcColom/DED
https://github.com/MarcColom/DED
4f92e8760ecbd9ba9470f07cdb3fda9645714aca
ee9975b5e55b1803ed6cc578b879834da0c9a219
refs/heads/master
2016-08-04T18:12:12.083000
2015-03-28T11:40:49
2015-03-28T11:40:49
33,031,309
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uoc.ei.practica; import java.util.Comparator; import java.util.Date; import uoc.ei.tads.Contenidor; import uoc.ei.tads.Iterador; /** * Classe que model una entitat Repositori */ public class Repository extends IdentifiedObject { /** * identificador del repositori */ private String idRepository; /** * path del repositori */ private String path; /** * descripciรณ del repositori */ private String description; /** * llista encadenada de grups d'un repositori */ private IdentifiedList<Group> groups; /** * indicador de l'activitat del repositori */ private int activity; /** * llista encadenada de branches * */ private IdentifiedList<Branch> branches; public Repository(String idRepository, String path, String description) { this.idRepository = idRepository; this.groups= new IdentifiedList<Group>(); this.path=path; this.description=description; this.branches = new IdentifiedList<Branch>(); this.addTrunkBranch("Trunk"); } /** * comparador dels repositoris. */ public static final Comparator REPOSITORIES_COMPARATOR = new Comparator<String>(){ @Override public int compare(String repo1, String repo2) { return (int)(repo1.compareTo(repo2)); } }; /** * mรจtode que proprociona una representaciรณ en forma de string d'un repositori */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("path: ").append(this.path).append(Messages.LS); sb.append("description: ").append(this.description).append(Messages.LS); sb.append("activity: ").append(this.activity).append(Messages.LS); sb.append("branches: ").append(Messages.LS); if (this.branches.estaBuit()) sb.append(Messages.PREFIX).append(""); else { Iterador<Branch> it = this.branches.elements(); while (it.hiHaSeguent()) sb.append(Messages.PREFIX).append(it.seguent()); } if (!this.groups.estaBuit()) { sb.append(Messages.LS); sb.append("groups: ").append(Messages.LS); Iterador<Group> it = this.groups.elements(); while (it.hiHaSeguent()) sb.append(Messages.PREFIX).append(it.seguent()); } sb.append(Messages.LS); return sb.toString(); } /** * mรจtode que afegeix un nou grup a un repositori * @param group */ public void addGroup(Group group) { this.groups.afegirAlFinal(group); } /** * mรจtode que verifica que algun grups de l'usuari estร  a la llista de grups del repositori * @param user * @return */ public boolean hasPermission(User user) { boolean found = false; Group g= null; Iterador<Group> groupsUser = user.groups(); while (groupsUser.hiHaSeguent() && !found) { g = groupsUser.seguent(); found = (this.groups.getIdentifiedObject(g.getIdentifier())!=null); } return found; } /** * mรจtode que afegeix una nova revisiรณ sobre un fitxer * @param user usuari que afegeix una nova revisiรณ * @param dateTime data en la que es produeix una nova revisiรณ * @param filePath fitxer sobre el que es realitza una nova revisiรณ * @param newSourceCode codi de la nova revisiรณ * @param idRevision identificador de la nova revisiรณ */ public void addRevision(String idBranch, User user, Date dateTime, String filePath, String newSourceCode, int idRevision) { File f = null; Branch b = findBranch(idBranch); f = b.getFile(filePath); if (f==null) f = b.addFile(filePath); f.addRevision(user, dateTime, newSourceCode, idRevision); } public void addTrunkBranch(String idBranch) { Branch b = new Branch(idBranch); this.branches.afegirAlFinal(b); } public Branch addBranch(String idSourceBranch, String idTargetBranch, String idUser) { Branch b = new Branch(idSourceBranch, idTargetBranch, idUser); this.branches.afegirAlFinal(b); return b; } /** * mรจtode que retorna un contenidor de branques * @return retorna el contenidor de branques */ public Contenidor<Branch> branches() { return this.branches; } /** * mรจtode que incrementa en una unitat l'activitat d'un repositori */ public void incActivity() { this.activity++; } /** * mรจtode que retorna l'activitat d'un repositori * @return */ public int getActivity() { return this.activity; } /** * mรจtode que retorna una revisiรณ d'un fitxer sobre una determinada revisiรณ * @param filePath path del fitxer * @param idRevision identificador de la revisiรณ * @return retorna la revisiรณ a cercar o null en el cas que no existeixi */ public Revision getRevision(String idBranch, String filePath, int idRevision) throws EIException { Revision r = null; Branch b = findBranch(idBranch); if (b!=null) r = b.getRevision(filePath, idRevision); return r; } public Branch findBranch(String idBranch) { Branch b = null; for (Iterador<Branch> it = branches.elements(); it.hiHaSeguent(); ) { b = it.seguent(); if (b.getBranch().equals(idBranch)) { return b; } } b = null; return b; } }
UTF-8
Java
5,013
java
Repository.java
Java
[]
null
[]
package uoc.ei.practica; import java.util.Comparator; import java.util.Date; import uoc.ei.tads.Contenidor; import uoc.ei.tads.Iterador; /** * Classe que model una entitat Repositori */ public class Repository extends IdentifiedObject { /** * identificador del repositori */ private String idRepository; /** * path del repositori */ private String path; /** * descripciรณ del repositori */ private String description; /** * llista encadenada de grups d'un repositori */ private IdentifiedList<Group> groups; /** * indicador de l'activitat del repositori */ private int activity; /** * llista encadenada de branches * */ private IdentifiedList<Branch> branches; public Repository(String idRepository, String path, String description) { this.idRepository = idRepository; this.groups= new IdentifiedList<Group>(); this.path=path; this.description=description; this.branches = new IdentifiedList<Branch>(); this.addTrunkBranch("Trunk"); } /** * comparador dels repositoris. */ public static final Comparator REPOSITORIES_COMPARATOR = new Comparator<String>(){ @Override public int compare(String repo1, String repo2) { return (int)(repo1.compareTo(repo2)); } }; /** * mรจtode que proprociona una representaciรณ en forma de string d'un repositori */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("path: ").append(this.path).append(Messages.LS); sb.append("description: ").append(this.description).append(Messages.LS); sb.append("activity: ").append(this.activity).append(Messages.LS); sb.append("branches: ").append(Messages.LS); if (this.branches.estaBuit()) sb.append(Messages.PREFIX).append(""); else { Iterador<Branch> it = this.branches.elements(); while (it.hiHaSeguent()) sb.append(Messages.PREFIX).append(it.seguent()); } if (!this.groups.estaBuit()) { sb.append(Messages.LS); sb.append("groups: ").append(Messages.LS); Iterador<Group> it = this.groups.elements(); while (it.hiHaSeguent()) sb.append(Messages.PREFIX).append(it.seguent()); } sb.append(Messages.LS); return sb.toString(); } /** * mรจtode que afegeix un nou grup a un repositori * @param group */ public void addGroup(Group group) { this.groups.afegirAlFinal(group); } /** * mรจtode que verifica que algun grups de l'usuari estร  a la llista de grups del repositori * @param user * @return */ public boolean hasPermission(User user) { boolean found = false; Group g= null; Iterador<Group> groupsUser = user.groups(); while (groupsUser.hiHaSeguent() && !found) { g = groupsUser.seguent(); found = (this.groups.getIdentifiedObject(g.getIdentifier())!=null); } return found; } /** * mรจtode que afegeix una nova revisiรณ sobre un fitxer * @param user usuari que afegeix una nova revisiรณ * @param dateTime data en la que es produeix una nova revisiรณ * @param filePath fitxer sobre el que es realitza una nova revisiรณ * @param newSourceCode codi de la nova revisiรณ * @param idRevision identificador de la nova revisiรณ */ public void addRevision(String idBranch, User user, Date dateTime, String filePath, String newSourceCode, int idRevision) { File f = null; Branch b = findBranch(idBranch); f = b.getFile(filePath); if (f==null) f = b.addFile(filePath); f.addRevision(user, dateTime, newSourceCode, idRevision); } public void addTrunkBranch(String idBranch) { Branch b = new Branch(idBranch); this.branches.afegirAlFinal(b); } public Branch addBranch(String idSourceBranch, String idTargetBranch, String idUser) { Branch b = new Branch(idSourceBranch, idTargetBranch, idUser); this.branches.afegirAlFinal(b); return b; } /** * mรจtode que retorna un contenidor de branques * @return retorna el contenidor de branques */ public Contenidor<Branch> branches() { return this.branches; } /** * mรจtode que incrementa en una unitat l'activitat d'un repositori */ public void incActivity() { this.activity++; } /** * mรจtode que retorna l'activitat d'un repositori * @return */ public int getActivity() { return this.activity; } /** * mรจtode que retorna una revisiรณ d'un fitxer sobre una determinada revisiรณ * @param filePath path del fitxer * @param idRevision identificador de la revisiรณ * @return retorna la revisiรณ a cercar o null en el cas que no existeixi */ public Revision getRevision(String idBranch, String filePath, int idRevision) throws EIException { Revision r = null; Branch b = findBranch(idBranch); if (b!=null) r = b.getRevision(filePath, idRevision); return r; } public Branch findBranch(String idBranch) { Branch b = null; for (Iterador<Branch> it = branches.elements(); it.hiHaSeguent(); ) { b = it.seguent(); if (b.getBranch().equals(idBranch)) { return b; } } b = null; return b; } }
5,013
0.686498
0.685697
199
24.085426
24.111294
99
false
false
0
0
0
0
0
0
1.904523
false
false
9
c1e467fed55cd986bfe689ace2bc32ebe334e0c8
14,834,817,048,662
7085a3395521d4da1a945d6911fb721cfde3d94c
/QueensThatCanAttacktheKing.java
820bbf938bf7324bfc4bc226f69ca4e663c83620
[]
no_license
elliotcho/LeetCode-Questions
https://github.com/elliotcho/LeetCode-Questions
1565656b0ade5f063156ce2b30310e9e8e56fc6a
f6e67effef52a30f12d7a30668ef4804baf41600
refs/heads/master
2023-03-26T16:19:32.366000
2021-03-12T07:05:32
2021-03-12T07:05:32
228,947,390
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Solution { public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) { List<List<Integer>> res=new ArrayList<>(); boolean[][] seen=new boolean[8][8]; for(int[] q: queens){ seen[q[0]][q[1]]=true; } int[] directions={-1,0,1}; for(int i=0;i<directions.length;i++){ for(int j=0;j<directions.length;j++){ if(i==1 && j==1){j++;} int x=king[0]; int y=king[1]; while(x+directions[i]>=0 && x+directions[i]<8 && y+directions[j]>=0 && y+directions[j]<8){ x+=directions[i]; y+=directions[j]; if(seen[x][y]==true){ res.add(Arrays.asList(x, y)); break; } } } } return res; } }
UTF-8
Java
1,043
java
QueensThatCanAttacktheKing.java
Java
[]
null
[]
class Solution { public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) { List<List<Integer>> res=new ArrayList<>(); boolean[][] seen=new boolean[8][8]; for(int[] q: queens){ seen[q[0]][q[1]]=true; } int[] directions={-1,0,1}; for(int i=0;i<directions.length;i++){ for(int j=0;j<directions.length;j++){ if(i==1 && j==1){j++;} int x=king[0]; int y=king[1]; while(x+directions[i]>=0 && x+directions[i]<8 && y+directions[j]>=0 && y+directions[j]<8){ x+=directions[i]; y+=directions[j]; if(seen[x][y]==true){ res.add(Arrays.asList(x, y)); break; } } } } return res; } }
1,043
0.35187
0.33557
33
29.60606
18.984745
80
false
false
0
0
0
0
0
0
0.606061
false
false
9
e1cce9236eaa8f2dd41e64d87fd531dfd4aa04ae
6,889,127,566,026
d0b1d529779c983c6c95f8b9120a16edcb5722b7
/src/main/java/org/cc/security/DummyAuthenticationManager.java
820048cd79d3937600cccdf26d9f90812731c3e6
[]
no_license
yaitskov/cloud48
https://github.com/yaitskov/cloud48
2a2b5b067ac377e452fd291541349add0dd31917
58aee6ff4fb21c469da85be0c5ffd8a259018c60
refs/heads/master
2016-09-06T19:36:44.664000
2012-12-29T12:09:11
2012-12-29T12:09:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.cc.security; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; /** * daneel yaitskov */ public class DummyAuthenticationManager implements AuthenticationManager { private static final Logger logger = LoggerFactory.getLogger(DummyAuthenticationManager.class); @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { logger.debug("authenticate"); return authentication; } }
UTF-8
Java
679
java
DummyAuthenticationManager.java
Java
[ { "context": "ork.security.core.AuthenticationException;\n\n/**\n * daneel yaitskov\n */\npublic class DummyAuthenticationManager imple", "end": 303, "score": 0.9997298121452332, "start": 288, "tag": "NAME", "value": "daneel yaitskov" } ]
null
[]
package org.cc.security; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; /** * <NAME> */ public class DummyAuthenticationManager implements AuthenticationManager { private static final Logger logger = LoggerFactory.getLogger(DummyAuthenticationManager.class); @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { logger.debug("authenticate"); return authentication; } }
670
0.807069
0.804124
21
31.333334
32.85804
102
false
false
0
0
0
0
0
0
0.428571
false
false
9
8e81bbc38c77232c56b4946cef418efe5cd3bcea
6,493,990,569,988
7526afd8d2a0b1954fe7f982e0fe4f188fc0fbca
/src/main/java/idv/lc/string/FirstUniqChar.java
a644c9a1e2ce7a6b7416b0a58e40b4fdb7c1e908
[]
no_license
dixentw/lcns
https://github.com/dixentw/lcns
cfd3946614caf8ac4d60cb08ee2f38581824f365
bd347cb790e9689243c5c6b0a8dfd520b3ba2439
refs/heads/master
2021-06-15T15:43:17.272000
2019-09-01T08:54:01
2019-09-01T08:54:01
132,464,424
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package idv.lc.string; import java.util.*; public class FirstUniqChar { /* * 1. naive ๅ…ฉๅ€‹่ฟดๅœˆ O(n^2) * 2. ๅ…ˆ็”จ 26ๅ€‹ int[] ๅญ˜่ตทไพ†๏ผŒๅœจ่ฟดๅœˆ้€ฒๅŽปๆŽƒ O(2n), ไฝ†ไธ็Ÿฅ้“char range * 3. use assumption, ๅฐฑ็”จ2ๅฏฆไฝœๅง * [FAIL] * test case "cc" * -> this is the first index setup problem */ public int firstUniqChar(String s) { int[] cs = new int[26]; for (int i=0; i<s.length(); i++) { cs[s.charAt(i)-'a']++; } for (int i=0; i<s.length(); i++) { if (cs[s.charAt(i)-'a'] == 1) { return i; } } return -1; } public int firstUniqCharOLD(String s) { int[] cs = new int[26]; for (int i=0; i<s.length(); i++) { cs[s.charAt(i)-'a']++; } int first = Integer.MAX_VALUE; for (int i=0; i<cs.length; i++) { if (cs[i] == 1 && s.indexOf((char)(i+'a')) < first) { // [FAIL] `i+'0'` first = s.indexOf((char)(i+'a')); // FAIL `i+'0'` } } if (first == Integer.MAX_VALUE) { return -1; } return first; } }
UTF-8
Java
1,196
java
FirstUniqChar.java
Java
[]
null
[]
package idv.lc.string; import java.util.*; public class FirstUniqChar { /* * 1. naive ๅ…ฉๅ€‹่ฟดๅœˆ O(n^2) * 2. ๅ…ˆ็”จ 26ๅ€‹ int[] ๅญ˜่ตทไพ†๏ผŒๅœจ่ฟดๅœˆ้€ฒๅŽปๆŽƒ O(2n), ไฝ†ไธ็Ÿฅ้“char range * 3. use assumption, ๅฐฑ็”จ2ๅฏฆไฝœๅง * [FAIL] * test case "cc" * -> this is the first index setup problem */ public int firstUniqChar(String s) { int[] cs = new int[26]; for (int i=0; i<s.length(); i++) { cs[s.charAt(i)-'a']++; } for (int i=0; i<s.length(); i++) { if (cs[s.charAt(i)-'a'] == 1) { return i; } } return -1; } public int firstUniqCharOLD(String s) { int[] cs = new int[26]; for (int i=0; i<s.length(); i++) { cs[s.charAt(i)-'a']++; } int first = Integer.MAX_VALUE; for (int i=0; i<cs.length; i++) { if (cs[i] == 1 && s.indexOf((char)(i+'a')) < first) { // [FAIL] `i+'0'` first = s.indexOf((char)(i+'a')); // FAIL `i+'0'` } } if (first == Integer.MAX_VALUE) { return -1; } return first; } }
1,196
0.430944
0.411713
43
25.60465
18.632479
83
false
false
0
0
0
0
0
0
0.511628
false
false
9
316d6ffb50c7273c80dd193432be807e2eb69b36
15,255,723,881,099
746fd646fbe3267caecc7a6606a1cb51785d3439
/src/main/java/utilities/SHA1Hasher.java
51b2b65f57417add62a30ba3d9383dde095dddbe
[]
no_license
gustavclausen/custom-p2p-network
https://github.com/gustavclausen/custom-p2p-network
de38c8c6abf15f714adb7100a7c072c68f949a30
4763ef264145035984e04b0b55ce519cfa804f81
refs/heads/master
2020-04-05T01:12:03.694000
2019-01-24T13:47:00
2019-01-24T13:47:00
156,427,551
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.java.utilities; import main.java.PeerAddress; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class SHA1Hasher { /** * Returns the hash-value of IP and port (combined) which are defined in the 'PeerAddress'-object taken as * argument */ public static BigInteger hashAddress(PeerAddress address) { String formattedAddress = address.getIp().concat(" " + Integer.toString(address.getPort())); BigInteger hash = hash(formattedAddress); if (hash == null) throw new NumberFormatException("Could not hash the address: " + formattedAddress); return hash; } /** * Returns the hash-value of a single integer taken as argument */ public static BigInteger hashKey(int key) { BigInteger hash = hash(Integer.toString(key)); if (hash == null) throw new NumberFormatException("Could not hash the key: " + key); return hash; } /** * The actual hash-function (SHA-1). * The function produces a 160-bit hash-value, and afterwards converts the value from a hexadecimal to a decimal * value. This value is stored in a 'BigInteger'-object, which is able to "hold" and represent this value. * The advantage of representing this value in a 'BigInteger'-object is to make it possible to compare two values * (a "less or greater than"-comparison) which this class supports. * * Source: http://www.sha1-online.com/sha1-java/ (accessed 2018-11-06) */ private static BigInteger hash(String input) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] hashedBytes = md.digest(input.getBytes()); StringBuffer sb = new StringBuffer(); for (byte hashedByte : hashedBytes) { sb.append(Integer.toString((hashedByte & 0xff) + 0x100, 16).substring(1)); } // Convert from hexadecimal to BigInteger (Precision: (2^32)^Integer.MAX_VALUE) return new BigInteger(sb.toString(), 16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } }
UTF-8
Java
2,256
java
SHA1Hasher.java
Java
[]
null
[]
package main.java.utilities; import main.java.PeerAddress; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class SHA1Hasher { /** * Returns the hash-value of IP and port (combined) which are defined in the 'PeerAddress'-object taken as * argument */ public static BigInteger hashAddress(PeerAddress address) { String formattedAddress = address.getIp().concat(" " + Integer.toString(address.getPort())); BigInteger hash = hash(formattedAddress); if (hash == null) throw new NumberFormatException("Could not hash the address: " + formattedAddress); return hash; } /** * Returns the hash-value of a single integer taken as argument */ public static BigInteger hashKey(int key) { BigInteger hash = hash(Integer.toString(key)); if (hash == null) throw new NumberFormatException("Could not hash the key: " + key); return hash; } /** * The actual hash-function (SHA-1). * The function produces a 160-bit hash-value, and afterwards converts the value from a hexadecimal to a decimal * value. This value is stored in a 'BigInteger'-object, which is able to "hold" and represent this value. * The advantage of representing this value in a 'BigInteger'-object is to make it possible to compare two values * (a "less or greater than"-comparison) which this class supports. * * Source: http://www.sha1-online.com/sha1-java/ (accessed 2018-11-06) */ private static BigInteger hash(String input) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] hashedBytes = md.digest(input.getBytes()); StringBuffer sb = new StringBuffer(); for (byte hashedByte : hashedBytes) { sb.append(Integer.toString((hashedByte & 0xff) + 0x100, 16).substring(1)); } // Convert from hexadecimal to BigInteger (Precision: (2^32)^Integer.MAX_VALUE) return new BigInteger(sb.toString(), 16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } }
2,256
0.643617
0.630762
63
34.809525
34.687199
117
false
false
0
0
0
0
0
0
0.365079
false
false
9
6f1c5fe4b40bc553e13bc4dc7fcd68d6e522e11f
12,429,635,383,796
f109a6e182a25b8032b8d7c7fc9430c6743af22b
/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/uimodel/UIMenuItem.java
515d75fb747630e07d013023afd8c6acdb05567f
[ "Apache-2.0" ]
permissive
davetcc/tcMenu
https://github.com/davetcc/tcMenu
8b0fb05f4ee70b11cac34a1b1b761e0096ad307f
7bc42e45c1e824fbab432e3095d3512299049707
refs/heads/master
2023-09-02T10:26:39.542000
2023-09-01T07:57:30
2023-09-01T07:57:30
130,464,600
237
23
Apache-2.0
false
2023-07-25T10:04:00
2018-04-21T10:47:16
2023-07-20T12:35:02
2023-07-25T10:03:59
11,009
214
23
19
Java
false
false
/* * Copyright (c) 2016-2019 https://www.thecoderscorner.com (Dave Cherry). * This product is licensed under an Apache license, see the LICENSE file in the top-level directory. * */ package com.thecoderscorner.menu.editorui.uimodel; import com.thecoderscorner.menu.domain.CustomBuilderMenuItem; import com.thecoderscorner.menu.domain.MenuItem; import com.thecoderscorner.menu.domain.MenuItemBuilder; import com.thecoderscorner.menu.domain.state.MenuTree; import com.thecoderscorner.menu.domain.util.MenuItemHelper; import com.thecoderscorner.menu.editorui.MenuEditorApp; import com.thecoderscorner.menu.editorui.dialog.EditCallbackFunctionDialog; import com.thecoderscorner.menu.editorui.generator.core.VariableNameGenerator; import com.thecoderscorner.menu.editorui.project.MenuIdChooser; import com.thecoderscorner.menu.editorui.util.SafeNavigator; import com.thecoderscorner.menu.persist.LocaleMappingHandler; import javafx.application.Platform; import javafx.beans.Observable; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.geometry.Insets; import javafx.scene.Node; import javafx.scene.control.*; import javafx.scene.control.cell.TextFieldListCell; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.scene.input.DataFormat; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.stage.Stage; import java.io.IOException; import java.util.*; import java.util.function.BiConsumer; import java.util.stream.Collectors; import static com.thecoderscorner.menu.editorui.uimodel.UIMenuItem.StringFieldType.*; import static com.thecoderscorner.menu.editorui.util.StringHelper.isStringEmptyOrNull; import static java.lang.System.Logger.Level.ERROR; /** * This represents a UI editor that can edit the fields of a MenuItem, specialised for each type of menu item in a * similar way to the underlying items. * Special thanks should go to <a href="http://bekwam.blogspot.co.uk/2014/10/cut-copy-and-paste-from-javafx-menubar.html">bekwam.blogspot.co.uk</a> * for the copy and paste functionality. * @param <T> */ public abstract class UIMenuItem<T extends MenuItem> { protected final System.Logger logger = System.getLogger(getClass().getSimpleName()); public enum StringFieldType { VARIABLE, MANDATORY, OPTIONAL, CALLBACK_FN } public static final String NO_FUNCTION_DEFINED = "NoCallback"; private final MenuIdChooser chooser; protected VariableNameGenerator variableNameGenerator; protected final BiConsumer<MenuItem, MenuItem> changeConsumer; private T menuItem; protected LocaleMappingHandler localHandler; MenuTree menuTree; private final String urlDocs; private TextField idField; protected TextField nameField; private ToggleButton notLocalizedButton; protected TextField variableField; protected TextField functionNameTextField; private Button functionBtn; private TextField eepromField; private Label errorsField; private CheckBox readOnlyCheck; private CheckBox noRemoteCheck; private CheckBox visibleCheck; private CheckBox staticDataRamCheckbox; private List<TextField> textFieldsForCopy = Collections.emptyList(); protected final ResourceBundle bundle = MenuEditorApp.getBundle(); public UIMenuItem(T menuItem, MenuIdChooser chooser, VariableNameGenerator gen, BiConsumer<MenuItem, MenuItem> changeConsumer, String urlDocs) { this.menuItem = menuItem; this.chooser = chooser; this.variableNameGenerator = gen; this.changeConsumer = changeConsumer; this.urlDocs = urlDocs; } public GridPane initPanel(MenuTree tree, LocaleMappingHandler handler) { this.menuTree = tree; this.localHandler = handler; GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setMaxWidth(9999); grid.setPadding(new Insets(0, 10, 6, 10)); ColumnConstraints col1 = new ColumnConstraints(120); ColumnConstraints col2 = new ColumnConstraints(280, 300, Double.MAX_VALUE); ColumnConstraints col3 = new ColumnConstraints(100, 100, Double.MAX_VALUE); col2.setHgrow(Priority.ALWAYS); grid.getColumnConstraints().addAll(col1, col2, col3); int idx = 0; String itemType; if(menuItem instanceof CustomBuilderMenuItem customItem) { itemType = switch(customItem.getMenuType()) { case AUTHENTICATION -> "AuthenticationItem"; case REMOTE_IOT_MONITOR -> "Remote/IoT Monitor"; }; } else { itemType = (menuItem != null) ? menuItem.getClass().getSimpleName() : ""; } Hyperlink docsHyperlink = new Hyperlink(bundle.getString("menu.editor.online.help") + " " + itemType); docsHyperlink.setTooltip(new Tooltip(urlDocs)); docsHyperlink.setOnAction(evt -> SafeNavigator.safeNavigateTo(urlDocs)); docsHyperlink.setId("onlineDocsHyperlink"); grid.add(docsHyperlink, 0, idx, 2, 1); idx++; errorsField = new Label(); errorsField.setId("uiItemErrors"); errorsField.setManaged(false); errorsField.setVisible(false); errorsField.setText(""); grid.add(errorsField, 0, idx, 3, 1); idx++; grid.add(new Label(bundle.getString("menu.editor.id.field")), 0, idx); idField = new TextField(String.valueOf(menuItem.getId())); idField.setId("idField"); idField.setEditable(false); grid.add(idField, 1, idx++, 2, 1); grid.add(new Label(bundle.getString("menu.editor.name.field")), 0, idx); String text = localHandler.getWithLocaleInitIfNeeded(menuItemToLocale("name"), menuItem.getName()); nameField = new TextField(text); nameField.setId("nameField"); nameField.setTooltip(new Tooltip("The name of the menu item as shown on the device and sent remotely")); grid.add(nameField, 1, idx); //var item = new javafx.scene.control.MenuItem(bundle.getString("locale.dialog.not.localized")); //item.setOnAction(event -> localHasChanged(Locale.of("--"))); notLocalizedButton = new ToggleButton(bundle.getString("locale.dialog.not.localized")); notLocalizedButton.setSelected(!menuItem.getName().startsWith("%") || menuItem.getName().startsWith("%%")); notLocalizedButton.setDisable(!localHandler.isLocalSupportEnabled()); notLocalizedButton.setMaxWidth(9999); grid.add(notLocalizedButton, 2, idx++); nameField.textProperty().addListener((observableValue, s, t1) -> { if(variableNameGenerator.getUncommittedItems().contains(getMenuItem().getId())) { variableField.setText(variableNameGenerator.makeNameToVar(getMenuItem(), nameField.getText())); } callChangeConsumer(); }); idx++; grid.add(new Label(bundle.getString("menu.editor.variable.name")), 0, idx); var varName = menuItem.getVariableName(); if(isStringEmptyOrNull(varName)) { varName = variableNameGenerator.makeNameToVar(getMenuItem()); } variableField = new TextField(varName); variableField.setId("variableField"); variableField.setTooltip(new Tooltip("The name of the variable to be created. Always prepended with menu")); variableField.textProperty().addListener(this::coreValueChanged); variableField.setMaxWidth(9999); variableField.setOnKeyPressed((keyEvent) -> variableNameGenerator.getUncommittedItems().remove(getMenuItem().getId())); var varSyncButton = new Button(bundle.getString("menu.editor.button.sync")); varSyncButton.setMaxWidth(9999); varSyncButton.setOnAction(actionEvent -> { variableField.setText(variableNameGenerator.makeNameToVar(getMenuItem(), nameField.getText())); callChangeConsumer(); }); varSyncButton.setId("varSyncButton"); grid.add(variableField, 1, idx, 1, 1); grid.add(varSyncButton, 2, idx, 1, 1); if(MenuItemHelper.eepromSizeForItem(getMenuItem()) != 0) { idx++; grid.add(new Label(bundle.getString("menu.editor.eeprom.save.addr")), 0, idx); eepromField = new TextField(String.valueOf(menuItem.getEepromAddress())); eepromField.setId("eepromField"); eepromField.setMaxWidth(9999); eepromField.setTooltip(new Tooltip("The location in EEPROM to store this value or -1 for none")); eepromField.textProperty().addListener(this::coreValueChanged); TextFormatterUtils.applyIntegerFormatToField(eepromField); grid.add(eepromField, 1, idx); Button eepromNextBtn = new Button(bundle.getString("menu.editor.button.auto")); eepromNextBtn.setId("eepromNextBtn"); eepromNextBtn.setMaxWidth(9999); grid.add(eepromNextBtn, 2, idx); TextFormatterUtils.applyIntegerFormatToField(eepromField); eepromNextBtn.setOnAction((act) -> eepromField.setText(Integer.toString(chooser.nextHighestEeprom()))); } else eepromField = null; if(itemRequiresFunctionCallback()) { idx++; grid.add(new Label(bundle.getString("menu.editor.callback.function")), 0, idx); String functionName = menuItem.getFunctionName(); functionNameTextField = new TextField(!isStringEmptyOrNull(functionName) ? functionName : NO_FUNCTION_DEFINED); functionNameTextField.textProperty().addListener(this::coreValueChanged); functionNameTextField.setId("functionNameTextField"); functionNameTextField.setMaxWidth(9999); functionNameTextField.setTooltip(new Tooltip("Defines the callback function or blank for none. Advanced: start with @ to define only in header")); grid.add(functionNameTextField, 1, idx); functionBtn = new Button(bundle.getString("menu.editor.button.edit")); functionBtn.setId("functionEditor"); functionBtn.setMaxWidth(9999); grid.add(functionBtn, 2, idx); functionBtn.setOnAction(event -> { var stage = (Stage) functionNameTextField.getScene().getWindow(); var dlg = new EditCallbackFunctionDialog(stage, true, functionNameTextField.getText(), menuItem); dlg.getResult().ifPresent(res -> functionNameTextField.setText(res)); }); } idx = internalInitPanel(grid, idx); readOnlyCheck = new CheckBox(bundle.getString("menu.editor.check.read.only")); readOnlyCheck.setId("readOnlyField"); readOnlyCheck.setTooltip(new Tooltip("Prevents any editing of the item both locally and remotely")); readOnlyCheck.setOnAction(this::checkboxChanged); readOnlyCheck.setSelected(menuItem.isReadOnly()); noRemoteCheck = new CheckBox(bundle.getString("menu.editor.check.local.only")); noRemoteCheck.setId("dontRemoteField"); noRemoteCheck.setTooltip(new Tooltip("Prevent the item being sent over IoT when checked")); noRemoteCheck.setOnAction(this::checkboxChanged); noRemoteCheck.setSelected(menuItem.isLocalOnly()); visibleCheck = new CheckBox(bundle.getString("menu.editor.check.visible")); visibleCheck.setId("visibleItemField"); visibleCheck.setTooltip(new Tooltip("Control the visibility of this item")); visibleCheck.setOnAction(this::checkboxChanged); visibleCheck.setSelected(menuItem.isVisible()); idx++; grid.add(readOnlyCheck, 1, idx, 2, 1); idx++; grid.add(noRemoteCheck, 1, idx, 2, 1); idx++; grid.add(visibleCheck, 1, idx, 2, 1); staticDataRamCheckbox = new CheckBox(bundle.getString("menu.editor.check.static.in.ram")); staticDataRamCheckbox.setId("memLocationCheck"); staticDataRamCheckbox.setTooltip(new Tooltip("Store static data in RAM instead of FLASH so it can be changed at runtime")); staticDataRamCheckbox.setOnAction(this::checkboxChanged); staticDataRamCheckbox.setSelected(menuItem.isStaticDataInRAM()); idx++; grid.add(staticDataRamCheckbox, 1, idx, 2, 1); textFieldsForCopy = grid.getChildren().stream() .filter(node -> node instanceof TextField) .map(textField -> (TextField) textField) .collect(Collectors.toList()); return grid; } public void localeDidChange() { notLocalizedButton.setDisable(localHandler.isLocalSupportEnabled()); } public boolean shouldAvoidLocalization() { return !localHandler.isLocalSupportEnabled() || notLocalizedButton.isSelected(); } protected String menuItemToLocale(String name) { return "%menu." + menuItem.getId() + "." + name; } protected boolean itemRequiresFunctionCallback() { return true; } public void focusFirst() { // need to defer this until the form is properly loaded. Platform.runLater(() -> nameField.requestFocus()); } private String getFunctionName(List<FieldError> errors) { if(functionNameTextField == null) return ""; String text = functionNameTextField.getText(); if (isStringEmptyOrNull(text) || NO_FUNCTION_DEFINED.equals(text)) { return null; } return safeStringFromProperty(functionNameTextField.textProperty(), "Callback", errors, 32, CALLBACK_FN); } protected void getChangedDefaults(MenuItemBuilder<?,?> builder, List<FieldError> errorsBuilder) { int eeprom = -1; if (eepromField != null) { eeprom = safeIntFromProperty(eepromField.textProperty(), "EEPROM", errorsBuilder, -1, Short.MAX_VALUE); } String name = safeStringFromProperty(nameField.textProperty(), "Name", errorsBuilder, 19, MANDATORY); if(!shouldAvoidLocalization()) { String localeEntry = menuItemToLocale("name"); localHandler.setLocalSpecificEntry(localeEntry.substring(1), name); name = localeEntry; } String varName = safeStringFromProperty(variableField.textProperty(), "VariableName", errorsBuilder, 128, OPTIONAL); builder.withFunctionName(getFunctionName(errorsBuilder)) .withEepromAddr(eeprom) .withName(name) .withVariableName(varName) .withReadOnly(readOnlyCheck.isSelected()) .withLocalOnly(noRemoteCheck.isSelected()) .withVisible(visibleCheck.isSelected()) .withStaticDataInRAM(staticDataRamCheckbox.isSelected()); } protected Optional<T> getItemOrReportError(T item, List<FieldError> errors) { if(errors.isEmpty()) { errorsField.setVisible(false); errorsField.setManaged(false); return Optional.of(item); } else { String errorText = bundle.getString("menu.editor.fields.preventing.save") + "\n"; errorText += errors.stream() .map(error-> error.getField() + " - " + error.getMessage()) .collect(Collectors.joining("\n")); errorsField.setText(errorText); errorsField.setVisible(true); errorsField.setManaged(true); } return Optional.empty(); } protected List<String> getValueLocalizedFromUIList(ObservableList<String> items) { if (!shouldAvoidLocalization()) { var itemsLocaleList = new ArrayList<String>(); for (int i = 0; i < items.size(); i++) { String enumEntryName = getEnumEntryKey(i); localHandler.setLocalSpecificEntry(enumEntryName, items.get(i)); itemsLocaleList.add("%" + enumEntryName); } return itemsLocaleList; } else { return items; } } protected ObservableList<String> createLocalizedList(ListView<String> listView, List<String> enumEntries, ObservableList<String> list) { if(!shouldAvoidLocalization()) { var itemsLocaleList = new ArrayList<String>(); for(int i = 0; i< enumEntries.size(); i++) { String enumEntryName = getEnumEntryKey(i); itemsLocaleList.add(localHandler.getWithLocaleInitIfNeeded("%" + enumEntryName, enumEntries.get(i))); } list = FXCollections.observableList(itemsLocaleList); } listView.setEditable(true); listView.setPrefHeight(120); listView.setItems(list); listView.setCellFactory(TextFieldListCell.forListView()); final ListView<String> lv = listView; listView.setOnEditCommit(t -> lv.getItems().set(t.getIndex(), t.getNewValue())); listView.setMinHeight(100); return list; } protected ControlButtons prepareAddRemoveButtons(ListView<String> listView, GridPane grid, int idx) { Button addButton = new Button(bundle.getString("core.add.button")); addButton.setId("addEnumEntry"); Button removeButton = new Button(bundle.getString("core.remove.button")); removeButton.setId("removeEnumEntry"); removeButton.setDisable(true); HBox hbox = new HBox(addButton, removeButton); grid.add(hbox, 1, idx); addButton.setOnAction(event -> { listView.getItems().add("ChangeMe"); listView.getSelectionModel().selectLast(); callChangeConsumer(); }); removeButton.setOnAction(event -> { String selectedItem = listView.getSelectionModel().getSelectedItem(); if(selectedItem != null) { listView.getItems().remove(selectedItem); callChangeConsumer(); } }); listView.setId("enumList"); listView.getSelectionModel().selectFirst(); listView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { removeButton.setDisable(newValue == null); callChangeConsumer(); }); return new ControlButtons(addButton, removeButton); } protected String getEnumEntryKey(int i) { return "unknown" + i; } @SuppressWarnings("unused") protected void coreValueChanged(Observable observable, String oldVal, String newVal) { callChangeConsumer(); } @SuppressWarnings("unused") protected void checkboxChanged(ActionEvent actionEvent) { callChangeConsumer(); } protected void callChangeConsumer() { getChangedMenuItem().ifPresent(newItem -> { changeConsumer.accept(menuItem, newItem); menuItem = newItem; }); } protected abstract Optional<T> getChangedMenuItem(); protected abstract int internalInitPanel(GridPane pane, int idx); public T getMenuItem() { return menuItem; } /** * Gets the string value from a text field and validates it is correct in terms of length and content. * @param stringProperty the string property to get the string from * @param field the field name to report errors against * @param errorsBuilder the list of errors reported so far * @param maxLen the maximum allowable length * @param fieldType the type of field which changes the method of evaluation. * @return the string once checked */ protected String safeStringFromProperty(StringProperty stringProperty, String field, List<FieldError> errorsBuilder, int maxLen, StringFieldType fieldType) { String s = stringProperty.get(); if(s == null) { if(fieldType != OPTIONAL) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.unpopulated"), field)); } return ""; } // check the size of the text is within the allowable range. if(fieldType == OPTIONAL && s.length() > maxLen) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.field.len") + " " + maxLen + " characters", field)); } else if(fieldType != OPTIONAL && (s.length() > maxLen || s.isEmpty())) { errorsBuilder.add(new FieldError("field must not be blank and less than " + maxLen + " characters", field)); } // callbacks have a special mode where they are still function names, but they can start with "@" // otherwise check the variable or text against the regex. if(fieldType == CALLBACK_FN && !s.matches("^@?[\\p{L}_$][\\p{L}\\p{N}_]*$")) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.variable.invalid"), field)); } else if(fieldType == VARIABLE && !s.matches("^[\\p{L}_$][\\p{L}\\p{N}_]*$")) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.variable.invalid"), field)); } else if((fieldType == MANDATORY || fieldType == OPTIONAL) && !s.matches("^[\\p{L}\\p{N}\\s\\-_*%()\\.]*$")) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.text.invalid"), field)); } return s; } /** * Gets the integer value from a text field property and validates it again the conditions provided. It must be * a number and within the ranges provided. * @param strProp the property to convert * @param field the field to report errors against * @param errorsBuilder the list of errors recorded so far * @param min the minimum value allowed * @param max the maximum value allowed * @return the integer value if all conditions are met */ protected int safeIntFromProperty(StringProperty strProp, String field, List<FieldError> errorsBuilder, int min, int max) { String s = strProp.get(); if (isStringEmptyOrNull(s)) { return 0; } int val = 0; try { val = Integer.parseInt(s); if(val < min || val > max) { errorsBuilder.add(new FieldError("Value must be between " + min + " and " + max, field)); } } catch (NumberFormatException e) { errorsBuilder.add(new FieldError("Value must be a number", field)); } return val; } public boolean handleCut() { Clipboard systemClipboard = Clipboard.getSystemClipboard(); TextField focused = getFocusedTextField(); if (focused == null) return false; String text = focused.getSelectedText(); ClipboardContent content = new ClipboardContent(); content.putString(text); systemClipboard.setContent(content); IndexRange range = focused.getSelection(); String origText = focused.getText(); String firstPart = origText.substring(0, range.getStart()); String lastPart = origText.substring(range.getEnd()); focused.setText(firstPart + lastPart); focused.positionCaret(range.getStart()); return true; } private TextField getFocusedTextField() { return textFieldsForCopy.stream().filter(Node::isFocused).findFirst().orElse(null); } public boolean handleCopy() { TextField focused = getFocusedTextField(); if (focused == null) return false; String text = focused.getSelectedText(); if (!isStringEmptyOrNull(text)) { Clipboard systemClipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(text); systemClipboard.setContent(content); } return true; } public boolean handlePaste() { TextField focusedTF = getFocusedTextField(); if(focusedTF == null) return false; Clipboard systemClipboard = Clipboard.getSystemClipboard(); if (!systemClipboard.hasContent(DataFormat.PLAIN_TEXT)) { return true; } String clipboardText = systemClipboard.getString(); IndexRange range = focusedTF.getSelection(); String origText = focusedTF.getText(); int endPos; String updatedText; String firstPart = origText.substring(0, range.getStart()); String lastPart = origText.substring(range.getEnd()); updatedText = firstPart + clipboardText + lastPart; if (range.getStart() == range.getEnd()) { endPos = range.getEnd() + clipboardText.length(); } else { endPos = range.getStart() + clipboardText.length(); } focusedTF.setText(updatedText); focusedTF.positionCaret(endPos); return true; } public boolean canCopy() { TextField tf = getFocusedTextField(); return (tf != null && !isStringEmptyOrNull(tf.getSelectedText())); } public boolean canPaste() { Clipboard systemClipboard = Clipboard.getSystemClipboard(); return systemClipboard.hasContent(DataFormat.PLAIN_TEXT); } protected static class FieldError { private final String field; private final String message; public FieldError(String message, String field) { this.field = field; this.message = message; } public String getField() { return field; } public String getMessage() { return message; } } public record ControlButtons(Button addButton, Button removeButton) { } }
UTF-8
Java
26,092
java
UIMenuItem.java
Java
[ { "context": "t (c) 2016-2019 https://www.thecoderscorner.com (Dave Cherry).\n * This product is licensed under an Apache lic", "end": 75, "score": 0.9995788335800171, "start": 64, "tag": "NAME", "value": "Dave Cherry" } ]
null
[]
/* * Copyright (c) 2016-2019 https://www.thecoderscorner.com (<NAME>). * This product is licensed under an Apache license, see the LICENSE file in the top-level directory. * */ package com.thecoderscorner.menu.editorui.uimodel; import com.thecoderscorner.menu.domain.CustomBuilderMenuItem; import com.thecoderscorner.menu.domain.MenuItem; import com.thecoderscorner.menu.domain.MenuItemBuilder; import com.thecoderscorner.menu.domain.state.MenuTree; import com.thecoderscorner.menu.domain.util.MenuItemHelper; import com.thecoderscorner.menu.editorui.MenuEditorApp; import com.thecoderscorner.menu.editorui.dialog.EditCallbackFunctionDialog; import com.thecoderscorner.menu.editorui.generator.core.VariableNameGenerator; import com.thecoderscorner.menu.editorui.project.MenuIdChooser; import com.thecoderscorner.menu.editorui.util.SafeNavigator; import com.thecoderscorner.menu.persist.LocaleMappingHandler; import javafx.application.Platform; import javafx.beans.Observable; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.geometry.Insets; import javafx.scene.Node; import javafx.scene.control.*; import javafx.scene.control.cell.TextFieldListCell; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.scene.input.DataFormat; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.stage.Stage; import java.io.IOException; import java.util.*; import java.util.function.BiConsumer; import java.util.stream.Collectors; import static com.thecoderscorner.menu.editorui.uimodel.UIMenuItem.StringFieldType.*; import static com.thecoderscorner.menu.editorui.util.StringHelper.isStringEmptyOrNull; import static java.lang.System.Logger.Level.ERROR; /** * This represents a UI editor that can edit the fields of a MenuItem, specialised for each type of menu item in a * similar way to the underlying items. * Special thanks should go to <a href="http://bekwam.blogspot.co.uk/2014/10/cut-copy-and-paste-from-javafx-menubar.html">bekwam.blogspot.co.uk</a> * for the copy and paste functionality. * @param <T> */ public abstract class UIMenuItem<T extends MenuItem> { protected final System.Logger logger = System.getLogger(getClass().getSimpleName()); public enum StringFieldType { VARIABLE, MANDATORY, OPTIONAL, CALLBACK_FN } public static final String NO_FUNCTION_DEFINED = "NoCallback"; private final MenuIdChooser chooser; protected VariableNameGenerator variableNameGenerator; protected final BiConsumer<MenuItem, MenuItem> changeConsumer; private T menuItem; protected LocaleMappingHandler localHandler; MenuTree menuTree; private final String urlDocs; private TextField idField; protected TextField nameField; private ToggleButton notLocalizedButton; protected TextField variableField; protected TextField functionNameTextField; private Button functionBtn; private TextField eepromField; private Label errorsField; private CheckBox readOnlyCheck; private CheckBox noRemoteCheck; private CheckBox visibleCheck; private CheckBox staticDataRamCheckbox; private List<TextField> textFieldsForCopy = Collections.emptyList(); protected final ResourceBundle bundle = MenuEditorApp.getBundle(); public UIMenuItem(T menuItem, MenuIdChooser chooser, VariableNameGenerator gen, BiConsumer<MenuItem, MenuItem> changeConsumer, String urlDocs) { this.menuItem = menuItem; this.chooser = chooser; this.variableNameGenerator = gen; this.changeConsumer = changeConsumer; this.urlDocs = urlDocs; } public GridPane initPanel(MenuTree tree, LocaleMappingHandler handler) { this.menuTree = tree; this.localHandler = handler; GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setMaxWidth(9999); grid.setPadding(new Insets(0, 10, 6, 10)); ColumnConstraints col1 = new ColumnConstraints(120); ColumnConstraints col2 = new ColumnConstraints(280, 300, Double.MAX_VALUE); ColumnConstraints col3 = new ColumnConstraints(100, 100, Double.MAX_VALUE); col2.setHgrow(Priority.ALWAYS); grid.getColumnConstraints().addAll(col1, col2, col3); int idx = 0; String itemType; if(menuItem instanceof CustomBuilderMenuItem customItem) { itemType = switch(customItem.getMenuType()) { case AUTHENTICATION -> "AuthenticationItem"; case REMOTE_IOT_MONITOR -> "Remote/IoT Monitor"; }; } else { itemType = (menuItem != null) ? menuItem.getClass().getSimpleName() : ""; } Hyperlink docsHyperlink = new Hyperlink(bundle.getString("menu.editor.online.help") + " " + itemType); docsHyperlink.setTooltip(new Tooltip(urlDocs)); docsHyperlink.setOnAction(evt -> SafeNavigator.safeNavigateTo(urlDocs)); docsHyperlink.setId("onlineDocsHyperlink"); grid.add(docsHyperlink, 0, idx, 2, 1); idx++; errorsField = new Label(); errorsField.setId("uiItemErrors"); errorsField.setManaged(false); errorsField.setVisible(false); errorsField.setText(""); grid.add(errorsField, 0, idx, 3, 1); idx++; grid.add(new Label(bundle.getString("menu.editor.id.field")), 0, idx); idField = new TextField(String.valueOf(menuItem.getId())); idField.setId("idField"); idField.setEditable(false); grid.add(idField, 1, idx++, 2, 1); grid.add(new Label(bundle.getString("menu.editor.name.field")), 0, idx); String text = localHandler.getWithLocaleInitIfNeeded(menuItemToLocale("name"), menuItem.getName()); nameField = new TextField(text); nameField.setId("nameField"); nameField.setTooltip(new Tooltip("The name of the menu item as shown on the device and sent remotely")); grid.add(nameField, 1, idx); //var item = new javafx.scene.control.MenuItem(bundle.getString("locale.dialog.not.localized")); //item.setOnAction(event -> localHasChanged(Locale.of("--"))); notLocalizedButton = new ToggleButton(bundle.getString("locale.dialog.not.localized")); notLocalizedButton.setSelected(!menuItem.getName().startsWith("%") || menuItem.getName().startsWith("%%")); notLocalizedButton.setDisable(!localHandler.isLocalSupportEnabled()); notLocalizedButton.setMaxWidth(9999); grid.add(notLocalizedButton, 2, idx++); nameField.textProperty().addListener((observableValue, s, t1) -> { if(variableNameGenerator.getUncommittedItems().contains(getMenuItem().getId())) { variableField.setText(variableNameGenerator.makeNameToVar(getMenuItem(), nameField.getText())); } callChangeConsumer(); }); idx++; grid.add(new Label(bundle.getString("menu.editor.variable.name")), 0, idx); var varName = menuItem.getVariableName(); if(isStringEmptyOrNull(varName)) { varName = variableNameGenerator.makeNameToVar(getMenuItem()); } variableField = new TextField(varName); variableField.setId("variableField"); variableField.setTooltip(new Tooltip("The name of the variable to be created. Always prepended with menu")); variableField.textProperty().addListener(this::coreValueChanged); variableField.setMaxWidth(9999); variableField.setOnKeyPressed((keyEvent) -> variableNameGenerator.getUncommittedItems().remove(getMenuItem().getId())); var varSyncButton = new Button(bundle.getString("menu.editor.button.sync")); varSyncButton.setMaxWidth(9999); varSyncButton.setOnAction(actionEvent -> { variableField.setText(variableNameGenerator.makeNameToVar(getMenuItem(), nameField.getText())); callChangeConsumer(); }); varSyncButton.setId("varSyncButton"); grid.add(variableField, 1, idx, 1, 1); grid.add(varSyncButton, 2, idx, 1, 1); if(MenuItemHelper.eepromSizeForItem(getMenuItem()) != 0) { idx++; grid.add(new Label(bundle.getString("menu.editor.eeprom.save.addr")), 0, idx); eepromField = new TextField(String.valueOf(menuItem.getEepromAddress())); eepromField.setId("eepromField"); eepromField.setMaxWidth(9999); eepromField.setTooltip(new Tooltip("The location in EEPROM to store this value or -1 for none")); eepromField.textProperty().addListener(this::coreValueChanged); TextFormatterUtils.applyIntegerFormatToField(eepromField); grid.add(eepromField, 1, idx); Button eepromNextBtn = new Button(bundle.getString("menu.editor.button.auto")); eepromNextBtn.setId("eepromNextBtn"); eepromNextBtn.setMaxWidth(9999); grid.add(eepromNextBtn, 2, idx); TextFormatterUtils.applyIntegerFormatToField(eepromField); eepromNextBtn.setOnAction((act) -> eepromField.setText(Integer.toString(chooser.nextHighestEeprom()))); } else eepromField = null; if(itemRequiresFunctionCallback()) { idx++; grid.add(new Label(bundle.getString("menu.editor.callback.function")), 0, idx); String functionName = menuItem.getFunctionName(); functionNameTextField = new TextField(!isStringEmptyOrNull(functionName) ? functionName : NO_FUNCTION_DEFINED); functionNameTextField.textProperty().addListener(this::coreValueChanged); functionNameTextField.setId("functionNameTextField"); functionNameTextField.setMaxWidth(9999); functionNameTextField.setTooltip(new Tooltip("Defines the callback function or blank for none. Advanced: start with @ to define only in header")); grid.add(functionNameTextField, 1, idx); functionBtn = new Button(bundle.getString("menu.editor.button.edit")); functionBtn.setId("functionEditor"); functionBtn.setMaxWidth(9999); grid.add(functionBtn, 2, idx); functionBtn.setOnAction(event -> { var stage = (Stage) functionNameTextField.getScene().getWindow(); var dlg = new EditCallbackFunctionDialog(stage, true, functionNameTextField.getText(), menuItem); dlg.getResult().ifPresent(res -> functionNameTextField.setText(res)); }); } idx = internalInitPanel(grid, idx); readOnlyCheck = new CheckBox(bundle.getString("menu.editor.check.read.only")); readOnlyCheck.setId("readOnlyField"); readOnlyCheck.setTooltip(new Tooltip("Prevents any editing of the item both locally and remotely")); readOnlyCheck.setOnAction(this::checkboxChanged); readOnlyCheck.setSelected(menuItem.isReadOnly()); noRemoteCheck = new CheckBox(bundle.getString("menu.editor.check.local.only")); noRemoteCheck.setId("dontRemoteField"); noRemoteCheck.setTooltip(new Tooltip("Prevent the item being sent over IoT when checked")); noRemoteCheck.setOnAction(this::checkboxChanged); noRemoteCheck.setSelected(menuItem.isLocalOnly()); visibleCheck = new CheckBox(bundle.getString("menu.editor.check.visible")); visibleCheck.setId("visibleItemField"); visibleCheck.setTooltip(new Tooltip("Control the visibility of this item")); visibleCheck.setOnAction(this::checkboxChanged); visibleCheck.setSelected(menuItem.isVisible()); idx++; grid.add(readOnlyCheck, 1, idx, 2, 1); idx++; grid.add(noRemoteCheck, 1, idx, 2, 1); idx++; grid.add(visibleCheck, 1, idx, 2, 1); staticDataRamCheckbox = new CheckBox(bundle.getString("menu.editor.check.static.in.ram")); staticDataRamCheckbox.setId("memLocationCheck"); staticDataRamCheckbox.setTooltip(new Tooltip("Store static data in RAM instead of FLASH so it can be changed at runtime")); staticDataRamCheckbox.setOnAction(this::checkboxChanged); staticDataRamCheckbox.setSelected(menuItem.isStaticDataInRAM()); idx++; grid.add(staticDataRamCheckbox, 1, idx, 2, 1); textFieldsForCopy = grid.getChildren().stream() .filter(node -> node instanceof TextField) .map(textField -> (TextField) textField) .collect(Collectors.toList()); return grid; } public void localeDidChange() { notLocalizedButton.setDisable(localHandler.isLocalSupportEnabled()); } public boolean shouldAvoidLocalization() { return !localHandler.isLocalSupportEnabled() || notLocalizedButton.isSelected(); } protected String menuItemToLocale(String name) { return "%menu." + menuItem.getId() + "." + name; } protected boolean itemRequiresFunctionCallback() { return true; } public void focusFirst() { // need to defer this until the form is properly loaded. Platform.runLater(() -> nameField.requestFocus()); } private String getFunctionName(List<FieldError> errors) { if(functionNameTextField == null) return ""; String text = functionNameTextField.getText(); if (isStringEmptyOrNull(text) || NO_FUNCTION_DEFINED.equals(text)) { return null; } return safeStringFromProperty(functionNameTextField.textProperty(), "Callback", errors, 32, CALLBACK_FN); } protected void getChangedDefaults(MenuItemBuilder<?,?> builder, List<FieldError> errorsBuilder) { int eeprom = -1; if (eepromField != null) { eeprom = safeIntFromProperty(eepromField.textProperty(), "EEPROM", errorsBuilder, -1, Short.MAX_VALUE); } String name = safeStringFromProperty(nameField.textProperty(), "Name", errorsBuilder, 19, MANDATORY); if(!shouldAvoidLocalization()) { String localeEntry = menuItemToLocale("name"); localHandler.setLocalSpecificEntry(localeEntry.substring(1), name); name = localeEntry; } String varName = safeStringFromProperty(variableField.textProperty(), "VariableName", errorsBuilder, 128, OPTIONAL); builder.withFunctionName(getFunctionName(errorsBuilder)) .withEepromAddr(eeprom) .withName(name) .withVariableName(varName) .withReadOnly(readOnlyCheck.isSelected()) .withLocalOnly(noRemoteCheck.isSelected()) .withVisible(visibleCheck.isSelected()) .withStaticDataInRAM(staticDataRamCheckbox.isSelected()); } protected Optional<T> getItemOrReportError(T item, List<FieldError> errors) { if(errors.isEmpty()) { errorsField.setVisible(false); errorsField.setManaged(false); return Optional.of(item); } else { String errorText = bundle.getString("menu.editor.fields.preventing.save") + "\n"; errorText += errors.stream() .map(error-> error.getField() + " - " + error.getMessage()) .collect(Collectors.joining("\n")); errorsField.setText(errorText); errorsField.setVisible(true); errorsField.setManaged(true); } return Optional.empty(); } protected List<String> getValueLocalizedFromUIList(ObservableList<String> items) { if (!shouldAvoidLocalization()) { var itemsLocaleList = new ArrayList<String>(); for (int i = 0; i < items.size(); i++) { String enumEntryName = getEnumEntryKey(i); localHandler.setLocalSpecificEntry(enumEntryName, items.get(i)); itemsLocaleList.add("%" + enumEntryName); } return itemsLocaleList; } else { return items; } } protected ObservableList<String> createLocalizedList(ListView<String> listView, List<String> enumEntries, ObservableList<String> list) { if(!shouldAvoidLocalization()) { var itemsLocaleList = new ArrayList<String>(); for(int i = 0; i< enumEntries.size(); i++) { String enumEntryName = getEnumEntryKey(i); itemsLocaleList.add(localHandler.getWithLocaleInitIfNeeded("%" + enumEntryName, enumEntries.get(i))); } list = FXCollections.observableList(itemsLocaleList); } listView.setEditable(true); listView.setPrefHeight(120); listView.setItems(list); listView.setCellFactory(TextFieldListCell.forListView()); final ListView<String> lv = listView; listView.setOnEditCommit(t -> lv.getItems().set(t.getIndex(), t.getNewValue())); listView.setMinHeight(100); return list; } protected ControlButtons prepareAddRemoveButtons(ListView<String> listView, GridPane grid, int idx) { Button addButton = new Button(bundle.getString("core.add.button")); addButton.setId("addEnumEntry"); Button removeButton = new Button(bundle.getString("core.remove.button")); removeButton.setId("removeEnumEntry"); removeButton.setDisable(true); HBox hbox = new HBox(addButton, removeButton); grid.add(hbox, 1, idx); addButton.setOnAction(event -> { listView.getItems().add("ChangeMe"); listView.getSelectionModel().selectLast(); callChangeConsumer(); }); removeButton.setOnAction(event -> { String selectedItem = listView.getSelectionModel().getSelectedItem(); if(selectedItem != null) { listView.getItems().remove(selectedItem); callChangeConsumer(); } }); listView.setId("enumList"); listView.getSelectionModel().selectFirst(); listView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { removeButton.setDisable(newValue == null); callChangeConsumer(); }); return new ControlButtons(addButton, removeButton); } protected String getEnumEntryKey(int i) { return "unknown" + i; } @SuppressWarnings("unused") protected void coreValueChanged(Observable observable, String oldVal, String newVal) { callChangeConsumer(); } @SuppressWarnings("unused") protected void checkboxChanged(ActionEvent actionEvent) { callChangeConsumer(); } protected void callChangeConsumer() { getChangedMenuItem().ifPresent(newItem -> { changeConsumer.accept(menuItem, newItem); menuItem = newItem; }); } protected abstract Optional<T> getChangedMenuItem(); protected abstract int internalInitPanel(GridPane pane, int idx); public T getMenuItem() { return menuItem; } /** * Gets the string value from a text field and validates it is correct in terms of length and content. * @param stringProperty the string property to get the string from * @param field the field name to report errors against * @param errorsBuilder the list of errors reported so far * @param maxLen the maximum allowable length * @param fieldType the type of field which changes the method of evaluation. * @return the string once checked */ protected String safeStringFromProperty(StringProperty stringProperty, String field, List<FieldError> errorsBuilder, int maxLen, StringFieldType fieldType) { String s = stringProperty.get(); if(s == null) { if(fieldType != OPTIONAL) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.unpopulated"), field)); } return ""; } // check the size of the text is within the allowable range. if(fieldType == OPTIONAL && s.length() > maxLen) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.field.len") + " " + maxLen + " characters", field)); } else if(fieldType != OPTIONAL && (s.length() > maxLen || s.isEmpty())) { errorsBuilder.add(new FieldError("field must not be blank and less than " + maxLen + " characters", field)); } // callbacks have a special mode where they are still function names, but they can start with "@" // otherwise check the variable or text against the regex. if(fieldType == CALLBACK_FN && !s.matches("^@?[\\p{L}_$][\\p{L}\\p{N}_]*$")) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.variable.invalid"), field)); } else if(fieldType == VARIABLE && !s.matches("^[\\p{L}_$][\\p{L}\\p{N}_]*$")) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.variable.invalid"), field)); } else if((fieldType == MANDATORY || fieldType == OPTIONAL) && !s.matches("^[\\p{L}\\p{N}\\s\\-_*%()\\.]*$")) { errorsBuilder.add(new FieldError(bundle.getString("menu.editor.core.text.invalid"), field)); } return s; } /** * Gets the integer value from a text field property and validates it again the conditions provided. It must be * a number and within the ranges provided. * @param strProp the property to convert * @param field the field to report errors against * @param errorsBuilder the list of errors recorded so far * @param min the minimum value allowed * @param max the maximum value allowed * @return the integer value if all conditions are met */ protected int safeIntFromProperty(StringProperty strProp, String field, List<FieldError> errorsBuilder, int min, int max) { String s = strProp.get(); if (isStringEmptyOrNull(s)) { return 0; } int val = 0; try { val = Integer.parseInt(s); if(val < min || val > max) { errorsBuilder.add(new FieldError("Value must be between " + min + " and " + max, field)); } } catch (NumberFormatException e) { errorsBuilder.add(new FieldError("Value must be a number", field)); } return val; } public boolean handleCut() { Clipboard systemClipboard = Clipboard.getSystemClipboard(); TextField focused = getFocusedTextField(); if (focused == null) return false; String text = focused.getSelectedText(); ClipboardContent content = new ClipboardContent(); content.putString(text); systemClipboard.setContent(content); IndexRange range = focused.getSelection(); String origText = focused.getText(); String firstPart = origText.substring(0, range.getStart()); String lastPart = origText.substring(range.getEnd()); focused.setText(firstPart + lastPart); focused.positionCaret(range.getStart()); return true; } private TextField getFocusedTextField() { return textFieldsForCopy.stream().filter(Node::isFocused).findFirst().orElse(null); } public boolean handleCopy() { TextField focused = getFocusedTextField(); if (focused == null) return false; String text = focused.getSelectedText(); if (!isStringEmptyOrNull(text)) { Clipboard systemClipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(text); systemClipboard.setContent(content); } return true; } public boolean handlePaste() { TextField focusedTF = getFocusedTextField(); if(focusedTF == null) return false; Clipboard systemClipboard = Clipboard.getSystemClipboard(); if (!systemClipboard.hasContent(DataFormat.PLAIN_TEXT)) { return true; } String clipboardText = systemClipboard.getString(); IndexRange range = focusedTF.getSelection(); String origText = focusedTF.getText(); int endPos; String updatedText; String firstPart = origText.substring(0, range.getStart()); String lastPart = origText.substring(range.getEnd()); updatedText = firstPart + clipboardText + lastPart; if (range.getStart() == range.getEnd()) { endPos = range.getEnd() + clipboardText.length(); } else { endPos = range.getStart() + clipboardText.length(); } focusedTF.setText(updatedText); focusedTF.positionCaret(endPos); return true; } public boolean canCopy() { TextField tf = getFocusedTextField(); return (tf != null && !isStringEmptyOrNull(tf.getSelectedText())); } public boolean canPaste() { Clipboard systemClipboard = Clipboard.getSystemClipboard(); return systemClipboard.hasContent(DataFormat.PLAIN_TEXT); } protected static class FieldError { private final String field; private final String message; public FieldError(String message, String field) { this.field = field; this.message = message; } public String getField() { return field; } public String getMessage() { return message; } } public record ControlButtons(Button addButton, Button removeButton) { } }
26,087
0.655335
0.649854
620
41.08387
31.978159
158
false
false
0
0
0
0
0
0
0.809677
false
false
9
5e231b070e69e9cb2e47d7e095ca936dd69a3262
12,429,635,383,502
e3dd252c7464b7171a76e1f8f2784aebee5b438f
/src/graph/CloneGraph.java
73bdf8925d333c967669e3348904f8cc47986e85
[]
no_license
cserspring/leetcode
https://github.com/cserspring/leetcode
d6853a2798276b360bb65d222a2bb2435e4de360
76b07b81b73b176ba38d025775ab5b2b51c4c507
refs/heads/master
2020-05-21T04:22:09.408000
2016-11-01T06:09:42
2016-11-01T06:09:42
46,645,778
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package graph; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Queue; class UndirectedGraphNode { int label; List<UndirectedGraphNode> neighbors; UndirectedGraphNode(int x) { label = x; neighbors = new ArrayList<UndirectedGraphNode>(); } }; public class CloneGraph { public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) { if (node == null) return null; Map<UndirectedGraphNode, UndirectedGraphNode> createdNodes = new HashMap<UndirectedGraphNode, UndirectedGraphNode>(); Queue<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode>(); queue.add(node); UndirectedGraphNode nodeCpy = new UndirectedGraphNode(node.label); createdNodes.put(node, nodeCpy); while (!queue.isEmpty()) { UndirectedGraphNode curNode = queue.poll(); UndirectedGraphNode curNodeCpy = createdNodes.get(curNode); List<UndirectedGraphNode> neighbors = curNode.neighbors; for (UndirectedGraphNode neighbor : neighbors) { UndirectedGraphNode neighborCpy; if (createdNodes.containsKey(neighbor)) { neighborCpy = createdNodes.get(neighbor); } else { neighborCpy = new UndirectedGraphNode(neighbor.label); createdNodes.put(neighbor, neighborCpy); queue.add(neighbor); } curNodeCpy.neighbors.add(neighborCpy); } } return createdNodes.get(node); } public static void main(String[] args) { // TODO Auto-generated method stub } }
UTF-8
Java
1,671
java
CloneGraph.java
Java
[]
null
[]
package graph; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Queue; class UndirectedGraphNode { int label; List<UndirectedGraphNode> neighbors; UndirectedGraphNode(int x) { label = x; neighbors = new ArrayList<UndirectedGraphNode>(); } }; public class CloneGraph { public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) { if (node == null) return null; Map<UndirectedGraphNode, UndirectedGraphNode> createdNodes = new HashMap<UndirectedGraphNode, UndirectedGraphNode>(); Queue<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode>(); queue.add(node); UndirectedGraphNode nodeCpy = new UndirectedGraphNode(node.label); createdNodes.put(node, nodeCpy); while (!queue.isEmpty()) { UndirectedGraphNode curNode = queue.poll(); UndirectedGraphNode curNodeCpy = createdNodes.get(curNode); List<UndirectedGraphNode> neighbors = curNode.neighbors; for (UndirectedGraphNode neighbor : neighbors) { UndirectedGraphNode neighborCpy; if (createdNodes.containsKey(neighbor)) { neighborCpy = createdNodes.get(neighbor); } else { neighborCpy = new UndirectedGraphNode(neighbor.label); createdNodes.put(neighbor, neighborCpy); queue.add(neighbor); } curNodeCpy.neighbors.add(neighborCpy); } } return createdNodes.get(node); } public static void main(String[] args) { // TODO Auto-generated method stub } }
1,671
0.67325
0.67325
50
32.419998
27.42779
125
false
false
0
0
0
0
0
0
1.32
false
false
9
bf1ade5987451db1e39b6ae4039f21fa32445785
17,179,904,518
659afd1ed36b50596825f381a56af9be62e032f0
/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/vision/org/apache/jsp/user/jsp_0020files/museums/museums_jsp.java
e8a2e7fd31edbb1a72f179716454f9ff66c85b15
[]
no_license
Deepak-147/City-Blog
https://github.com/Deepak-147/City-Blog
cd6dc97bffbf9169b8fab4a5faa8e3de18cdae9e
83672059543e7310978d0af80e1f6cb279d5a694
refs/heads/master
2020-03-26T19:57:55.225000
2018-08-19T11:10:41
2018-08-19T11:10:41
145,296,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.52 * Generated at: 2014-08-16 06:17:39 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.user.jsp_0020files.museums; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class museums_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; static { _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1); _jspx_dependants.put("/user/jsp files/checksession.jsp", Long.valueOf(1407909381372L)); } private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n"); out.write("\r\n"); out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n"); out.write("<title>Insert title here</title>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("\r\n"); String usernm = (String) session.getAttribute("username"); if(usernm==null) response.sendRedirect("/vision/user/jsp files/index/login_signup.jsp"); out.write("\r\n"); out.write("\r\n"); out.write("</body>\r\n"); out.write("</html>"); out.write("\r\n"); out.write("<script src=\"/vision/user/js files/scroll.js\" type=\"text/javascript\"></script>\r\n"); out.write("<title>Insert title here</title>\r\n"); out.write("<style>\r\n"); out.write("/* hover menu*/\r\n"); out.write("#indiv tr td a\r\n"); out.write("{\r\n"); out.write(" float: left;\r\n"); out.write("\tdisplay: block;\r\n"); out.write("\twidth: 160px;\r\n"); out.write("\theight: 45px;\r\n"); out.write("\tpadding: 20px 0px 0 0px;\r\n"); out.write("\tmargin: 0px 10px 0px 10px ;\r\n"); out.write("\tfont-size: 18px;\r\n"); out.write("\ttext-align: center;\r\n"); out.write("\ttext-decoration: none;\r\n"); out.write("\tcolor:Black;\t\r\n"); out.write("\tfont-weight: bold;\r\n"); out.write("\toutline: none;\r\n"); out.write("\r\n"); out.write("}\r\n"); out.write("\r\n"); out.write("#indiv tr td a:hover,#indiv tr td .current\r\n"); out.write("{\r\n"); out.write(" border-radius: 10px;\r\n"); out.write(" background: Black ;\r\n"); out.write(" color: Orange; \r\n"); out.write("}\t\r\n"); out.write("\r\n"); out.write("#indiv tr td ul li ul li a:hover\r\n"); out.write("{\r\n"); out.write(" background:none;\r\n"); out.write(" \r\n"); out.write(" \r\n"); out.write(" color: White; \r\n"); out.write("}\r\n"); out.write("/* drop down menu*/\r\n"); out.write("/*body {\r\n"); out.write(" font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;\r\n"); out.write(" padding: 20px 50px 150px;\r\n"); out.write(" font-size: 13px;\r\n"); out.write(" text-align: center;\r\n"); out.write(" background: #E3CAA1;\r\n"); out.write("}*/\r\n"); out.write("\r\n"); out.write("#dropdown ul {\r\n"); out.write(" text-align: left;\r\n"); out.write(" display: inline;\r\n"); out.write(" margin: 0;\r\n"); out.write(" padding: 45px 10px 17px 5px;\r\n"); out.write(" list-style: none;\r\n"); out.write(" /*-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);\r\n"); out.write(" -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);\r\n"); out.write(" box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);*/\r\n"); out.write("}\r\n"); out.write("#dropdown ul li {\r\n"); out.write(" font: bold 16px/16px sans-serif;\r\n"); out.write(" display: inline-block;\r\n"); out.write(" margin-right: 5px;\r\n"); out.write(" position: relative;\r\n"); out.write(" padding: 10px 15px;\r\n"); out.write(" background: rgba(213, 35, 35, 0.67);\r\n"); out.write(" cursor: pointer;\r\n"); out.write(" -webkit-transition: all 0.2s;\r\n"); out.write(" -moz-transition: all 0.2s;\r\n"); out.write(" -ms-transition: all 0.2s;\r\n"); out.write(" -o-transition: all 0.2s;\r\n"); out.write(" transition: all 0.2s;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li:hover {\r\n"); out.write(" background: rgba(213, 35, 35, 0.67);\r\n"); out.write(" color: #fff;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li ul {\r\n"); out.write(" padding: 0px;\r\n"); out.write(" position: absolute;\r\n"); out.write(" top: 52px;\r\n"); out.write(" left: 0px;\r\n"); out.write(" width: 130px;\r\n"); out.write(" /*-webkit-box-shadow: none;\r\n"); out.write(" -moz-box-shadow: none;\r\n"); out.write(" box-shadow: none;*/\r\n"); out.write(" display: none;\r\n"); out.write(" opacity: 0;\r\n"); out.write(" visibility: hidden;\r\n"); out.write(" -webkit-transiton: opacity 0.2s;\r\n"); out.write(" -moz-transition: opacity 0.2s;\r\n"); out.write(" -ms-transition: opacity 0.2s;\r\n"); out.write(" -o-transition: opacity 0.2s;\r\n"); out.write(" -transition: opacity 0.2s;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li ul li { \r\n"); out.write(" background: rgba(199, 89, 38, 0.67);\r\n"); out.write(" display: block; \r\n"); out.write(" color: #fff;\r\n"); out.write(" //text-shadow: 0 -1px 0 #000;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li ul li:hover \r\n"); out.write("{ background: rgba(199, 89, 38, 0.67);display: none;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li:hover ul {\r\n"); out.write(" display: block;\r\n"); out.write(" opacity: 1;\r\n"); out.write(" visibility: visible;\r\n"); out.write("}\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("</style>\r\n"); out.write("\r\n"); out.write("</head>\r\n"); out.write("<body style=\"background:url(/vision/user/images/background/parquet_flooring-1920x1200.jpg); background-size: cover; \">\r\n"); out.write("<table align=\"center\" width=\"60%\">\r\n"); out.write(" <tr height=\"40\">\r\n"); out.write(" <td>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr height='50' >\r\n"); out.write(" <td>\r\n"); out.write(" <table id='indiv' align=\"center\"><!--table 2 inside table 1-->\r\n"); out.write(" <tr>\r\n"); out.write("\t <td><a href='/vision/user/jsp files/afterlogin/afterlogin_index.jsp' target='_parent'>HOME</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/about_us.jsp' target='_parent'>ABOUT US</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/contact_us.jsp' target='_parent'>CONTACT US</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/afterlogin/afterlogin_information.jsp' target='_parent'>INFORMATION RESOURCE</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/afterlogin/feedback.jsp' target='_parent'>FEEDBACK</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/afterlogin/afterlogin_features.jsp' target='_top'class='current'>FEATURES</a></td>\r\n"); out.write(" <td><img src='/vision/user/images/loginform/user1.png'></img></td>\r\n"); out.write("\t <td id=dropdown>\r\n"); out.write("\t <ul >\r\n"); out.write("\t <li style=\"width: 83px;height: 33px\">\r\n"); out.write(" Hi, "); String usrname=(String) session.getAttribute("username"); out.print(usrname ); out.write("\r\n"); out.write("\t\t <ul>\r\n"); out.write(" <li style=\"float: left;display: inherit; \" ><a href='/vision/LogoutServlet' style=\"font-size: inherit;text-align: left; width: 63px; height: 8px; \">Log Out</a></li>\r\n"); out.write(" \t <li style=\"float: left;display: inherit; \"><a href='/vision/UpdateServlet' style=\"font-size: inherit;text-align: left; width: 107px; height: 17px \">Update profile</a></li>\r\n"); out.write("\t\t </ul>\t\t\t\t\t\t\t\t\r\n"); out.write(" \t\t</li>\t\t\t \r\n"); out.write(" </ul> \r\n"); out.write(" </td> \r\n"); out.write(" \t\t\t\t \r\n"); out.write("\t </tr>\r\n"); out.write("\t\t\t \r\n"); out.write(" </table><!--end of table 2--> \r\n"); out.write(" </td> \t \r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <a name=\"top\"></a>\r\n"); out.write(" <br/>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">MUSEUMS IN UDAIPUR</p>\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" Udaipur is a majestic city that presents artifacts of the bygone age by the means of museums. These museums peep into the ancient times of the imperial city.\r\n"); out.write(" If you have planned to come to the city of Udaipur, then take out some time to visit the art museums of Udaipur.\r\n"); out.write(" These museums are made to preserve the priceless objects of the noble kings. Various museums of Udaipur offer a glimpse of the items that used to be the part of the regal lifestyle.\r\n"); out.write(" Udaipur Government is making constant efforts to preserve the artifacts of the previous age. If you are keen to know about the glorious past, these museums would be of great interest for you. \r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">CITY PALACE MUSEUM</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/city_palace_Udaipur1-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" More than four centuries ago, in A.D. 1559, Rana Udai Singh II the father of Rana Pratap, laid the Foundation of the City Palace after the birth of his grandson Amar Singh I and on the advice of a Hermit Goswami Prem Giriji Maharaj,\r\n"); out.write(" who had a small hut on this hill. The enormous complex of the old palace standing on a low ridge called Rana Magri (Rana's Hill) overlooking lake Pichola on the west is a tribute to the constructive genius and architectural taste of the Maharana's of Mewar,\r\n"); out.write(" ranging from Rana Udai Singh II to the present 76th Custodian of House of Mewar, Shriji Arvind Singh Mewar.\r\n"); out.write(" It has been so planned and integrated with the original building that the entire structure assumes a shape of one edifice from the exterior, with canopies, towers, domes, cupolas, bastions, beautifully carved balconies and ornamental turrets.\r\n"); out.write(" The City Palace built by Rana Udai Singh II has been added to and extended by the successive generations of Maharanas, notably by Rana Karan Singh, and Rana Sangram Singh II. Maharana Sajjan Singh and Maharana Fateh Singh further expanded the palace in the 19th century.\r\n"); out.write(" \r\n"); out.write(" <a href='/vision/user/jsp files/museums/citypalace.jsp' target='_parent' style=\"color: Orange\">Read More</a>\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">THE VINTAGE AND CLASSIC CAR COLLECTION</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/vintage-collection-of-classic-cars-museum-udaipur-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" A unique private collection of vintage cars of the House of Mewar - the world's longest serving dynasty\r\n"); out.write(" The Vintage & Classic Car Collection is a landmark in the city of Udaipur ever since it was inaugurated in February 2000. \r\n"); out.write(" The grand limousines and cars showcased in the Collection belong to the House of Mewar and are still in perfect running condition. \r\n"); out.write(" Visitors are privy to the display of the magnificent Rolls-Royce, 1939 Cadillac open convertibles, rare Mercedes models, 1936 Vauxhall and 1937 Opel models. \r\n"); out.write(" The Collection has been curated for the benefit of vintage car-lovers from India and all over the world; it is probably the only collection of its kind in India about which the global and indian press has written reams. \r\n"); out.write(" Awe-struck visitors to the Collection are narrated innumerable stories and anecdotes about the Maharanas of Mewar and their preferred Rolls-Royce or Mercedes customised at their request.\r\n"); out.write(" <a href='/vision/user/jsp files/museums/vintage.jsp' target='_parent' style=\"color: Orange\" >Read More</a>\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">AHAR MUSEUM</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/13731263-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" The Ahar Museum, Udaipur is named after the beautiful city Ahar, where this museum is located. Ahar is the capital of Sisodias and is about 3 Kms away from Udaipur, in Rajasthan. \r\n"); out.write(" There are various types of iron objects and also a wide variety of other objects of art forms in the magnificent Ahar Museum. These objects are around 5000 years old.\r\n"); out.write(" Earthen Pots are among the rare collection of antiquities in Ahar Museum.\r\n"); out.write(" The architectural pieces stored in the museum are extremely old, as a matter of fact some of the pieces date back to 1700 BC.\r\n"); out.write(" One of the major attractions and an eye catcher is a Buddha statue, which is a 10th century figure made out of metal.\r\n"); out.write(" There are a huge number of cenotaphs in Ahar Museum in Udaipur, India. There are about nineteen cenotaphs of the great Maharanas which are cremated there. \r\n"); out.write(" Among all the cenotaphs in Ahar Museum, Rajasthan, one of the most striking cenotaphs is that of Maharana Amar Singh, who ruled during the period 1597 to 1620.\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">SHILPGRAM MUSEUM</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/shilpgram-museum4-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" Literally meaning a \"Craftsmen's Village\" is a living ethnographic museum depicting the enormous diversities in craft, art & culture between various Indian states,\r\n"); out.write(" but the exquisite terracotta work mainly in dark red and dark brown sand material along with the wooden carvings are the forte of this ethnic village . \r\n"); out.write(" Shilpgram comprises 26 huts set in 70 acres of natural surroundings at the foot of the Aravali Hills.A colourful craft festival during winter seasons to the whole set up induces viatanity and zeal.\r\n"); out.write(" Situated 3 kms west of Udaipur near the Havala village is the Centre's Shilpgram - the Rural Arts and Crafts Complex. Spread over an undulating terrain of 130 bighas (70 Acres) of land and surrounded by the Aravallies, \r\n"); out.write(" the Rural Arts and Crafts Complex is conceived as a living enthnographic museum to depict the lifestyles of the folk and tribal people of the West Zone. Within this complex,\r\n"); out.write(" huts of the member states are constructed incorporating traditional architectural features of different geographical and ethnic groups residing within the West Zone of India comprising of five Federal States.\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">BHARTIYA LOK KALA MANDAL</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/lok-kala-mandal-udaipur-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\"> \r\n"); out.write(" Bhartiya Lok Kala Museum is one of the most famous museums of Udaipur, exhibiting the brilliant collection of folk articles of Rajasthan.\r\n"); out.write(" This rare compilation varies from typical rural-dresses, ornaments, puppets, masks, dolls, folk musical instruments, folk deities and paintings.\r\n"); out.write(" The museum is comfortably located in the building of Bhartiya Lok Kala Mandal near Chetak Circle in Udaipur city.\r\n"); out.write(" Mewar region of Rajasthan is known for its rich art and culture. Actually, the local handicrafts and things of art of this region have always been cherished all over the world.\r\n"); out.write(" With the intention to maintain this rich tradition, Bhartiya Lok Kala Mandal took the initiative, to start an institution, to encourage the local arts and crafts of Mewar.\r\n"); out.write(" Bhartiya Lok Kala Museum is a part of their program that displays the best art and craft of Mewar.\r\n"); out.write(" The museum portrays the remarkable collection of over past 44 years, gathered by the Bhartiya Lok Kala Mandal. To provide a summarized idea of the folk heritage of India, traditional attires, ornaments, miniature paintings and many other art objects are displayed here. Bhartiya Lok Kala Museum of Udaipur definitely requires a visit to closely observe the artistic and culturally rich region of Rajasthan. \r\n"); out.write(" </p><br/>\r\n"); out.write(" <a href='#top' style=\"color: Orange\">Back To Top</a>\r\n"); out.write(" </td>\r\n"); out.write(" </tr> \r\n"); out.write("</table>\r\n"); out.write("</body>\r\n"); out.write(" \r\n"); out.write(" \r\n"); out.write(" \r\n"); out.write(" "); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
UTF-8
Java
22,322
java
museums_jsp.java
Java
[ { "context": "\");\nString usrname=(String) session.getAttribute(\"username\");\n out.print(usrname );\n out.write(\"\\r", "end": 10139, "score": 0.9838929176330566, "start": 10131, "tag": "USERNAME", "value": "username" }, { "context": "te(\" More than four centuries ago, in A.D. 1559, Rana Udai Singh II the father of Rana Pratap, laid the Foundation", "end": 12864, "score": 0.9987645149230957, "start": 12849, "tag": "NAME", "value": "Rana Udai Singh" }, { "context": "go, in A.D. 1559, Rana Udai Singh II the father of Rana Pratap, laid the Foundation of the City Palace after the", "end": 12893, "score": 0.9993064999580383, "start": 12882, "tag": "NAME", "value": "Rana Pratap" }, { "context": "of the City Palace after the birth of his grandson Amar Singh I and on the advice of a Hermit Goswami Prem Giriji", "end": 12978, "score": 0.9063913226127625, "start": 12966, "tag": "NAME", "value": "Amar Singh I" }, { "context": "randson Amar Singh I and on the advice of a Hermit Goswami Prem Giriji Maharaj,\\r\\n\");\n out.write(\" w", "end": 13016, "score": 0.8990095257759094, "start": 13009, "tag": "NAME", "value": "Goswami" }, { "context": "Singh I and on the advice of a Hermit Goswami Prem Giriji Maharaj,\\r\\n\");\n out.write(\" who had a small hut o", "end": 13036, "score": 0.9963477253913879, "start": 13022, "tag": "NAME", "value": "Giriji Maharaj" }, { "context": "x of the old palace standing on a low ridge called Rana Magri (Rana's Hill) overlooking lake Pichola on the wes", "end": 13179, "score": 0.8729042410850525, "start": 13169, "tag": "NAME", "value": "Rana Magri" }, { "context": " of Mewar,\\r\\n\");\n out.write(\" ranging from Rana Udai Singh II to the present 76th Custodian of Hous", "end": 13369, "score": 0.5970371961593628, "start": 13363, "tag": "NAME", "value": "Rana U" }, { "context": "I to the present 76th Custodian of House of Mewar, Shriji Arvind Singh Mewar.\\r\\n\");\n out.write(\" It has been so ", "end": 13450, "score": 0.8692505359649658, "start": 13431, "tag": "NAME", "value": "Shriji Arvind Singh" }, { "context": "Custodian of House of Mewar, Shriji Arvind Singh Mewar.\\r\\n\");\n out.write(\" It has been so plan", "end": 13454, "score": 0.628786027431488, "start": 13452, "tag": "NAME", "value": "ew" }, { "context": "\\n\");\n out.write(\" The City Palace built by Rana Udai Singh II has been added to and extended by the su", "end": 13789, "score": 0.673177182674408, "start": 13780, "tag": "NAME", "value": "Rana Udai" }, { "context": "he successive generations of Maharanas, notably by Rana Karan Singh, and Rana Sangram Singh II. Maharana Sajjan Singh", "end": 13901, "score": 0.984330952167511, "start": 13885, "tag": "NAME", "value": "Rana Karan Singh" }, { "context": "ons of Maharanas, notably by Rana Karan Singh, and Rana Sangram Singh II. Maharana Sajjan Singh and Maharana Fateh Sing", "end": 13925, "score": 0.9656282067298889, "start": 13907, "tag": "NAME", "value": "Rana Sangram Singh" }, { "context": "ly by Rana Karan Singh, and Rana Sangram Singh II. Maharana Sajjan Singh and Maharana Fateh Singh further expanded the pal", "end": 13951, "score": 0.9957939982414246, "start": 13930, "tag": "NAME", "value": "Maharana Sajjan Singh" }, { "context": "d Rana Sangram Singh II. Maharana Sajjan Singh and Maharana Fateh Singh further expanded the palace in the 19th century.\\", "end": 13976, "score": 0.9969660639762878, "start": 13956, "tag": "NAME", "value": "Maharana Fateh Singh" } ]
null
[]
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.52 * Generated at: 2014-08-16 06:17:39 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.user.jsp_0020files.museums; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class museums_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; static { _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1); _jspx_dependants.put("/user/jsp files/checksession.jsp", Long.valueOf(1407909381372L)); } private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n"); out.write("\r\n"); out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n"); out.write("<title>Insert title here</title>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("\r\n"); String usernm = (String) session.getAttribute("username"); if(usernm==null) response.sendRedirect("/vision/user/jsp files/index/login_signup.jsp"); out.write("\r\n"); out.write("\r\n"); out.write("</body>\r\n"); out.write("</html>"); out.write("\r\n"); out.write("<script src=\"/vision/user/js files/scroll.js\" type=\"text/javascript\"></script>\r\n"); out.write("<title>Insert title here</title>\r\n"); out.write("<style>\r\n"); out.write("/* hover menu*/\r\n"); out.write("#indiv tr td a\r\n"); out.write("{\r\n"); out.write(" float: left;\r\n"); out.write("\tdisplay: block;\r\n"); out.write("\twidth: 160px;\r\n"); out.write("\theight: 45px;\r\n"); out.write("\tpadding: 20px 0px 0 0px;\r\n"); out.write("\tmargin: 0px 10px 0px 10px ;\r\n"); out.write("\tfont-size: 18px;\r\n"); out.write("\ttext-align: center;\r\n"); out.write("\ttext-decoration: none;\r\n"); out.write("\tcolor:Black;\t\r\n"); out.write("\tfont-weight: bold;\r\n"); out.write("\toutline: none;\r\n"); out.write("\r\n"); out.write("}\r\n"); out.write("\r\n"); out.write("#indiv tr td a:hover,#indiv tr td .current\r\n"); out.write("{\r\n"); out.write(" border-radius: 10px;\r\n"); out.write(" background: Black ;\r\n"); out.write(" color: Orange; \r\n"); out.write("}\t\r\n"); out.write("\r\n"); out.write("#indiv tr td ul li ul li a:hover\r\n"); out.write("{\r\n"); out.write(" background:none;\r\n"); out.write(" \r\n"); out.write(" \r\n"); out.write(" color: White; \r\n"); out.write("}\r\n"); out.write("/* drop down menu*/\r\n"); out.write("/*body {\r\n"); out.write(" font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;\r\n"); out.write(" padding: 20px 50px 150px;\r\n"); out.write(" font-size: 13px;\r\n"); out.write(" text-align: center;\r\n"); out.write(" background: #E3CAA1;\r\n"); out.write("}*/\r\n"); out.write("\r\n"); out.write("#dropdown ul {\r\n"); out.write(" text-align: left;\r\n"); out.write(" display: inline;\r\n"); out.write(" margin: 0;\r\n"); out.write(" padding: 45px 10px 17px 5px;\r\n"); out.write(" list-style: none;\r\n"); out.write(" /*-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);\r\n"); out.write(" -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);\r\n"); out.write(" box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);*/\r\n"); out.write("}\r\n"); out.write("#dropdown ul li {\r\n"); out.write(" font: bold 16px/16px sans-serif;\r\n"); out.write(" display: inline-block;\r\n"); out.write(" margin-right: 5px;\r\n"); out.write(" position: relative;\r\n"); out.write(" padding: 10px 15px;\r\n"); out.write(" background: rgba(213, 35, 35, 0.67);\r\n"); out.write(" cursor: pointer;\r\n"); out.write(" -webkit-transition: all 0.2s;\r\n"); out.write(" -moz-transition: all 0.2s;\r\n"); out.write(" -ms-transition: all 0.2s;\r\n"); out.write(" -o-transition: all 0.2s;\r\n"); out.write(" transition: all 0.2s;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li:hover {\r\n"); out.write(" background: rgba(213, 35, 35, 0.67);\r\n"); out.write(" color: #fff;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li ul {\r\n"); out.write(" padding: 0px;\r\n"); out.write(" position: absolute;\r\n"); out.write(" top: 52px;\r\n"); out.write(" left: 0px;\r\n"); out.write(" width: 130px;\r\n"); out.write(" /*-webkit-box-shadow: none;\r\n"); out.write(" -moz-box-shadow: none;\r\n"); out.write(" box-shadow: none;*/\r\n"); out.write(" display: none;\r\n"); out.write(" opacity: 0;\r\n"); out.write(" visibility: hidden;\r\n"); out.write(" -webkit-transiton: opacity 0.2s;\r\n"); out.write(" -moz-transition: opacity 0.2s;\r\n"); out.write(" -ms-transition: opacity 0.2s;\r\n"); out.write(" -o-transition: opacity 0.2s;\r\n"); out.write(" -transition: opacity 0.2s;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li ul li { \r\n"); out.write(" background: rgba(199, 89, 38, 0.67);\r\n"); out.write(" display: block; \r\n"); out.write(" color: #fff;\r\n"); out.write(" //text-shadow: 0 -1px 0 #000;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li ul li:hover \r\n"); out.write("{ background: rgba(199, 89, 38, 0.67);display: none;\r\n"); out.write("}\r\n"); out.write("#dropdown ul li:hover ul {\r\n"); out.write(" display: block;\r\n"); out.write(" opacity: 1;\r\n"); out.write(" visibility: visible;\r\n"); out.write("}\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("</style>\r\n"); out.write("\r\n"); out.write("</head>\r\n"); out.write("<body style=\"background:url(/vision/user/images/background/parquet_flooring-1920x1200.jpg); background-size: cover; \">\r\n"); out.write("<table align=\"center\" width=\"60%\">\r\n"); out.write(" <tr height=\"40\">\r\n"); out.write(" <td>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr height='50' >\r\n"); out.write(" <td>\r\n"); out.write(" <table id='indiv' align=\"center\"><!--table 2 inside table 1-->\r\n"); out.write(" <tr>\r\n"); out.write("\t <td><a href='/vision/user/jsp files/afterlogin/afterlogin_index.jsp' target='_parent'>HOME</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/about_us.jsp' target='_parent'>ABOUT US</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/contact_us.jsp' target='_parent'>CONTACT US</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/afterlogin/afterlogin_information.jsp' target='_parent'>INFORMATION RESOURCE</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/afterlogin/feedback.jsp' target='_parent'>FEEDBACK</a></td>\r\n"); out.write(" <td><a href='/vision/user/jsp files/afterlogin/afterlogin_features.jsp' target='_top'class='current'>FEATURES</a></td>\r\n"); out.write(" <td><img src='/vision/user/images/loginform/user1.png'></img></td>\r\n"); out.write("\t <td id=dropdown>\r\n"); out.write("\t <ul >\r\n"); out.write("\t <li style=\"width: 83px;height: 33px\">\r\n"); out.write(" Hi, "); String usrname=(String) session.getAttribute("username"); out.print(usrname ); out.write("\r\n"); out.write("\t\t <ul>\r\n"); out.write(" <li style=\"float: left;display: inherit; \" ><a href='/vision/LogoutServlet' style=\"font-size: inherit;text-align: left; width: 63px; height: 8px; \">Log Out</a></li>\r\n"); out.write(" \t <li style=\"float: left;display: inherit; \"><a href='/vision/UpdateServlet' style=\"font-size: inherit;text-align: left; width: 107px; height: 17px \">Update profile</a></li>\r\n"); out.write("\t\t </ul>\t\t\t\t\t\t\t\t\r\n"); out.write(" \t\t</li>\t\t\t \r\n"); out.write(" </ul> \r\n"); out.write(" </td> \r\n"); out.write(" \t\t\t\t \r\n"); out.write("\t </tr>\r\n"); out.write("\t\t\t \r\n"); out.write(" </table><!--end of table 2--> \r\n"); out.write(" </td> \t \r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <a name=\"top\"></a>\r\n"); out.write(" <br/>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">MUSEUMS IN UDAIPUR</p>\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" Udaipur is a majestic city that presents artifacts of the bygone age by the means of museums. These museums peep into the ancient times of the imperial city.\r\n"); out.write(" If you have planned to come to the city of Udaipur, then take out some time to visit the art museums of Udaipur.\r\n"); out.write(" These museums are made to preserve the priceless objects of the noble kings. Various museums of Udaipur offer a glimpse of the items that used to be the part of the regal lifestyle.\r\n"); out.write(" Udaipur Government is making constant efforts to preserve the artifacts of the previous age. If you are keen to know about the glorious past, these museums would be of great interest for you. \r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">CITY PALACE MUSEUM</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/city_palace_Udaipur1-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" More than four centuries ago, in A.D. 1559, <NAME> II the father of <NAME>, laid the Foundation of the City Palace after the birth of his grandson <NAME> and on the advice of a Hermit Goswami Prem <NAME>,\r\n"); out.write(" who had a small hut on this hill. The enormous complex of the old palace standing on a low ridge called <NAME> (Rana's Hill) overlooking lake Pichola on the west is a tribute to the constructive genius and architectural taste of the Maharana's of Mewar,\r\n"); out.write(" ranging from <NAME>dai Singh II to the present 76th Custodian of House of Mewar, <NAME> Mewar.\r\n"); out.write(" It has been so planned and integrated with the original building that the entire structure assumes a shape of one edifice from the exterior, with canopies, towers, domes, cupolas, bastions, beautifully carved balconies and ornamental turrets.\r\n"); out.write(" The City Palace built by <NAME> Singh II has been added to and extended by the successive generations of Maharanas, notably by <NAME>, and <NAME> II. <NAME> and <NAME> further expanded the palace in the 19th century.\r\n"); out.write(" \r\n"); out.write(" <a href='/vision/user/jsp files/museums/citypalace.jsp' target='_parent' style=\"color: Orange\">Read More</a>\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">THE VINTAGE AND CLASSIC CAR COLLECTION</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/vintage-collection-of-classic-cars-museum-udaipur-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" A unique private collection of vintage cars of the House of Mewar - the world's longest serving dynasty\r\n"); out.write(" The Vintage & Classic Car Collection is a landmark in the city of Udaipur ever since it was inaugurated in February 2000. \r\n"); out.write(" The grand limousines and cars showcased in the Collection belong to the House of Mewar and are still in perfect running condition. \r\n"); out.write(" Visitors are privy to the display of the magnificent Rolls-Royce, 1939 Cadillac open convertibles, rare Mercedes models, 1936 Vauxhall and 1937 Opel models. \r\n"); out.write(" The Collection has been curated for the benefit of vintage car-lovers from India and all over the world; it is probably the only collection of its kind in India about which the global and indian press has written reams. \r\n"); out.write(" Awe-struck visitors to the Collection are narrated innumerable stories and anecdotes about the Maharanas of Mewar and their preferred Rolls-Royce or Mercedes customised at their request.\r\n"); out.write(" <a href='/vision/user/jsp files/museums/vintage.jsp' target='_parent' style=\"color: Orange\" >Read More</a>\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">AHAR MUSEUM</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/13731263-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" The Ahar Museum, Udaipur is named after the beautiful city Ahar, where this museum is located. Ahar is the capital of Sisodias and is about 3 Kms away from Udaipur, in Rajasthan. \r\n"); out.write(" There are various types of iron objects and also a wide variety of other objects of art forms in the magnificent Ahar Museum. These objects are around 5000 years old.\r\n"); out.write(" Earthen Pots are among the rare collection of antiquities in Ahar Museum.\r\n"); out.write(" The architectural pieces stored in the museum are extremely old, as a matter of fact some of the pieces date back to 1700 BC.\r\n"); out.write(" One of the major attractions and an eye catcher is a Buddha statue, which is a 10th century figure made out of metal.\r\n"); out.write(" There are a huge number of cenotaphs in Ahar Museum in Udaipur, India. There are about nineteen cenotaphs of the great Maharanas which are cremated there. \r\n"); out.write(" Among all the cenotaphs in Ahar Museum, Rajasthan, one of the most striking cenotaphs is that of Maharana Amar Singh, who ruled during the period 1597 to 1620.\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">SHILPGRAM MUSEUM</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/shilpgram-museum4-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\">\r\n"); out.write(" Literally meaning a \"Craftsmen's Village\" is a living ethnographic museum depicting the enormous diversities in craft, art & culture between various Indian states,\r\n"); out.write(" but the exquisite terracotta work mainly in dark red and dark brown sand material along with the wooden carvings are the forte of this ethnic village . \r\n"); out.write(" Shilpgram comprises 26 huts set in 70 acres of natural surroundings at the foot of the Aravali Hills.A colourful craft festival during winter seasons to the whole set up induces viatanity and zeal.\r\n"); out.write(" Situated 3 kms west of Udaipur near the Havala village is the Centre's Shilpgram - the Rural Arts and Crafts Complex. Spread over an undulating terrain of 130 bighas (70 Acres) of land and surrounded by the Aravallies, \r\n"); out.write(" the Rural Arts and Crafts Complex is conceived as a living enthnographic museum to depict the lifestyles of the folk and tribal people of the West Zone. Within this complex,\r\n"); out.write(" huts of the member states are constructed incorporating traditional architectural features of different geographical and ethnic groups residing within the West Zone of India comprising of five Federal States.\r\n"); out.write(" </p><br/>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write(" \r\n"); out.write(" <tr>\r\n"); out.write(" <td>\r\n"); out.write(" <p style=\"font-family: cursive;font-size: x-large;font-weight: bold;color: Orange\">BHARTIYA LOK KALA MANDAL</p>\r\n"); out.write(" <img src=\"/vision/user/images/museums/lok-kala-mandal-udaipur-qpr.jpg\" />\r\n"); out.write(" <p style=\"color: White;font-family: cursive;font-size: medium;text-align: justify;\"> \r\n"); out.write(" Bhartiya Lok Kala Museum is one of the most famous museums of Udaipur, exhibiting the brilliant collection of folk articles of Rajasthan.\r\n"); out.write(" This rare compilation varies from typical rural-dresses, ornaments, puppets, masks, dolls, folk musical instruments, folk deities and paintings.\r\n"); out.write(" The museum is comfortably located in the building of Bhartiya Lok Kala Mandal near Chetak Circle in Udaipur city.\r\n"); out.write(" Mewar region of Rajasthan is known for its rich art and culture. Actually, the local handicrafts and things of art of this region have always been cherished all over the world.\r\n"); out.write(" With the intention to maintain this rich tradition, Bhartiya Lok Kala Mandal took the initiative, to start an institution, to encourage the local arts and crafts of Mewar.\r\n"); out.write(" Bhartiya Lok Kala Museum is a part of their program that displays the best art and craft of Mewar.\r\n"); out.write(" The museum portrays the remarkable collection of over past 44 years, gathered by the Bhartiya Lok Kala Mandal. To provide a summarized idea of the folk heritage of India, traditional attires, ornaments, miniature paintings and many other art objects are displayed here. Bhartiya Lok Kala Museum of Udaipur definitely requires a visit to closely observe the artistic and culturally rich region of Rajasthan. \r\n"); out.write(" </p><br/>\r\n"); out.write(" <a href='#top' style=\"color: Orange\">Back To Top</a>\r\n"); out.write(" </td>\r\n"); out.write(" </tr> \r\n"); out.write("</table>\r\n"); out.write("</body>\r\n"); out.write(" \r\n"); out.write(" \r\n"); out.write(" \r\n"); out.write(" "); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
22,223
0.629066
0.615043
350
62.777142
59.267544
434
false
false
0
0
0
0
0
0
1.485714
false
false
9
010d153b6539506c5f1a14861d1d1778cf26cde8
17,179,901,033
72b9bd2c07a1b9defd12af5d152f514aded693db
/app/src/main/java/com/example/home/makemebeautiful/servercommunication/UploadImage.java
ef3bb2ec246fc2173f712acc5fd6b87a393df2bb
[]
no_license
Arielmann/Make-Me-Beautiful
https://github.com/Arielmann/Make-Me-Beautiful
eed9d898375b93c4c57aea6db7f1da2411451f97
d7d49e82616a5d0a69a29d2d4e5060734add365d
refs/heads/master
2020-06-26T02:04:17.780000
2017-10-31T15:28:19
2017-10-31T15:28:19
74,606,770
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.home.makemebeautiful.servercommunication; import android.content.Context; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; import com.example.home.makemebeautiful.R; import com.example.home.makemebeautiful.profile.sharedprefrences.SharedPrefManager; import com.example.home.makemebeautiful.resources.AppStrings; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class UploadImage extends AsyncTask<Void, String, String> { private String regId; private String TAG = "Upload data"; private File sourceFile; private String imageUrlFromServer = null; private String uploadImagePath; private Object interfaceHolder; private Uri imageUri; public UploadImage(Context context, Object interfaceHolder, String uploadFilePath, Uri imageUri) { this.regId = SharedPrefManager.getInstance(context).getUserGcmToken(); //SharedPrefManager inputStream a LOCAL class this.sourceFile = new File(uploadFilePath); this.interfaceHolder = interfaceHolder; this.uploadImagePath = uploadFilePath; this.imageUri = imageUri; Log.d(TAG, "Object created"); } @Override protected String doInBackground (Void...params){ Log.d(TAG, "Starting parameters init"); try { // open a URL connection to the Servlet FileInputStream fileInputStream = new FileInputStream(sourceFile); String upLoadServerUrl = Config.IMAGE_UPLOADS; URL url = new URL(upLoadServerUrl); // Open a HTTP connection to the URL //Doesn't send the push notification but definetly should do it HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs from server conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); //keep connection alive after headers were sent conn.setRequestProperty("ENCTYPE", "multipart/form-data"); //multipart indicates that server should read it AS BYTES String boundary = "*****"; conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); //serve expects to get Stream of BYTES String fileName = sourceFile.getName(); //ADD USER NAME!! conn.setRequestProperty("uploaded_file", sourceFile.getName()); conn.setRequestProperty("user_id", "1"); //php need to connect image to userId conn.setRequestProperty("msg", "TextMessage from HTTPUrlConntection"); conn.setRequestProperty("reg_id", regId); DataOutputStream dos = new DataOutputStream(conn.getOutputStream()); String twoHyphens = "--", lineEnd = "\r\n"; dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\"" + fileName + "\"" + lineEnd); dos.writeBytes(lineEnd); Log.d(TAG, "parameters were written as bytes"); Log.d(TAG, "file size: " + sourceFile.length()); // create a buffer of maximum size int bytesAvailable = fileInputStream.available(); int maxBufferSize = 1024; int bufferSize = Math.min(bytesAvailable, maxBufferSize); byte[] buffer = new byte[bufferSize]; // read file and write it into form... int bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead > 0) { dos.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } // send multipart form data necesssary after file data... dos.writeBytes(lineEnd); //USE DEFENSIVE PROGRAMMING HERE dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); int serverResponseCode = conn.getResponseCode(); String serverResponseMessage = conn.getResponseMessage(); Log.d(TAG, "HTTP Response inputStream : " + serverResponseMessage + ": " + serverResponseCode); if (serverResponseCode == 200) { } //close the streams // fileInputStream.close(); InputStream is = conn.getInputStream(); //the inputstream inputStream the server response to client call int counter = 0; StringBuilder builder = new StringBuilder(); while ((counter = is.read(buffer)) != -1) { builder.append(new String(buffer, 0, counter)); } Log.d(TAG, "inputStream: " + builder.toString()); imageUrlFromServer = builder.toString(); dos.flush(); Log.d(TAG, "upload started"); dos.close(); } catch (MalformedURLException ex) { ex.printStackTrace(); Log.e(TAG, "Cancel Async. error: " + ex.getMessage(), ex); cancel(true); } catch (Exception e) { Log.e(TAG, "Cancel Async. Exception: " + e.getMessage(), e); cancel(true); } Log.d(TAG, "Final url: " + Config.SERVER_URL + imageUrlFromServer); return Config.SERVER_URL + imageUrlFromServer; } @Override protected void onPostExecute (String imageUrl){ ((OnImageUploadedToServer) interfaceHolder).handleServerImageUrl(imageUrl, uploadImagePath, imageUri); Log.d(TAG, "interface was activated with url: " + imageUrl); } }
UTF-8
Java
6,362
java
UploadImage.java
Java
[]
null
[]
package com.example.home.makemebeautiful.servercommunication; import android.content.Context; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; import com.example.home.makemebeautiful.R; import com.example.home.makemebeautiful.profile.sharedprefrences.SharedPrefManager; import com.example.home.makemebeautiful.resources.AppStrings; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class UploadImage extends AsyncTask<Void, String, String> { private String regId; private String TAG = "Upload data"; private File sourceFile; private String imageUrlFromServer = null; private String uploadImagePath; private Object interfaceHolder; private Uri imageUri; public UploadImage(Context context, Object interfaceHolder, String uploadFilePath, Uri imageUri) { this.regId = SharedPrefManager.getInstance(context).getUserGcmToken(); //SharedPrefManager inputStream a LOCAL class this.sourceFile = new File(uploadFilePath); this.interfaceHolder = interfaceHolder; this.uploadImagePath = uploadFilePath; this.imageUri = imageUri; Log.d(TAG, "Object created"); } @Override protected String doInBackground (Void...params){ Log.d(TAG, "Starting parameters init"); try { // open a URL connection to the Servlet FileInputStream fileInputStream = new FileInputStream(sourceFile); String upLoadServerUrl = Config.IMAGE_UPLOADS; URL url = new URL(upLoadServerUrl); // Open a HTTP connection to the URL //Doesn't send the push notification but definetly should do it HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs from server conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); //keep connection alive after headers were sent conn.setRequestProperty("ENCTYPE", "multipart/form-data"); //multipart indicates that server should read it AS BYTES String boundary = "*****"; conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); //serve expects to get Stream of BYTES String fileName = sourceFile.getName(); //ADD USER NAME!! conn.setRequestProperty("uploaded_file", sourceFile.getName()); conn.setRequestProperty("user_id", "1"); //php need to connect image to userId conn.setRequestProperty("msg", "TextMessage from HTTPUrlConntection"); conn.setRequestProperty("reg_id", regId); DataOutputStream dos = new DataOutputStream(conn.getOutputStream()); String twoHyphens = "--", lineEnd = "\r\n"; dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\"" + fileName + "\"" + lineEnd); dos.writeBytes(lineEnd); Log.d(TAG, "parameters were written as bytes"); Log.d(TAG, "file size: " + sourceFile.length()); // create a buffer of maximum size int bytesAvailable = fileInputStream.available(); int maxBufferSize = 1024; int bufferSize = Math.min(bytesAvailable, maxBufferSize); byte[] buffer = new byte[bufferSize]; // read file and write it into form... int bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead > 0) { dos.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } // send multipart form data necesssary after file data... dos.writeBytes(lineEnd); //USE DEFENSIVE PROGRAMMING HERE dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); int serverResponseCode = conn.getResponseCode(); String serverResponseMessage = conn.getResponseMessage(); Log.d(TAG, "HTTP Response inputStream : " + serverResponseMessage + ": " + serverResponseCode); if (serverResponseCode == 200) { } //close the streams // fileInputStream.close(); InputStream is = conn.getInputStream(); //the inputstream inputStream the server response to client call int counter = 0; StringBuilder builder = new StringBuilder(); while ((counter = is.read(buffer)) != -1) { builder.append(new String(buffer, 0, counter)); } Log.d(TAG, "inputStream: " + builder.toString()); imageUrlFromServer = builder.toString(); dos.flush(); Log.d(TAG, "upload started"); dos.close(); } catch (MalformedURLException ex) { ex.printStackTrace(); Log.e(TAG, "Cancel Async. error: " + ex.getMessage(), ex); cancel(true); } catch (Exception e) { Log.e(TAG, "Cancel Async. Exception: " + e.getMessage(), e); cancel(true); } Log.d(TAG, "Final url: " + Config.SERVER_URL + imageUrlFromServer); return Config.SERVER_URL + imageUrlFromServer; } @Override protected void onPostExecute (String imageUrl){ ((OnImageUploadedToServer) interfaceHolder).handleServerImageUrl(imageUrl, uploadImagePath, imageUri); Log.d(TAG, "interface was activated with url: " + imageUrl); } }
6,362
0.599969
0.597611
143
43.468533
32.147129
139
false
false
0
0
0
0
0
0
0.888112
false
false
9
137282f34d5759447e7be803e5bdebbc662d0424
17,179,901,360
139d477c0503d36d5f36e8b98a4996e9aeb6c1cf
/src/main/java/com/udec/Clases/Genero.java
576c6db1079a6c2388f8ffe9a0837f013b98a148
[]
no_license
JuanRRC95/EmpresaFinanciera
https://github.com/JuanRRC95/EmpresaFinanciera
050ea57db5833d7257bdf6aa5eb097d073db95c2
17dc5054e3938159cb9d93abd4ecb295b1ccd66b
refs/heads/master
2022-06-05T10:16:41.938000
2019-09-10T01:41:06
2019-09-10T01:41:06
206,857,794
0
0
null
false
2022-05-20T21:09:17
2019-09-06T19:05:24
2019-09-10T01:41:25
2022-05-20T21:09:17
28
0
0
1
Java
false
false
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.udec.Clases; /** * Clase de tipo enum que contiene los generos. * @since EmpresaFinanciera 1.0 * @version 1.0 * @author Juan Ricardo Rodriguez Campos */ public enum Genero { Masculino(1), Femenino(2); private int tipo; Genero(int genero){ this.tipo=genero; } public int getTipo() { return tipo; } }
UTF-8
Java
594
java
Genero.java
Java
[ { "context": "EmpresaFinanciera 1.0\r\n * @version 1.0\r\n * @author Juan Ricardo Rodriguez Campos\r\n */\r\npublic enum Genero {\r\n Masculino(1),\r\n ", "end": 360, "score": 0.9998698830604553, "start": 331, "tag": "NAME", "value": "Juan Ricardo Rodriguez Campos" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.udec.Clases; /** * Clase de tipo enum que contiene los generos. * @since EmpresaFinanciera 1.0 * @version 1.0 * @author <NAME> */ public enum Genero { Masculino(1), Femenino(2); private int tipo; Genero(int genero){ this.tipo=genero; } public int getTipo() { return tipo; } }
571
0.609428
0.599327
28
19.214285
18.904568
79
false
false
0
0
0
0
0
0
0.321429
false
false
9
84dd2b980a131048744e5477703c91dcf7495c96
19,146,964,250,072
5aec90679b082164cedafa641a0850d7e1b7a87a
/src/main/java/com/scala/controlfinan/domain/Transaction.java
87322a81c5ae0fd3a8e354b1880003c1a253d4a5
[]
no_license
srochagomes/controle-spring
https://github.com/srochagomes/controle-spring
0f80362b8e62ed275123ba46306b13cd3fea35df
3f09b03c1b3f6a783a7f06cc8388853da8b5e4fe
refs/heads/master
2023-09-03T07:07:04.412000
2021-11-21T19:35:44
2021-11-21T19:35:44
390,839,091
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scala.controlfinan.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.scala.controlfinan.repository.data.TransactionEntity; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.time.LocalDateTime; @Data @NoArgsConstructor @AllArgsConstructor @Builder @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public class Transaction { @ApiModelProperty(hidden = true) private Integer id; @NotNull(message = "Account is required.") private Integer accountId; @NotNull(message = "Value is required.") private BigDecimal value; @ApiModelProperty(hidden = true) private LocalDateTime createdAt; @NotNull(message = "Category is required.") private Integer categoryId; @ApiModelProperty(hidden = true) private LocalDateTime startedAt; @ApiModelProperty(hidden = true) private LocalDateTime endedAt; public static Transaction parser(TransactionEntity transaction) { return Transaction.builder() .id(transaction.getId()) .accountId(transaction.getAccount().getId()) .categoryId(transaction.getCategory().getId()) .value(transaction.getValue()) .createdAt(transaction.getCreatedAt()) .build(); } }
UTF-8
Java
1,584
java
Transaction.java
Java
[]
null
[]
package com.scala.controlfinan.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.scala.controlfinan.repository.data.TransactionEntity; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.time.LocalDateTime; @Data @NoArgsConstructor @AllArgsConstructor @Builder @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public class Transaction { @ApiModelProperty(hidden = true) private Integer id; @NotNull(message = "Account is required.") private Integer accountId; @NotNull(message = "Value is required.") private BigDecimal value; @ApiModelProperty(hidden = true) private LocalDateTime createdAt; @NotNull(message = "Category is required.") private Integer categoryId; @ApiModelProperty(hidden = true) private LocalDateTime startedAt; @ApiModelProperty(hidden = true) private LocalDateTime endedAt; public static Transaction parser(TransactionEntity transaction) { return Transaction.builder() .id(transaction.getId()) .accountId(transaction.getAccount().getId()) .categoryId(transaction.getCategory().getId()) .value(transaction.getValue()) .createdAt(transaction.getCreatedAt()) .build(); } }
1,584
0.729798
0.729798
54
28.333334
20.061941
69
false
false
0
0
0
0
0
0
0.37037
false
false
9
ad153b1e14f4cf5d8ed64b568b85ef08d9bdb679
28,827,820,512,597
7965a3c0e61b514e317a8f131b6601929e92f196
/pf-play-model/src/main/java/com/pf/play/model/protocol/response/my/Vitality.java
f9752ec7f283a215077a03917f85cf1d598eca50
[]
no_license
moutainhigh/pf-play
https://github.com/moutainhigh/pf-play
8cbd59c39caaa60d05c9b018ba7a1915bc42c1bb
2369d9a6324232e6471253b2ce80f614c53b669f
refs/heads/master
2022-04-15T08:44:27.718000
2020-02-24T03:49:28
2020-02-24T03:49:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pf.play.model.protocol.response.my; /** * @Description TODO * @Author long * @Date 2019/11/27 22:18 * @Version 1.0 */ public class Vitality { private String vitalityName; private String pushNumber; private String teamVitalitNum; private String allianceVitalitNum; private String rewardNum; private Integer upgradeNum; private Integer level; private String remarks; public String getVitalityName() { return vitalityName; } public void setVitalityName(String vitalityName) { this.vitalityName = vitalityName; } public String getPushNumber() { return pushNumber; } public void setPushNumber(String pushNumber) { this.pushNumber = pushNumber; } public String getTeamVitalitNum() { return teamVitalitNum; } public void setTeamVitalitNum(String teamVitalitNum) { this.teamVitalitNum = teamVitalitNum; } public String getAllianceVitalitNum() { return allianceVitalitNum; } public void setAllianceVitalitNum(String allianceVitalitNum) { this.allianceVitalitNum = allianceVitalitNum; } public String getRewardNum() { return rewardNum; } public void setRewardNum(String rewardNum) { this.rewardNum = rewardNum; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } public Integer getUpgradeNum() { return upgradeNum; } public void setUpgradeNum(Integer upgradeNum) { this.upgradeNum = upgradeNum; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } }
UTF-8
Java
1,793
java
Vitality.java
Java
[ { "context": ".response.my;\n\n/**\n * @Description TODO\n * @Author long\n * @Date 2019/11/27 22:18\n * @Version 1.0\n */\npub", "end": 89, "score": 0.515001654624939, "start": 85, "tag": "NAME", "value": "long" } ]
null
[]
package com.pf.play.model.protocol.response.my; /** * @Description TODO * @Author long * @Date 2019/11/27 22:18 * @Version 1.0 */ public class Vitality { private String vitalityName; private String pushNumber; private String teamVitalitNum; private String allianceVitalitNum; private String rewardNum; private Integer upgradeNum; private Integer level; private String remarks; public String getVitalityName() { return vitalityName; } public void setVitalityName(String vitalityName) { this.vitalityName = vitalityName; } public String getPushNumber() { return pushNumber; } public void setPushNumber(String pushNumber) { this.pushNumber = pushNumber; } public String getTeamVitalitNum() { return teamVitalitNum; } public void setTeamVitalitNum(String teamVitalitNum) { this.teamVitalitNum = teamVitalitNum; } public String getAllianceVitalitNum() { return allianceVitalitNum; } public void setAllianceVitalitNum(String allianceVitalitNum) { this.allianceVitalitNum = allianceVitalitNum; } public String getRewardNum() { return rewardNum; } public void setRewardNum(String rewardNum) { this.rewardNum = rewardNum; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } public Integer getUpgradeNum() { return upgradeNum; } public void setUpgradeNum(Integer upgradeNum) { this.upgradeNum = upgradeNum; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } }
1,793
0.649749
0.641941
83
20.602409
18.35194
66
false
false
0
0
0
0
0
0
0.301205
false
false
9
275c642db4142eb3dd8414438b7be4ee9d42fe34
26,448,408,675,606
67580ae0f82353238c674b1ba450ffd4d013f48b
/src/com/design/patterns/abstractfactory/pcfactory/entity/impl/DellMouse.java
113194b4111ca9e2aae083801f71b97558597dc4
[]
no_license
wyh2011300127/mystudy
https://github.com/wyh2011300127/mystudy
e757e201ad2486f41084ffbf2f74dace978d5141
69da26416acbf4a5fcaccd9dededd96c2a30fc05
refs/heads/master
2020-04-24T13:13:11.107000
2019-04-10T14:21:41
2019-04-10T14:21:41
171,979,835
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.design.patterns.abstractfactory.pcfactory.entity.impl; import com.design.patterns.abstractfactory.pcfactory.entity.Mouse; public class DellMouse implements Mouse { public DellMouse() { System.out.println("ๅฎžไพ‹ๅŒ–ๆˆดๅฐ”้ผ ๆ ‡"); } }
UTF-8
Java
263
java
DellMouse.java
Java
[]
null
[]
package com.design.patterns.abstractfactory.pcfactory.entity.impl; import com.design.patterns.abstractfactory.pcfactory.entity.Mouse; public class DellMouse implements Mouse { public DellMouse() { System.out.println("ๅฎžไพ‹ๅŒ–ๆˆดๅฐ”้ผ ๆ ‡"); } }
263
0.759036
0.759036
9
26.777779
25.788792
66
false
false
0
0
0
0
0
0
0.333333
false
false
9
524c4c6ad84b28d2c5fc7c9ce80a741ca12fb948
4,896,262,738,554
65ebd70efdcd90313972791b2df64de27f6d7908
/Rio-EM/OpenCV/pptToImg/PptToImg.java
1ba6f18516328ed2a5824ae0ac6c82a5860143e3
[]
no_license
RenanFucciScripts/Java
https://github.com/RenanFucciScripts/Java
de3616a6fe4a3f8c9f04e656e1e0a2de41c55392
80b767565147626f8cf0e346750fc60a67122785
refs/heads/master
2021-01-12T02:54:30.808000
2017-01-05T17:16:01
2017-01-05T17:16:01
78,131,209
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pptToImg; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.HashMap; import java.util.List; import javax.imageio.ImageIO; import org.apache.poi.xslf.usermodel.XMLSlideShow; import org.apache.poi.xslf.usermodel.XSLFSlide; public class PptToImg { private double tamDesejado; public PptToImg(File fl, double tamDesejado_emPX) { this.tamDesejado = tamDesejado_emPX; init(fl); } public PptToImg(String dirIN, double tamDesejado_emPX) { this.tamDesejado = tamDesejado_emPX; init(new File(dirIN)); } /** * <b>@author Renan Fucci</b><br> * <b>Metodo init</b><br> * Metodo para iniciar o processo de convercao de arquivos PPT para JPG. * @param fl arquivo no formato ppt ou pptx. */ private void init(File fl){ HashMap<String, BufferedImage> list = slides_pptToImgs(fl); String dir = fl.getParent(); String newDir = fl.getName().substring(0, fl.getName().lastIndexOf(".")); File dirFinal = new File(dir+File.separator+newDir+File.separator); dirFinal.mkdirs(); try { for (String key : list.keySet()) { ImageIO.write(list.get(key), "jpg", new File(dirFinal+File.separator+key)); } } catch (IOException e) { e.printStackTrace(); } } /** * <b>@author Renan Fucci</b><br> * <b>Metodo slides_pptToImgs</b><br> * Metodo para converter, dentro de um documento de apresentacao, cada slide em uma imagem no formato jpg. * @param fl arquivo no formato ppt ou pptx. * @return lista {@link HashMap},no qual as chaves(key) sao os nomes dos arq e os valores(values) sao as imagens no formato jpg. */ protected HashMap<String, BufferedImage> slides_pptToImgs(File fl){ HashMap<String, BufferedImage> listImgs = new HashMap<String, BufferedImage>(); try { File file=fl; XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(file)); Dimension pgsize = ppt.getPageSize(); double zoom = (tamDesejado<pgsize.getHeight())? (1) : (tamDesejado/ pgsize.getHeight()); AffineTransform at = new AffineTransform(); at.setToScale(zoom, zoom); List<XSLFSlide> slide = ppt.getSlides(); for (int i = 0; i < slide.size(); i++) { BufferedImage img = new BufferedImage((int)Math.floor(pgsize.width*zoom), (int)Math.floor(pgsize.height*zoom), BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); graphics.setTransform(at); graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); slide.get(i).draw(graphics); String key = (i==0)?("capa.jpg"):("ilustracao-"+i+".jpg"); listImgs.put(key, toJPG(img)); } ppt.close(); } catch (IOException e) { System.err.println(e.getMessage()); e.printStackTrace(); } return listImgs; } /** * <b>@author Renan Fucci</b><br> * <b>Metodo toJPG</b><br> * Metodo para converter qualquer tipo de extensao de imagem para jpg. * @param bufferedImage imagem a ser convertida. * @return imagem no padrao jpg. */ private static BufferedImage toJPG(BufferedImage bufferedImage){ BufferedImage newBufferedImage ;//Buffer da img com o aplha newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_INT_RGB); newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.WHITE, null); return newBufferedImage; } }
UTF-8
Java
3,568
java
PptToImg.java
Java
[ { "context": "\n\t\tinit(new File(dirIN));\n\t}\n\t\n\t/**\n\t * <b>@author Renan Fucci</b><br>\n\t * <b>Metodo init</b><br>\n\t * Metodo par", "end": 796, "score": 0.9997763633728027, "start": 785, "tag": "NAME", "value": "Renan Fucci" }, { "context": ".printStackTrace();\n\t\t}\n\t\t\n\t}\n\n\t/**\n\t * <b>@author Renan Fucci</b><br>\n\t * <b>Metodo slides_pptToImgs</b><br>\n\t ", "end": 1472, "score": 0.9998842477798462, "start": 1461, "tag": "NAME", "value": "Renan Fucci" }, { "context": "();\n\t\t}\n\t\treturn listImgs;\n\t}\n\n\t/**\n\t * <b>@author Renan Fucci</b><br>\n\t * <b>Metodo toJPG</b><br>\n\t * Metodo pa", "end": 2997, "score": 0.9998874664306641, "start": 2986, "tag": "NAME", "value": "Renan Fucci" } ]
null
[]
package pptToImg; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.HashMap; import java.util.List; import javax.imageio.ImageIO; import org.apache.poi.xslf.usermodel.XMLSlideShow; import org.apache.poi.xslf.usermodel.XSLFSlide; public class PptToImg { private double tamDesejado; public PptToImg(File fl, double tamDesejado_emPX) { this.tamDesejado = tamDesejado_emPX; init(fl); } public PptToImg(String dirIN, double tamDesejado_emPX) { this.tamDesejado = tamDesejado_emPX; init(new File(dirIN)); } /** * <b>@author <NAME></b><br> * <b>Metodo init</b><br> * Metodo para iniciar o processo de convercao de arquivos PPT para JPG. * @param fl arquivo no formato ppt ou pptx. */ private void init(File fl){ HashMap<String, BufferedImage> list = slides_pptToImgs(fl); String dir = fl.getParent(); String newDir = fl.getName().substring(0, fl.getName().lastIndexOf(".")); File dirFinal = new File(dir+File.separator+newDir+File.separator); dirFinal.mkdirs(); try { for (String key : list.keySet()) { ImageIO.write(list.get(key), "jpg", new File(dirFinal+File.separator+key)); } } catch (IOException e) { e.printStackTrace(); } } /** * <b>@author <NAME></b><br> * <b>Metodo slides_pptToImgs</b><br> * Metodo para converter, dentro de um documento de apresentacao, cada slide em uma imagem no formato jpg. * @param fl arquivo no formato ppt ou pptx. * @return lista {@link HashMap},no qual as chaves(key) sao os nomes dos arq e os valores(values) sao as imagens no formato jpg. */ protected HashMap<String, BufferedImage> slides_pptToImgs(File fl){ HashMap<String, BufferedImage> listImgs = new HashMap<String, BufferedImage>(); try { File file=fl; XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(file)); Dimension pgsize = ppt.getPageSize(); double zoom = (tamDesejado<pgsize.getHeight())? (1) : (tamDesejado/ pgsize.getHeight()); AffineTransform at = new AffineTransform(); at.setToScale(zoom, zoom); List<XSLFSlide> slide = ppt.getSlides(); for (int i = 0; i < slide.size(); i++) { BufferedImage img = new BufferedImage((int)Math.floor(pgsize.width*zoom), (int)Math.floor(pgsize.height*zoom), BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); graphics.setTransform(at); graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); slide.get(i).draw(graphics); String key = (i==0)?("capa.jpg"):("ilustracao-"+i+".jpg"); listImgs.put(key, toJPG(img)); } ppt.close(); } catch (IOException e) { System.err.println(e.getMessage()); e.printStackTrace(); } return listImgs; } /** * <b>@author <NAME></b><br> * <b>Metodo toJPG</b><br> * Metodo para converter qualquer tipo de extensao de imagem para jpg. * @param bufferedImage imagem a ser convertida. * @return imagem no padrao jpg. */ private static BufferedImage toJPG(BufferedImage bufferedImage){ BufferedImage newBufferedImage ;//Buffer da img com o aplha newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_INT_RGB); newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.WHITE, null); return newBufferedImage; } }
3,553
0.70796
0.704596
113
30.575222
28.82563
143
false
false
0
0
0
0
0
0
2.19469
false
false
9
641dede8fcc405d027425992ada889addc0d38cc
25,280,177,534,249
6f672fb72caedccb841ee23f53e32aceeaf1895e
/Photography/photogrid_source/src/com/roidapp/photogrid/common/ar.java
a8d50cce05a0c442015035c96dcc23eeeb784a79
[]
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.roidapp.photogrid.common; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.SharedPreferences; import android.view.KeyEvent; import com.roidapp.photogrid.release.PhotoGridActivity; // Referenced classes of package com.roidapp.photogrid.common: // ap final class ar implements android.content.DialogInterface.OnKeyListener { final Activity a; final AlertDialog b; final ap c; ar(ap ap, Activity activity, AlertDialog alertdialog) { c = ap; a = activity; b = alertdialog; super(); } public final boolean onKey(DialogInterface dialoginterface, int i, KeyEvent keyevent) { if (i == 4) { ((PhotoGridActivity)a).i = false; a.getSharedPreferences(a.getPackageName(), 0).edit().putInt("REGISTER_COUNT", -3).apply(); b.dismiss(); return true; } else { return false; } } }
UTF-8
Java
1,213
java
ar.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.9996793270111084, "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.roidapp.photogrid.common; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.SharedPreferences; import android.view.KeyEvent; import com.roidapp.photogrid.release.PhotoGridActivity; // Referenced classes of package com.roidapp.photogrid.common: // ap final class ar implements android.content.DialogInterface.OnKeyListener { final Activity a; final AlertDialog b; final ap c; ar(ap ap, Activity activity, AlertDialog alertdialog) { c = ap; a = activity; b = alertdialog; super(); } public final boolean onKey(DialogInterface dialoginterface, int i, KeyEvent keyevent) { if (i == 4) { ((PhotoGridActivity)a).i = false; a.getSharedPreferences(a.getPackageName(), 0).edit().putInt("REGISTER_COUNT", -3).apply(); b.dismiss(); return true; } else { return false; } } }
1,203
0.651278
0.643034
46
25.369566
24.355482
102
false
false
0
0
0
0
0
0
0.543478
false
false
9
5f6ae9fa149f6170851241e3c7201171448a0fd2
16,260,746,204,324
da73e195b3c54286a6f3438f76132b36b2cbeec7
/BasementAdmin/src/servleeet/Rezept.java
6e460bf48533e708d959a3b73b0059634b17d9b6
[]
no_license
emmschuster/basement_administration_project
https://github.com/emmschuster/basement_administration_project
f1dbcc2b69e68acca2cdb42a7dd185689d11596d
cacdfb5b9475e45ac1625b10048602a3d9e71f36
refs/heads/master
2023-04-02T13:03:46.099000
2021-04-13T13:46:53
2021-04-13T13:46:53
299,829,627
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package servleeet; import util.DatabaseManager; import javax.servlet.RequestDispatcher; 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 javax.servlet.http.HttpSession; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; @WebServlet(name = "Rezept", urlPatterns = "/Rezept") public class Rezept extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String rezID = request.getParameter("rezID"); boolean x = true; DatabaseManager m=null; try { m = DatabaseManager.getInstance(); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } Connection con = null; try { con = m.getConnection(); x = m.rezeptVorhanden(con, rezID); } catch (Exception e) { System.out.println("Rip ME"); } //Weiterleitung: if (x) { HttpSession session = request.getSession(); session.setAttribute("rezept", rezID); RequestDispatcher d = request.getRequestDispatcher("zumRez.jsp"); //hier .jsp weil noch keine .html seite Verfรผgbar ; MVC noch im arsch // Weiterleitung durchfรผhren d.forward(request, response); }else { HttpSession session = request.getSession(false); if (session != null) session.invalidate(); RequestDispatcher d = request.getRequestDispatcher("index.jsp"); // hm wenns die ID ned gibt... des geht ja eig ned d.forward(request, response); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("Served at: ").append(request.getContextPath()); } }
UTF-8
Java
2,124
java
Rezept.java
Java
[]
null
[]
package servleeet; import util.DatabaseManager; import javax.servlet.RequestDispatcher; 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 javax.servlet.http.HttpSession; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; @WebServlet(name = "Rezept", urlPatterns = "/Rezept") public class Rezept extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String rezID = request.getParameter("rezID"); boolean x = true; DatabaseManager m=null; try { m = DatabaseManager.getInstance(); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } Connection con = null; try { con = m.getConnection(); x = m.rezeptVorhanden(con, rezID); } catch (Exception e) { System.out.println("Rip ME"); } //Weiterleitung: if (x) { HttpSession session = request.getSession(); session.setAttribute("rezept", rezID); RequestDispatcher d = request.getRequestDispatcher("zumRez.jsp"); //hier .jsp weil noch keine .html seite Verfรผgbar ; MVC noch im arsch // Weiterleitung durchfรผhren d.forward(request, response); }else { HttpSession session = request.getSession(false); if (session != null) session.invalidate(); RequestDispatcher d = request.getRequestDispatcher("index.jsp"); // hm wenns die ID ned gibt... des geht ja eig ned d.forward(request, response); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("Served at: ").append(request.getContextPath()); } }
2,124
0.656927
0.656927
55
37.581818
31.854609
149
false
false
0
0
0
0
0
0
0.745455
false
false
9
02c9b312f928afcf9a89f9df53524bb5e9dafc59
429,496,782,103
c357d9d628289edb5ec783ffd633c16093e68a39
/Team15091/src/main/java/org/firstinspires/ftc/team15091/ConceptTensorFlowObjectDetectionWebcam.java
7b4dfda27880245f041fd6f08e1a98ce6b672cd1
[ "BSD-3-Clause" ]
permissive
kinyewlee/SkyStone
https://github.com/kinyewlee/SkyStone
0f975b611b609b238caebe6990a6214ac2cdc6e5
25ad0a9006147b100bedaa92b78e2ccdae0ef59b
refs/heads/master
2021-07-17T14:01:50.866000
2020-09-12T23:35:42
2020-09-12T23:35:42
211,759,555
0
0
null
true
2020-09-12T19:47:17
2019-09-30T02:28:31
2020-09-12T19:17:51
2020-09-12T19:47:07
221,298
0
0
0
Java
false
false
/* Copyright (c) 2019 FIRST. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted (subject to the limitations in the disclaimer below) provided that * the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * Neither the name of FIRST nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.team15091; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.vuforia.HINT; import com.vuforia.Vuforia; import org.firstinspires.ftc.robotcore.external.ClassFactory; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer; import org.firstinspires.ftc.robotcore.external.tfod.Recognition; import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector; import java.util.List; /** * This 2019-2020 OpMode illustrates the basics of using the TensorFlow Object Detection API to * determine the position of the Skystone game elements. * <p> * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list. * <p> * IMPORTANT: In order to use this OpMode, you need to obtain your own Vuforia license key as * is explained below. */ @TeleOp(name = "Concept: TensorFlow Object Detection Webcam", group = "Concept") //@Disabled public class ConceptTensorFlowObjectDetectionWebcam extends LinearOpMode { @Override public void runOpMode() { SkystoneDetector skystoneDetector = new SkystoneDetector(this, 0L, 800L); /** Wait for the game to begin */ telemetry.addData(">", "Press Play to start op mode"); telemetry.update(); waitForStart(); if (opModeIsActive()) { while (opModeIsActive()) { telemetry.addData("Detected", skystoneDetector.objectDetected()); if (skystoneDetector.objectDetected()) { if (skystoneDetector.skytoneRecognitions != null) { telemetry.addData("# Object Detected", skystoneDetector.skytoneRecognitions.size()); // step through the list of recognitions and display boundary info. int i = 0; for (Recognition recognition : skystoneDetector.skytoneRecognitions) { float recognitionLeft = Math.max(recognition.getLeft(), 0L); float recognitionWidth = recognition.getRight() - recognitionLeft; float recognitionMid = recognitionLeft + (recognitionWidth / 2L); telemetry.addData(String.format("label (%d)", i), "%s (%.03f)", recognition.getLabel(), recognition.getConfidence()); telemetry.addData(" left,top ", "%.03f , %.03f", recognition.getLeft(), recognition.getTop()); telemetry.addData(" right,bottom ", "%.03f , %.03f", recognition.getRight(), recognition.getBottom()); telemetry.addData(" width,mid ", "%.03f , %.03f", recognitionWidth, recognitionMid); telemetry.addData(" angle ", "%.03f", recognition.estimateAngleToObject(AngleUnit.DEGREES)); i++; } } } telemetry.update(); } } skystoneDetector.dispose(); } }
UTF-8
Java
5,248
java
ConceptTensorFlowObjectDetectionWebcam.java
Java
[]
null
[]
/* Copyright (c) 2019 FIRST. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted (subject to the limitations in the disclaimer below) provided that * the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * Neither the name of FIRST nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.team15091; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.vuforia.HINT; import com.vuforia.Vuforia; import org.firstinspires.ftc.robotcore.external.ClassFactory; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer; import org.firstinspires.ftc.robotcore.external.tfod.Recognition; import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector; import java.util.List; /** * This 2019-2020 OpMode illustrates the basics of using the TensorFlow Object Detection API to * determine the position of the Skystone game elements. * <p> * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list. * <p> * IMPORTANT: In order to use this OpMode, you need to obtain your own Vuforia license key as * is explained below. */ @TeleOp(name = "Concept: TensorFlow Object Detection Webcam", group = "Concept") //@Disabled public class ConceptTensorFlowObjectDetectionWebcam extends LinearOpMode { @Override public void runOpMode() { SkystoneDetector skystoneDetector = new SkystoneDetector(this, 0L, 800L); /** Wait for the game to begin */ telemetry.addData(">", "Press Play to start op mode"); telemetry.update(); waitForStart(); if (opModeIsActive()) { while (opModeIsActive()) { telemetry.addData("Detected", skystoneDetector.objectDetected()); if (skystoneDetector.objectDetected()) { if (skystoneDetector.skytoneRecognitions != null) { telemetry.addData("# Object Detected", skystoneDetector.skytoneRecognitions.size()); // step through the list of recognitions and display boundary info. int i = 0; for (Recognition recognition : skystoneDetector.skytoneRecognitions) { float recognitionLeft = Math.max(recognition.getLeft(), 0L); float recognitionWidth = recognition.getRight() - recognitionLeft; float recognitionMid = recognitionLeft + (recognitionWidth / 2L); telemetry.addData(String.format("label (%d)", i), "%s (%.03f)", recognition.getLabel(), recognition.getConfidence()); telemetry.addData(" left,top ", "%.03f , %.03f", recognition.getLeft(), recognition.getTop()); telemetry.addData(" right,bottom ", "%.03f , %.03f", recognition.getRight(), recognition.getBottom()); telemetry.addData(" width,mid ", "%.03f , %.03f", recognitionWidth, recognitionMid); telemetry.addData(" angle ", "%.03f", recognition.estimateAngleToObject(AngleUnit.DEGREES)); i++; } } } telemetry.update(); } } skystoneDetector.dispose(); } }
5,248
0.664063
0.656441
102
50.450981
34.08485
108
false
false
0
0
0
0
0
0
0.813725
false
false
9
815e56cedb3880c38887a32086fd8a766dfeeb2a
13,460,427,528,612
7d2494e6498ae97cd1106eeb50476943efe37356
/src/main/java/org/isegodin/jsdk/twitch/api/service/TwitchApiService.java
f113c98279468a9a11f40e94593310d2ede800d3
[]
no_license
IgorSegodin/test-twitch-api
https://github.com/IgorSegodin/test-twitch-api
a3674dc2310d4362ee4612e2641a3d1718130db7
181ade1258bdff05eb0707f15b3c76d37571ae66
refs/heads/master
2021-01-22T16:10:14.827000
2019-04-14T11:53:20
2019-04-14T11:53:20
102,390,122
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.isegodin.jsdk.twitch.api.service; import org.isegodin.jsdk.twitch.api.data.response.SubscriptionResponse; /** * @author isegodin */ public interface TwitchApiService { String getAccessToken(); SubscriptionResponse getSubscriptions(); }
UTF-8
Java
262
java
TwitchApiService.java
Java
[ { "context": "ata.response.SubscriptionResponse;\n\n/**\n * @author isegodin\n */\npublic interface TwitchApiService {\n\n Stri", "end": 143, "score": 0.9996482729911804, "start": 135, "tag": "USERNAME", "value": "isegodin" } ]
null
[]
package org.isegodin.jsdk.twitch.api.service; import org.isegodin.jsdk.twitch.api.data.response.SubscriptionResponse; /** * @author isegodin */ public interface TwitchApiService { String getAccessToken(); SubscriptionResponse getSubscriptions(); }
262
0.767176
0.767176
13
19.153847
22.569027
71
false
false
0
0
0
0
0
0
0.307692
false
false
9
58f318a1d7d5df94f0a170888f84d91a6e80ccdf
11,416,023,127,642
1e4b89aca09b2cb099cd0e87b5617515dea8e0ee
/Magi.java
cdad81e1c8d9a772f71ddbcb734f68cec0e5043f
[]
no_license
Speedor/MagiCookie
https://github.com/Speedor/MagiCookie
4419603bedb5b6aea906012572b32f8141c94300
c82d53f892d550daa3aa3a89c3d41e09c31c8346
refs/heads/master
2022-11-21T15:34:05.899000
2020-07-27T12:09:55
2020-07-27T12:09:55
282,881,606
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package xxxxxxxx; /** * @author Speedor * @program spider * @description Magi ๆœ็ดขๅผ•ๆ“Žๆœ็ดข cookie ็”Ÿๆˆ * @create 2020-07-25 20:42 **/ public class Magi { private static String hexJoin(String arg) { int[] v0x4b082b = {0xf, 0x23, 0x1d, 0x18, 0x21, 0x10, 0x1, 0x26, 0xa, 0x9, 0x13, 0x1f, 0x28, 0x1b, 0x16, 0x17, 0x19, 0xd, 0x6, 0xb, 0x27, 0x12, 0x14, 0x8, 0xe, 0x15, 0x20, 0x1a, 0x2, 0x1e, 0x7, 0x4, 0x11, 0x5, 0x3, 0x1c, 0x22, 0x25, 0xc, 0x24}; String[] v0x4da0dc = new String[40]; for (int v0x20a7bf = 0; v0x20a7bf < arg.length(); v0x20a7bf++) { char v0x385ee3 = arg.charAt(v0x20a7bf); for (int v0x217721 = 0; v0x217721 < v0x4b082b.length; v0x217721++) { if (v0x4b082b[v0x217721] == v0x20a7bf + 0x1) { v0x4da0dc[v0x217721] = String.valueOf(v0x385ee3); } } } return String.join("", v0x4da0dc); } private static String hexXor(String v0x4e08d8, String v0x23a392) { StringBuilder v0x5a5d3b = new StringBuilder(); for (int v0xe89588 = 0x0; v0xe89588 < v0x4e08d8.length() && v0xe89588 < v0x23a392.length(); v0xe89588 += 0x2) { int v0x105f59 = Integer.parseInt(v0x23a392.substring(v0xe89588, v0xe89588 + 0x2), 16); int v0x401af1 = Integer.parseInt(v0x4e08d8.substring(v0xe89588, v0xe89588 + 0x2), 16); String v0x189e2c = Integer.toHexString(v0x401af1 ^ v0x105f59); if (v0x189e2c.length() == 0x1) { v0x189e2c = "0" + v0x189e2c; } v0x5a5d3b.append(v0x189e2c); } return v0x5a5d3b.toString(); } /** * ๆต‹่ฏ•๏ผš * arg1 = "E609CBF569B6DB613EDB0C3E3174149363F521A9" * acw_sc__v2 = "5f1e7681965cf7c53baeafe680320df91b843110" * @param args */ public static void main(String[] args) { String key = "3000176000856006061501533003690027800375"; String v0x23a392 = hexJoin("E609CBF569B6DB613EDB0C3E3174149363F521A9"); String arg2 = "acw_sc__v2=" + hexXor(key, v0x23a392); System.out.println(arg2); } }
UTF-8
Java
2,179
java
Magi.java
Java
[ { "context": "package xxxxxxxx;\n\n/**\n * @author Speedor\n * @program spider\n * @description Magi ๆœ็ดขๅผ•ๆ“Žๆœ็ดข ", "end": 39, "score": 0.7419235110282898, "start": 34, "tag": "USERNAME", "value": "Speed" }, { "context": "package xxxxxxxx;\n\n/**\n * @author Speedor\n * @program spider\n * @description Magi ๆœ็ดขๅผ•ๆ“Žๆœ็ดข co", "end": 41, "score": 0.5069401860237122, "start": 39, "tag": "NAME", "value": "or" }, { "context": " void main(String[] args) {\n String key = \"3000176000856006061501533003690027800375\";\n String v0x2", "end": 1942, "score": 0.9996348023414612, "start": 1930, "tag": "KEY", "value": "300017600085" } ]
null
[]
package xxxxxxxx; /** * @author Speedor * @program spider * @description Magi ๆœ็ดขๅผ•ๆ“Žๆœ็ดข cookie ็”Ÿๆˆ * @create 2020-07-25 20:42 **/ public class Magi { private static String hexJoin(String arg) { int[] v0x4b082b = {0xf, 0x23, 0x1d, 0x18, 0x21, 0x10, 0x1, 0x26, 0xa, 0x9, 0x13, 0x1f, 0x28, 0x1b, 0x16, 0x17, 0x19, 0xd, 0x6, 0xb, 0x27, 0x12, 0x14, 0x8, 0xe, 0x15, 0x20, 0x1a, 0x2, 0x1e, 0x7, 0x4, 0x11, 0x5, 0x3, 0x1c, 0x22, 0x25, 0xc, 0x24}; String[] v0x4da0dc = new String[40]; for (int v0x20a7bf = 0; v0x20a7bf < arg.length(); v0x20a7bf++) { char v0x385ee3 = arg.charAt(v0x20a7bf); for (int v0x217721 = 0; v0x217721 < v0x4b082b.length; v0x217721++) { if (v0x4b082b[v0x217721] == v0x20a7bf + 0x1) { v0x4da0dc[v0x217721] = String.valueOf(v0x385ee3); } } } return String.join("", v0x4da0dc); } private static String hexXor(String v0x4e08d8, String v0x23a392) { StringBuilder v0x5a5d3b = new StringBuilder(); for (int v0xe89588 = 0x0; v0xe89588 < v0x4e08d8.length() && v0xe89588 < v0x23a392.length(); v0xe89588 += 0x2) { int v0x105f59 = Integer.parseInt(v0x23a392.substring(v0xe89588, v0xe89588 + 0x2), 16); int v0x401af1 = Integer.parseInt(v0x4e08d8.substring(v0xe89588, v0xe89588 + 0x2), 16); String v0x189e2c = Integer.toHexString(v0x401af1 ^ v0x105f59); if (v0x189e2c.length() == 0x1) { v0x189e2c = "0" + v0x189e2c; } v0x5a5d3b.append(v0x189e2c); } return v0x5a5d3b.toString(); } /** * ๆต‹่ฏ•๏ผš * arg1 = "E609CBF569B6DB613EDB0C3E3174149363F521A9" * acw_sc__v2 = "5f1e7681965cf7c53baeafe680320df91b843110" * @param args */ public static void main(String[] args) { String key = "3000176000856006061501533003690027800375"; String v0x23a392 = hexJoin("E609CBF569B6DB613EDB0C3E3174149363F521A9"); String arg2 = "acw_sc__v2=" + hexXor(key, v0x23a392); System.out.println(arg2); } }
2,179
0.594808
0.36764
54
38.944443
33.898224
129
false
false
0
0
0
0
0
0
1.277778
false
false
9
d778ce186a8babdb415d156c66c4fd4438be2370
10,101,763,104,700
f556597f1ef4639f7507f21cc510696699dbdea6
/swat/src/main/java/com/kluster/model/Escolaridade.java
44e63f684de9ba190c7fc20d9d8a138a8fe150ab
[]
no_license
Marcelolynx/swat-action
https://github.com/Marcelolynx/swat-action
8d371e27fa6825761f6dc63a939421914644abcf
c5788961c9481f1a75ec9e280a46734f81ffeda8
refs/heads/master
2016-08-05T11:07:34.071000
2015-04-28T17:52:49
2015-04-28T17:52:49
33,746,753
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kluster.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "tbl_escolaridade") public class Escolaridade implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String grauEscolaridade; // 1ยบ grau, 2ยบ grau, 3ยบ grau etc private String status; // cursando ou completo? private Date dtConclusao; // data de conclusao dos estudos }
UTF-8
Java
692
java
Escolaridade.java
Java
[]
null
[]
package com.kluster.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "tbl_escolaridade") public class Escolaridade implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String grauEscolaridade; // 1ยบ grau, 2ยบ grau, 3ยบ grau etc private String status; // cursando ou completo? private Date dtConclusao; // data de conclusao dos estudos }
692
0.753266
0.74746
27
23.518518
21.159658
66
false
false
0
0
0
0
0
0
0.925926
false
false
9
0220fbb52e3d9a70531478b7dedb912be71a5a60
592,705,516,870
b80102a6242af7a9d1494c81ac2df29ca5f0e232
/examencrudproducto/src/main/java/com/jared/repository/ProductoRepository.java
3deb75e24b5270eb3c6deeeb7dbddef7f1cb5e41
[]
no_license
yarelim/examencrudlp2_jared
https://github.com/yarelim/examencrudlp2_jared
cdd25011d4a3d4b3ec5a9d9f54b75776c2882362
3600d89269c68fa771d0839fabcf4ea928e43e2f
refs/heads/master
2020-04-08T00:27:30.310000
2018-11-23T16:03:05
2018-11-23T16:03:05
158,852,905
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jared.repository; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import com.jared.modell.Producto; public interface ProductoRepository extends JpaRepository<Producto, Long> { Producto findById(long id); Optional<Producto> findByDescripcion(String descripcion); }
UTF-8
Java
350
java
ProductoRepository.java
Java
[]
null
[]
package com.jared.repository; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import com.jared.modell.Producto; public interface ProductoRepository extends JpaRepository<Producto, Long> { Producto findById(long id); Optional<Producto> findByDescripcion(String descripcion); }
350
0.76
0.76
17
18.588236
24.53583
75
false
false
0
0
0
0
0
0
0.705882
false
false
9
f8f40944b56a50e809a420b0c32c3ad1c94b2dfd
16,750,372,473,229
c6d93152ab18b0e282960b8ff224a52c88efb747
/ๅฎ‰ๆ…ง่ฝฏไปถ่ต„ๆ–™/gitRepository/ITMS-3.0/Code/cy.its.road/cy.its.road.repository/src/main/java/cy/its/road/mybatis/client/SpecialSectionMapper.java
6060c89fb50652f7221043f9bc464a3aeb4c4213
[]
no_license
BAT6188/company-database
https://github.com/BAT6188/company-database
adfe5d8b87b66cd51efd0355e131de164b69d3f9
40d0342345cadc51ca2555840e32339ca0c83f51
refs/heads/master
2023-05-23T22:18:22.702000
2018-12-25T00:58:15
2018-12-25T00:58:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cy.its.road.mybatis.client; import java.util.List; import java.util.Map; import cy.its.road.domain.model.highway.SpecialSection; public interface SpecialSectionMapper { int deleteByPrimaryKey(String specialSectionId); int insert(SpecialSection record); int insertSelective(SpecialSection record); SpecialSection selectByPrimaryKey(String specialSectionId); int updateByPrimaryKeySelective(SpecialSection record); int updateByPrimaryKey(SpecialSection record); List<SpecialSection> selectSpecialSections(Map<String, Object> params); int deleteByRoadId(String roadId); int countSpecialSections(Map<String, Object> parseParams); }
UTF-8
Java
687
java
SpecialSectionMapper.java
Java
[]
null
[]
package cy.its.road.mybatis.client; import java.util.List; import java.util.Map; import cy.its.road.domain.model.highway.SpecialSection; public interface SpecialSectionMapper { int deleteByPrimaryKey(String specialSectionId); int insert(SpecialSection record); int insertSelective(SpecialSection record); SpecialSection selectByPrimaryKey(String specialSectionId); int updateByPrimaryKeySelective(SpecialSection record); int updateByPrimaryKey(SpecialSection record); List<SpecialSection> selectSpecialSections(Map<String, Object> params); int deleteByRoadId(String roadId); int countSpecialSections(Map<String, Object> parseParams); }
687
0.784571
0.784571
26
25.461538
25.366894
75
false
false
0
0
0
0
0
0
0.615385
false
false
9
4a286226a9a71f91a0968949182cfb8b199ee68a
8,349,416,443,788
4a2ab4e01f886ed6d93e422b21ec005f41876404
/test/core/koopa/core/grammars/test/BinaryGrammarTest.java
ecfc86f33d7717f1e0bc82fb1ee5245476f6eb3a
[ "BSD-3-Clause" ]
permissive
krisds/koopa
https://github.com/krisds/koopa
05477ec2a35856d8e7414406a6db060854ac3161
e3e5bb18ce5eef2f3791a6c65f671176c4eeda8d
refs/heads/master
2023-05-02T12:57:28.936000
2023-04-30T11:08:50
2023-04-30T11:08:50
171,827,886
31
13
NOASSERTION
false
2019-11-05T10:29:54
2019-02-21T08:07:12
2019-11-04T14:59:26
2019-11-05T10:29:52
12,414
12
1
2
COBOL
false
false
package koopa.core.grammars.test; import org.junit.BeforeClass; import org.junit.Test; import koopa.core.grammars.combinators.Scoped; import koopa.core.parsers.ParserCombinator; import koopa.core.util.test.TreeSample; // TODO Redo with a fluent grammar ? // TODO AST tests for every input. public class BinaryGrammarTest extends GrammarTest { private static final String FOX = "The quick brown fox jumped over the lazy dog . "; private static final String LIPSUM = "Lorem ipsum dolor sit amet , "; private static ParserCombinator and = null; private static ParserCombinator or = null; private static Scoped cond = null; private static Scoped disj = null; private static Scoped conj = null; private static Scoped atom = null; private static Scoped nested = null; private static Scoped unknown = null; @BeforeClass public static void setup() { TestGrammar G = new TestGrammar(); cond = (Scoped) G.scoped("cond"); disj = (Scoped) G.scoped("disj"); conj = (Scoped) G.scoped("conj"); atom = (Scoped) G.scoped("atom"); nested = (Scoped) G.scoped("nested"); unknown = (Scoped) G.scoped("unknown"); final ParserCombinator openParen = G.literal("("); final ParserCombinator closeParen = G.literal(")"); and = G.notNested(G.token("AND")); or = G.notNested(G.token("OR")); // TODO G.eoi(), instead of G.eof() ? unknown.setParser(G.skipto(G.eof())); nested.setParser(G.sequence(// openParen, // G.balancing(openParen, closeParen, // G.upTo(cond, G.notNested(closeParen))), // closeParen)); atom.setParser(G.choice(nested, unknown)); conj.setParser(G.sequence( // G.upTo(atom, and), G.star(G.sequence(and, G.upTo(atom, and))))); disj.setParser(G.sequence( // G.upTo(conj, or), G.star(G.sequence(or, G.upTo(conj, or))))); cond.setParser(G.balancing( // openParen, closeParen, // disj)); } @Test public void testUnknown() { // 'unknown' eats everything to the end of the file/input. shouldAccept(unknown, TreeSample.from( // "+ unknown", // " > " + FOX // )); } @Test public void testUnknownUpTo() { // We can limit what 'unknown' sees. Here it will consume until the next // 'AND'. ParserCombinator upToAnd = G.upTo(unknown, and); // '%match unkown %upto and' should still consume to the end of the // input as is though. shouldAccept(upToAnd, TreeSample.from( // "+ unknown", // " > " + FOX // )); // But when we expect that 'AND', it should still get matched correctly. ParserCombinator upToAndMore = G.sequence(upToAnd, and, G.token("more")); // This fails because there is no 'AND' following FOX. shouldReject(upToAndMore, spaced(FOX)); // This fails because there is no 'more' after 'AND'. shouldReject(upToAndMore, spaced(FOX + " AND")); shouldAccept(upToAndMore, TreeSample.from( // "+ unknown", // " > " + FOX, // "> AND more" // )); shouldAccept(upToAndMore, TreeSample.from( // "+ unknown", // " > " + LIPSUM, // "> AND more" // )); } @Test public void testUnknownUpToNotNested() { // We can limit what 'unknown' sees. Here it will consume until the next // 'AND'. Note that that 'AND' must be a "not nested" 'AND'. An 'AND' // which is nested does not count towards the limit. ParserCombinator unknownUpToAnd = G.upTo(unknown, and); // So let's test that. We will be balancing parentheses while scanning // for the "not nested" 'AND'. ParserCombinator balanced = G.balancing( // G.literal("("), G.literal(")"), // G.sequence(unknownUpToAnd, and, G.token("more")) // ); // This old example should still work. shouldAccept(balanced, spaced(FOX + " AND more")); // This one shouldn't, as the wrong thing is following the 'AND'. shouldReject(balanced, spaced(FOX + " AND hare")); // This one should match again, as the faulty 'AND' is now nested and // should therefore be ignored. shouldAccept(balanced, spaced(FOX + " ( AND hare ) AND more")); } @Test public void testUnknownConditions() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/unknown", // " > " + FOX // )); shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/unknown", // " > " + LIPSUM // )); } @Test public void testConjunction() { shouldAccept(cond, TreeSample.from(// "+ cond/disj/conj", // " + atom/unknown", // " > " + FOX, // " > AND", // " + atom/unknown", // " > " + LIPSUM // )); } @Test public void testDisjunction() { shouldAccept(cond, TreeSample.from(// "+ cond/disj", // " + conj/atom/unknown", // " > " + FOX, // " > OR", // " + conj/atom/unknown", // " > " + LIPSUM // )); } @Test public void testCombined() { shouldAccept(cond, TreeSample.from(// "+ cond/disj", // " + conj", // " + atom/unknown", // " > " + FOX, // " > AND", // " + atom/unknown", // " > " + LIPSUM, // " > OR", // " + conj", // " + atom/unknown", // " > " + LIPSUM, // " > AND", // " + atom/unknown", // " > " + FOX // )); } @Test public void testDisjunctionWithNesting() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/nested", // " > (", // " + cond/disj/conj/atom/unknown", // " > " + FOX, // " > )" // )); shouldAccept(cond, spaced("( " + LIPSUM + " )")); shouldAccept(cond, spaced("( " + FOX + " AND " + LIPSUM + " )")); shouldAccept(cond, spaced("( " + LIPSUM + " OR " + FOX + " )")); shouldAccept(cond, spaced("( " + FOX + " AND " + LIPSUM + " OR " + LIPSUM + " AND " + FOX + " )")); // This uses parentheses to invert the order of precedence. shouldAccept(cond, spaced("( " + FOX + " OR " + LIPSUM + " ) AND ( " + LIPSUM + " OR " + FOX + " )")); } @Test public void testDeepNesting() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/nested", // " > (", // " + cond/disj/conj/atom/nested", // " > (", // " + cond/disj/conj/atom/unknown", // " > A", // " > )", // " > )" // )); // Going overboard on the parentheses. shouldAccept(cond, spaced( "( ( ( ( ( ( " + FOX + " ) ) ) ) OR " + LIPSUM + " ) )")); } @Test public void testIssue() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj", // " + atom/nested", // " > (", // " + cond/disj", // " + conj/atom/unknown", // " > A", // " > OR", // " + conj/atom/unknown", // " > B", // " > )", // " > AND", // " + atom/unknown", // " > C" // )); } }
UTF-8
Java
6,901
java
BinaryGrammarTest.java
Java
[]
null
[]
package koopa.core.grammars.test; import org.junit.BeforeClass; import org.junit.Test; import koopa.core.grammars.combinators.Scoped; import koopa.core.parsers.ParserCombinator; import koopa.core.util.test.TreeSample; // TODO Redo with a fluent grammar ? // TODO AST tests for every input. public class BinaryGrammarTest extends GrammarTest { private static final String FOX = "The quick brown fox jumped over the lazy dog . "; private static final String LIPSUM = "Lorem ipsum dolor sit amet , "; private static ParserCombinator and = null; private static ParserCombinator or = null; private static Scoped cond = null; private static Scoped disj = null; private static Scoped conj = null; private static Scoped atom = null; private static Scoped nested = null; private static Scoped unknown = null; @BeforeClass public static void setup() { TestGrammar G = new TestGrammar(); cond = (Scoped) G.scoped("cond"); disj = (Scoped) G.scoped("disj"); conj = (Scoped) G.scoped("conj"); atom = (Scoped) G.scoped("atom"); nested = (Scoped) G.scoped("nested"); unknown = (Scoped) G.scoped("unknown"); final ParserCombinator openParen = G.literal("("); final ParserCombinator closeParen = G.literal(")"); and = G.notNested(G.token("AND")); or = G.notNested(G.token("OR")); // TODO G.eoi(), instead of G.eof() ? unknown.setParser(G.skipto(G.eof())); nested.setParser(G.sequence(// openParen, // G.balancing(openParen, closeParen, // G.upTo(cond, G.notNested(closeParen))), // closeParen)); atom.setParser(G.choice(nested, unknown)); conj.setParser(G.sequence( // G.upTo(atom, and), G.star(G.sequence(and, G.upTo(atom, and))))); disj.setParser(G.sequence( // G.upTo(conj, or), G.star(G.sequence(or, G.upTo(conj, or))))); cond.setParser(G.balancing( // openParen, closeParen, // disj)); } @Test public void testUnknown() { // 'unknown' eats everything to the end of the file/input. shouldAccept(unknown, TreeSample.from( // "+ unknown", // " > " + FOX // )); } @Test public void testUnknownUpTo() { // We can limit what 'unknown' sees. Here it will consume until the next // 'AND'. ParserCombinator upToAnd = G.upTo(unknown, and); // '%match unkown %upto and' should still consume to the end of the // input as is though. shouldAccept(upToAnd, TreeSample.from( // "+ unknown", // " > " + FOX // )); // But when we expect that 'AND', it should still get matched correctly. ParserCombinator upToAndMore = G.sequence(upToAnd, and, G.token("more")); // This fails because there is no 'AND' following FOX. shouldReject(upToAndMore, spaced(FOX)); // This fails because there is no 'more' after 'AND'. shouldReject(upToAndMore, spaced(FOX + " AND")); shouldAccept(upToAndMore, TreeSample.from( // "+ unknown", // " > " + FOX, // "> AND more" // )); shouldAccept(upToAndMore, TreeSample.from( // "+ unknown", // " > " + LIPSUM, // "> AND more" // )); } @Test public void testUnknownUpToNotNested() { // We can limit what 'unknown' sees. Here it will consume until the next // 'AND'. Note that that 'AND' must be a "not nested" 'AND'. An 'AND' // which is nested does not count towards the limit. ParserCombinator unknownUpToAnd = G.upTo(unknown, and); // So let's test that. We will be balancing parentheses while scanning // for the "not nested" 'AND'. ParserCombinator balanced = G.balancing( // G.literal("("), G.literal(")"), // G.sequence(unknownUpToAnd, and, G.token("more")) // ); // This old example should still work. shouldAccept(balanced, spaced(FOX + " AND more")); // This one shouldn't, as the wrong thing is following the 'AND'. shouldReject(balanced, spaced(FOX + " AND hare")); // This one should match again, as the faulty 'AND' is now nested and // should therefore be ignored. shouldAccept(balanced, spaced(FOX + " ( AND hare ) AND more")); } @Test public void testUnknownConditions() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/unknown", // " > " + FOX // )); shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/unknown", // " > " + LIPSUM // )); } @Test public void testConjunction() { shouldAccept(cond, TreeSample.from(// "+ cond/disj/conj", // " + atom/unknown", // " > " + FOX, // " > AND", // " + atom/unknown", // " > " + LIPSUM // )); } @Test public void testDisjunction() { shouldAccept(cond, TreeSample.from(// "+ cond/disj", // " + conj/atom/unknown", // " > " + FOX, // " > OR", // " + conj/atom/unknown", // " > " + LIPSUM // )); } @Test public void testCombined() { shouldAccept(cond, TreeSample.from(// "+ cond/disj", // " + conj", // " + atom/unknown", // " > " + FOX, // " > AND", // " + atom/unknown", // " > " + LIPSUM, // " > OR", // " + conj", // " + atom/unknown", // " > " + LIPSUM, // " > AND", // " + atom/unknown", // " > " + FOX // )); } @Test public void testDisjunctionWithNesting() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/nested", // " > (", // " + cond/disj/conj/atom/unknown", // " > " + FOX, // " > )" // )); shouldAccept(cond, spaced("( " + LIPSUM + " )")); shouldAccept(cond, spaced("( " + FOX + " AND " + LIPSUM + " )")); shouldAccept(cond, spaced("( " + LIPSUM + " OR " + FOX + " )")); shouldAccept(cond, spaced("( " + FOX + " AND " + LIPSUM + " OR " + LIPSUM + " AND " + FOX + " )")); // This uses parentheses to invert the order of precedence. shouldAccept(cond, spaced("( " + FOX + " OR " + LIPSUM + " ) AND ( " + LIPSUM + " OR " + FOX + " )")); } @Test public void testDeepNesting() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj/atom/nested", // " > (", // " + cond/disj/conj/atom/nested", // " > (", // " + cond/disj/conj/atom/unknown", // " > A", // " > )", // " > )" // )); // Going overboard on the parentheses. shouldAccept(cond, spaced( "( ( ( ( ( ( " + FOX + " ) ) ) ) OR " + LIPSUM + " ) )")); } @Test public void testIssue() { shouldAccept(cond, TreeSample.from( // "+ cond/disj/conj", // " + atom/nested", // " > (", // " + cond/disj", // " + conj/atom/unknown", // " > A", // " > OR", // " + conj/atom/unknown", // " > B", // " > )", // " > AND", // " + atom/unknown", // " > C" // )); } }
6,901
0.554847
0.554847
260
25.542307
19.715334
85
false
false
0
0
0
0
0
0
3.419231
false
false
9
e3ca069ae8556bee353a7459d2e94f5af5025253
20,598,663,155,880
d117eb4528be50a114855ce930d9b2c10d0d3f4f
/app/src/main/java/com/example/myapplication/Models/list_chat.java
6a4db968a70aec5b8896b09d611290704d0a9357
[]
no_license
rachmat2110/BMI
https://github.com/rachmat2110/BMI
33e3b41ffe43fd06a1d638418c5c0502f0e7e236
7b973567f8ea3df2457e34f2b788c4f00e5c76b0
refs/heads/master
2023-02-15T11:56:15.604000
2021-01-12T04:23:29
2021-01-12T04:23:29
328,869,545
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.myapplication.Models; import com.google.firebase.firestore.ServerTimestamp; import java.util.Date; public class list_chat { private String message; private String receiver; private String sender; private boolean isseen; @ServerTimestamp private Date Tanggal; public list_chat() { } public list_chat(String message, String receiver, String sender, boolean isseen) { this.message = message; this.receiver = receiver; this.sender = sender; this.isseen = isseen; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getReceiver() { return receiver; } public void setReceiver(String receiver) { this.receiver = receiver; } public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public Date getTanggal() { return Tanggal; } public void setTanggal(Date tanggal) { Tanggal = tanggal; } public boolean isIsseen() { return isseen; } public void setIsseen(boolean isseen) { this.isseen = isseen; } }
UTF-8
Java
1,287
java
list_chat.java
Java
[]
null
[]
package com.example.myapplication.Models; import com.google.firebase.firestore.ServerTimestamp; import java.util.Date; public class list_chat { private String message; private String receiver; private String sender; private boolean isseen; @ServerTimestamp private Date Tanggal; public list_chat() { } public list_chat(String message, String receiver, String sender, boolean isseen) { this.message = message; this.receiver = receiver; this.sender = sender; this.isseen = isseen; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getReceiver() { return receiver; } public void setReceiver(String receiver) { this.receiver = receiver; } public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public Date getTanggal() { return Tanggal; } public void setTanggal(Date tanggal) { Tanggal = tanggal; } public boolean isIsseen() { return isseen; } public void setIsseen(boolean isseen) { this.isseen = isseen; } }
1,287
0.621601
0.621601
65
18.799999
17.49655
86
false
false
0
0
0
0
0
0
0.384615
false
false
9
9bd8ad7be208a0966db330666b3727f4ddb147c4
14,164,802,164,025
573070ec8ba16cd248cde31845032a012b49db0c
/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerConfigArtifact.java
fbccfa5825ce7310ac1611fc5018af370f6c34be
[]
no_license
eclipse/virgo.kernel
https://github.com/eclipse/virgo.kernel
a071ab2605768e5f4611bd1b04e7aee1213dab9d
d66f4272dc19c6b0f9b5249183bbb5002b548876
refs/heads/master
2020-11-10T17:33:55.429000
2020-07-23T22:18:18
2020-07-23T22:18:18
1,553,768
8
8
null
false
2014-06-14T18:58:09
2011-04-01T02:12:18
2014-05-14T15:00:29
2014-05-14T15:00:28
10,157
8
3
2
Java
null
null
/******************************************************************************* * Copyright (c) 2011 VMware Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VMware Inc. - initial contribution *******************************************************************************/ package org.eclipse.virgo.kernel.model.internal.deployer; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.Properties; import org.eclipse.equinox.region.Region; import org.eclipse.virgo.kernel.install.artifact.ConfigInstallArtifact; import org.osgi.framework.BundleContext; /** * {@link DeployerConfigArtifact} is a {@link DeployerArtifact} that understands * a configuration install artifact's properties. * <p /> * * <strong>Concurrent Semantics</strong><br /> * Thread safe. */ final class DeployerConfigArtifact extends DeployerArtifact { private final ConfigInstallArtifact configInstallArtifact; public DeployerConfigArtifact(BundleContext bundleContext, ConfigInstallArtifact configInstallArtifact, Region region) { super(bundleContext, configInstallArtifact, region); this.configInstallArtifact = configInstallArtifact; } /** * {@inheritDoc} */ @Override public Map<String, String> getProperties() { Map<String, String> properties = new HashMap<String, String>(super.getProperties()); try { Properties props = this.configInstallArtifact.getProperties(); Enumeration<Object> keys = props.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); if (key instanceof String) { Object value = props.get(key); if (value instanceof String) { properties.put((String)key, (String)value); } } } } catch (IOException ignored) { // Default to superclass behaviour } return properties; } }
UTF-8
Java
2,286
java
DeployerConfigArtifact.java
Java
[]
null
[]
/******************************************************************************* * Copyright (c) 2011 VMware Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VMware Inc. - initial contribution *******************************************************************************/ package org.eclipse.virgo.kernel.model.internal.deployer; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.Properties; import org.eclipse.equinox.region.Region; import org.eclipse.virgo.kernel.install.artifact.ConfigInstallArtifact; import org.osgi.framework.BundleContext; /** * {@link DeployerConfigArtifact} is a {@link DeployerArtifact} that understands * a configuration install artifact's properties. * <p /> * * <strong>Concurrent Semantics</strong><br /> * Thread safe. */ final class DeployerConfigArtifact extends DeployerArtifact { private final ConfigInstallArtifact configInstallArtifact; public DeployerConfigArtifact(BundleContext bundleContext, ConfigInstallArtifact configInstallArtifact, Region region) { super(bundleContext, configInstallArtifact, region); this.configInstallArtifact = configInstallArtifact; } /** * {@inheritDoc} */ @Override public Map<String, String> getProperties() { Map<String, String> properties = new HashMap<String, String>(super.getProperties()); try { Properties props = this.configInstallArtifact.getProperties(); Enumeration<Object> keys = props.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); if (key instanceof String) { Object value = props.get(key); if (value instanceof String) { properties.put((String)key, (String)value); } } } } catch (IOException ignored) { // Default to superclass behaviour } return properties; } }
2,286
0.621172
0.617673
67
33.119404
28.517353
124
false
false
0
0
0
0
0
0
0.41791
false
false
9
b8b1bc18b7fdbf7a2fe0c06c689caaa7951572b8
9,715,216,045,960
0f40d66f8e333a8c64f474f392e2153970302e37
/Module01/src/com/auguigu/bean/Customer.java
73a0d053c7c478af9aaaf46a75d74294ab28df9b
[]
no_license
tiffary802/Project01
https://github.com/tiffary802/Project01
5bc759d8413203373cf9c9f27be98ed30790e053
408881a7039bcc6798077eb2d2c7bb385213af7f
refs/heads/master
2023-07-01T16:01:46.689000
2021-08-04T15:55:42
2021-08-04T15:55:42
392,725,984
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.auguigu.bean; //djfdkfjdf public class Customer { public static void main(String[] args){ System.out.println("hello world 2222!!"); } public void method2(){ System.out.println("method2"); } }
UTF-8
Java
238
java
Customer.java
Java
[]
null
[]
package com.auguigu.bean; //djfdkfjdf public class Customer { public static void main(String[] args){ System.out.println("hello world 2222!!"); } public void method2(){ System.out.println("method2"); } }
238
0.62605
0.60084
14
16
16.7332
47
false
false
0
0
0
0
0
0
0.214286
false
false
9
c1e86a07585fd45779c92f7fe07bf878131f9590
21,706,764,736,436
6c0e43ed1cdcbcab568190e21a55d65410dee4b4
/src/examples/android/puc/LocationTable.java
5ca10b4c27ce2f97fda5bc94b16dff5430eb44be
[]
no_license
alexandremcosta/LocationNotifier
https://github.com/alexandremcosta/LocationNotifier
15df6e863b9922b86da80bb4477b2bf9edf9f238
dfbb89b736c4795e48e205092f0042fe3db1c89a
refs/heads/master
2020-04-29T02:03:27.926000
2012-11-24T00:07:19
2012-11-24T00:07:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package examples.android.puc; import android.database.sqlite.SQLiteDatabase; import android.util.Log; public class LocationTable { public static final String TABLE = "LEMBRETE"; public static final String ID = "_id"; public static final String LATITUDE = "latitude"; public static final String LONGITUDE = "longitude"; public static final String ACTIVE = "active"; public static final String NAME = "name"; private static final String DATABASE_CREATE = "create table " + TABLE + "(" + ID + " integer primary key autoincrement, " + LATITUDE + " real not null, " + LONGITUDE + " real not null, " + NAME + " text not null, " + ACTIVE + " integer not null" + ");"; public static void onCreate(SQLiteDatabase database) { database.execSQL(DATABASE_CREATE); } public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { Log.w(LocationTable.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); database.execSQL("DROP TABLE IF EXISTS " + TABLE); onCreate(database); } }
UTF-8
Java
1,111
java
LocationTable.java
Java
[]
null
[]
package examples.android.puc; import android.database.sqlite.SQLiteDatabase; import android.util.Log; public class LocationTable { public static final String TABLE = "LEMBRETE"; public static final String ID = "_id"; public static final String LATITUDE = "latitude"; public static final String LONGITUDE = "longitude"; public static final String ACTIVE = "active"; public static final String NAME = "name"; private static final String DATABASE_CREATE = "create table " + TABLE + "(" + ID + " integer primary key autoincrement, " + LATITUDE + " real not null, " + LONGITUDE + " real not null, " + NAME + " text not null, " + ACTIVE + " integer not null" + ");"; public static void onCreate(SQLiteDatabase database) { database.execSQL(DATABASE_CREATE); } public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { Log.w(LocationTable.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); database.execSQL("DROP TABLE IF EXISTS " + TABLE); onCreate(database); } }
1,111
0.706571
0.706571
33
32.666668
24.270779
78
false
false
0
0
0
0
0
0
1.939394
false
false
9
088db61b4b4a5f8745e7baf9b0f0a02a9b433a42
21,706,764,732,984
2152ea9aa36a4ecd84b2833ae37877fe0898b7d2
/src/LoginPage.java
d5c9bf2942341f00a68e31d810d632ff8f653563
[]
no_license
BakulPrajapati/Website_Test_Automation
https://github.com/BakulPrajapati/Website_Test_Automation
74360f7b8d8501bb231503e071cf15d0da4913ab
f99ebd2a58aa436cc416abb29b69315f57f973fa
refs/heads/master
2023-08-01T01:08:18.206000
2021-09-25T23:43:10
2021-09-25T23:43:10
410,396,883
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import static org.testng.Assert.assertEquals; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.NoAlertPresentException; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; public class LoginPage { static String button = "btnLogin"; static ChromeDriver driver; @Test static void correctId_correctPass() { System.setProperty("webdriver.chrome.driver", "C:/Selenium/chromedriver.exe"); driver = new ChromeDriver(); driver.get(Details.BASE_URL); driver.findElement(By.name("btnReset")).click(); System.out.println("Both userid and password correct"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.USER_ID); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(Details.PASSWORD); driver.findElement(By.name(button)).click(); Alert alert = driver.switchTo().alert(); alert.accept(); } @Test static void correctId_wrongPass() { driver.get(Details.BASE_URL); System.out.println("Trying for wrong password and correct id"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.USER_ID); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(Details.INVALID_PASS); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } @Test static void correctPass_wrongId() { System.out.println("Trying for wrong id and correct password"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.INVALID_UID); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(Details.PASSWORD); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } @Test static void userIdEmpty() { System.out.println("Trying to keep userID field empty"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(Details.PASSWORD); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } @Test static void passwordEmpty() { System.out.println("Trying to keep password field empty"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.USER_ID); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } static void ManagerHomePage() { driver.get(Details.MANAGER_URL); String actualTitle = driver.getTitle(); System.out.println(actualTitle); } static void changePass() { driver.get(Details.MANAGER_URL); driver.findElement(By.xpath("/html/body/div[3]/div/ul/li[11]/a")).click(); driver.findElement(By.name("oldpassword")).sendKeys(Details.INVALID_PASS); driver.findElement(By.name("newpassword")).sendKeys("123456"); driver.findElement(By.name("confirmpassword")).sendKeys("123456"); } static void driverClose() { driver.close(); } }
UTF-8
Java
4,211
java
LoginPage.java
Java
[ { "context": "ent(By.name(\"password\")).sendKeys(Details.INVALID_PASS);\n\t\tdriver.findElement(By.name(button)).click();\n", "end": 1362, "score": 0.5144596695899963, "start": 1358, "tag": "PASSWORD", "value": "PASS" }, { "context": "\tdriver.findElement(By.name(\"password\")).sendKeys(Details.PASSWORD);\n\t\tdriver.findElement(By.name(button)).click();\n", "end": 2680, "score": 0.7984039187431335, "start": 2664, "tag": "PASSWORD", "value": "Details.PASSWORD" }, { "context": "ver.findElement(By.name(\"newpassword\")).sendKeys(\"123456\");\n\t\tdriver.findElement(By.name(\"confirmpassword\"", "end": 4080, "score": 0.9994626045227051, "start": 4074, "tag": "PASSWORD", "value": "123456" }, { "context": "findElement(By.name(\"confirmpassword\")).sendKeys(\"123456\");\n\n\t}\n\n\tstatic void driverClose() {\n\t\tdriver.clo", "end": 4149, "score": 0.999440610408783, "start": 4143, "tag": "PASSWORD", "value": "123456" } ]
null
[]
import static org.testng.Assert.assertEquals; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.NoAlertPresentException; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; public class LoginPage { static String button = "btnLogin"; static ChromeDriver driver; @Test static void correctId_correctPass() { System.setProperty("webdriver.chrome.driver", "C:/Selenium/chromedriver.exe"); driver = new ChromeDriver(); driver.get(Details.BASE_URL); driver.findElement(By.name("btnReset")).click(); System.out.println("Both userid and password correct"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.USER_ID); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(Details.PASSWORD); driver.findElement(By.name(button)).click(); Alert alert = driver.switchTo().alert(); alert.accept(); } @Test static void correctId_wrongPass() { driver.get(Details.BASE_URL); System.out.println("Trying for wrong password and correct id"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.USER_ID); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(Details.INVALID_<PASSWORD>); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } @Test static void correctPass_wrongId() { System.out.println("Trying for wrong id and correct password"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.INVALID_UID); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(Details.PASSWORD); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } @Test static void userIdEmpty() { System.out.println("Trying to keep userID field empty"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys(<PASSWORD>); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } @Test static void passwordEmpty() { System.out.println("Trying to keep password field empty"); driver.findElement(By.name("uid")).clear(); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("uid")).sendKeys(Details.USER_ID); driver.findElement(By.name(button)).click(); try { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); assertEquals(alertMsg, Details.EXPECTED_ERROR); } catch (NoAlertPresentException ex) { String actualTitle = driver.getTitle(); assertEquals(actualTitle, Details.EXPECTED_TITLE); } } static void ManagerHomePage() { driver.get(Details.MANAGER_URL); String actualTitle = driver.getTitle(); System.out.println(actualTitle); } static void changePass() { driver.get(Details.MANAGER_URL); driver.findElement(By.xpath("/html/body/div[3]/div/ul/li[11]/a")).click(); driver.findElement(By.name("oldpassword")).sendKeys(Details.INVALID_PASS); driver.findElement(By.name("newpassword")).sendKeys("<PASSWORD>"); driver.findElement(By.name("confirmpassword")).sendKeys("<PASSWORD>"); } static void driverClose() { driver.close(); } }
4,219
0.720494
0.716932
137
29.729927
23.625269
80
false
false
0
0
0
0
0
0
2.131387
false
false
9
638ead7c8615680799052e0d26dd1a4b2ed3abf6
16,389,595,222,394
2dd393018802284a7f826a9f3157defb80f86715
/src/main/java/org/apache/datasketches/quantiles/ItemsUtil.java
bf42dd18cc525c13aab98e4c9109e610de605d3c
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
apache/datasketches-java
https://github.com/apache/datasketches-java
6e5d84da45fc3785d657724118cbde377109d774
2a8e5dff9d273d2a6e420f9e90b35dcd9744e0c9
refs/heads/master
2023-08-31T02:58:35.134000
2023-08-30T17:26:55
2023-08-30T17:26:55
38,279,790
185
39
Apache-2.0
false
2023-08-31T22:55:33
2015-06-30T01:05:21
2023-08-29T08:22:37
2023-08-31T22:55:32
16,563
836
215
0
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.datasketches.quantiles; import static org.apache.datasketches.common.Util.LS; import java.util.Arrays; import org.apache.datasketches.common.SketchesArgumentException; /** * Utility class for generic quantiles sketch. * * @author Kevin Lang * @author Alexander Saydakov */ final class ItemsUtil { private ItemsUtil() {} static final int ITEMS_SER_VER = 3; static final int PRIOR_ITEMS_SER_VER = 2; /** * Check the validity of the given serialization version * @param serVer the given serialization version */ static void checkItemsSerVer(final int serVer) { if ((serVer == ITEMS_SER_VER) || (serVer == PRIOR_ITEMS_SER_VER)) { return; } throw new SketchesArgumentException( "Possible corruption: Invalid Serialization Version: " + serVer); } /** * Called when the base buffer has just acquired 2*k elements. * @param <T> the data type * @param sketch the given quantiles sketch */ @SuppressWarnings("unchecked") static <T> void processFullBaseBuffer(final ItemsSketch<T> sketch) { final int bbCount = sketch.getBaseBufferCount(); final long n = sketch.getN(); assert bbCount == (2 * sketch.getK()); // internal consistency check // make sure there will be enough levels for the propagation ItemsUpdateImpl.maybeGrowLevels(sketch, n); // important: n_ was incremented by update before we got here // this aliasing is a bit dangerous; notice that we did it after the possible resizing final Object[] baseBuffer = sketch.getCombinedBuffer(); Arrays.sort((T[]) baseBuffer, 0, bbCount, sketch.getComparator()); ItemsUpdateImpl.inPlacePropagateCarry( 0, null, 0, // this null is okay (T[]) baseBuffer, 0, true, sketch); sketch.baseBufferCount_ = 0; Arrays.fill(baseBuffer, 0, 2 * sketch.getK(), null); // to release the discarded objects assert (n / (2L * sketch.getK())) == sketch.getBitPattern(); // internal consistency check } static <T> String toString(final boolean sketchSummary, final boolean dataDetail, final ItemsSketch<T> sketch) { final StringBuilder sb = new StringBuilder(); final String thisSimpleName = sketch.getClass().getSimpleName(); final int bbCount = sketch.getBaseBufferCount(); final int combAllocCount = sketch.getCombinedBufferAllocatedCount(); final int k = sketch.getK(); final long bitPattern = sketch.getBitPattern(); if (dataDetail) { sb.append(ClassicUtil.LS).append("### ").append(thisSimpleName).append(" DATA DETAIL: ").append(ClassicUtil.LS); final Object[] items = sketch.getCombinedBuffer(); //output the base buffer sb.append(" BaseBuffer :"); if (bbCount > 0) { for (int i = 0; i < bbCount; i++) { sb.append(' ').append(items[i]); } } sb.append(ClassicUtil.LS); //output all the levels final int numItems = combAllocCount; if (numItems > (2 * k)) { sb.append(" Valid | Level"); for (int j = 2 * k; j < numItems; j++) { //output level data starting at 2K if ((j % k) == 0) { //start output of new level final int levelNum = j > (2 * k) ? (j - (2 * k)) / k : 0; final String validLvl = ((1L << levelNum) & bitPattern) > 0 ? " T " : " F "; final String lvl = String.format("%5d", levelNum); sb.append(ClassicUtil.LS).append(" ").append(validLvl).append(" ").append(lvl).append(":"); } sb.append(' ').append(items[j]); } sb.append(ClassicUtil.LS); } sb.append("### END DATA DETAIL").append(ClassicUtil.LS); } if (sketchSummary) { final long n = sketch.getN(); final String nStr = String.format("%,d", n); final int numLevels = ClassicUtil.computeNumLevelsNeeded(k, n); final String bufCntStr = String.format("%,d", combAllocCount); final int preBytes = sketch.isEmpty() ? Long.BYTES : 2 * Long.BYTES; final double epsPmf = ClassicUtil.getNormalizedRankError(k, true); final String epsPmfPctStr = String.format("%.3f%%", epsPmf * 100.0); final double eps = ClassicUtil.getNormalizedRankError(k, false); final String epsPctStr = String.format("%.3f%%", eps * 100.0); final int numSamples = sketch.getNumRetained(); final String numSampStr = String.format("%,d", numSamples); final T minItem = sketch.isEmpty() ? null : sketch.getMinItem(); final T maxItem = sketch.isEmpty() ? null : sketch.getMaxItem(); sb.append(ClassicUtil.LS).append("### ").append(thisSimpleName).append(" SUMMARY: ").append(ClassicUtil.LS); sb.append(" K : ").append(k).append(ClassicUtil.LS); sb.append(" N : ").append(nStr).append(ClassicUtil.LS); sb.append(" BaseBufferCount : ").append(bbCount).append(ClassicUtil.LS); sb.append(" CombinedBufferAllocatedCount : ").append(bufCntStr).append(ClassicUtil.LS); sb.append(" Total Levels : ").append(numLevels).append(ClassicUtil.LS); sb.append(" Valid Levels : ").append(ClassicUtil.computeValidLevels(bitPattern)) .append(ClassicUtil.LS); sb.append(" Level Bit Pattern : ").append(Long.toBinaryString(bitPattern)) .append(ClassicUtil.LS); sb.append(" Valid Samples : ").append(numSampStr).append(ClassicUtil.LS); sb.append(" Preamble Bytes : ").append(preBytes).append(ClassicUtil.LS); sb.append(" Normalized Rank Error : ").append(epsPctStr).append(LS); sb.append(" Normalized Rank Error (PMF) : ").append(epsPmfPctStr).append(LS); sb.append(" Min Quantile : ").append(minItem).append(ClassicUtil.LS); sb.append(" Max Quantile : ").append(maxItem).append(ClassicUtil.LS); sb.append("### END SKETCH SUMMARY").append(ClassicUtil.LS); } return sb.toString(); } }
UTF-8
Java
6,864
java
ItemsUtil.java
Java
[ { "context": " class for generic quantiles sketch.\n *\n * @author Kevin Lang\n * @author Alexander Saydakov\n */\nfinal class Ite", "end": 1075, "score": 0.9997917413711548, "start": 1065, "tag": "NAME", "value": "Kevin Lang" }, { "context": "ntiles sketch.\n *\n * @author Kevin Lang\n * @author Alexander Saydakov\n */\nfinal class ItemsUtil {\n\n private ItemsUtil(", "end": 1105, "score": 0.9998305439949036, "start": 1087, "tag": "NAME", "value": "Alexander Saydakov" } ]
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.datasketches.quantiles; import static org.apache.datasketches.common.Util.LS; import java.util.Arrays; import org.apache.datasketches.common.SketchesArgumentException; /** * Utility class for generic quantiles sketch. * * @author <NAME> * @author <NAME> */ final class ItemsUtil { private ItemsUtil() {} static final int ITEMS_SER_VER = 3; static final int PRIOR_ITEMS_SER_VER = 2; /** * Check the validity of the given serialization version * @param serVer the given serialization version */ static void checkItemsSerVer(final int serVer) { if ((serVer == ITEMS_SER_VER) || (serVer == PRIOR_ITEMS_SER_VER)) { return; } throw new SketchesArgumentException( "Possible corruption: Invalid Serialization Version: " + serVer); } /** * Called when the base buffer has just acquired 2*k elements. * @param <T> the data type * @param sketch the given quantiles sketch */ @SuppressWarnings("unchecked") static <T> void processFullBaseBuffer(final ItemsSketch<T> sketch) { final int bbCount = sketch.getBaseBufferCount(); final long n = sketch.getN(); assert bbCount == (2 * sketch.getK()); // internal consistency check // make sure there will be enough levels for the propagation ItemsUpdateImpl.maybeGrowLevels(sketch, n); // important: n_ was incremented by update before we got here // this aliasing is a bit dangerous; notice that we did it after the possible resizing final Object[] baseBuffer = sketch.getCombinedBuffer(); Arrays.sort((T[]) baseBuffer, 0, bbCount, sketch.getComparator()); ItemsUpdateImpl.inPlacePropagateCarry( 0, null, 0, // this null is okay (T[]) baseBuffer, 0, true, sketch); sketch.baseBufferCount_ = 0; Arrays.fill(baseBuffer, 0, 2 * sketch.getK(), null); // to release the discarded objects assert (n / (2L * sketch.getK())) == sketch.getBitPattern(); // internal consistency check } static <T> String toString(final boolean sketchSummary, final boolean dataDetail, final ItemsSketch<T> sketch) { final StringBuilder sb = new StringBuilder(); final String thisSimpleName = sketch.getClass().getSimpleName(); final int bbCount = sketch.getBaseBufferCount(); final int combAllocCount = sketch.getCombinedBufferAllocatedCount(); final int k = sketch.getK(); final long bitPattern = sketch.getBitPattern(); if (dataDetail) { sb.append(ClassicUtil.LS).append("### ").append(thisSimpleName).append(" DATA DETAIL: ").append(ClassicUtil.LS); final Object[] items = sketch.getCombinedBuffer(); //output the base buffer sb.append(" BaseBuffer :"); if (bbCount > 0) { for (int i = 0; i < bbCount; i++) { sb.append(' ').append(items[i]); } } sb.append(ClassicUtil.LS); //output all the levels final int numItems = combAllocCount; if (numItems > (2 * k)) { sb.append(" Valid | Level"); for (int j = 2 * k; j < numItems; j++) { //output level data starting at 2K if ((j % k) == 0) { //start output of new level final int levelNum = j > (2 * k) ? (j - (2 * k)) / k : 0; final String validLvl = ((1L << levelNum) & bitPattern) > 0 ? " T " : " F "; final String lvl = String.format("%5d", levelNum); sb.append(ClassicUtil.LS).append(" ").append(validLvl).append(" ").append(lvl).append(":"); } sb.append(' ').append(items[j]); } sb.append(ClassicUtil.LS); } sb.append("### END DATA DETAIL").append(ClassicUtil.LS); } if (sketchSummary) { final long n = sketch.getN(); final String nStr = String.format("%,d", n); final int numLevels = ClassicUtil.computeNumLevelsNeeded(k, n); final String bufCntStr = String.format("%,d", combAllocCount); final int preBytes = sketch.isEmpty() ? Long.BYTES : 2 * Long.BYTES; final double epsPmf = ClassicUtil.getNormalizedRankError(k, true); final String epsPmfPctStr = String.format("%.3f%%", epsPmf * 100.0); final double eps = ClassicUtil.getNormalizedRankError(k, false); final String epsPctStr = String.format("%.3f%%", eps * 100.0); final int numSamples = sketch.getNumRetained(); final String numSampStr = String.format("%,d", numSamples); final T minItem = sketch.isEmpty() ? null : sketch.getMinItem(); final T maxItem = sketch.isEmpty() ? null : sketch.getMaxItem(); sb.append(ClassicUtil.LS).append("### ").append(thisSimpleName).append(" SUMMARY: ").append(ClassicUtil.LS); sb.append(" K : ").append(k).append(ClassicUtil.LS); sb.append(" N : ").append(nStr).append(ClassicUtil.LS); sb.append(" BaseBufferCount : ").append(bbCount).append(ClassicUtil.LS); sb.append(" CombinedBufferAllocatedCount : ").append(bufCntStr).append(ClassicUtil.LS); sb.append(" Total Levels : ").append(numLevels).append(ClassicUtil.LS); sb.append(" Valid Levels : ").append(ClassicUtil.computeValidLevels(bitPattern)) .append(ClassicUtil.LS); sb.append(" Level Bit Pattern : ").append(Long.toBinaryString(bitPattern)) .append(ClassicUtil.LS); sb.append(" Valid Samples : ").append(numSampStr).append(ClassicUtil.LS); sb.append(" Preamble Bytes : ").append(preBytes).append(ClassicUtil.LS); sb.append(" Normalized Rank Error : ").append(epsPctStr).append(LS); sb.append(" Normalized Rank Error (PMF) : ").append(epsPmfPctStr).append(LS); sb.append(" Min Quantile : ").append(minItem).append(ClassicUtil.LS); sb.append(" Max Quantile : ").append(maxItem).append(ClassicUtil.LS); sb.append("### END SKETCH SUMMARY").append(ClassicUtil.LS); } return sb.toString(); } }
6,848
0.642045
0.636364
152
44.157894
32.508724
118
false
false
0
0
0
0
0
0
0.703947
false
false
9
49c1f610834cf75e6beef25d0645baa19d362434
1,400,159,372,821
a5d0de8f66007b4041882b7d62d1bda8bb818ee4
/NetBeansProjects/CS151HW2/src/FilterTester.java
9109ec6b79b9698870dffbe763b7eca8d68e4ae2
[]
no_license
eric62451/aaaaa
https://github.com/eric62451/aaaaa
5d0fa4a978b18bf768d0d190ea51583a08a40137
d73da9a5001f7fb4d9ee0b6c116b42a9f5e5f833
refs/heads/master
2021-01-19T17:17:04.684000
2015-07-29T06:45:34
2015-07-29T06:45:34
39,877,742
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Eric Tam */ public class FilterTester { public static String[] filter(String[] a, Filter f) { ArrayList<String> temp = new ArrayList<String>(); for (int i = 0; i < a.length; i++) { if (f.accept(a[i])) { temp.add(a[i]); } } String[] answer = new String[temp.size()]; int j = 0; for (String i : temp) { answer[j] = i; j++; } return answer; } public static void main(String[] args) { String[] a = new String[10]; a[0] = "abcd"; a[1] = "123"; a[2] = "water"; a[3] = "fire"; a[4] = "ice"; a[5] = "one"; a[6] = "two"; a[7] = "three"; a[8] = "four"; a[9] = "six"; String[] b = filter(a, new Filter() { public boolean accept(String x) { if (x.length() < 4) { return true; } return false; } }); for(int i = 0; i<b.length;i++){ System.out.println(b[i]); } } }
UTF-8
Java
1,272
java
FilterTester.java
Java
[ { "context": " the template in the editor.\n */\n/**\n *\n * @author Eric Tam\n */\npublic class FilterTester {\n\n public stati", "end": 156, "score": 0.9998157620429993, "start": 148, "tag": "NAME", "value": "Eric Tam" } ]
null
[]
import java.util.ArrayList; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author <NAME> */ public class FilterTester { public static String[] filter(String[] a, Filter f) { ArrayList<String> temp = new ArrayList<String>(); for (int i = 0; i < a.length; i++) { if (f.accept(a[i])) { temp.add(a[i]); } } String[] answer = new String[temp.size()]; int j = 0; for (String i : temp) { answer[j] = i; j++; } return answer; } public static void main(String[] args) { String[] a = new String[10]; a[0] = "abcd"; a[1] = "123"; a[2] = "water"; a[3] = "fire"; a[4] = "ice"; a[5] = "one"; a[6] = "two"; a[7] = "three"; a[8] = "four"; a[9] = "six"; String[] b = filter(a, new Filter() { public boolean accept(String x) { if (x.length() < 4) { return true; } return false; } }); for(int i = 0; i<b.length;i++){ System.out.println(b[i]); } } }
1,270
0.415881
0.400943
56
21.696428
16.127748
57
false
false
0
0
0
0
0
0
0.553571
false
false
9
1d9114728cfa71d39ec2ae8faf0cdea81aaa4bee
18,932,215,878,979
572ae9544bcccfd090aaa9fb4567dc599aa8d1f9
/collinearPoints/src/main/java/collinearPoints/utils/FileUtils.java
1da07c618a57c7ccfb113e0ece527bd57465caca
[]
no_license
matiaC90/collinearPoints
https://github.com/matiaC90/collinearPoints
91a807b77d5ab5c8531b74702000d37006b8ec1f
0c4191f3c59c731976d174053418a1372da0ab2b
refs/heads/master
2021-04-12T03:05:34.702000
2018-03-18T16:40:57
2018-03-18T16:40:57
125,726,417
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package collinearPoints.utils; import java.io.File; import java.io.IOException; import org.springframework.core.io.ClassPathResource; public class FileUtils { private static final String EXTENSION_FILE = ".txt"; public static File getFileFromName(String nameResource) throws IOException { File file = new ClassPathResource(nameResource.concat(EXTENSION_FILE)).getFile(); return file; } }
UTF-8
Java
429
java
FileUtils.java
Java
[]
null
[]
package collinearPoints.utils; import java.io.File; import java.io.IOException; import org.springframework.core.io.ClassPathResource; public class FileUtils { private static final String EXTENSION_FILE = ".txt"; public static File getFileFromName(String nameResource) throws IOException { File file = new ClassPathResource(nameResource.concat(EXTENSION_FILE)).getFile(); return file; } }
429
0.734266
0.734266
20
19.450001
26.339087
84
false
false
0
0
0
0
0
0
0.95
false
false
9
21c08e90f6b834b8b5b92660a3fd3a5ca5357ce4
14,559,939,171,981
87b93320555ac599f4b5304626c77d82d367c04e
/app/src/main/java/org/lenve/databinding1/adapter/NewsAdapter.java
b37d8f8809c2b63844e6d24263f886655fb73e16
[]
no_license
lovelye27326/DataBinding1
https://github.com/lovelye27326/DataBinding1
67d2322913e3d27da93e180a98f0c85a9843e9ab
a9805484adea8202ef62004b4082afe1ddf9b628
refs/heads/master
2020-08-06T02:57:49.845000
2019-10-04T12:20:11
2019-10-04T12:20:11
212,808,392
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.lenve.databinding1.adapter; import android.content.Context; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import org.lenve.databinding1.R; import org.lenve.databinding1.data.DayNews; import org.lenve.databinding1.util.UILRequestManager; import java.util.List; public class NewsAdapter extends BaseAdapter { private Context context; private List<DayNews> list; public NewsAdapter(Context context, List<DayNews> list) { this.context = context; this.list = list; } @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } private class Holder { ImageView msgPic; TextView msgTitle, time, content; } @Override public View getView(int position, View convertView, ViewGroup parent) { Holder holder; if (convertView == null) { holder = new Holder(); convertView = View.inflate(context, R.layout.msg_listview_item, null); holder.msgPic = (ImageView) convertView.findViewById(R.id.msg_pic); holder.msgTitle = (TextView) convertView .findViewById(R.id.msg_title); holder.content = (TextView) convertView .findViewById(R.id.msg_author); holder.time = (TextView) convertView .findViewById(R.id.msg_time); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); } DayNews news = list.get(position); String img = news.getLogofile(); if (!TextUtils.isEmpty(img)){ UILRequestManager.displayImage(img, holder.msgPic); } holder.msgTitle.setText(news.getTitle()); holder.content.setText(news.getSummary()); String time = "2015-04-09 08:10:56"; if (!TextUtils.isEmpty(news.getPublishdate())) { time = news.getPublishdate(); } holder.time.setText(time); return convertView; } }
UTF-8
Java
1,994
java
NewsAdapter.java
Java
[]
null
[]
package org.lenve.databinding1.adapter; import android.content.Context; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import org.lenve.databinding1.R; import org.lenve.databinding1.data.DayNews; import org.lenve.databinding1.util.UILRequestManager; import java.util.List; public class NewsAdapter extends BaseAdapter { private Context context; private List<DayNews> list; public NewsAdapter(Context context, List<DayNews> list) { this.context = context; this.list = list; } @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } private class Holder { ImageView msgPic; TextView msgTitle, time, content; } @Override public View getView(int position, View convertView, ViewGroup parent) { Holder holder; if (convertView == null) { holder = new Holder(); convertView = View.inflate(context, R.layout.msg_listview_item, null); holder.msgPic = (ImageView) convertView.findViewById(R.id.msg_pic); holder.msgTitle = (TextView) convertView .findViewById(R.id.msg_title); holder.content = (TextView) convertView .findViewById(R.id.msg_author); holder.time = (TextView) convertView .findViewById(R.id.msg_time); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); } DayNews news = list.get(position); String img = news.getLogofile(); if (!TextUtils.isEmpty(img)){ UILRequestManager.displayImage(img, holder.msgPic); } holder.msgTitle.setText(news.getTitle()); holder.content.setText(news.getSummary()); String time = "2015-04-09 08:10:56"; if (!TextUtils.isEmpty(news.getPublishdate())) { time = news.getPublishdate(); } holder.time.setText(time); return convertView; } }
1,994
0.72668
0.717653
82
23.317074
18.146341
72
false
false
0
0
0
0
0
0
1.987805
false
false
9
12f2bdb610bfc641b64dee4e6bec6857f0f7947f
21,131,239,129,562
264b166dbdffcedbd3c79c6912042e063a0366a7
/src/main/java/ua/km/khnu/virtual/university/transfare/legacy/GroupForm.java
8f9db7156cb03fd75c02a9bf32fb7f4a1cfd8085
[]
no_license
jrybak23/virtual-university
https://github.com/jrybak23/virtual-university
f5aa4ccdde120d1e106f3e1ae9f3780b05402015
178e603861642052b9c9850a77817cbc4293f649
refs/heads/master
2021-06-17T22:49:13.873000
2017-06-21T08:45:01
2017-06-21T08:45:01
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.km.khnu.virtual.university.transfare.legacy; /** * @author Igor Rybak */ public class GroupForm { private String name; private int yearEntered; private int yearOfStudyEntered; private int specialtyId; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getYearEntered() { return yearEntered; } public void setYearEntered(int yearEntered) { this.yearEntered = yearEntered; } public int getYearOfStudyEntered() { return yearOfStudyEntered; } public void setYearOfStudyEntered(int yearOfStudyEntered) { this.yearOfStudyEntered = yearOfStudyEntered; } public int getSpecialtyId() { return specialtyId; } public void setSpecialtyId(int specialtyId) { this.specialtyId = specialtyId; } }
UTF-8
Java
906
java
GroupForm.java
Java
[ { "context": "rtual.university.transfare.legacy;\n\n/**\n * @author Igor Rybak\n */\npublic class GroupForm {\n private String n", "end": 82, "score": 0.9998382329940796, "start": 72, "tag": "NAME", "value": "Igor Rybak" } ]
null
[]
package ua.km.khnu.virtual.university.transfare.legacy; /** * @author <NAME> */ public class GroupForm { private String name; private int yearEntered; private int yearOfStudyEntered; private int specialtyId; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getYearEntered() { return yearEntered; } public void setYearEntered(int yearEntered) { this.yearEntered = yearEntered; } public int getYearOfStudyEntered() { return yearOfStudyEntered; } public void setYearOfStudyEntered(int yearOfStudyEntered) { this.yearOfStudyEntered = yearOfStudyEntered; } public int getSpecialtyId() { return specialtyId; } public void setSpecialtyId(int specialtyId) { this.specialtyId = specialtyId; } }
902
0.652318
0.652318
46
18.695652
18.577534
63
false
false
0
0
0
0
0
0
0.282609
false
false
9
78eae97a2a2a4148b063eb10a356cb267f7862d6
3,178,275,848,387
4ce1dd7825ea955e7a73c2721d487250e0dce5bf
/src/com/lc/entity/CommonTable.java
9bd0dc8a39177ab8a05c6de81fe920770eaae45a
[]
no_license
hy5424/blackA
https://github.com/hy5424/blackA
543204d99db21d7f90ff29f244b7e0da48e8d17e
4b66413034de1f5d0176e06b9859240ce72f9491
refs/heads/master
2021-09-10T05:44:35.845000
2018-03-21T07:32:46
2018-03-21T07:32:46
124,483,415
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lc.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; /** * ******************************************************** * * @ClassName: CommonTable * @Description: ็‰Œๅฑ€่กจ * @author ็”จlcyๆ”น่ฟ›็‰ˆ็š„ไปฃ็ ่‡ชๅŠจ็”Ÿๆˆๅ™จ * @date 2018-03-13 ไธ‹ๅˆ 05:19:07 */ @Entity @Table(name = "COMMON_TABLE") public class CommonTable extends BaseIdEntity { private static final long serialVersionUID = 2168258348520061809L; private String name; // ๆ˜ต็งฐ private String roomId; // ๆˆฟ้—ดID private String status; // ็Šถๆ€ @Column(name = "NAME", length = 20) public String getName() { return this.name; } public void setName(String name) { this.name = name; } @Column(name = "ROOM_ID", length = 20) public String getRoomId() { return this.roomId; } public void setRoomId(String roomId) { this.roomId = roomId; } @Column(name = "STATUS", length = 1) public String getStatus() { return this.status; } public void setStatus(String status) { this.status = status; } }
UTF-8
Java
1,216
java
CommonTable.java
Java
[]
null
[]
package com.lc.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; /** * ******************************************************** * * @ClassName: CommonTable * @Description: ็‰Œๅฑ€่กจ * @author ็”จlcyๆ”น่ฟ›็‰ˆ็š„ไปฃ็ ่‡ชๅŠจ็”Ÿๆˆๅ™จ * @date 2018-03-13 ไธ‹ๅˆ 05:19:07 */ @Entity @Table(name = "COMMON_TABLE") public class CommonTable extends BaseIdEntity { private static final long serialVersionUID = 2168258348520061809L; private String name; // ๆ˜ต็งฐ private String roomId; // ๆˆฟ้—ดID private String status; // ็Šถๆ€ @Column(name = "NAME", length = 20) public String getName() { return this.name; } public void setName(String name) { this.name = name; } @Column(name = "ROOM_ID", length = 20) public String getRoomId() { return this.roomId; } public void setRoomId(String roomId) { this.roomId = roomId; } @Column(name = "STATUS", length = 1) public String getStatus() { return this.status; } public void setStatus(String status) { this.status = status; } }
1,216
0.575214
0.542735
52
20.461538
17.641148
70
false
false
0
0
0
0
0
0
0.326923
false
false
9
6f073d0ca0e7c89671bb096f58d33c0c13460e06
9,715,216,063,481
ca83fe97b9418c3a9a110c77c2682e7db667782b
/src/com/alexishida/forms/Principal.java
f322bc1802e7fb7f90d8f46ed00242b909d15c35
[ "MIT" ]
permissive
alexishida/id3tag-music-renamer
https://github.com/alexishida/id3tag-music-renamer
fabe9399ca27cb709eaaffa8b3ef6a411e6b67e6
b5375771f936ee72a3193045358ca7cf7fcbb22f
refs/heads/master
2020-05-16T07:55:09.694000
2014-06-04T22:04:13
2014-06-04T22:04:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.alexishida.forms; import com.alexishida.controller.ThreadRenomear; import com.alexishida.utils.Diretorios; import java.awt.Toolkit; import java.io.File; import java.util.ArrayList; import javax.swing.JFileChooser; /** * * @author 94954658268 */ public class Principal extends javax.swing.JFrame { /** * Creates new form Principal */ public static ArrayList<String> listaMusicas = new ArrayList(); public static String pastaMusicas = ""; public Principal() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { menuBar1 = new java.awt.MenuBar(); menu1 = new java.awt.Menu(); menu2 = new java.awt.Menu(); jPanel1 = new javax.swing.JPanel(); jTextCaminho = new javax.swing.JTextField(); jButtonBuscaDiretorio = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabelAlbumArt = new javax.swing.JLabel(); jLabelArquivoRenomeado = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabelTotalArquivos = new javax.swing.JLabel(); jProgressBarRenomear = new javax.swing.JProgressBar(); jButtonRenomear = new javax.swing.JButton(); jLabelArtista = new javax.swing.JLabel(); jLabelTitulo = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem2 = new javax.swing.JMenuItem(); menu1.setLabel("File"); menuBar1.add(menu1); menu2.setLabel("Edit"); menuBar1.add(menu2); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Renomeador de Musicas v1.0"); setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/alexishida/imagens/icone-titulo.png"))); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Selecione o Diretรณrio")); jTextCaminho.setEditable(false); jTextCaminho.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jTextCaminho.setToolTipText(""); jButtonBuscaDiretorio.setText("Selecionar Diretรณrio"); jButtonBuscaDiretorio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonBuscaDiretorioActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jTextCaminho, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButtonBuscaDiretorio) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(12, 12, 12) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButtonBuscaDiretorio, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) .addComponent(jTextCaminho)) .addContainerGap()) ); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jPanel2.setMaximumSize(new java.awt.Dimension(466, 466)); jPanel2.setPreferredSize(null); jLabelAlbumArt.setBackground(new java.awt.Color(255, 255, 255)); jLabelAlbumArt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/alexishida/imagens/sem_imagem.jpg"))); // NOI18N jLabelAlbumArt.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); jLabelArquivoRenomeado.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelArquivoRenomeado.setText("AC DC - Back In Black.mp3"); jLabelArquivoRenomeado.setPreferredSize(null); jLabel2.setText("Artista:"); jLabel3.setText("Tรญtulo:"); jLabel4.setText("Buscando:"); jLabelTotalArquivos.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelTotalArquivos.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); jLabelTotalArquivos.setText("1/20"); jProgressBarRenomear.setToolTipText(""); jButtonRenomear.setText("Renomear"); jButtonRenomear.setEnabled(false); jButtonRenomear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonRenomearActionPerformed(evt); } }); jLabelArtista.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelArtista.setText("AC DC"); jLabelTitulo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelTitulo.setText("Back In Black"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButtonRenomear) .addGap(186, 186, 186)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jProgressBarRenomear, javax.swing.GroupLayout.PREFERRED_SIZE, 442, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(13, 13, 13) .addComponent(jLabelAlbumArt, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelArquivoRenomeado, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelArtista, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(jLabelTotalArquivos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabelAlbumArt, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabelTotalArquivos) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabelArtista)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabelTitulo) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabelArquivoRenomeado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addGap(32, 32, 32))) .addComponent(jProgressBarRenomear, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButtonRenomear) .addContainerGap(15, Short.MAX_VALUE)) ); jMenu1.setText("Configuraรงรตes"); jMenu1.setMargin(new java.awt.Insets(0, 5, 0, 5)); jMenuItem1.setText("Proxy"); jMenuItem1.setBorder(null); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenuBar1.add(jMenu1); jMenu2.setText("Ajuda"); jMenu2.setMargin(new java.awt.Insets(0, 5, 0, 5)); jMenu2.setRequestFocusEnabled(false); jMenuItem2.setText("Sobre"); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu2.add(jMenuItem2); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 466, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jButtonBuscaDiretorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscaDiretorioActionPerformed String diretorioPadrao = "C:\\"; if(!jTextCaminho.getText().equals("")) { diretorioPadrao = jTextCaminho.getText(); } JFileChooser file = new JFileChooser(diretorioPadrao); file.setDialogTitle("Selecione o diretรณrio dos MP3s"); file.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int i= file.showOpenDialog(null) ; if (i==1){ // jTextLocalArquivo.setText(""); } else { File arquivo = file.getSelectedFile(); jTextCaminho.setText(arquivo.getPath()); Diretorios diretorios = new Diretorios(); listaMusicas = diretorios.arquivosDiretorio(arquivo.getPath()); pastaMusicas = arquivo.getPath() + File.separator; jLabelTotalArquivos.setText("Total de Musicas: 0/"+listaMusicas.size()); jProgressBarRenomear.setValue(0); jLabelArquivoRenomeado.setText(""); if(listaMusicas.size() > 0) { jButtonRenomear.setEnabled(true); } else { jButtonRenomear.setEnabled(false); } } }//GEN-LAST:event_jButtonBuscaDiretorioActionPerformed private void jButtonRenomearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRenomearActionPerformed jButtonRenomear.setEnabled(false); Thread renomeia = new ThreadRenomear(); renomeia.setName("Renomear"); renomeia.start(); }//GEN-LAST:event_jButtonRenomearActionPerformed private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened jLabelTotalArquivos.setText(""); jLabelArquivoRenomeado.setText(""); jLabelArtista.setText(""); jLabelTitulo.setText(""); }//GEN-LAST:event_formWindowOpened private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jMenuItem1ActionPerformed private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed // TODO add your handling code here: Sobre sobre = new Sobre(this, true); sobre.setVisible(true); }//GEN-LAST:event_jMenuItem2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { // javax.swing.UIManager.setLookAndFeel(info.getClassName()); javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); break; } else { javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Principal().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonBuscaDiretorio; public static javax.swing.JButton jButtonRenomear; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; public static javax.swing.JLabel jLabelAlbumArt; public static javax.swing.JLabel jLabelArquivoRenomeado; public static javax.swing.JLabel jLabelArtista; public static javax.swing.JLabel jLabelTitulo; public static javax.swing.JLabel jLabelTotalArquivos; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; public static javax.swing.JProgressBar jProgressBarRenomear; public static javax.swing.JTextField jTextCaminho; private java.awt.Menu menu1; private java.awt.Menu menu2; private java.awt.MenuBar menuBar1; // End of variables declaration//GEN-END:variables }
UTF-8
Java
20,193
java
Principal.java
Java
[]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.alexishida.forms; import com.alexishida.controller.ThreadRenomear; import com.alexishida.utils.Diretorios; import java.awt.Toolkit; import java.io.File; import java.util.ArrayList; import javax.swing.JFileChooser; /** * * @author 94954658268 */ public class Principal extends javax.swing.JFrame { /** * Creates new form Principal */ public static ArrayList<String> listaMusicas = new ArrayList(); public static String pastaMusicas = ""; public Principal() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { menuBar1 = new java.awt.MenuBar(); menu1 = new java.awt.Menu(); menu2 = new java.awt.Menu(); jPanel1 = new javax.swing.JPanel(); jTextCaminho = new javax.swing.JTextField(); jButtonBuscaDiretorio = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabelAlbumArt = new javax.swing.JLabel(); jLabelArquivoRenomeado = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabelTotalArquivos = new javax.swing.JLabel(); jProgressBarRenomear = new javax.swing.JProgressBar(); jButtonRenomear = new javax.swing.JButton(); jLabelArtista = new javax.swing.JLabel(); jLabelTitulo = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem2 = new javax.swing.JMenuItem(); menu1.setLabel("File"); menuBar1.add(menu1); menu2.setLabel("Edit"); menuBar1.add(menu2); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Renomeador de Musicas v1.0"); setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/alexishida/imagens/icone-titulo.png"))); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Selecione o Diretรณrio")); jTextCaminho.setEditable(false); jTextCaminho.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jTextCaminho.setToolTipText(""); jButtonBuscaDiretorio.setText("Selecionar Diretรณrio"); jButtonBuscaDiretorio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonBuscaDiretorioActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jTextCaminho, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButtonBuscaDiretorio) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(12, 12, 12) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButtonBuscaDiretorio, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) .addComponent(jTextCaminho)) .addContainerGap()) ); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jPanel2.setMaximumSize(new java.awt.Dimension(466, 466)); jPanel2.setPreferredSize(null); jLabelAlbumArt.setBackground(new java.awt.Color(255, 255, 255)); jLabelAlbumArt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/alexishida/imagens/sem_imagem.jpg"))); // NOI18N jLabelAlbumArt.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); jLabelArquivoRenomeado.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelArquivoRenomeado.setText("AC DC - Back In Black.mp3"); jLabelArquivoRenomeado.setPreferredSize(null); jLabel2.setText("Artista:"); jLabel3.setText("Tรญtulo:"); jLabel4.setText("Buscando:"); jLabelTotalArquivos.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelTotalArquivos.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); jLabelTotalArquivos.setText("1/20"); jProgressBarRenomear.setToolTipText(""); jButtonRenomear.setText("Renomear"); jButtonRenomear.setEnabled(false); jButtonRenomear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonRenomearActionPerformed(evt); } }); jLabelArtista.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelArtista.setText("AC DC"); jLabelTitulo.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabelTitulo.setText("Back In Black"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButtonRenomear) .addGap(186, 186, 186)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jProgressBarRenomear, javax.swing.GroupLayout.PREFERRED_SIZE, 442, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(13, 13, 13) .addComponent(jLabelAlbumArt, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelArquivoRenomeado, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelArtista, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(jLabelTotalArquivos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabelAlbumArt, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabelTotalArquivos) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabelArtista)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabelTitulo) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabelArquivoRenomeado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addGap(32, 32, 32))) .addComponent(jProgressBarRenomear, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButtonRenomear) .addContainerGap(15, Short.MAX_VALUE)) ); jMenu1.setText("Configuraรงรตes"); jMenu1.setMargin(new java.awt.Insets(0, 5, 0, 5)); jMenuItem1.setText("Proxy"); jMenuItem1.setBorder(null); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenuBar1.add(jMenu1); jMenu2.setText("Ajuda"); jMenu2.setMargin(new java.awt.Insets(0, 5, 0, 5)); jMenu2.setRequestFocusEnabled(false); jMenuItem2.setText("Sobre"); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu2.add(jMenuItem2); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 466, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jButtonBuscaDiretorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscaDiretorioActionPerformed String diretorioPadrao = "C:\\"; if(!jTextCaminho.getText().equals("")) { diretorioPadrao = jTextCaminho.getText(); } JFileChooser file = new JFileChooser(diretorioPadrao); file.setDialogTitle("Selecione o diretรณrio dos MP3s"); file.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int i= file.showOpenDialog(null) ; if (i==1){ // jTextLocalArquivo.setText(""); } else { File arquivo = file.getSelectedFile(); jTextCaminho.setText(arquivo.getPath()); Diretorios diretorios = new Diretorios(); listaMusicas = diretorios.arquivosDiretorio(arquivo.getPath()); pastaMusicas = arquivo.getPath() + File.separator; jLabelTotalArquivos.setText("Total de Musicas: 0/"+listaMusicas.size()); jProgressBarRenomear.setValue(0); jLabelArquivoRenomeado.setText(""); if(listaMusicas.size() > 0) { jButtonRenomear.setEnabled(true); } else { jButtonRenomear.setEnabled(false); } } }//GEN-LAST:event_jButtonBuscaDiretorioActionPerformed private void jButtonRenomearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRenomearActionPerformed jButtonRenomear.setEnabled(false); Thread renomeia = new ThreadRenomear(); renomeia.setName("Renomear"); renomeia.start(); }//GEN-LAST:event_jButtonRenomearActionPerformed private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened jLabelTotalArquivos.setText(""); jLabelArquivoRenomeado.setText(""); jLabelArtista.setText(""); jLabelTitulo.setText(""); }//GEN-LAST:event_formWindowOpened private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jMenuItem1ActionPerformed private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed // TODO add your handling code here: Sobre sobre = new Sobre(this, true); sobre.setVisible(true); }//GEN-LAST:event_jMenuItem2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { // javax.swing.UIManager.setLookAndFeel(info.getClassName()); javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); break; } else { javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Principal().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonBuscaDiretorio; public static javax.swing.JButton jButtonRenomear; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; public static javax.swing.JLabel jLabelAlbumArt; public static javax.swing.JLabel jLabelArquivoRenomeado; public static javax.swing.JLabel jLabelArtista; public static javax.swing.JLabel jLabelTitulo; public static javax.swing.JLabel jLabelTotalArquivos; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; public static javax.swing.JProgressBar jProgressBarRenomear; public static javax.swing.JTextField jTextCaminho; private java.awt.Menu menu1; private java.awt.Menu menu2; private java.awt.MenuBar menuBar1; // End of variables declaration//GEN-END:variables }
20,193
0.645069
0.631595
408
48.47794
37.785118
183
false
false
0
0
0
0
0
0
0.671569
false
false
9
656525cff405e47a55e502cf4afedd951ba25b82
31,147,102,846,264
a8b2dde7157de1c462dcf3999b328e00bb7c0c2f
/ReverseStringArray.java
a497b1bf1fb42812cffe5f1a859a1023f70e0f7a
[]
no_license
dhruv-patel1/111-Java
https://github.com/dhruv-patel1/111-Java
9a3f641ad4bee3de2b443d3d1c621ff5b57fa44f
f938d1a74be7d32c49bf6686ced42d42d04b844c
refs/heads/master
2021-07-05T18:10:30.208000
2020-12-09T08:35:34
2020-12-09T08:35:34
209,627,906
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class ReverseStringArray { public static void reverse(String[][]str) { for (int i=0; i<str.length; i++) { for (int j=0; j<str[i].length; j++) { String temp = ""; for (int x=0; x<str[i][j].length(); x++) { temp += str[i][j].charAt(str[i][j].length()-x-1); } str[i][j] = temp; } } } }
UTF-8
Java
353
java
ReverseStringArray.java
Java
[]
null
[]
public class ReverseStringArray { public static void reverse(String[][]str) { for (int i=0; i<str.length; i++) { for (int j=0; j<str[i].length; j++) { String temp = ""; for (int x=0; x<str[i][j].length(); x++) { temp += str[i][j].charAt(str[i][j].length()-x-1); } str[i][j] = temp; } } } }
353
0.475921
0.464589
17
18.647058
18.792807
54
false
false
0
0
0
0
0
0
2.882353
false
false
9
7f7678cc34f432f01e58f50ae962a441b501cf01
6,682,969,137,847
21ad4fa5a2a1fb5e8c235db9b6b392c999a0497b
/src/main/java/com/gravitant/product/web/resource/CatalogResource.java
932f34954e34250c7c5db51d2c39db28a4b99000
[]
no_license
apigility-developer/coreapi-invoice
https://github.com/apigility-developer/coreapi-invoice
deb8900840b7140abe936033860b77d873366038
bf0b39668c0a89ad9fd5d0b77de78e54488419f9
refs/heads/master
2021-01-09T06:55:16.403000
2016-06-12T02:31:09
2016-06-12T02:31:09
60,936,047
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gravitant.product.web.resource; import org.springframework.hateoas.ResourceSupport; import org.springframework.hateoas.core.Relation; import org.joda.time.DateTime; @Relation(value="catalog", collectionRelation="catalogs") public class CatalogResource extends ResourceSupport { private String displayName; private String name; private String description; public CatalogResource() { } public String getDisplayName() { return this.displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } }
UTF-8
Java
828
java
CatalogResource.java
Java
[]
null
[]
package com.gravitant.product.web.resource; import org.springframework.hateoas.ResourceSupport; import org.springframework.hateoas.core.Relation; import org.joda.time.DateTime; @Relation(value="catalog", collectionRelation="catalogs") public class CatalogResource extends ResourceSupport { private String displayName; private String name; private String description; public CatalogResource() { } public String getDisplayName() { return this.displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } }
828
0.762077
0.762077
40
19.700001
18.905291
57
false
false
0
0
0
0
0
0
1.175
false
false
9
5dc9ba9a66efb7ca502ac38811eec47059617103
6,682,969,137,199
4d20dbbc287443c36c250ab3ccc18bb0fd031955
/Ballrus/Ballrus/src/org/usfirst/frc100/Ballrus/commands/CalibrateTilter.java
bd6fda688fb93acf1278b26f84f04999f4e232e1
[]
no_license
Team100/Team-100-Robot-Code-Archive
https://github.com/Team100/Team-100-Robot-Code-Archive
728bb0c92e10a30662df82b65734dd1b227975b6
e1993326919bb7942ad586ea81b343b3d22ba13c
refs/heads/master
2021-05-16T02:39:45.518000
2018-05-24T20:47:56
2018-05-24T20:47:56
28,732,571
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//will probably not be used package org.usfirst.frc100.Ballrus.commands; import edu.wpi.first.wpilibj.command.Command; import org.usfirst.frc100.Ballrus.Ballrus; import org.usfirst.frc100.Ballrus.Preferences; /** * Sets the ratio and offset preferences of the shooter */ public class CalibrateTilter extends Command { boolean forwardTriggered = false; // whether the forward limit has been triggered yet boolean isFinished = false; double topValue = 0; double bottomValue = 0; public CalibrateTilter() { requires(Ballrus.tilter); } // Called just before this Command runs the first time protected void initialize() { } // Called repeatedly when this Command is scheduled to run protected void execute() { if(!forwardTriggered&&!Ballrus.tilter.getTopLimit()){ // moving up Ballrus.tilter.manualControl(0.3); } else if(!forwardTriggered&&Ballrus.tilter.getTopLimit()){ // all the way up Ballrus.tilter.manualControl(0); topValue = Ballrus.tilter.getSensorValue(); forwardTriggered = true; } else if(forwardTriggered&&!Ballrus.tilter.getBottomLimit()){ // pulling down Ballrus.tilter.manualControl(-0.3); } else if(forwardTriggered&&Ballrus.tilter.getBottomLimit()){ // all the way down Ballrus.tilter.manualControl(0); bottomValue = Ballrus.tilter.getSensorValue(); Preferences.tilterPotToDegreeRatio = (bottomValue - topValue)/(Preferences.tilterMinAngle-Preferences.tilterMaxAngle); Preferences.tilterPot180DegreePosition = ((bottomValue/Preferences.tilterPotToDegreeRatio)+(180-Preferences.tilterMinAngle))*Preferences.tilterPotToDegreeRatio; System.out.println("TilterPot180DegreePosition = " + Preferences.tilterPot180DegreePosition); System.out.println("TilterPotToDegreeRatio = " + Preferences.tilterPotToDegreeRatio); isFinished = true; } } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return isFinished||timeSinceInitialized()>10; } // Called once after isFinished returns true protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { end(); } }
UTF-8
Java
2,521
java
CalibrateTilter.java
Java
[]
null
[]
//will probably not be used package org.usfirst.frc100.Ballrus.commands; import edu.wpi.first.wpilibj.command.Command; import org.usfirst.frc100.Ballrus.Ballrus; import org.usfirst.frc100.Ballrus.Preferences; /** * Sets the ratio and offset preferences of the shooter */ public class CalibrateTilter extends Command { boolean forwardTriggered = false; // whether the forward limit has been triggered yet boolean isFinished = false; double topValue = 0; double bottomValue = 0; public CalibrateTilter() { requires(Ballrus.tilter); } // Called just before this Command runs the first time protected void initialize() { } // Called repeatedly when this Command is scheduled to run protected void execute() { if(!forwardTriggered&&!Ballrus.tilter.getTopLimit()){ // moving up Ballrus.tilter.manualControl(0.3); } else if(!forwardTriggered&&Ballrus.tilter.getTopLimit()){ // all the way up Ballrus.tilter.manualControl(0); topValue = Ballrus.tilter.getSensorValue(); forwardTriggered = true; } else if(forwardTriggered&&!Ballrus.tilter.getBottomLimit()){ // pulling down Ballrus.tilter.manualControl(-0.3); } else if(forwardTriggered&&Ballrus.tilter.getBottomLimit()){ // all the way down Ballrus.tilter.manualControl(0); bottomValue = Ballrus.tilter.getSensorValue(); Preferences.tilterPotToDegreeRatio = (bottomValue - topValue)/(Preferences.tilterMinAngle-Preferences.tilterMaxAngle); Preferences.tilterPot180DegreePosition = ((bottomValue/Preferences.tilterPotToDegreeRatio)+(180-Preferences.tilterMinAngle))*Preferences.tilterPotToDegreeRatio; System.out.println("TilterPot180DegreePosition = " + Preferences.tilterPot180DegreePosition); System.out.println("TilterPotToDegreeRatio = " + Preferences.tilterPotToDegreeRatio); isFinished = true; } } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return isFinished||timeSinceInitialized()>10; } // Called once after isFinished returns true protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { end(); } }
2,521
0.665609
0.653312
64
37.421875
34.9217
172
false
false
0
0
0
0
0
0
0.390625
false
false
9
5f4013d8d1bb3ee6c6af73f76c0f1bfded039554
12,103,217,865,083
04225053ea3b445c2809343773a4ad7d2aaa217e
/src/ojdev/client/Client.java
71cea9dfa1439cfa9d1b302782431c34a1344ff4
[]
no_license
oluahmed/https-github.com-JoshuaEN-SEN632
https://github.com/oluahmed/https-github.com-JoshuaEN-SEN632
cbd6522fe7f773396f6c8a14da1535062ba344dd
485dd4baea3983025ecd8634480f2d35c6812d1f
refs/heads/master
2021-09-03T23:37:55.784000
2015-11-26T06:02:44
2015-11-26T06:02:44
117,292,413
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ojdev.client; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import ojdev.common.connections.Connection; import ojdev.common.exceptions.IllegalMessageContext; import ojdev.common.exceptions.InvalidMessageTypeException; import ojdev.common.message_handlers.ServerMessageHandler; import ojdev.common.messages.InvalidMessage; import ojdev.common.messages.MessageBase; import ojdev.common.messages.server.*; import ojdev.common.warriors.WarriorBase; import ojdev.common.ConnectedClientState; import ojdev.common.SelectedAction; /** * Helper class for UI Clients; provides generic logic not related to displaying information. */ public class Client implements Runnable, ServerMessageHandler { private final Connection connection; private final ServerMessageHandler serverMessageHandler; private final ClientUserInterface clientInterface; private volatile int currentClientId = -1; private volatile WarriorBase currentWarrior; private volatile Map<Integer, ConnectedClientState> connectedClients = new HashMap<Integer, ConnectedClientState>(); private volatile Map<Integer, Date> connectedClientsRemovalList = new HashMap<Integer, Date>(); private volatile Integer engagementStartedBy = null; private volatile List<Integer> engagementParticipantClientIds = null; private volatile Map<Integer, SelectedAction> engagementCurrentlySelectedActions = null; /** * @param connection * @param serverMessageHandler */ public Client(Connection connection, ServerMessageHandler serverMessageHandler, ClientUserInterface clientInterface) { this.connection = connection; this.serverMessageHandler = serverMessageHandler; this.clientInterface = clientInterface; } public Client(Connection connection, Object clientUI) { // One would, logically, check these types but, alas, Java insists the // constructor be the first statement so. this(connection, (ServerMessageHandler)clientUI, (ClientUserInterface)clientUI); } @Override public void run() { safeListen(); } /** * Notifies specified clientInterface of any exceptions instead * of passing the exception upwards. * @throws IllegalArgumentException if clientInterface is null */ public void safeListen() throws IllegalArgumentException { // Ensure we don't allow exceptions to be swallowed accidently. if(clientInterface == null) { throw new IllegalArgumentException("A Client Interface MUST be specified to use this method. Use listen() instead to avoid this requirement."); } try { listen(); } catch (InvalidMessageTypeException | IOException | IllegalMessageContext e) { notifyException(e); } } public void listen() throws InvalidMessageTypeException, IOException, IllegalMessageContext { while(connection.isClosed() == false) { MessageBase message = connection.receiveMessage(); handleMessage(message); } } protected void handleMessage(MessageBase message) throws IllegalMessageContext { message.handleWith(this); if(serverMessageHandler != null) { message.handleWith(serverMessageHandler); } } public Connection getConnection() { return connection; } public int getClientId() { return currentClientId; } private void SetClientId(int clientId) { this.currentClientId = clientId; } public WarriorBase getCurrentWarrior() { return currentWarrior; } private void setCurrentWarrior(WarriorBase currentWarrior) { this.currentWarrior = currentWarrior; notifyCurrentWarriorChanged(currentWarrior); } protected void notifyCurrentWarriorChanged(WarriorBase currentWarrior) { if(clientInterface != null) { clientInterface.notifyCurrentWarriorChanged(currentWarrior); } } protected void notifyException(Exception e) { if(clientInterface != null) { clientInterface.notifyException(e); } } public Map<Integer, ConnectedClientState> getConnectedClientsMap() { return Collections.unmodifiableMap(connectedClients); } public List<ConnectedClientState> getConnectedClientsList() { return Collections.unmodifiableList(new ArrayList<ConnectedClientState>(connectedClients.values())); } public ConnectedClientState getConnectedClientById(int clientId) { return connectedClients.get(clientId); } protected ServerMessageHandler getExternalMessageHandler() { return serverMessageHandler; } protected ClientUserInterface getUserInterface() { return clientInterface; } private void setConnectedClientById(int clientId, ConnectedClientState connectedClientState) { connectedClients.put(clientId, connectedClientState); if(clientId == getClientId()) { setCurrentWarrior(connectedClientState.getWarrior()); } } private void removeConnectedClientById(int clientId, ConnectedClientState connectedClientState) { connectedClientsRemovalList.put(clientId, connectedClientState.getCreatedAt()); connectedClients.remove(clientId); } private void setConnectedClients(List<ConnectedClientState> newConnectedClientsList) { // keySet returns an unmodifiable Set, we need to modify it so we create a new Set based on it Set<Integer> existingRemovedClients = new HashSet<Integer>(getConnectedClientsMap().keySet()); for(ConnectedClientState connectedClientState : newConnectedClientsList) { ConnectedClientState currentConnectedClientState = getConnectedClientById(connectedClientState.getClientId()); if(checkUpdateCurrentConnectedClientAction(currentConnectedClientState, connectedClientState)) { setConnectedClientById(connectedClientState.getClientId(), connectedClientState); } existingRemovedClients.remove(connectedClientState.getClientId()); } for(int clientId : existingRemovedClients) { removeConnectedClientById(clientId, getConnectedClientById(clientId)); } } private void addConnectedClient(ConnectedClientState newConnectedClientState) { updateConnectedClient(newConnectedClientState); } private void removeConnectedClient(ConnectedClientState newConnectedClientState) { ConnectedClientState currentConnectedClientState = getConnectedClientById(newConnectedClientState.getClientId()); if(checkUpdateCurrentConnectedClientAction(currentConnectedClientState, newConnectedClientState)) { removeConnectedClientById(newConnectedClientState.getClientId(), newConnectedClientState); } } private void updateConnectedClient(ConnectedClientState newConnectedClientState) { ConnectedClientState currentConnectedClientState = getConnectedClientById(newConnectedClientState.getClientId()); if(checkUpdateCurrentConnectedClientAction(currentConnectedClientState, newConnectedClientState)) { setConnectedClientById(newConnectedClientState.getClientId(), newConnectedClientState); } } /** * * @param existing the existing client state to compare, may be null * @param prospect the prospective client state to compare, may not be null * @return if the prospective client state should replace the existing client state */ private boolean checkUpdateCurrentConnectedClientAction(ConnectedClientState existing, ConnectedClientState prospect) { Date comparePoint; if(existing == null) { comparePoint = connectedClientsRemovalList.get(prospect.getClientId()); } else { comparePoint = existing.getCreatedAt(); } if(comparePoint == null) { return true; } // If the dates are the same, defer to the order they were received (last received = newest) if(prospect.getCreatedAt().before(comparePoint) == false) { return true; } return false; } public Integer getEngagementStartedByClientId() { return engagementStartedBy; } private void setEngagementStartedByClientId(Integer engagementStartedBy) { this.engagementStartedBy = engagementStartedBy; } public List<Integer> getEngagementParticipantClientIds() { return engagementParticipantClientIds; } private void setEngagementParticipantClientIds(List<Integer> engagementParticipantClientIds) { this.engagementParticipantClientIds = engagementParticipantClientIds; } public Map<Integer, SelectedAction> getEngagementCurrentlySelectedActions() { return engagementCurrentlySelectedActions; } private void setEngagementCurrentlySelectedAction(SelectedAction selectedAction) { engagementCurrentlySelectedActions.put(selectedAction.getClientId(), selectedAction); } private void initEngagementCurrentlySelectedActions() { engagementCurrentlySelectedActions = new HashMap<Integer, SelectedAction>(); } private void clearEngagementCurrentlySelectedActions() { engagementCurrentlySelectedActions.clear(); } private void nullEngagementCurrentlySelectedActions() { engagementCurrentlySelectedActions = null; } public boolean isInEngagement() { return engagementCurrentlySelectedActions != null && engagementParticipantClientIds != null && engagementStartedBy != null; } public boolean isActionSelected() { if(engagementCurrentlySelectedActions == null) { return false; } for(Entry<Integer, SelectedAction> entry : engagementCurrentlySelectedActions.entrySet()) { if(entry.getKey() == getClientId()) { if(entry.getValue() == null) { return false; } else { return true; } } } return false; } public void sendMessage(MessageBase message) throws IOException { connection.sendMessage(message); } @Override public void handleInvalidMessage(InvalidMessage message) { // NOOP } @Override public void handleRelayedTextMessage(RelayedTextMessage message) { // NOOP } @Override public void handleServerTextMessage(ServerTextMessage message) { // NOOP } @Override public void handleSetClientIdMessage(SetClientIdMessage message) { SetClientId(message.getClientId()); } @Override public void handleConnectedClientsListMessage(ConnectedClientsListMessage message) { setConnectedClients(message.getWarriors()); } @Override public void handleEngagementCombatResultMessage(EngagementCombatResultMessage message) { clearEngagementCurrentlySelectedActions(); } @Override public void handleEngagementStartedMessage(EngagementStartedMessage message) { setEngagementStartedByClientId(message.getStartedByClientId()); setEngagementParticipantClientIds(message.getInvolvedClientIds()); initEngagementCurrentlySelectedActions(); } @Override public void handleEngagementEndedMessage(EngagementEndedMessage message) { setEngagementStartedByClientId(null); setEngagementParticipantClientIds(null); nullEngagementCurrentlySelectedActions(); } @Override public void handleEngagementActionSelectedMessage(EngagementActionSelectedMessage message) { setEngagementCurrentlySelectedAction(message.getSelectedAction()); } @Override public void handleClientConnectedMessage(ClientConnectedMessage message) { addConnectedClient(message.getConnectedClientState()); } @Override public void handleClientDisconnectedMessage(ClientDisconnectedMessage message) { removeConnectedClient(message.getConnectedClientState()); } @Override public void handleClientStateChangedMessage(ClientStateChangedMessage message) { updateConnectedClient(message.getConnectedClientState()); } @Override public void handleRelayedTextToAllMessage(RelayedTextToAllMessage message) { // NOOP } }
UTF-8
Java
11,455
java
Client.java
Java
[]
null
[]
package ojdev.client; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import ojdev.common.connections.Connection; import ojdev.common.exceptions.IllegalMessageContext; import ojdev.common.exceptions.InvalidMessageTypeException; import ojdev.common.message_handlers.ServerMessageHandler; import ojdev.common.messages.InvalidMessage; import ojdev.common.messages.MessageBase; import ojdev.common.messages.server.*; import ojdev.common.warriors.WarriorBase; import ojdev.common.ConnectedClientState; import ojdev.common.SelectedAction; /** * Helper class for UI Clients; provides generic logic not related to displaying information. */ public class Client implements Runnable, ServerMessageHandler { private final Connection connection; private final ServerMessageHandler serverMessageHandler; private final ClientUserInterface clientInterface; private volatile int currentClientId = -1; private volatile WarriorBase currentWarrior; private volatile Map<Integer, ConnectedClientState> connectedClients = new HashMap<Integer, ConnectedClientState>(); private volatile Map<Integer, Date> connectedClientsRemovalList = new HashMap<Integer, Date>(); private volatile Integer engagementStartedBy = null; private volatile List<Integer> engagementParticipantClientIds = null; private volatile Map<Integer, SelectedAction> engagementCurrentlySelectedActions = null; /** * @param connection * @param serverMessageHandler */ public Client(Connection connection, ServerMessageHandler serverMessageHandler, ClientUserInterface clientInterface) { this.connection = connection; this.serverMessageHandler = serverMessageHandler; this.clientInterface = clientInterface; } public Client(Connection connection, Object clientUI) { // One would, logically, check these types but, alas, Java insists the // constructor be the first statement so. this(connection, (ServerMessageHandler)clientUI, (ClientUserInterface)clientUI); } @Override public void run() { safeListen(); } /** * Notifies specified clientInterface of any exceptions instead * of passing the exception upwards. * @throws IllegalArgumentException if clientInterface is null */ public void safeListen() throws IllegalArgumentException { // Ensure we don't allow exceptions to be swallowed accidently. if(clientInterface == null) { throw new IllegalArgumentException("A Client Interface MUST be specified to use this method. Use listen() instead to avoid this requirement."); } try { listen(); } catch (InvalidMessageTypeException | IOException | IllegalMessageContext e) { notifyException(e); } } public void listen() throws InvalidMessageTypeException, IOException, IllegalMessageContext { while(connection.isClosed() == false) { MessageBase message = connection.receiveMessage(); handleMessage(message); } } protected void handleMessage(MessageBase message) throws IllegalMessageContext { message.handleWith(this); if(serverMessageHandler != null) { message.handleWith(serverMessageHandler); } } public Connection getConnection() { return connection; } public int getClientId() { return currentClientId; } private void SetClientId(int clientId) { this.currentClientId = clientId; } public WarriorBase getCurrentWarrior() { return currentWarrior; } private void setCurrentWarrior(WarriorBase currentWarrior) { this.currentWarrior = currentWarrior; notifyCurrentWarriorChanged(currentWarrior); } protected void notifyCurrentWarriorChanged(WarriorBase currentWarrior) { if(clientInterface != null) { clientInterface.notifyCurrentWarriorChanged(currentWarrior); } } protected void notifyException(Exception e) { if(clientInterface != null) { clientInterface.notifyException(e); } } public Map<Integer, ConnectedClientState> getConnectedClientsMap() { return Collections.unmodifiableMap(connectedClients); } public List<ConnectedClientState> getConnectedClientsList() { return Collections.unmodifiableList(new ArrayList<ConnectedClientState>(connectedClients.values())); } public ConnectedClientState getConnectedClientById(int clientId) { return connectedClients.get(clientId); } protected ServerMessageHandler getExternalMessageHandler() { return serverMessageHandler; } protected ClientUserInterface getUserInterface() { return clientInterface; } private void setConnectedClientById(int clientId, ConnectedClientState connectedClientState) { connectedClients.put(clientId, connectedClientState); if(clientId == getClientId()) { setCurrentWarrior(connectedClientState.getWarrior()); } } private void removeConnectedClientById(int clientId, ConnectedClientState connectedClientState) { connectedClientsRemovalList.put(clientId, connectedClientState.getCreatedAt()); connectedClients.remove(clientId); } private void setConnectedClients(List<ConnectedClientState> newConnectedClientsList) { // keySet returns an unmodifiable Set, we need to modify it so we create a new Set based on it Set<Integer> existingRemovedClients = new HashSet<Integer>(getConnectedClientsMap().keySet()); for(ConnectedClientState connectedClientState : newConnectedClientsList) { ConnectedClientState currentConnectedClientState = getConnectedClientById(connectedClientState.getClientId()); if(checkUpdateCurrentConnectedClientAction(currentConnectedClientState, connectedClientState)) { setConnectedClientById(connectedClientState.getClientId(), connectedClientState); } existingRemovedClients.remove(connectedClientState.getClientId()); } for(int clientId : existingRemovedClients) { removeConnectedClientById(clientId, getConnectedClientById(clientId)); } } private void addConnectedClient(ConnectedClientState newConnectedClientState) { updateConnectedClient(newConnectedClientState); } private void removeConnectedClient(ConnectedClientState newConnectedClientState) { ConnectedClientState currentConnectedClientState = getConnectedClientById(newConnectedClientState.getClientId()); if(checkUpdateCurrentConnectedClientAction(currentConnectedClientState, newConnectedClientState)) { removeConnectedClientById(newConnectedClientState.getClientId(), newConnectedClientState); } } private void updateConnectedClient(ConnectedClientState newConnectedClientState) { ConnectedClientState currentConnectedClientState = getConnectedClientById(newConnectedClientState.getClientId()); if(checkUpdateCurrentConnectedClientAction(currentConnectedClientState, newConnectedClientState)) { setConnectedClientById(newConnectedClientState.getClientId(), newConnectedClientState); } } /** * * @param existing the existing client state to compare, may be null * @param prospect the prospective client state to compare, may not be null * @return if the prospective client state should replace the existing client state */ private boolean checkUpdateCurrentConnectedClientAction(ConnectedClientState existing, ConnectedClientState prospect) { Date comparePoint; if(existing == null) { comparePoint = connectedClientsRemovalList.get(prospect.getClientId()); } else { comparePoint = existing.getCreatedAt(); } if(comparePoint == null) { return true; } // If the dates are the same, defer to the order they were received (last received = newest) if(prospect.getCreatedAt().before(comparePoint) == false) { return true; } return false; } public Integer getEngagementStartedByClientId() { return engagementStartedBy; } private void setEngagementStartedByClientId(Integer engagementStartedBy) { this.engagementStartedBy = engagementStartedBy; } public List<Integer> getEngagementParticipantClientIds() { return engagementParticipantClientIds; } private void setEngagementParticipantClientIds(List<Integer> engagementParticipantClientIds) { this.engagementParticipantClientIds = engagementParticipantClientIds; } public Map<Integer, SelectedAction> getEngagementCurrentlySelectedActions() { return engagementCurrentlySelectedActions; } private void setEngagementCurrentlySelectedAction(SelectedAction selectedAction) { engagementCurrentlySelectedActions.put(selectedAction.getClientId(), selectedAction); } private void initEngagementCurrentlySelectedActions() { engagementCurrentlySelectedActions = new HashMap<Integer, SelectedAction>(); } private void clearEngagementCurrentlySelectedActions() { engagementCurrentlySelectedActions.clear(); } private void nullEngagementCurrentlySelectedActions() { engagementCurrentlySelectedActions = null; } public boolean isInEngagement() { return engagementCurrentlySelectedActions != null && engagementParticipantClientIds != null && engagementStartedBy != null; } public boolean isActionSelected() { if(engagementCurrentlySelectedActions == null) { return false; } for(Entry<Integer, SelectedAction> entry : engagementCurrentlySelectedActions.entrySet()) { if(entry.getKey() == getClientId()) { if(entry.getValue() == null) { return false; } else { return true; } } } return false; } public void sendMessage(MessageBase message) throws IOException { connection.sendMessage(message); } @Override public void handleInvalidMessage(InvalidMessage message) { // NOOP } @Override public void handleRelayedTextMessage(RelayedTextMessage message) { // NOOP } @Override public void handleServerTextMessage(ServerTextMessage message) { // NOOP } @Override public void handleSetClientIdMessage(SetClientIdMessage message) { SetClientId(message.getClientId()); } @Override public void handleConnectedClientsListMessage(ConnectedClientsListMessage message) { setConnectedClients(message.getWarriors()); } @Override public void handleEngagementCombatResultMessage(EngagementCombatResultMessage message) { clearEngagementCurrentlySelectedActions(); } @Override public void handleEngagementStartedMessage(EngagementStartedMessage message) { setEngagementStartedByClientId(message.getStartedByClientId()); setEngagementParticipantClientIds(message.getInvolvedClientIds()); initEngagementCurrentlySelectedActions(); } @Override public void handleEngagementEndedMessage(EngagementEndedMessage message) { setEngagementStartedByClientId(null); setEngagementParticipantClientIds(null); nullEngagementCurrentlySelectedActions(); } @Override public void handleEngagementActionSelectedMessage(EngagementActionSelectedMessage message) { setEngagementCurrentlySelectedAction(message.getSelectedAction()); } @Override public void handleClientConnectedMessage(ClientConnectedMessage message) { addConnectedClient(message.getConnectedClientState()); } @Override public void handleClientDisconnectedMessage(ClientDisconnectedMessage message) { removeConnectedClient(message.getConnectedClientState()); } @Override public void handleClientStateChangedMessage(ClientStateChangedMessage message) { updateConnectedClient(message.getConnectedClientState()); } @Override public void handleRelayedTextToAllMessage(RelayedTextToAllMessage message) { // NOOP } }
11,455
0.795373
0.795286
369
30.04607
32.835644
147
false
false
0
0
0
0
0
0
1.737127
false
false
9
9aaa524ffef9e9190501654740728ce9d26f9437
27,504,970,612,827
fe2b7eaee1683533878128ec6c48bd23be91842a
/src/model/HoSo.java
209548481c695e12fb6aa5ca664e12fdeb394209
[]
no_license
HieuSilva/QLHoSo
https://github.com/HieuSilva/QLHoSo
4b06f1e38c653bf43923b378e828e8990c17ee2d
1925ce8599fadb421b93d2735d596c34d891c3a1
refs/heads/master
2020-03-13T07:34:27.444000
2018-04-28T07:08:44
2018-04-28T07:08:44
131,027,914
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model; /** * * @author HIEU */ public class HoSo { private int id; private PhongBan phongBan; }
UTF-8
Java
316
java
HoSo.java
Java
[ { "context": "ditor.\r\n */\r\npackage model;\r\n\r\n/**\r\n *\r\n * @author HIEU\r\n */\r\npublic class HoSo {\r\n private int id;\r\n ", "end": 232, "score": 0.9970114827156067, "start": 228, "tag": "USERNAME", "value": "HIEU" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model; /** * * @author HIEU */ public class HoSo { private int id; private PhongBan phongBan; }
316
0.661392
0.661392
15
19.066668
22.563885
79
false
false
0
0
0
0
0
0
0.4
false
false
9
eb0ee5e2d47edcaf872ea975115a466d41fb21d5
5,497,558,184,745
1672eba417eb5b10174a4bd7a6e756f85f210e0c
/src/botpackage/FxFenetre.java
57929712b5b60cad292966f7cdc64fcfb5f1086a
[ "Apache-2.0" ]
permissive
bigteacup/botpackage
https://github.com/bigteacup/botpackage
1499d81294873aa7c70d6e42d649170c162882ec
f76e8a5ed8df292f19bc1ab892125f5c22cee419
refs/heads/master
2021-06-05T23:59:55.766000
2019-12-30T12:51:40
2019-12-30T12:51:40
103,675,128
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package botpackage; import java.io.IOException; import javafx.application.Application; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.stage.WindowEvent; //import javafx.stage.StageStyle; public class FxFenetre extends Application { //fx:controller="botpackage.FxFenetreController" //Le constructeur JAVAFX doit avoir un construteur sans parametre, et utiliser un "getconfig" de ce style dans la classe appelante. // public static Lancerbot getConfig() { // return new Lancerbot(); // } // public FxFenetre() { // } Lancerbot bot; Travian t; public FxFenetreController controller; public void setBot(Lancerbot bot){ this.bot = bot; } @Override public void start(Stage primaryStage) { primaryStage.setTitle("TimTools lite"); controller = new FxFenetreController(); //primaryStage controller.setStage(primaryStage); // primaryStage.setsetIconImage(new ImageIcon(this.getClass().getResource("mainicon.png")).getImage()); try { Image anotherIcon = new Image("https://iconverticons.com/img/logo.png"); primaryStage.getIcons().add(anotherIcon); } catch (Exception e) { } FXMLLoader loader = new FXMLLoader(getClass().getResource("fxFenetre.fxml")); loader.setController(controller); // loader.setLocation(getClass().getResource("fxFenetre.fxml"));//getClass().getResource("FxFenetre.fxml") Parent myPane = null; try { myPane = (Parent) loader.load(); } catch (IOException e) {e.printStackTrace(); } Scene myScene = new Scene(myPane); myScene.getStylesheets().add(FxFenetre.class.getResource("fxconsole.css").toExternalForm()); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //TODO investiguer les possibilitรฉes : fenetre de question type etesvoussur? ou autre primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { controller.bot.eteindreTravian(); // event.consume(); //genial mais pas utile ici System.out.println("Application fermรฉe par croix rouge (X)"); // System.exit(5000); } }); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// myPane.setOpacity(1.0); myPane.setStyle("-fx-background-color: rgba(0, 100, 100, 0.5)"); // -fx-background-color: transparent; //(ii) set the scene fill to transparent myScene.setFill(null); myScene.setFill(Color.TRANSPARENT); //(iii) set the stage background to transparent // primaryStage.initStyle(StageStyle.TRANSPARENT); // myPane.initStyle(StageStyle.TRANSPARENT); // primaryStage. // this.initStyle(StageStyle.TRANSPARENT); // myScene.getStylesheets()("-fx-background-color: null;"); // myPane.setStyle("-fx-background-color: null;"); // myPane.setBackground(Background.EMPTY); primaryStage.setScene(myScene); //this.initStyle(StageStyle.TRANSPARENT); primaryStage.show(); } public static void main(String[] args) { launch(args); } /* public void allumer(){ System.out.println("on"); try { if (bot.travian.allume == false){ String serveur = serveurj.getText(); String userName = userNamej.getText(); String motDePasse = motDePassej.getText(); bot.lancerTravian(serveur, userName, motDePasse ); } }catch (Exception e1){ String serveur = serveurj.getText(); String userName = userNamej.getText(); String motDePasse = motDePassej.getText(); bot.lancerTravian(serveur, userName, motDePasse );} // System.out.println(bot.getName()); // System.out.println(bot.getState()); } */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * ////override methode Stop du Stage @Override public void stop(){ //consume(); controller.resize(25.0, 25.0); //System.exit(50000); // Platform.exit()); // System.exit(5000); System.out.println("Stage is closing"); } */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }
UTF-8
Java
5,036
java
FxFenetre.java
Java
[]
null
[]
package botpackage; import java.io.IOException; import javafx.application.Application; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.stage.WindowEvent; //import javafx.stage.StageStyle; public class FxFenetre extends Application { //fx:controller="botpackage.FxFenetreController" //Le constructeur JAVAFX doit avoir un construteur sans parametre, et utiliser un "getconfig" de ce style dans la classe appelante. // public static Lancerbot getConfig() { // return new Lancerbot(); // } // public FxFenetre() { // } Lancerbot bot; Travian t; public FxFenetreController controller; public void setBot(Lancerbot bot){ this.bot = bot; } @Override public void start(Stage primaryStage) { primaryStage.setTitle("TimTools lite"); controller = new FxFenetreController(); //primaryStage controller.setStage(primaryStage); // primaryStage.setsetIconImage(new ImageIcon(this.getClass().getResource("mainicon.png")).getImage()); try { Image anotherIcon = new Image("https://iconverticons.com/img/logo.png"); primaryStage.getIcons().add(anotherIcon); } catch (Exception e) { } FXMLLoader loader = new FXMLLoader(getClass().getResource("fxFenetre.fxml")); loader.setController(controller); // loader.setLocation(getClass().getResource("fxFenetre.fxml"));//getClass().getResource("FxFenetre.fxml") Parent myPane = null; try { myPane = (Parent) loader.load(); } catch (IOException e) {e.printStackTrace(); } Scene myScene = new Scene(myPane); myScene.getStylesheets().add(FxFenetre.class.getResource("fxconsole.css").toExternalForm()); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //TODO investiguer les possibilitรฉes : fenetre de question type etesvoussur? ou autre primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { controller.bot.eteindreTravian(); // event.consume(); //genial mais pas utile ici System.out.println("Application fermรฉe par croix rouge (X)"); // System.exit(5000); } }); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// myPane.setOpacity(1.0); myPane.setStyle("-fx-background-color: rgba(0, 100, 100, 0.5)"); // -fx-background-color: transparent; //(ii) set the scene fill to transparent myScene.setFill(null); myScene.setFill(Color.TRANSPARENT); //(iii) set the stage background to transparent // primaryStage.initStyle(StageStyle.TRANSPARENT); // myPane.initStyle(StageStyle.TRANSPARENT); // primaryStage. // this.initStyle(StageStyle.TRANSPARENT); // myScene.getStylesheets()("-fx-background-color: null;"); // myPane.setStyle("-fx-background-color: null;"); // myPane.setBackground(Background.EMPTY); primaryStage.setScene(myScene); //this.initStyle(StageStyle.TRANSPARENT); primaryStage.show(); } public static void main(String[] args) { launch(args); } /* public void allumer(){ System.out.println("on"); try { if (bot.travian.allume == false){ String serveur = serveurj.getText(); String userName = userNamej.getText(); String motDePasse = motDePassej.getText(); bot.lancerTravian(serveur, userName, motDePasse ); } }catch (Exception e1){ String serveur = serveurj.getText(); String userName = userNamej.getText(); String motDePasse = motDePassej.getText(); bot.lancerTravian(serveur, userName, motDePasse );} // System.out.println(bot.getName()); // System.out.println(bot.getState()); } */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * ////override methode Stop du Stage @Override public void stop(){ //consume(); controller.resize(25.0, 25.0); //System.exit(50000); // Platform.exit()); // System.exit(5000); System.out.println("Stage is closing"); } */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }
5,036
0.539134
0.532976
164
29.664635
31.19183
147
false
false
0
0
0
0
141
0.103298
1.518293
false
false
9
4b39894cabe925e1ca8f711c4fd64689b4ce8567
12,472,585,066,812
7f2b7cc3511ddf57f26364135c0fd1b17d3df6db
/_EndAbgabe/Maven/src/de/dezibel/UpdateEntity.java
da5f6834746b3fa765f31ecccae3fcc50b2e75b3
[]
no_license
benjaminknauer/Dezibel
https://github.com/benjaminknauer/Dezibel
b9363bc73183c2f2f265658a4961bfbfcb507556
9a67300eabf6f0192d2d69c2aaa8f0b1bf39ad92
refs/heads/master
2021-05-27T14:09:53.951000
2014-03-17T10:30:55
2014-03-17T10:30:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package de.dezibel; /** * * @author Benny */ public enum UpdateEntity{ MEDIUM, PLAYLIST, NEWS, ALBUM, FAVORITES, APPLICATION, RECOMMENDATIONS, LABEL; }
UTF-8
Java
288
java
UpdateEntity.java
Java
[ { "context": "editor.\n */\npackage de.dezibel;\n\n/**\n *\n * @author Benny\n */\npublic enum UpdateEntity{\n MEDIUM,\n PLA", "end": 144, "score": 0.9997784495353699, "start": 139, "tag": "NAME", "value": "Benny" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package de.dezibel; /** * * @author Benny */ public enum UpdateEntity{ MEDIUM, PLAYLIST, NEWS, ALBUM, FAVORITES, APPLICATION, RECOMMENDATIONS, LABEL; }
288
0.628472
0.628472
20
13.4
12.912785
52
false
false
0
0
0
0
0
0
0.55
false
false
9
e77512efbe81c13e5ba3ce53b3d10508f0924eb4
27,092,653,754,675
4a880387c5efe6924c34aceb4e329af0a4281672
/hongyang20191231/src/main/java/com/bawei/hongyang20191231/api/Api.java
289e4c8a44f7c05225ac9fffb9858d19a201e66e
[]
no_license
HongYang1994/week20191231
https://github.com/HongYang1994/week20191231
4896db8ab4326fec98fabd785fa82b0a1b2f231f
88c28ac5cfeff3f70342c7f47d53be4b0868ba82
refs/heads/master
2020-12-02T14:17:33.248000
2019-12-31T02:35:56
2019-12-31T02:35:56
231,034,268
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bawei.hongyang20191231.api; /** * Created by Android Studio. * User: HONGYANG */ public class Api { public static final String BASE_URL = "http://blog.zhaoliang5156.cn/api/news/ranking.json"; }
UTF-8
Java
215
java
Api.java
Java
[ { "context": "1.api;\n\n/**\n * Created by Android Studio.\n * User: HONGYANG\n */\n\npublic class Api {\n public static final S", "end": 92, "score": 0.9977044463157654, "start": 84, "tag": "NAME", "value": "HONGYANG" } ]
null
[]
package com.bawei.hongyang20191231.api; /** * Created by Android Studio. * User: HONGYANG */ public class Api { public static final String BASE_URL = "http://blog.zhaoliang5156.cn/api/news/ranking.json"; }
215
0.711628
0.655814
10
20.5
27.958004
95
false
false
0
0
0
0
0
0
0.2
false
false
9
e47e6a96410c4eba873405244c32a6bbc7738900
489,626,328,120
a911f926261b82ec8a2ade2d0af1a973280ceab6
/qipai_paodekuai/src/main/java/com/anbang/qipai/paodekuai/cqrs/q/dao/PukeGameInfoDboDao.java
6e4d08f074722d231fe3846012172a6e6f6eab60
[]
no_license
791837060/qipai_huainanmajiang
https://github.com/791837060/qipai_huainanmajiang
31325550c9db1fcb139c6f5a89d84f7deac0e3a2
b4f17b26484bbe2840a0852156117faee9996bbb
refs/heads/master
2023-06-26T22:31:40.822000
2021-07-30T07:20:49
2021-07-30T07:20:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.anbang.qipai.paodekuai.cqrs.q.dao; import com.anbang.qipai.paodekuai.cqrs.q.dbo.PukeGameInfoDbo; import java.util.List; public interface PukeGameInfoDboDao { void save(PukeGameInfoDbo dbo); List<PukeGameInfoDbo> findByGameIdAndPanNo(String gameId, int panNo); void removeByTime(long endTime); }
UTF-8
Java
324
java
PukeGameInfoDboDao.java
Java
[]
null
[]
package com.anbang.qipai.paodekuai.cqrs.q.dao; import com.anbang.qipai.paodekuai.cqrs.q.dbo.PukeGameInfoDbo; import java.util.List; public interface PukeGameInfoDboDao { void save(PukeGameInfoDbo dbo); List<PukeGameInfoDbo> findByGameIdAndPanNo(String gameId, int panNo); void removeByTime(long endTime); }
324
0.780864
0.780864
13
23.923077
24.962931
73
false
false
0
0
0
0
0
0
0.538462
false
false
9
97cd4dc8b4ff1ca5c141168799081669a6a23f18
4,982,162,103,936
bfec63856289204199bb86fc3986fc61377af8d4
/app/src/main/java/com/vpage/vcars/activity/GenerateOTPActivity.java
7f00c8b9149df81ed54e9263e318944227a5da17
[]
no_license
VPageDevelopment/VCars
https://github.com/VPageDevelopment/VCars
1a6d1eb5debb0e6304e98d2e99bb67c70638c386
5e202c81da29c4cfbde7b27b7273e53b00d8daaf
refs/heads/master
2021-01-13T11:34:31.106000
2017-04-08T10:15:58
2017-04-08T10:15:58
81,209,808
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vpage.vcars.activity; import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.telephony.SmsManager; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.vpage.vcars.R; import com.vpage.vcars.tools.VTools; import com.vpage.vcars.tools.utils.LogFlag; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Background; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.UiThread; import org.androidannotations.annotations.ViewById; import java.util.ArrayList; import java.util.Random; import java.util.Timer; import java.util.TimerTask; @EActivity(R.layout.activity_generateotp) public class GenerateOTPActivity extends Activity { private static final String TAG = GenerateOTPActivity.class.getName(); @ViewById(R.id.txtPhoneNo) EditText txtPhoneNo; @ViewById(R.id.btnGenerateOtp) Button btnGenerateOtp; private static final int PERMISSION_SEND_SMS = 123; private static final int MY_PERMISSIONS_REQUEST_READ_CONTACTS = 24601; private String phoneNumber,generatedOTP; @AfterViews public void initLoginView() { /* Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent); */ btnGenerateOtp.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { phoneNumber = txtPhoneNo.getText().toString(); // To Do get the members phone number from server or DB String oldUserPhoneNumber = "6788990003"; generateOTP(oldUserPhoneNumber); } }); } /* @Override protected void onResume() { super.onResume(); SMSReceiver.bindListener(new SmsListener() { @Override public void messageReceived(String messageText) { if (LogFlag.bLogOn) Log.d(TAG,"SMSReceiver: "+messageText); gotoLoginPage(messageText); } }); }*/ @UiThread public void generateOTP(String oldUserPhoneNumber) { if (phoneNumber != null) { // User ID is verified if(phoneNumber.equals(oldUserPhoneNumber)) { if (LogFlag.bLogOn) Log.d(TAG,"Already User "); }else { generatedOTPProcessFinish(); } }else { if (LogFlag.bLogOn)Log.d(TAG," Please enter phoneNumber"); } } @Background void generatedOTPProcessFinish() { // Server generates an OTP and waits for client to send this Random r = new Random(); String otp = new String(); for(int i=0 ; i < 8 ; i++) { otp += r.nextInt(10); } // Server starts a timer of 10 seconds during which the OTP is valid. TimeOutTask task = new TimeOutTask(); Timer t = new Timer(); t.schedule(task, 100000L); if(task.isTimedOut) { // User took more than 100 seconds and hence the OTP is invalid if (LogFlag.bLogOn)Log.d(TAG, "PASSWORD: " + "Time out!"); } else { if (LogFlag.bLogOn)Log.d(TAG,"OTP GENERATED "); if (LogFlag.bLogOn)Log.d(TAG,"otp: "+otp); generatedOTP = otp; //requestSmsPermission(); //to be used for developing gotoLoginPage(); //for testing only } //Calling register method on register button click // register(); // Working code for Password generation // int passwordSize = 4; // Log.d(TAG,"PASSWORD: "+new PasswordBuilder().addCharsOption("!@#$%&*()_-+=[]{}\\|:/?.,><", 1).addRangeOption('A', 'Z', 1).addRangeOption('a', 'z', 0).addRangeOption('0', '9', 1).setSize(passwordSize).build()); /* // Working code for Password generation TOTP totp = new TOTP(); String seed = "3132333435363738393031323334353637383930"; long T0 = 0; long X = 30; long testTime[] = {59, 1111111109, 1111111111,1234567890, 2000000000}; DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("UTC")); try{ for(int i=0; i<testTime.length; i++) { long T = (testTime[i] - T0)/X; steps = Long.toHexString(T).toUpperCase(); while(steps.length() < 16) steps = "0" + steps; String fmtTime = String.format("%1$-10s", testTime[i]); String utcTime = df.format(new Date(testTime[i]*1000)); if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+totp.generateTOTP(seed, steps, "4", "HmacSHA1") ); if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+totp.generateTOTP(seed, steps, "4", "HmacSHA256") ); if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+totp.generateTOTP(seed, steps, "4", "HmacSHA512")); } }catch (final Exception e){ if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+ e.getMessage()); } */ } class TimeOutTask extends TimerTask { boolean isTimedOut = false; public void run() { isTimedOut = true; } } private void requestSmsPermission() { // check permission is given if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { // request permission (see result in onRequestPermissionsResult() method) ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.SEND_SMS}, PERMISSION_SEND_SMS); } else { // permission already granted run sms send String message = "This the OTP number for user Mapee app "+generatedOTP; if (phoneNumber.length()>0 && message.length()>0){ sendSMS(message); } else{ Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } } } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSIONS_REQUEST_READ_CONTACTS: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted String message = "This the OTP number for user Mapee app "+generatedOTP; if (phoneNumber.length()>0 && message.length()>0){ sendSMS(message); } else{ Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } } else { // permission denied Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } return; } } } private void sendSms( String message){ SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, null, null); } //---sends a SMS message to another device--- private void sendSMS( String message) { /* PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, test.class), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, pi, null); */ /* if (LogFlag.bLogOn)Log.d(TAG, "sendSMS Called"); String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS sent", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(getBaseContext(), "No service", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(getBaseContext(), "Radio off", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(SENT)); //---when the SMS has been delivered--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CANCELED: Toast.makeText(getBaseContext(), "SMS not delivered", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(DELIVERED)); */ try { SmsManager smsManager = SmsManager.getDefault(); ArrayList<String> parts = smsManager.divideMessage(message); smsManager.sendMultipartTextMessage(phoneNumber, null, parts, null, null); } catch (Exception e) { if (LogFlag.bLogOn)Log.e(TAG, e.getMessage()); } gotoLoginPage(); } private void gotoLoginPage() { Intent intent = new Intent(getApplicationContext(), SigninActivity_.class); intent.putExtra("OTP",generatedOTP); startActivity(intent); VTools.animation(this); finish(); } }
UTF-8
Java
11,391
java
GenerateOTPActivity.java
Java
[ { "context": " TOTP totp = new TOTP();\n\n String seed = \"3132333435363738393031323334353637383930\";\n long T0 = 0;\n ", "end": 4378, "score": 0.7389467358589172, "start": 4364, "tag": "KEY", "value": "13233343536373" }, { "context": "TP();\n\n String seed = \"3132333435363738393031323334353637383930\";\n long T0 = 0;\n long X = 30;\n ", "end": 4403, "score": 0.7001978158950806, "start": 4383, "tag": "KEY", "value": "31323334353637383930" } ]
null
[]
package com.vpage.vcars.activity; import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.telephony.SmsManager; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.vpage.vcars.R; import com.vpage.vcars.tools.VTools; import com.vpage.vcars.tools.utils.LogFlag; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Background; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.UiThread; import org.androidannotations.annotations.ViewById; import java.util.ArrayList; import java.util.Random; import java.util.Timer; import java.util.TimerTask; @EActivity(R.layout.activity_generateotp) public class GenerateOTPActivity extends Activity { private static final String TAG = GenerateOTPActivity.class.getName(); @ViewById(R.id.txtPhoneNo) EditText txtPhoneNo; @ViewById(R.id.btnGenerateOtp) Button btnGenerateOtp; private static final int PERMISSION_SEND_SMS = 123; private static final int MY_PERMISSIONS_REQUEST_READ_CONTACTS = 24601; private String phoneNumber,generatedOTP; @AfterViews public void initLoginView() { /* Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent); */ btnGenerateOtp.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { phoneNumber = txtPhoneNo.getText().toString(); // To Do get the members phone number from server or DB String oldUserPhoneNumber = "6788990003"; generateOTP(oldUserPhoneNumber); } }); } /* @Override protected void onResume() { super.onResume(); SMSReceiver.bindListener(new SmsListener() { @Override public void messageReceived(String messageText) { if (LogFlag.bLogOn) Log.d(TAG,"SMSReceiver: "+messageText); gotoLoginPage(messageText); } }); }*/ @UiThread public void generateOTP(String oldUserPhoneNumber) { if (phoneNumber != null) { // User ID is verified if(phoneNumber.equals(oldUserPhoneNumber)) { if (LogFlag.bLogOn) Log.d(TAG,"Already User "); }else { generatedOTPProcessFinish(); } }else { if (LogFlag.bLogOn)Log.d(TAG," Please enter phoneNumber"); } } @Background void generatedOTPProcessFinish() { // Server generates an OTP and waits for client to send this Random r = new Random(); String otp = new String(); for(int i=0 ; i < 8 ; i++) { otp += r.nextInt(10); } // Server starts a timer of 10 seconds during which the OTP is valid. TimeOutTask task = new TimeOutTask(); Timer t = new Timer(); t.schedule(task, 100000L); if(task.isTimedOut) { // User took more than 100 seconds and hence the OTP is invalid if (LogFlag.bLogOn)Log.d(TAG, "PASSWORD: " + "Time out!"); } else { if (LogFlag.bLogOn)Log.d(TAG,"OTP GENERATED "); if (LogFlag.bLogOn)Log.d(TAG,"otp: "+otp); generatedOTP = otp; //requestSmsPermission(); //to be used for developing gotoLoginPage(); //for testing only } //Calling register method on register button click // register(); // Working code for Password generation // int passwordSize = 4; // Log.d(TAG,"PASSWORD: "+new PasswordBuilder().addCharsOption("!@#$%&*()_-+=[]{}\\|:/?.,><", 1).addRangeOption('A', 'Z', 1).addRangeOption('a', 'z', 0).addRangeOption('0', '9', 1).setSize(passwordSize).build()); /* // Working code for Password generation TOTP totp = new TOTP(); String seed = "3132333435363738393031323334353637383930"; long T0 = 0; long X = 30; long testTime[] = {59, 1111111109, 1111111111,1234567890, 2000000000}; DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("UTC")); try{ for(int i=0; i<testTime.length; i++) { long T = (testTime[i] - T0)/X; steps = Long.toHexString(T).toUpperCase(); while(steps.length() < 16) steps = "0" + steps; String fmtTime = String.format("%1$-10s", testTime[i]); String utcTime = df.format(new Date(testTime[i]*1000)); if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+totp.generateTOTP(seed, steps, "4", "HmacSHA1") ); if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+totp.generateTOTP(seed, steps, "4", "HmacSHA256") ); if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+totp.generateTOTP(seed, steps, "4", "HmacSHA512")); } }catch (final Exception e){ if (LogFlag.bLogOn)Log.d(TAG,"PASSWORD: "+ e.getMessage()); } */ } class TimeOutTask extends TimerTask { boolean isTimedOut = false; public void run() { isTimedOut = true; } } private void requestSmsPermission() { // check permission is given if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { // request permission (see result in onRequestPermissionsResult() method) ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.SEND_SMS}, PERMISSION_SEND_SMS); } else { // permission already granted run sms send String message = "This the OTP number for user Mapee app "+generatedOTP; if (phoneNumber.length()>0 && message.length()>0){ sendSMS(message); } else{ Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } } } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSIONS_REQUEST_READ_CONTACTS: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted String message = "This the OTP number for user Mapee app "+generatedOTP; if (phoneNumber.length()>0 && message.length()>0){ sendSMS(message); } else{ Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } } else { // permission denied Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } return; } } } private void sendSms( String message){ SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, null, null); } //---sends a SMS message to another device--- private void sendSMS( String message) { /* PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, test.class), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, pi, null); */ /* if (LogFlag.bLogOn)Log.d(TAG, "sendSMS Called"); String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS sent", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(getBaseContext(), "No service", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(getBaseContext(), "Radio off", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(SENT)); //---when the SMS has been delivered--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CANCELED: Toast.makeText(getBaseContext(), "SMS not delivered", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(DELIVERED)); */ try { SmsManager smsManager = SmsManager.getDefault(); ArrayList<String> parts = smsManager.divideMessage(message); smsManager.sendMultipartTextMessage(phoneNumber, null, parts, null, null); } catch (Exception e) { if (LogFlag.bLogOn)Log.e(TAG, e.getMessage()); } gotoLoginPage(); } private void gotoLoginPage() { Intent intent = new Intent(getApplicationContext(), SigninActivity_.class); intent.putExtra("OTP",generatedOTP); startActivity(intent); VTools.animation(this); finish(); } }
11,391
0.557984
0.543411
338
32.701183
29.370659
221
false
false
0
0
0
0
0
0
0.653846
false
false
9
8841e5e7a061d1b82bf27176bb0892d1c206eb96
240,518,213,429
8ae65dcb5a7db09067f3d90813d4d1c4f39b42f3
/mobal.const/src/main/java/mobalDev/logic/produit/mapper/ProduitMapper.java
582fc7191d1cc87c3b80012c57eb6f965e092620
[]
no_license
mobalde/mobalCons
https://github.com/mobalde/mobalCons
c2e9ebb864552bad445a2e5e9afcd58fb58594e4
9ab3980ca8aca620c6ac2c526bd94cb1036b0042
refs/heads/master
2021-06-14T15:23:35.436000
2019-05-05T13:48:18
2019-05-05T13:48:18
133,260,833
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mobalDev.logic.produit.mapper; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import mobalDev.logic.SourceDestinationMapper; import mobalDev.logic.produit.dto.ProduitDto; import mobalDev.model.produit.HistoriqueProduitEntity; import mobalDev.model.produit.ProduitEntity; @Component public class ProduitMapper implements SourceDestinationMapper<ProduitEntity, ProduitDto>{ @Autowired private ModelMapper modelMaper; @Override public ProduitDto convertEntityToDto(ProduitEntity entity) { return this.modelMaper.map(entity, ProduitDto.class); } @Override public ProduitEntity convertDtoToEntity(ProduitDto dto) { return this.modelMaper.map(dto, ProduitEntity.class); } public HistoriqueProduitEntity setHistoEntity(ProduitEntity entity) { HistoriqueProduitEntity histoEntity = new HistoriqueProduitEntity(); histoEntity.setLibelle(entity.getLibelle()); histoEntity.setQuantite(entity.getQuantiteCommande()); histoEntity.setType(entity.getType()); return histoEntity; } }
UTF-8
Java
1,197
java
ProduitMapper.java
Java
[]
null
[]
package mobalDev.logic.produit.mapper; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import mobalDev.logic.SourceDestinationMapper; import mobalDev.logic.produit.dto.ProduitDto; import mobalDev.model.produit.HistoriqueProduitEntity; import mobalDev.model.produit.ProduitEntity; @Component public class ProduitMapper implements SourceDestinationMapper<ProduitEntity, ProduitDto>{ @Autowired private ModelMapper modelMaper; @Override public ProduitDto convertEntityToDto(ProduitEntity entity) { return this.modelMaper.map(entity, ProduitDto.class); } @Override public ProduitEntity convertDtoToEntity(ProduitDto dto) { return this.modelMaper.map(dto, ProduitEntity.class); } public HistoriqueProduitEntity setHistoEntity(ProduitEntity entity) { HistoriqueProduitEntity histoEntity = new HistoriqueProduitEntity(); histoEntity.setLibelle(entity.getLibelle()); histoEntity.setQuantite(entity.getQuantiteCommande()); histoEntity.setType(entity.getType()); return histoEntity; } }
1,197
0.824561
0.822055
40
28.924999
27.338057
89
false
false
0
0
0
0
0
0
1.25
false
false
9
103959319ec44aeff0dbbbf1e754a41419d1bc03
17,987,323,078,313
8eba14fa51e106c2779782b3f3d52d1143b2fae8
/app/src/main/java/com/example/www/goldmineproject/adapters/FinSumAdapter.java
7beed9e8e9a521725ef0060eedacf983649b7624
[]
no_license
YanaPalacheva/GoldMineProject
https://github.com/YanaPalacheva/GoldMineProject
e71e0082f74943e206fbb72488bdfd319a27f590
4776bd359aa2108a93ca0180574a4f5559b98ec1
refs/heads/master
2021-09-11T21:35:35.735000
2018-04-12T13:19:19
2018-04-12T13:19:19
112,954,316
0
3
null
false
2018-04-02T18:32:37
2017-12-03T18:53:46
2018-04-01T09:55:07
2018-04-02T18:32:36
309
0
3
0
Java
false
null
package com.example.www.goldmineproject.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.example.www.goldmineproject.MainActivity; import com.example.www.goldmineproject.R; import java.util.List; import appdb.CurTotal; import io.realm.Realm; /** * Created by ะ›ะธะฑั€ะพ on 21.02.2018. */ public class FinSumAdapter extends BaseAdapter { private LayoutInflater mLayoutInflater; private List<CurTotal> mData; private Realm realm; private Context context; public FinSumAdapter(Context context, List data){ mData = data; mLayoutInflater = LayoutInflater.from(context); //realm = ((MainActivity) context).getRealm(); this.context = context; } @Override public int getCount() { return mData == null ? 0 : mData.size(); } @Override public CurTotal getItem(int position) { return mData.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View view, ViewGroup parent) { View vi = view; //trying to reuse a recycled view FinSumAdapter.ViewHolder holder = null; if (vi == null) { //The view is not a recycled one: we have to inflate vi = mLayoutInflater.inflate(R.layout.item_fin_sum, parent, false); holder = new FinSumAdapter.ViewHolder(); holder.tvSum = vi.findViewById(R.id.tvSumValue); holder.tvCurrency = vi.findViewById(R.id.tvSumCurrency); vi.setTag(holder); } else { holder = (FinSumAdapter.ViewHolder) vi.getTag(); } CurTotal item = getItem(position); holder.tvCurrency.setText(item.getCurrency().getName()); //if (item.getTotal() != null) { String tot = String.valueOf(item.getValue()); if (item.getValue() >=0 ) { if (tot.length() == 8) { tot = tot.charAt(0) + tot.charAt(1) + tot.charAt(2) + "K"; } if (tot.length() > 8) { String totalMil = tot; tot = ""+ totalMil.charAt(0); tot += "M"; } } else{ if (tot.length() == 9) { tot = tot.charAt(0) + tot.charAt(1) + tot.charAt(2)+tot.charAt(3) + "K"; } if (tot.length() > 9) { String totalMil = tot; tot = "-"+totalMil.charAt(1); tot += "M"; } } holder.tvSum.setText(tot); if (item.getValue()<0) holder.tvSum.setTextColor(context.getResources().getColor(R.color.minusBalance)); else holder.tvSum.setTextColor(context.getResources().getColor(R.color.plusBalance)); //} return vi; } static class ViewHolder{ TextView tvSum; TextView tvCurrency; } }
UTF-8
Java
3,076
java
FinSumAdapter.java
Java
[ { "context": "urTotal;\nimport io.realm.Realm;\n\n/**\n * Created by ะ›ะธะฑั€ะพ on 21.02.2018.\n */\n\npublic class FinSumAdapter ex", "end": 434, "score": 0.999618411064148, "start": 429, "tag": "NAME", "value": "ะ›ะธะฑั€ะพ" } ]
null
[]
package com.example.www.goldmineproject.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.example.www.goldmineproject.MainActivity; import com.example.www.goldmineproject.R; import java.util.List; import appdb.CurTotal; import io.realm.Realm; /** * Created by ะ›ะธะฑั€ะพ on 21.02.2018. */ public class FinSumAdapter extends BaseAdapter { private LayoutInflater mLayoutInflater; private List<CurTotal> mData; private Realm realm; private Context context; public FinSumAdapter(Context context, List data){ mData = data; mLayoutInflater = LayoutInflater.from(context); //realm = ((MainActivity) context).getRealm(); this.context = context; } @Override public int getCount() { return mData == null ? 0 : mData.size(); } @Override public CurTotal getItem(int position) { return mData.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View view, ViewGroup parent) { View vi = view; //trying to reuse a recycled view FinSumAdapter.ViewHolder holder = null; if (vi == null) { //The view is not a recycled one: we have to inflate vi = mLayoutInflater.inflate(R.layout.item_fin_sum, parent, false); holder = new FinSumAdapter.ViewHolder(); holder.tvSum = vi.findViewById(R.id.tvSumValue); holder.tvCurrency = vi.findViewById(R.id.tvSumCurrency); vi.setTag(holder); } else { holder = (FinSumAdapter.ViewHolder) vi.getTag(); } CurTotal item = getItem(position); holder.tvCurrency.setText(item.getCurrency().getName()); //if (item.getTotal() != null) { String tot = String.valueOf(item.getValue()); if (item.getValue() >=0 ) { if (tot.length() == 8) { tot = tot.charAt(0) + tot.charAt(1) + tot.charAt(2) + "K"; } if (tot.length() > 8) { String totalMil = tot; tot = ""+ totalMil.charAt(0); tot += "M"; } } else{ if (tot.length() == 9) { tot = tot.charAt(0) + tot.charAt(1) + tot.charAt(2)+tot.charAt(3) + "K"; } if (tot.length() > 9) { String totalMil = tot; tot = "-"+totalMil.charAt(1); tot += "M"; } } holder.tvSum.setText(tot); if (item.getValue()<0) holder.tvSum.setTextColor(context.getResources().getColor(R.color.minusBalance)); else holder.tvSum.setTextColor(context.getResources().getColor(R.color.plusBalance)); //} return vi; } static class ViewHolder{ TextView tvSum; TextView tvCurrency; } }
3,076
0.582546
0.574731
96
30.989584
22.430677
93
false
false
0
0
0
0
0
0
0.552083
false
false
9
615cf6e5ce6b3e8c200cee2f5f6260302f022b44
33,320,356,350,613
e07ad469529c86adbff6d822bcad1b6cc6292295
/base-lib-ratel-api/src/main/java/com/virjar/ratel/api/DexMakerProxyBuilderHelper.java
9a90a907a7052bbe1b6dca58c433c508c32f0eef
[]
no_license
zzzgoda/ratel-core
https://github.com/zzzgoda/ratel-core
5ec0b811afd2a38b0cd12f5a75741ed351b0f4a8
392dc1f13ba6152ee684954d8d1d9bef278c12e9
refs/heads/master
2023-07-14T15:08:13.418000
2022-02-13T15:08:00
2022-02-13T15:08:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.virjar.ratel.api; import com.virjar.ratel.api.hint.RatelEngineHistory; import com.virjar.ratel.api.hint.RatelEngineVersion; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @RatelEngineVersion(RatelEngineHistory.V_1_2_8) public interface DexMakerProxyBuilderHelper { /** * ๅˆ›ๅปบไธ€ไธชaopไปฃ็†ๆž„้€ ๅ™จ * * @param clazz ๅฏนๅบ”class๏ผŒๅฆ‚ไปฃ็†InputStream * @param <T> ไปปๆ„class็ฑปๅž‹ * @return builderๅฎžไพ‹ */ <T> DexMakerProxyBuilder<T> forClass(Class<T> clazz); /** * ๅˆคๆ–ญไธ€ไธชclassๆ˜ฏไธๆ˜ฏaopไปฃ็†ไบง็”Ÿ็š„class * * @param c ๅพ…ๆต‹่ฏ•็š„class * @return ๆต‹่ฏ•็ป“ๆžœ๏ผŒๆ˜ฏๅฆไธบไปฃ็†class */ boolean isProxyClass(Class<?> c); /** * ่ฐƒ็”จsupperๆ–นๆณ•๏ผŒ็”ฑไบŽๆˆ‘ไปฌ็ปงๆ‰ฟไบ†ๆ–นๆณ•๏ผŒๅœจAOPๅœบๆ™ฏไธ‹๏ผŒๆˆ‘ไปฌ่ฟ˜้œ€่ฆcall originใ€‚ๆˆ‘ไปฌๅฏ่ƒฝๅชๆ˜ฏไฟฎๆ”นๅ‚ๆ•ฐๆˆ–่€…ๆ‹ฆๆˆช่ฟ”ๅ›žๅ€ผ * * @param proxy ๅฝ“ๅ‰็š„ไปฃ็†ๅฏน่ฑก * @param method ๅฝ“ๅ‰่ฐƒ็”จๆ–นๆณ• * @param args ๅ‚ๆ•ฐ * @return ๆ–นๆณ•่ฐƒ็”จ็ป“ๆžœ * @throws Throwable ๅฏ่ƒฝๆŠ›ๅ‡บๅผ‚ๅธธ */ Object callSuper(Object proxy, Method method, Object... args) throws Throwable; /** * InvocationHandlerๆ˜ฏๅŠจๆ€ไปฃ็†ๆœบๅˆถ้‡Œ้ขๅพˆ้‡่ฆ็š„ไธ€ไธชๆฆ‚ๅฟต๏ผŒ้€š่ฟ‡ไป–ๅค„็†AOP็š„ๅฎž้™…ไธšๅŠก้€ป่พ‘๏ผŒไธ€่ˆฌๅพˆๅฐ‘ไฝฟ็”จ * * @param instance ไปฃ็†ๅฏน่ฑก * @return ่Žทๅ–ๅฏนๅบ”็š„ InvocationHandler */ InvocationHandler getInvocationHandler(Object instance); /** * ็ป™ไปฃ็†ๅฏน่ฑกๆ›ฟๆขhandler๏ผŒไธ€่ˆฌๅพˆๅฐ‘ไฝฟ็”จ * * @param instance ไปฃ็†ๅฏน่ฑก * @param handler ๆ–ฐ็š„handler */ void setInvocationHandler(Object instance, InvocationHandler handler); }
UTF-8
Java
1,749
java
DexMakerProxyBuilderHelper.java
Java
[]
null
[]
package com.virjar.ratel.api; import com.virjar.ratel.api.hint.RatelEngineHistory; import com.virjar.ratel.api.hint.RatelEngineVersion; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @RatelEngineVersion(RatelEngineHistory.V_1_2_8) public interface DexMakerProxyBuilderHelper { /** * ๅˆ›ๅปบไธ€ไธชaopไปฃ็†ๆž„้€ ๅ™จ * * @param clazz ๅฏนๅบ”class๏ผŒๅฆ‚ไปฃ็†InputStream * @param <T> ไปปๆ„class็ฑปๅž‹ * @return builderๅฎžไพ‹ */ <T> DexMakerProxyBuilder<T> forClass(Class<T> clazz); /** * ๅˆคๆ–ญไธ€ไธชclassๆ˜ฏไธๆ˜ฏaopไปฃ็†ไบง็”Ÿ็š„class * * @param c ๅพ…ๆต‹่ฏ•็š„class * @return ๆต‹่ฏ•็ป“ๆžœ๏ผŒๆ˜ฏๅฆไธบไปฃ็†class */ boolean isProxyClass(Class<?> c); /** * ่ฐƒ็”จsupperๆ–นๆณ•๏ผŒ็”ฑไบŽๆˆ‘ไปฌ็ปงๆ‰ฟไบ†ๆ–นๆณ•๏ผŒๅœจAOPๅœบๆ™ฏไธ‹๏ผŒๆˆ‘ไปฌ่ฟ˜้œ€่ฆcall originใ€‚ๆˆ‘ไปฌๅฏ่ƒฝๅชๆ˜ฏไฟฎๆ”นๅ‚ๆ•ฐๆˆ–่€…ๆ‹ฆๆˆช่ฟ”ๅ›žๅ€ผ * * @param proxy ๅฝ“ๅ‰็š„ไปฃ็†ๅฏน่ฑก * @param method ๅฝ“ๅ‰่ฐƒ็”จๆ–นๆณ• * @param args ๅ‚ๆ•ฐ * @return ๆ–นๆณ•่ฐƒ็”จ็ป“ๆžœ * @throws Throwable ๅฏ่ƒฝๆŠ›ๅ‡บๅผ‚ๅธธ */ Object callSuper(Object proxy, Method method, Object... args) throws Throwable; /** * InvocationHandlerๆ˜ฏๅŠจๆ€ไปฃ็†ๆœบๅˆถ้‡Œ้ขๅพˆ้‡่ฆ็š„ไธ€ไธชๆฆ‚ๅฟต๏ผŒ้€š่ฟ‡ไป–ๅค„็†AOP็š„ๅฎž้™…ไธšๅŠก้€ป่พ‘๏ผŒไธ€่ˆฌๅพˆๅฐ‘ไฝฟ็”จ * * @param instance ไปฃ็†ๅฏน่ฑก * @return ่Žทๅ–ๅฏนๅบ”็š„ InvocationHandler */ InvocationHandler getInvocationHandler(Object instance); /** * ็ป™ไปฃ็†ๅฏน่ฑกๆ›ฟๆขhandler๏ผŒไธ€่ˆฌๅพˆๅฐ‘ไฝฟ็”จ * * @param instance ไปฃ็†ๅฏน่ฑก * @param handler ๆ–ฐ็š„handler */ void setInvocationHandler(Object instance, InvocationHandler handler); }
1,749
0.671728
0.669559
54
24.611111
21.577951
83
false
false
0
0
0
0
0
0
0.240741
false
false
9
25c95ef8bc7951f20526d02a1dc90decaf6e786d
13,967,233,690,162
be41b0d417594c4c1ed0a6325a00d546a1246180
/IntArrayRand/src/IntArrayRand.java
548f0bf79d0fb08ab59d0e9583eeb67149f55298
[]
no_license
anomie7/JavaPractice02
https://github.com/anomie7/JavaPractice02
d3ea46dce65f3e01d4a1ece0a5503be59104c5a9
44cef26799683049f508f1095226bdc8390267d1
refs/heads/master
2021-01-20T02:30:49.766000
2017-07-21T13:23:56
2017-07-21T13:23:56
89,418,287
0
0
null
false
2017-06-24T03:41:02
2017-04-26T00:09:22
2017-06-16T11:29:21
2017-06-24T03:41:02
5,217
0
0
0
Java
null
null
import java.util.Random; import java.util.Scanner; public class IntArrayRand { public static void main(String[] args){ Random rand = new Random(); Scanner stdIn = new Scanner(System.in); System.out.print("ยฟรคยผร’ ยผรถ : "); int n = stdIn.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++){ arr[i] = rand.nextInt(10) + 1; } for(int i = 0; i < n; i++){ System.out.print("a[" + i + "] = "); System.out.print(arr[i] + " "); for(int j = 0; j < arr[i]; j++){ System.out.print("*"); } System.out.println(); stdIn.close(); } } }
WINDOWS-1252
Java
590
java
IntArrayRand.java
Java
[]
null
[]
import java.util.Random; import java.util.Scanner; public class IntArrayRand { public static void main(String[] args){ Random rand = new Random(); Scanner stdIn = new Scanner(System.in); System.out.print("ยฟรคยผร’ ยผรถ : "); int n = stdIn.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++){ arr[i] = rand.nextInt(10) + 1; } for(int i = 0; i < n; i++){ System.out.print("a[" + i + "] = "); System.out.print(arr[i] + " "); for(int j = 0; j < arr[i]; j++){ System.out.print("*"); } System.out.println(); stdIn.close(); } } }
590
0.546233
0.532534
29
19.137932
14.48596
41
false
false
0
0
0
0
0
0
2.413793
false
false
9
b14ec9a655025cb97283affd9cc87e7a63c4deac
13,967,233,692,639
1c8e601626ba1c360f5bf00f883accb4ecc63ab1
/src/edu/nuc/action/QueryFileOneAction.java
529659271ae53701cb2860b75e99ce4c7530d7a1
[]
no_license
RoundYuanYuan/ResourceHub
https://github.com/RoundYuanYuan/ResourceHub
d017ca89bb5b98d33709ce26189d33b9d891c6b7
863b75797e358c7aade37a04bcdf0c802ab22357
refs/heads/master
2020-03-22T15:00:03.252000
2018-07-09T02:23:32
2018-07-09T02:23:32
140,221,298
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.nuc.action; import java.util.ArrayList; import java.util.List; import com.opensymphony.xwork2.ActionSupport; import dao.ComAndRevDao; import edu.nuc.dao.FileQueryDao; import model.Comment; import model.Revert; import model.Source; public class QueryFileOneAction extends ActionSupport { private Source source = new Source(); List<Source> sources=new ArrayList<Source>(); FileQueryDao fd=new FileQueryDao(); public Source getSource() { return source; } public void setSource(Source source) { this.source = source; } public List<Source> getSources() { return sources; } public void setSources(List<Source> sources) { this.sources = sources; } public String QueryOneFMethod() { String sql="select * from tb_resource where sourceId="+source.getSourceId()+""; sources=fd.querySourceMethod(sql); int pageS=3; this.commentList=comAndRevDao.findById(source); int listLength=this.commentList.size(); if(listLength%pageS==0){ this.lastPage=listLength/pageS; }else this.lastPage=listLength/pageS+1; if(currentPage<1){ currentPage=1; } if(currentPage>this.lastPage){ currentPage=this.lastPage; } int startIndex=(this.currentPage-1)*pageS; int endIndex=startIndex+pageS; if(endIndex>=listLength) endIndex=listLength; //this.commentList=this.commentList.subList(startIndex, endIndex); this.revertList=comAndRevDao.findByComId(); /* Iterator<Comment> comm=commentList.iterator(); while(comm.hasNext()){ Comment comment=comm.next(); System.out.println(comment.getComTest()); } System.out.println();*/ return SUCCESS; } /* */ private Comment comment; private Revert revert; private List<Comment> commentList; private List<Revert> revertList; public List<Comment> getCommentList() { return commentList; } public void setCommentList(List<Comment> commentList) { this.commentList = commentList; } private int currentPage=1; //ๅฝ“ๅ‰้กต public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public int getLastPage() { return lastPage; } public void setLastPage(int lastPage) { this.lastPage = lastPage; } private int lastPage; //ๅฐพ้กต private ComAndRevDao comAndRevDao=new ComAndRevDao(); public Comment getComment() { return comment; } public void setComment(Comment comment) { this.comment = comment; } public String addComment(){ // TODO ่‡ชๅŠจ็”Ÿๆˆ็š„ๆ–นๆณ•ๅญ˜ๆ น System.out.println(comment.getComTest()); comment.setUserName("saasd"); int jg=comAndRevDao.addComments(comment); System.out.println("่ฏ„่ฎบๆˆๅŠŸ"); return "Csuccess"; } public String addRevert(){ System.out.println(revert.getRevertText()); revert.setUserName("saasd"); revert.setUserId(1); System.out.println(revert.getComId()); int jg=comAndRevDao.addRevertes(revert); System.out.println("ๅ›žๅคๆˆๅŠŸ"); return "Rsuccess"; } /* public String getAllByPage(){ int pageS=3; int sourceId=1; this.commentList=comAndRevDao.findById(sourceId); int listLength=this.commentList.size(); if(listLength%pageS==0){ this.lastPage=listLength/pageS; }else this.lastPage=listLength/pageS+1; if(currentPage<1){ currentPage=1; } if(currentPage>this.lastPage){ currentPage=this.lastPage; } int startIndex=(this.currentPage-1)*pageS; int endIndex=startIndex+pageS; if(endIndex>=listLength) endIndex=listLength; this.commentList=this.commentList.subList(startIndex, endIndex); this.revertList=comAndRevDao.findByComId(); /* Iterator<Comment> comm=commentList.iterator(); while(comm.hasNext()){ Comment comment=comm.next(); System.out.println(comment.getComTest()); } System.out.println(); return SUCCESS; }*/ public Revert getRevert() { return revert; } public void setRevert(Revert revert) { this.revert = revert; } public List<Revert> getRevertList() { return revertList; } public void setRevertList(List<Revert> revertList) { this.revertList = revertList; } }
GB18030
Java
4,188
java
QueryFileOneAction.java
Java
[ { "context": "tln(comment.getComTest());\n\t\tcomment.setUserName(\"saasd\");\n\t\t int jg=comAndRevDao.addComments(comment);\n\t", "end": 2608, "score": 0.9995981454849243, "start": 2603, "tag": "USERNAME", "value": "saasd" }, { "context": "ln(revert.getRevertText());\n\t\trevert.setUserName(\"saasd\");\n\t\trevert.setUserId(1);\n\t\tSystem.out.println(re", "end": 2816, "score": 0.9995887875556946, "start": 2811, "tag": "USERNAME", "value": "saasd" } ]
null
[]
package edu.nuc.action; import java.util.ArrayList; import java.util.List; import com.opensymphony.xwork2.ActionSupport; import dao.ComAndRevDao; import edu.nuc.dao.FileQueryDao; import model.Comment; import model.Revert; import model.Source; public class QueryFileOneAction extends ActionSupport { private Source source = new Source(); List<Source> sources=new ArrayList<Source>(); FileQueryDao fd=new FileQueryDao(); public Source getSource() { return source; } public void setSource(Source source) { this.source = source; } public List<Source> getSources() { return sources; } public void setSources(List<Source> sources) { this.sources = sources; } public String QueryOneFMethod() { String sql="select * from tb_resource where sourceId="+source.getSourceId()+""; sources=fd.querySourceMethod(sql); int pageS=3; this.commentList=comAndRevDao.findById(source); int listLength=this.commentList.size(); if(listLength%pageS==0){ this.lastPage=listLength/pageS; }else this.lastPage=listLength/pageS+1; if(currentPage<1){ currentPage=1; } if(currentPage>this.lastPage){ currentPage=this.lastPage; } int startIndex=(this.currentPage-1)*pageS; int endIndex=startIndex+pageS; if(endIndex>=listLength) endIndex=listLength; //this.commentList=this.commentList.subList(startIndex, endIndex); this.revertList=comAndRevDao.findByComId(); /* Iterator<Comment> comm=commentList.iterator(); while(comm.hasNext()){ Comment comment=comm.next(); System.out.println(comment.getComTest()); } System.out.println();*/ return SUCCESS; } /* */ private Comment comment; private Revert revert; private List<Comment> commentList; private List<Revert> revertList; public List<Comment> getCommentList() { return commentList; } public void setCommentList(List<Comment> commentList) { this.commentList = commentList; } private int currentPage=1; //ๅฝ“ๅ‰้กต public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public int getLastPage() { return lastPage; } public void setLastPage(int lastPage) { this.lastPage = lastPage; } private int lastPage; //ๅฐพ้กต private ComAndRevDao comAndRevDao=new ComAndRevDao(); public Comment getComment() { return comment; } public void setComment(Comment comment) { this.comment = comment; } public String addComment(){ // TODO ่‡ชๅŠจ็”Ÿๆˆ็š„ๆ–นๆณ•ๅญ˜ๆ น System.out.println(comment.getComTest()); comment.setUserName("saasd"); int jg=comAndRevDao.addComments(comment); System.out.println("่ฏ„่ฎบๆˆๅŠŸ"); return "Csuccess"; } public String addRevert(){ System.out.println(revert.getRevertText()); revert.setUserName("saasd"); revert.setUserId(1); System.out.println(revert.getComId()); int jg=comAndRevDao.addRevertes(revert); System.out.println("ๅ›žๅคๆˆๅŠŸ"); return "Rsuccess"; } /* public String getAllByPage(){ int pageS=3; int sourceId=1; this.commentList=comAndRevDao.findById(sourceId); int listLength=this.commentList.size(); if(listLength%pageS==0){ this.lastPage=listLength/pageS; }else this.lastPage=listLength/pageS+1; if(currentPage<1){ currentPage=1; } if(currentPage>this.lastPage){ currentPage=this.lastPage; } int startIndex=(this.currentPage-1)*pageS; int endIndex=startIndex+pageS; if(endIndex>=listLength) endIndex=listLength; this.commentList=this.commentList.subList(startIndex, endIndex); this.revertList=comAndRevDao.findByComId(); /* Iterator<Comment> comm=commentList.iterator(); while(comm.hasNext()){ Comment comment=comm.next(); System.out.println(comment.getComTest()); } System.out.println(); return SUCCESS; }*/ public Revert getRevert() { return revert; } public void setRevert(Revert revert) { this.revert = revert; } public List<Revert> getRevertList() { return revertList; } public void setRevertList(List<Revert> revertList) { this.revertList = revertList; } }
4,188
0.704392
0.700531
165
24.115152
17.925911
81
false
false
0
0
0
0
0
0
1.763636
false
false
9
fc47eb2056d536cc3d5b34755291d3061f8df40e
33,105,607,974,210
4ca9363a81f9abf0de8f70c50c7d4dd99a4c5872
/app/src/main/java/com/informationsystem/mvp/model/IActivityJoinModel.java
b1c160e5a777260adfeb6852a065b67330d4b840
[]
no_license
sixgodw/InformationService
https://github.com/sixgodw/InformationService
d123f4c7dceb77e25df409e2ce04e54a32e8a810
b0f3b3d5c55d50c5bb231ce609b9e8ae41e726d2
refs/heads/master
2018-04-04T16:56:48.855000
2017-04-27T04:00:38
2017-04-27T04:00:38
89,036,973
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.informationsystem.mvp.model; import com.informationsystem.http.bean.ActivityJoin; /** * Created by Administrator on 2017/4/27. */ public interface IActivityJoinModel { ActivityJoin ActivityJoin(String aid,String uid,String data); }
UTF-8
Java
253
java
IActivityJoinModel.java
Java
[]
null
[]
package com.informationsystem.mvp.model; import com.informationsystem.http.bean.ActivityJoin; /** * Created by Administrator on 2017/4/27. */ public interface IActivityJoinModel { ActivityJoin ActivityJoin(String aid,String uid,String data); }
253
0.778656
0.750988
11
22
23.882288
65
false
false
0
0
0
0
0
0
0.454545
false
false
9
6d6065473826db6ef4b98401c561119d4bd195cd
1,176,821,102,656
14ee9e6d387d6db578ee17ab05515a2814dd6eb2
/frpc-common/src/main/java/com/jibug/frpc/common/codec/serialize/SerializeProtocolEnum.java
0f46963dc056fb84d95cfd09efefd25c909fbdb0
[ "Apache-2.0" ]
permissive
heyingcai/frpc
https://github.com/heyingcai/frpc
f1c7354c60c848d9b9afeb2eeaa2134f9990fac3
f8ff87926e644b501220700e5880cd8faa826b3c
refs/heads/master
2022-06-30T06:39:46.559000
2019-08-05T08:06:59
2019-08-05T08:06:59
158,401,352
1
1
Apache-2.0
false
2019-10-29T21:26:40
2018-11-20T14:22:38
2019-08-05T08:07:08
2019-10-29T21:26:39
251
1
0
1
Java
false
false
package com.jibug.frpc.common.codec.serialize; import com.jibug.frpc.common.codec.serialize.hessian.HessianSerialize; import com.jibug.frpc.common.codec.serialize.jdk.JdkSerialize; import com.jibug.frpc.common.codec.serialize.json.JsonSerialize; import com.jibug.frpc.common.codec.serialize.kryo.KryoSerialize; /** * @author heyingcai */ public enum SerializeProtocolEnum { /** * jdkๅŽŸ็”Ÿๅบๅˆ—ๅŒ– */ JDK_SERIALIZE((byte) 0, JdkSerialize.class), /** * hessianๅบๅˆ—ๅŒ– */ HESSIAN_SERIALIZE((byte) (1 << 2), HessianSerialize.class), /** * kryoๅบๅˆ—ๅŒ– */ KRYO_SERIALIZE((byte) (1 << 3), KryoSerialize.class), /** * jsonๅบๅˆ—ๅŒ– */ JSON_SERIALIZE((byte) (1 << 4), JsonSerialize.class); private byte value; private Class<?> clazz; SerializeProtocolEnum(byte value, Class<?> clazz) { this.value = value; this.clazz = clazz; } public static Class<?> getSerialize(byte value) { SerializeProtocolEnum[] values = values(); for (SerializeProtocolEnum s : values) { if (s.value == value) { return s.clazz; } } return null; } public byte getValue() { return value; } public void setValue(byte value) { this.value = value; } public Class<?> getClazz() { return clazz; } public void setClazz(Class<?> clazz) { this.clazz = clazz; } }
UTF-8
Java
1,488
java
SerializeProtocolEnum.java
Java
[ { "context": "odec.serialize.kryo.KryoSerialize;\n\n/**\n * @author heyingcai\n */\npublic enum SerializeProtocolEnum {\n\n /**\n", "end": 337, "score": 0.9993399381637573, "start": 328, "tag": "USERNAME", "value": "heyingcai" } ]
null
[]
package com.jibug.frpc.common.codec.serialize; import com.jibug.frpc.common.codec.serialize.hessian.HessianSerialize; import com.jibug.frpc.common.codec.serialize.jdk.JdkSerialize; import com.jibug.frpc.common.codec.serialize.json.JsonSerialize; import com.jibug.frpc.common.codec.serialize.kryo.KryoSerialize; /** * @author heyingcai */ public enum SerializeProtocolEnum { /** * jdkๅŽŸ็”Ÿๅบๅˆ—ๅŒ– */ JDK_SERIALIZE((byte) 0, JdkSerialize.class), /** * hessianๅบๅˆ—ๅŒ– */ HESSIAN_SERIALIZE((byte) (1 << 2), HessianSerialize.class), /** * kryoๅบๅˆ—ๅŒ– */ KRYO_SERIALIZE((byte) (1 << 3), KryoSerialize.class), /** * jsonๅบๅˆ—ๅŒ– */ JSON_SERIALIZE((byte) (1 << 4), JsonSerialize.class); private byte value; private Class<?> clazz; SerializeProtocolEnum(byte value, Class<?> clazz) { this.value = value; this.clazz = clazz; } public static Class<?> getSerialize(byte value) { SerializeProtocolEnum[] values = values(); for (SerializeProtocolEnum s : values) { if (s.value == value) { return s.clazz; } } return null; } public byte getValue() { return value; } public void setValue(byte value) { this.value = value; } public Class<?> getClazz() { return clazz; } public void setClazz(Class<?> clazz) { this.clazz = clazz; } }
1,488
0.59726
0.592466
67
20.791044
20.982962
70
false
false
0
0
0
0
0
0
0.373134
false
false
9
e0b584e5d26916001899138fa03b7d704b4614ba
28,776,280,907,211
a3bd161c48d4991e77d902a47aa6747bf406d79b
/src/main/java/com/study/iocdi/aop/MyPointCut.java
b7e972e005428d5f492687af86fd403857d35a4b
[]
no_license
clglyj/aop-test
https://github.com/clglyj/aop-test
28043ea4c24715c32bd578bec6d2f61dc585968f
534e9c28ba7342ebb63d8e930bc7b30f2fceb816
refs/heads/master
2022-05-23T18:15:59.262000
2020-04-24T04:45:34
2020-04-24T04:45:34
258,405,545
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.study.iocdi.aop; public class MyPointCut { private String classPart ; private String methodPart ; public MyPointCut(String classPart, String methodPart) { this.classPart = classPart; this.methodPart = methodPart; } public String getMethodPart() { return methodPart; } public void setMethodPart(String methodPart) { this.methodPart = methodPart; } public String getClassPart() { return classPart; } public void setClassPart(String classPart) { this.classPart = classPart; } }
UTF-8
Java
594
java
MyPointCut.java
Java
[]
null
[]
package com.study.iocdi.aop; public class MyPointCut { private String classPart ; private String methodPart ; public MyPointCut(String classPart, String methodPart) { this.classPart = classPart; this.methodPart = methodPart; } public String getMethodPart() { return methodPart; } public void setMethodPart(String methodPart) { this.methodPart = methodPart; } public String getClassPart() { return classPart; } public void setClassPart(String classPart) { this.classPart = classPart; } }
594
0.646465
0.646465
28
20.214285
18.401003
60
false
false
0
0
0
0
0
0
0.357143
false
false
9
32038d1ae80887bfe1c5945f16acdf2e6ad4a12b
24,833,500,934,665
d504110d2237650b4a445417c80131915f303fe0
/netbeans/gas/phylo/src/com/gas/phylo/mrbayers/api/IMrBayesPanel.java
2aa03e6a2132a00787a72422733f28b663a3582f
[]
no_license
duncan1201/VF
https://github.com/duncan1201/VF
ab8741163bbff03962818cc1076cc35c1252bb03
095478313d2580925f7417dae6eb083d09636a30
refs/heads/master
2021-03-22T00:26:13.276000
2016-09-08T11:48:01
2016-09-08T11:48:01
32,251,044
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.gas.phylo.mrbayers.api; /** * * @author dq */ public interface IMrBayesPanel { MrBayesParam getMrBayersParam(); }
UTF-8
Java
234
java
IMrBayesPanel.java
Java
[ { "context": "age com.gas.phylo.mrbayers.api;\n\n/**\n *\n * @author dq\n */\npublic interface IMrBayesPanel {\n MrBayesP", "end": 157, "score": 0.9995663166046143, "start": 155, "tag": "USERNAME", "value": "dq" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.gas.phylo.mrbayers.api; /** * * @author dq */ public interface IMrBayesPanel { MrBayesParam getMrBayersParam(); }
234
0.692308
0.692308
13
17
18.012815
52
false
false
0
0
0
0
0
0
0.307692
false
false
9
bcb3eda26d4117cc79f15c19fef07881dce72ce5
39,032,662,791,821
87f49d587cc71a3afa1010d688123ca51a9aabeb
/sample/src/main/java/com/stfalcon/sample/video/EasyVideoCallback.java
5d67df9bc5fad677028f5bfe73921ae58e0a587c
[ "Apache-2.0" ]
permissive
AlexanderBuyko/StfalconImageViewer
https://github.com/AlexanderBuyko/StfalconImageViewer
27f030117231aa3f0b1ebfcb70f21dea9d793e56
c000f63f2efcd20878bc3e81560adaaa6eb8d9d9
refs/heads/master
2020-07-21T02:40:59.568000
2020-04-02T10:23:15
2020-04-02T10:23:15
206,737,161
2
0
Apache-2.0
true
2019-09-06T07:21:57
2019-09-06T07:21:57
2019-09-04T07:39:45
2019-04-11T07:45:07
9,903
0
0
0
null
false
false
package com.stfalcon.sample.video; import android.net.Uri; /** * @author Aidan Follestad (afollestad) */ public interface EasyVideoCallback { void onStarted(EasyVideoPlayer player); void onPaused(EasyVideoPlayer player); void onPreparing(EasyVideoPlayer player); void onPrepared(EasyVideoPlayer player); void onBuffering(int percent); void onError(EasyVideoPlayer player, Exception e); void onCompletion(EasyVideoPlayer player); void onRetry(EasyVideoPlayer player, Uri source); void onSubmit(EasyVideoPlayer player, Uri source); }
UTF-8
Java
606
java
EasyVideoCallback.java
Java
[ { "context": "deo;\r\n\r\nimport android.net.Uri;\r\n\r\n/**\r\n * @author Aidan Follestad (afollestad)\r\n */\r\npublic interface EasyVideoCall", "end": 96, "score": 0.9998920559883118, "start": 81, "tag": "NAME", "value": "Aidan Follestad" }, { "context": "roid.net.Uri;\r\n\r\n/**\r\n * @author Aidan Follestad (afollestad)\r\n */\r\npublic interface EasyVideoCallback {\r\n\r\n ", "end": 108, "score": 0.9995244741439819, "start": 98, "tag": "USERNAME", "value": "afollestad" } ]
null
[]
package com.stfalcon.sample.video; import android.net.Uri; /** * @author <NAME> (afollestad) */ public interface EasyVideoCallback { void onStarted(EasyVideoPlayer player); void onPaused(EasyVideoPlayer player); void onPreparing(EasyVideoPlayer player); void onPrepared(EasyVideoPlayer player); void onBuffering(int percent); void onError(EasyVideoPlayer player, Exception e); void onCompletion(EasyVideoPlayer player); void onRetry(EasyVideoPlayer player, Uri source); void onSubmit(EasyVideoPlayer player, Uri source); }
597
0.717822
0.717822
27
20.518518
21.637365
54
false
false
0
0
0
0
0
0
0.518519
false
false
9
dc73eb8305735095cd93f7b84a27ce69e5c2e6b3
39,350,490,368,923
3da768589c697d9868b8649798424e481a11a6cc
/src/FullHouse/GUI/wijzigToernooi.java
85420f1cdbcde2737f7e5655c792d2f22fa6ca5a
[]
no_license
sjoerd1112/FullHouse
https://github.com/sjoerd1112/FullHouse
d160fff2ea2da4a5df69c05d44238a211f70e9d8
0341ca9ecac836a1e48c68230ad77be5a762b9b3
refs/heads/master
2020-05-16T10:44:29.424000
2019-06-13T16:09:43
2019-06-13T16:09:43
182,988,770
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FullHouse.GUI; import FullHouse.DB.DBConnector; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import static FullHouse.Classes.checkDatum.checkDateFormat; /** * Created by sjoer on 24-5-2019. */ public class wijzigToernooi { private static JComboBox<String> locatie; private static JComboBox<String> type; private static JTextField datum = addToernooi.getDatum(); private static JTextField beginTijd = new JTextField(); private static JTextField eindTijd = new JTextField(); private static JTextField beschrijving = new JTextField(); private static JTextField condities= new JTextField(); private static JTextField max_aantallen = new JTextField(); private static JTextField inleggeld = new JTextField(); private static JTextField max_inschrijf_datum = addToernooi.getMax_inschrijf_datum(); private static JPanel toernooiPanel; public static void showWijzigToernooi(JFrame frame, JPanel panel, int id) throws SQLException { frame.remove(panel); frame.setTitle("Toernooi wijzigen"); toernooiPanel = new JPanel(new GridLayout(6,5,5,5)); JButton terug = new JButton("Terug"); JButton wijzig = new JButton("Wijzigen"); JLabel melding = new JLabel(); String[] locaties = new String[]{"Amsterdam", "Den Haag", "Utrecht", "Eindhoven", "Arnhem"}; locatie = new JComboBox<>(locaties); String[] types = new String[]{"Regulier", "Pink Ribbon", "Speciaal"}; type = new JComboBox<>(types); addComponent(terug, new JLabel(), melding, new JLabel(), wijzig, new JLabel("Locatie: "), locatie, new JLabel(), new JLabel("<html>Datum:<br>(dd-mm-jjjj)</html>"), datum, new JLabel("<html>Begintijd:<br>(hh:mm:ss)</html>"), beginTijd, new JLabel(), new JLabel("<html>Eindtijd:<br>(hh:mm:ss)</html>"), eindTijd, new JLabel("Beschrijving:"), beschrijving, new JLabel(), new JLabel("Condities:"), condities, new JLabel("Max aantallen:"), max_aantallen, new JLabel(), new JLabel("Inleggeld:"), inleggeld, new JLabel("<html>Max inschrijfdatum:<br>(dd-mm-jjjj hh:mm:ss)</html>"), max_inschrijf_datum, new JLabel(), new JLabel("Type:"), type); addToernooi.clear(datum); addToernooi.clear(beginTijd); addToernooi.clear(eindTijd); addToernooi.clear(beschrijving); addToernooi.clear(condities); addToernooi.clear(max_aantallen); addToernooi.clear(inleggeld); addToernooi.clear(max_inschrijf_datum); setText(id); frame.add(toernooiPanel); frame.pack(); frame.setSize(800, 250); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true); wijzig.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addToernooi.check(datum); addToernooi.check(beginTijd); addToernooi.check(eindTijd); addToernooi.check(beschrijving); addToernooi.check(condities); addToernooi.check(max_aantallen); addToernooi.check(inleggeld); addToernooi.check(max_inschrijf_datum); if (!addToernooi.getCheckValues().contains(false)) { String query = "UPDATE Toernooi SET locatie='"+locatie.getSelectedItem()+"', datum='"+addToernooi.getFormatDatum()+"',begintijd='"+beginTijd.getText()+"',eindtijd='"+eindTijd.getText()+"',beschrijving='"+beschrijving.getText()+"',condities='"+condities.getText()+"',max_aantallen='"+max_aantallen.getText()+"',inleggeld='"+inleggeld.getText()+"',max_inschrijfdatum='"+addToernooi.getMax_datum()+"',type='"+type.getSelectedItem()+"' WHERE toernooi_id="+id; try { DBConnector.executeQuery(query); frame.remove(toernooiPanel); Toernooien.showToernooi(frame, id); addToernooi.removeCheckValues(); } catch (SQLException | ClassNotFoundException e1) { e1.printStackTrace(); } } else { JOptionPane.showMessageDialog(frame, "Vul alle velden correct in a.u.b.", "Er is iets misgegaan!", JOptionPane.ERROR_MESSAGE); addToernooi.removeCheckValues(); } } }); terug.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.remove(toernooiPanel); try { Toernooien.showToernooi(frame, id); } catch (SQLException | ClassNotFoundException e1) { e1.printStackTrace(); } } }); } public static void setText(int id) throws SQLException { String query = "SELECT * FROM Toernooi WHERE toernooi_id="+id; ResultSet rs = DBConnector.query(query); while (rs.next()) { locatie.setSelectedItem(rs.getString("locatie")); Date date = rs.getDate("datum"); String inschrijf_datum = new SimpleDateFormat("dd-MM-yyyy").format(date); datum.setText(inschrijf_datum); beginTijd.setText(rs.getString("begintijd")); eindTijd.setText(rs.getString("eindtijd")); beschrijving.setText(rs.getString("beschrijving")); condities.setText(rs.getString("condities")); max_aantallen.setText(rs.getString("max_aantallen")); inleggeld.setText("" + rs.getString("inleggeld")); Date max_date = rs.getDate("Max_inschrijfdatum"); Date time = rs.getTime("Max_inschrijfdatum"); String convertDate = new SimpleDateFormat("dd-MM-yyyy").format(max_date); String convertTime = new SimpleDateFormat("HH:mm:ss").format(time); max_inschrijf_datum.setText(convertDate + " " + convertTime); type.setSelectedItem(rs.getString("type")); } } private static void addComponent(Component... com) { for (Component components : com) { toernooiPanel.add(components); } } }
UTF-8
Java
6,992
java
wijzigToernooi.java
Java
[ { "context": "ses.checkDatum.checkDateFormat;\n\n/**\n * Created by sjoer on 24-5-2019.\n */\npublic class wijzigToernooi {\n\n", "end": 462, "score": 0.9992039799690247, "start": 457, "tag": "USERNAME", "value": "sjoer" } ]
null
[]
package FullHouse.GUI; import FullHouse.DB.DBConnector; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import static FullHouse.Classes.checkDatum.checkDateFormat; /** * Created by sjoer on 24-5-2019. */ public class wijzigToernooi { private static JComboBox<String> locatie; private static JComboBox<String> type; private static JTextField datum = addToernooi.getDatum(); private static JTextField beginTijd = new JTextField(); private static JTextField eindTijd = new JTextField(); private static JTextField beschrijving = new JTextField(); private static JTextField condities= new JTextField(); private static JTextField max_aantallen = new JTextField(); private static JTextField inleggeld = new JTextField(); private static JTextField max_inschrijf_datum = addToernooi.getMax_inschrijf_datum(); private static JPanel toernooiPanel; public static void showWijzigToernooi(JFrame frame, JPanel panel, int id) throws SQLException { frame.remove(panel); frame.setTitle("Toernooi wijzigen"); toernooiPanel = new JPanel(new GridLayout(6,5,5,5)); JButton terug = new JButton("Terug"); JButton wijzig = new JButton("Wijzigen"); JLabel melding = new JLabel(); String[] locaties = new String[]{"Amsterdam", "Den Haag", "Utrecht", "Eindhoven", "Arnhem"}; locatie = new JComboBox<>(locaties); String[] types = new String[]{"Regulier", "Pink Ribbon", "Speciaal"}; type = new JComboBox<>(types); addComponent(terug, new JLabel(), melding, new JLabel(), wijzig, new JLabel("Locatie: "), locatie, new JLabel(), new JLabel("<html>Datum:<br>(dd-mm-jjjj)</html>"), datum, new JLabel("<html>Begintijd:<br>(hh:mm:ss)</html>"), beginTijd, new JLabel(), new JLabel("<html>Eindtijd:<br>(hh:mm:ss)</html>"), eindTijd, new JLabel("Beschrijving:"), beschrijving, new JLabel(), new JLabel("Condities:"), condities, new JLabel("Max aantallen:"), max_aantallen, new JLabel(), new JLabel("Inleggeld:"), inleggeld, new JLabel("<html>Max inschrijfdatum:<br>(dd-mm-jjjj hh:mm:ss)</html>"), max_inschrijf_datum, new JLabel(), new JLabel("Type:"), type); addToernooi.clear(datum); addToernooi.clear(beginTijd); addToernooi.clear(eindTijd); addToernooi.clear(beschrijving); addToernooi.clear(condities); addToernooi.clear(max_aantallen); addToernooi.clear(inleggeld); addToernooi.clear(max_inschrijf_datum); setText(id); frame.add(toernooiPanel); frame.pack(); frame.setSize(800, 250); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true); wijzig.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addToernooi.check(datum); addToernooi.check(beginTijd); addToernooi.check(eindTijd); addToernooi.check(beschrijving); addToernooi.check(condities); addToernooi.check(max_aantallen); addToernooi.check(inleggeld); addToernooi.check(max_inschrijf_datum); if (!addToernooi.getCheckValues().contains(false)) { String query = "UPDATE Toernooi SET locatie='"+locatie.getSelectedItem()+"', datum='"+addToernooi.getFormatDatum()+"',begintijd='"+beginTijd.getText()+"',eindtijd='"+eindTijd.getText()+"',beschrijving='"+beschrijving.getText()+"',condities='"+condities.getText()+"',max_aantallen='"+max_aantallen.getText()+"',inleggeld='"+inleggeld.getText()+"',max_inschrijfdatum='"+addToernooi.getMax_datum()+"',type='"+type.getSelectedItem()+"' WHERE toernooi_id="+id; try { DBConnector.executeQuery(query); frame.remove(toernooiPanel); Toernooien.showToernooi(frame, id); addToernooi.removeCheckValues(); } catch (SQLException | ClassNotFoundException e1) { e1.printStackTrace(); } } else { JOptionPane.showMessageDialog(frame, "Vul alle velden correct in a.u.b.", "Er is iets misgegaan!", JOptionPane.ERROR_MESSAGE); addToernooi.removeCheckValues(); } } }); terug.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.remove(toernooiPanel); try { Toernooien.showToernooi(frame, id); } catch (SQLException | ClassNotFoundException e1) { e1.printStackTrace(); } } }); } public static void setText(int id) throws SQLException { String query = "SELECT * FROM Toernooi WHERE toernooi_id="+id; ResultSet rs = DBConnector.query(query); while (rs.next()) { locatie.setSelectedItem(rs.getString("locatie")); Date date = rs.getDate("datum"); String inschrijf_datum = new SimpleDateFormat("dd-MM-yyyy").format(date); datum.setText(inschrijf_datum); beginTijd.setText(rs.getString("begintijd")); eindTijd.setText(rs.getString("eindtijd")); beschrijving.setText(rs.getString("beschrijving")); condities.setText(rs.getString("condities")); max_aantallen.setText(rs.getString("max_aantallen")); inleggeld.setText("" + rs.getString("inleggeld")); Date max_date = rs.getDate("Max_inschrijfdatum"); Date time = rs.getTime("Max_inschrijfdatum"); String convertDate = new SimpleDateFormat("dd-MM-yyyy").format(max_date); String convertTime = new SimpleDateFormat("HH:mm:ss").format(time); max_inschrijf_datum.setText(convertDate + " " + convertTime); type.setSelectedItem(rs.getString("type")); } } private static void addComponent(Component... com) { for (Component components : com) { toernooiPanel.add(components); } } }
6,992
0.585812
0.582809
171
39.883041
41.427006
475
false
false
0
0
0
0
0
0
0.859649
false
false
9
e6a9029147333323ccd167d2ed23136dffcded93
1,391,569,466,392
dd1fe61d08ace2d3df114a2a736cc4e80899fada
/src/test/java/svanimpe/reminders/validation/PasswordValidatorTest.java
f4a06ad28bf1ceed6c44959d434ed6fb1099614a
[ "BSD-2-Clause" ]
permissive
the-sloth-dev/reminders
https://github.com/the-sloth-dev/reminders
59088f2b615b80383ad6d91b775bdca4569be1de
2f38febd49b6d4527b22953f632b667b3a7dfbe3
refs/heads/master
2022-10-11T06:57:31.977000
2015-01-24T19:02:04
2015-01-24T19:02:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package svanimpe.reminders.validation; import java.util.Arrays; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import static org.junit.Assert.*; @RunWith(Parameterized.class) public class PasswordValidatorTest { @Parameterized.Parameters public static List<Object[]> getParameters() { return Arrays.asList(new Object[][] { {null, false}, {"", false}, {" \t\n ", false}, {" password", false}, {"password ", false}, {"passwor", false}, {"password", true}, {"P4$$vv0rD", true}, {"super - secret - password", true}, {"somepasswordthatiswaytoolongbutIdontreallyknowanywordlikethatso" + "thatswhyImjusttypingwhatevercomestomindhereletshopeitsovertwo" + "hundredandfiftysixcharacterslongsothetestwillfailbutitsprobably" + "notsoIbettercopypasteitsomepasswordthatiswaytoolongbutIdont" + "reallyknowanywordlikethatsothatswhyImjusttypingwhatevercomesto" + "mindhereletshopeitsovertwohundredandfiftysixcharacterslongsothe" + "testwillfailbutitsprobablynotsoIbettercopypasteit", false} }); } private final String password; private final boolean expectedResult; public PasswordValidatorTest(String password, boolean expectedResult) { this.password = password; this.expectedResult = expectedResult; } @Test public void testPasswordValidation() { PasswordValidator validator = new PasswordValidator(); assertEquals(expectedResult, validator.isValid(password, null)); } }
UTF-8
Java
1,741
java
PasswordValidatorTest.java
Java
[ { "context": "e},\n {\"password\", true},\n {\"P4$$vv0rD\", true},\n {\"super - secret - password\"", "end": 656, "score": 0.9929689168930054, "start": 647, "tag": "PASSWORD", "value": "P4$$vv0rD" }, { "context": "lean expectedResult)\n {\n this.password = password;\n this.expectedResult = expectedResult;\n ", "end": 1481, "score": 0.9847730994224548, "start": 1473, "tag": "PASSWORD", "value": "password" } ]
null
[]
package svanimpe.reminders.validation; import java.util.Arrays; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import static org.junit.Assert.*; @RunWith(Parameterized.class) public class PasswordValidatorTest { @Parameterized.Parameters public static List<Object[]> getParameters() { return Arrays.asList(new Object[][] { {null, false}, {"", false}, {" \t\n ", false}, {" password", false}, {"password ", false}, {"passwor", false}, {"password", true}, {"<PASSWORD>", true}, {"super - secret - password", true}, {"somepasswordthatiswaytoolongbutIdontreallyknowanywordlikethatso" + "thatswhyImjusttypingwhatevercomestomindhereletshopeitsovertwo" + "hundredandfiftysixcharacterslongsothetestwillfailbutitsprobably" + "notsoIbettercopypasteitsomepasswordthatiswaytoolongbutIdont" + "reallyknowanywordlikethatsothatswhyImjusttypingwhatevercomesto" + "mindhereletshopeitsovertwohundredandfiftysixcharacterslongsothe" + "testwillfailbutitsprobablynotsoIbettercopypasteit", false} }); } private final String password; private final boolean expectedResult; public PasswordValidatorTest(String password, boolean expectedResult) { this.password = <PASSWORD>; this.expectedResult = expectedResult; } @Test public void testPasswordValidation() { PasswordValidator validator = new PasswordValidator(); assertEquals(expectedResult, validator.isValid(password, null)); } }
1,744
0.665135
0.663986
52
32.48077
25.362366
81
false
false
0
0
0
0
0
0
0.692308
false
false
9
2ac925fba3e99f9f1fdd0d91128509a454cae6da
37,572,373,925,833
5fedb08590b97e71f65b6854cac40f4679e4ae93
/woooqi-bpm-logic/src/main/java/com/woooqi/bpm/service/bpm/impl/DeployServiceImpl.java
7fdf3c7f8f215dd3c8ffee09829075bd1bbe09f9
[]
no_license
xeon-ye/woooqi-bpm
https://github.com/xeon-ye/woooqi-bpm
c234156eb75420f4835800e3b25aa2b0f3df6fff
64dc99312eb91de4bb2008d60e0cd963a2d1c683
refs/heads/master
2021-09-05T12:20:37.785000
2018-01-27T13:57:11
2018-01-27T13:57:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.woooqi.bpm.service.bpm.impl; import java.io.IOException; import java.io.InputStream; import java.util.Date; import java.util.List; import org.activiti.engine.RepositoryService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.titan.entity.bpm.bpm.Deployment; import com.titan.service.bpm.DeployService; import com.titan.utils.DataBaseUtils; @Service public class DeployServiceImpl implements DeployService{ @Autowired private RepositoryService repositoryService; @Override public List<Deployment> getAllDeploy(String name) { String sql = "select c.id_,c.name_,c.tenant_id_,c.deploy_time_,c.version_,d.name as category_ from (select b.*,a.version_ from act_re_procdef a,act_re_deployment b where a.deployment_id_(+) = b.id_)c,bpm_category d where c.category_ =d.id(+)"; if(!"".equals(name)){ sql += " and c.name_ like '%"+name+"%'"; } sql+=" order by c.deploy_time_" ; List<Deployment> deployments = DataBaseUtils.queryForListBean(sql, Deployment.class); return deployments; } @Override public InputStream getImageByte(String deployId) throws IOException { String imageName = ""; List<String> names = repositoryService.getDeploymentResourceNames(deployId); for(String name:names){ if(name.endsWith(".png")){ imageName = name; } } if(!StringUtils.isBlank(imageName)){ InputStream imageStream = repositoryService.getResourceAsStream(deployId, imageName); return imageStream; } return null; } @Override public InputStream getXmlByte(String deployId) throws IOException { String xmlName = ""; List<String> names = repositoryService.getDeploymentResourceNames(deployId); for(String name:names){ if(name.endsWith(".xml")){ xmlName = name; } } if(!StringUtils.isBlank(xmlName)){ InputStream xmlStream = repositoryService.getResourceAsStream(deployId, xmlName); return xmlStream; } return null; } @Override public int setDeployGategory(String deployId, String categoryId) { String sql = "update act_re_deployment set category_=? where id_=?"; return DataBaseUtils.update(sql,categoryId,deployId); } }
UTF-8
Java
2,341
java
DeployServiceImpl.java
Java
[]
null
[]
package com.woooqi.bpm.service.bpm.impl; import java.io.IOException; import java.io.InputStream; import java.util.Date; import java.util.List; import org.activiti.engine.RepositoryService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.titan.entity.bpm.bpm.Deployment; import com.titan.service.bpm.DeployService; import com.titan.utils.DataBaseUtils; @Service public class DeployServiceImpl implements DeployService{ @Autowired private RepositoryService repositoryService; @Override public List<Deployment> getAllDeploy(String name) { String sql = "select c.id_,c.name_,c.tenant_id_,c.deploy_time_,c.version_,d.name as category_ from (select b.*,a.version_ from act_re_procdef a,act_re_deployment b where a.deployment_id_(+) = b.id_)c,bpm_category d where c.category_ =d.id(+)"; if(!"".equals(name)){ sql += " and c.name_ like '%"+name+"%'"; } sql+=" order by c.deploy_time_" ; List<Deployment> deployments = DataBaseUtils.queryForListBean(sql, Deployment.class); return deployments; } @Override public InputStream getImageByte(String deployId) throws IOException { String imageName = ""; List<String> names = repositoryService.getDeploymentResourceNames(deployId); for(String name:names){ if(name.endsWith(".png")){ imageName = name; } } if(!StringUtils.isBlank(imageName)){ InputStream imageStream = repositoryService.getResourceAsStream(deployId, imageName); return imageStream; } return null; } @Override public InputStream getXmlByte(String deployId) throws IOException { String xmlName = ""; List<String> names = repositoryService.getDeploymentResourceNames(deployId); for(String name:names){ if(name.endsWith(".xml")){ xmlName = name; } } if(!StringUtils.isBlank(xmlName)){ InputStream xmlStream = repositoryService.getResourceAsStream(deployId, xmlName); return xmlStream; } return null; } @Override public int setDeployGategory(String deployId, String categoryId) { String sql = "update act_re_deployment set category_=? where id_=?"; return DataBaseUtils.update(sql,categoryId,deployId); } }
2,341
0.709953
0.709526
75
30.213333
35.713413
245
false
false
0
0
0
0
0
0
1.653333
false
false
9
033eabd4e3ba27b8106d3c529eb9fa10d708e198
2,954,937,521,920
cad83be8c9acd481e5a00d5cc0dba6a3ea155374
/src/main/java/com/db/homework/service/StudentService.java
a85e31fbbed62f2ffc7297d0ec2094146898d08c
[]
no_license
caciaCC/homework-java
https://github.com/caciaCC/homework-java
7aaa6edf4d431e416e60b92d4eda0cbc5a84ba8c
256ec6db16d7194a06832b980b6655d6ba0bd408
refs/heads/master
2023-03-31T11:29:22.255000
2021-03-23T05:54:52
2021-03-23T05:54:52
344,740,487
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.db.homework.service; import com.db.homework.entity.Student; import java.text.ParseException; import java.util.List; public interface StudentService { //9 Student getBySnoAndPassword(String sno, String password); //9 void updateRegistered(Student studentInDB); //9 void updateCardNo(int id, String cardno); //29 List<Student> getAllStudents(); //30 Student addCardNo(Student student) throws ParseException; //31 Student deleteCardNo(Student student); //32 Student addStudent(Student student); }
UTF-8
Java
565
java
StudentService.java
Java
[]
null
[]
package com.db.homework.service; import com.db.homework.entity.Student; import java.text.ParseException; import java.util.List; public interface StudentService { //9 Student getBySnoAndPassword(String sno, String password); //9 void updateRegistered(Student studentInDB); //9 void updateCardNo(int id, String cardno); //29 List<Student> getAllStudents(); //30 Student addCardNo(Student student) throws ParseException; //31 Student deleteCardNo(Student student); //32 Student addStudent(Student student); }
565
0.715044
0.695575
23
23.565218
19.739225
61
false
false
0
0
0
0
0
0
0.565217
false
false
9
a1a87f8b5301af14fddcd54d35fac761ec3fa9bb
13,623,636,265,916
26421b8fd42ce085824d4746459eb370abc38f25
/611-compress-string-ii/compressstringii.java
644ca7ea61f59550c8aeef244a18e9d94bb58e59
[]
no_license
liulian1004/Laicode
https://github.com/liulian1004/Laicode
ccce3f1eaf4a9549464be6b4066eca3a05c44b62
a3b66b2aa60b45e83b15978dd7974013f0c7dc9e
refs/heads/master
2021-07-26T00:56:22.831000
2021-07-25T02:28:34
2021-07-25T02:28:34
220,113,889
0
2
null
false
2020-06-20T06:27:25
2019-11-07T00:03:48
2020-06-20T02:03:00
2020-06-20T06:27:25
2,916
0
0
0
Java
false
false
public class Solution { public String compress(String input) { // 1. ๅ…ˆไปŽๅทฆๅˆฐๅณ๏ผŒ้™คๅ‡บ็Žฐไธ€ๆฌก็š„ๅญ—ๆฏๅค–๏ผŒ้ƒฝๅ˜ๆˆๅญ—ๆฏ+ๆ•ฐๅญ—,่ฎก็ฎ—ๅ‡บ็Žฐไธ€ไธชๅญ—ๆฏ็š„ๆฌกๆ•ฐ,ๅนถ่ฎก็ฎ—ๅ‡บres array็š„้•ฟๅบฆใ€‚ ie ab2c //2. ๆ‰ฉๅฎน๏ผˆๆˆ–ไบง็”Ÿๆ–ฐ็š„ๆ•ฐ็ป„๏ผ‰ //3.ไปŽๅณๅˆฐๅทฆๆ‰ซๆ๏ผŒ็ขฐๅˆฐๆ•ฐๅญ—็›ดๆŽฅcopy๏ผŒ็ขฐๅˆฐๅญ—ๆฏๅ…ˆๅŠ ไธ€๏ผŒ็„ถๅŽcopyๅญ—ๆฏ- char[] array = input.toCharArray(); int slow = 0; int fast = 0; int newLength = 0; while(fast < array.length){ //for mark the range of repeated letter int begin = fast; // move fast until point to the new letter // no matter whatever, fast will move at least one step while(fast < array.length && array[fast] == array[begin]) { fast++; } //copy the letter to slow from begin and move slow array[slow] = array[begin]; slow++; //check whether it's duplicated //not duplicated if(fast - begin == 1) { //need 2 spaces for new array, letter + number newLength = newLength + 2; } else{ // duplicated happend, calculated how many digitals need to insert //and insert the number int len = copyDigits(array, slow, fast - begin); // slow point move to the next element and wait for the next iteration slow = slow + len; // need len + 1(letter) space for new array newLength = newLength + len + 1; } } //step 2, traversel from right to left char[] res = new char[newLength]; //fast point to the last element and ready to copy,point to array fast = slow - 1; // slow point to the res array and ready to copy //slow = res.length - 1; slow = newLength - 1; while(fast >= 0) { // the fast pointer is digital(API) // ๅฆ‚ๆžœ็ขฐๅˆฐๅญ—ๆฏ๏ผŒiๅ…ˆๅ˜1๏ผŒ i++ // ๅฆ‚ๆžœ็ขฐๅˆฐๆ•ฐๅญ—๏ผŒ็›ดๆŽฅcopyๆ•ฐๅญ—untilend if(Character.isDigit(array[fast])) { // if it's the number while(fast >= 0 && Character.isDigit(array[fast])) { res[slow] = array[fast]; slow--; fast--; } } else {// not number res[slow] = '1'; slow--; } //contiune copy, no matter the pre is number or letter //ไน‹ๅŽcopy ๅญ—ๆฏ res[slow] = array[fast]; slow--; fast--; } return new String(res); } private int copyDigits(char[] array, int index, int count) { int len = 0; for(int i = count; i > 0 ; i = i /10) { //check how many digtal will have and leave the space len++; //slow่ฆ็งปๅŠจ๏ผŒ็ป™ๆทปๅŠ ็š„ๆ•ฐๅญ—ๆตไฝ็ฝฎ index++; } for(int i = count; i > 0; i = i / 10) { // calculate the digital and add int digit = i % 10; //slowๆŒ‡้’ˆๅ›žๅˆฐไน‹ๅ‰็š„ไฝ็ฝฎ๏ผŒ่ฃ…ไธŠๆ•ฐๅญ— index--; // transfer the number to char and copy to array array[index] = (char)('0' + digit); } return len; } }
UTF-8
Java
2,936
java
compressstringii.java
Java
[]
null
[]
public class Solution { public String compress(String input) { // 1. ๅ…ˆไปŽๅทฆๅˆฐๅณ๏ผŒ้™คๅ‡บ็Žฐไธ€ๆฌก็š„ๅญ—ๆฏๅค–๏ผŒ้ƒฝๅ˜ๆˆๅญ—ๆฏ+ๆ•ฐๅญ—,่ฎก็ฎ—ๅ‡บ็Žฐไธ€ไธชๅญ—ๆฏ็š„ๆฌกๆ•ฐ,ๅนถ่ฎก็ฎ—ๅ‡บres array็š„้•ฟๅบฆใ€‚ ie ab2c //2. ๆ‰ฉๅฎน๏ผˆๆˆ–ไบง็”Ÿๆ–ฐ็š„ๆ•ฐ็ป„๏ผ‰ //3.ไปŽๅณๅˆฐๅทฆๆ‰ซๆ๏ผŒ็ขฐๅˆฐๆ•ฐๅญ—็›ดๆŽฅcopy๏ผŒ็ขฐๅˆฐๅญ—ๆฏๅ…ˆๅŠ ไธ€๏ผŒ็„ถๅŽcopyๅญ—ๆฏ- char[] array = input.toCharArray(); int slow = 0; int fast = 0; int newLength = 0; while(fast < array.length){ //for mark the range of repeated letter int begin = fast; // move fast until point to the new letter // no matter whatever, fast will move at least one step while(fast < array.length && array[fast] == array[begin]) { fast++; } //copy the letter to slow from begin and move slow array[slow] = array[begin]; slow++; //check whether it's duplicated //not duplicated if(fast - begin == 1) { //need 2 spaces for new array, letter + number newLength = newLength + 2; } else{ // duplicated happend, calculated how many digitals need to insert //and insert the number int len = copyDigits(array, slow, fast - begin); // slow point move to the next element and wait for the next iteration slow = slow + len; // need len + 1(letter) space for new array newLength = newLength + len + 1; } } //step 2, traversel from right to left char[] res = new char[newLength]; //fast point to the last element and ready to copy,point to array fast = slow - 1; // slow point to the res array and ready to copy //slow = res.length - 1; slow = newLength - 1; while(fast >= 0) { // the fast pointer is digital(API) // ๅฆ‚ๆžœ็ขฐๅˆฐๅญ—ๆฏ๏ผŒiๅ…ˆๅ˜1๏ผŒ i++ // ๅฆ‚ๆžœ็ขฐๅˆฐๆ•ฐๅญ—๏ผŒ็›ดๆŽฅcopyๆ•ฐๅญ—untilend if(Character.isDigit(array[fast])) { // if it's the number while(fast >= 0 && Character.isDigit(array[fast])) { res[slow] = array[fast]; slow--; fast--; } } else {// not number res[slow] = '1'; slow--; } //contiune copy, no matter the pre is number or letter //ไน‹ๅŽcopy ๅญ—ๆฏ res[slow] = array[fast]; slow--; fast--; } return new String(res); } private int copyDigits(char[] array, int index, int count) { int len = 0; for(int i = count; i > 0 ; i = i /10) { //check how many digtal will have and leave the space len++; //slow่ฆ็งปๅŠจ๏ผŒ็ป™ๆทปๅŠ ็š„ๆ•ฐๅญ—ๆตไฝ็ฝฎ index++; } for(int i = count; i > 0; i = i / 10) { // calculate the digital and add int digit = i % 10; //slowๆŒ‡้’ˆๅ›žๅˆฐไน‹ๅ‰็š„ไฝ็ฝฎ๏ผŒ่ฃ…ไธŠๆ•ฐๅญ— index--; // transfer the number to char and copy to array array[index] = (char)('0' + digit); } return len; } }
2,936
0.565819
0.5546
83
31.216867
19.096489
80
false
false
0
0
0
0
0
0
0.578313
false
false
9
5eb0971c8292cfbe51d39da61325b07483de7d75
5,042,291,636,573
d9fd1f8682bf96485a76b7a2c96d6143f05309e2
/src/main/java/com/zh/raback/domain/MaterialEnum.java
a1e656cb4907882f06e3ccb676857966ae5b0260
[]
no_license
zhanghui026/ra-backend
https://github.com/zhanghui026/ra-backend
6d17785bb0996a20e25bb9695134a5d9e97ec256
8f7ab1abe46fe126bc4178950489e4874680c52e
refs/heads/master
2022-07-21T03:01:00.628000
2020-05-27T17:35:23
2020-05-27T17:35:23
252,027,157
0
1
null
false
2022-07-07T18:04:33
2020-04-01T00:03:13
2020-05-27T17:35:34
2022-07-07T18:04:32
2,116
0
0
5
Java
false
false
package com.zh.raback.domain; /** * The MaterialEnum enumeration. */ public enum MaterialEnum { /*ไบš้บปๆฒน็”ปๅธƒ,็บฏๆฃ‰ๆฒน็”ปๅธƒ,ๅŒ–็บค๏ผˆๆถค็บถ๏ผ‰ๆฒน็”ปๅธƒ,ๆฃ‰้บป๏ผˆ55%้บป,45%ๆฃ‰๏ผ‰ๆฒน็”ปๅธƒ๏ผŒๅ…ถไป–ๆ่ดจๆฒน็”ปๅธƒ*/ LINSEED_CANVAS("ไบš้บปๆฒน"), COTTON_CANVAS("็บฏๆฃ‰"), CHEMICAL_FIBER_CANVAS("ๅŒ–็บค"), COTTON_HEMP_CANVAS("ๆฃ‰้บป"), OTHER_MATERIALS_CANVAS("ๅ…ถไป–ๆ่ดจ"); private String desc; MaterialEnum(String desc){ this.desc = desc; } }
UTF-8
Java
498
java
MaterialEnum.java
Java
[]
null
[]
package com.zh.raback.domain; /** * The MaterialEnum enumeration. */ public enum MaterialEnum { /*ไบš้บปๆฒน็”ปๅธƒ,็บฏๆฃ‰ๆฒน็”ปๅธƒ,ๅŒ–็บค๏ผˆๆถค็บถ๏ผ‰ๆฒน็”ปๅธƒ,ๆฃ‰้บป๏ผˆ55%้บป,45%ๆฃ‰๏ผ‰ๆฒน็”ปๅธƒ๏ผŒๅ…ถไป–ๆ่ดจๆฒน็”ปๅธƒ*/ LINSEED_CANVAS("ไบš้บปๆฒน"), COTTON_CANVAS("็บฏๆฃ‰"), CHEMICAL_FIBER_CANVAS("ๅŒ–็บค"), COTTON_HEMP_CANVAS("ๆฃ‰้บป"), OTHER_MATERIALS_CANVAS("ๅ…ถไป–ๆ่ดจ"); private String desc; MaterialEnum(String desc){ this.desc = desc; } }
498
0.6275
0.6175
22
17.181818
15.738304
54
false
false
0
0
0
0
0
0
0.545455
false
false
9
cd07470a0f23ca2ce668287a1e340e914bc75876
29,669,634,137,928
df23b9b56ca2ec1064668f23d49a7bee476be05e
/Lab 4/Lab 4A/gui_exercise01/MyFrame.java
814f21a1f21fc4e6f32d788b6314c03a7c7da920
[]
no_license
CanAvsar/CS102Labs
https://github.com/CanAvsar/CS102Labs
c1a5ebb79a98a5d935a13577a82805d5f4ac2f0e
4bfd7f6286248b55fefa15562672c39cfbcd10f2
refs/heads/main
2023-07-07T06:03:46.726000
2021-08-06T21:03:28
2021-08-06T21:03:28
361,521,721
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.*; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JFrame; /** * * @author * @version */ public class MyFrame extends JFrame { // properties // constructors public MyFrame() { JButton b; MyDrawingPanel p; setSize( 450, 300); setLayout( new FlowLayout() ); //add( new MyPanel() ); //add( new MyPanel() ); add( new MyDrawingPanel() ); p = new MyDrawingPanel(); //p.setLayout( new FlowLayout() ); //p.add( new Label( "Welcome to ONLINE Java") ); // // b = new Button( "Hello"); // p.add( b); // add( new Button( "Time for a break!" ) ); // // p.add( new TextField( 25) ); // add(p); pack(); setVisible( true); } // methods }
UTF-8
Java
852
java
MyFrame.java
Java
[]
null
[]
import java.awt.*; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JFrame; /** * * @author * @version */ public class MyFrame extends JFrame { // properties // constructors public MyFrame() { JButton b; MyDrawingPanel p; setSize( 450, 300); setLayout( new FlowLayout() ); //add( new MyPanel() ); //add( new MyPanel() ); add( new MyDrawingPanel() ); p = new MyDrawingPanel(); //p.setLayout( new FlowLayout() ); //p.add( new Label( "Welcome to ONLINE Java") ); // // b = new Button( "Hello"); // p.add( b); // add( new Button( "Time for a break!" ) ); // // p.add( new TextField( 25) ); // add(p); pack(); setVisible( true); } // methods }
852
0.501174
0.491784
47
17.148935
13.961922
54
false
false
0
0
0
0
0
0
0.468085
false
false
9
5397920ead34073d2b8200bac36910a09f6d41df
23,656,679,882,523
1711a862f62ea1467de16e533d28bc96b0261c75
/src/rockpaperscissors/ComputerGenerator.java
35d173630966869359bbbc7b8cecea36ec93feca
[]
no_license
jediluke1999/RockPaperScissors
https://github.com/jediluke1999/RockPaperScissors
3277a97bf3a4e6d4ba2756515815deb96589b04a
4ec481e261c4537456cbb856a0cf9e43a9e02785
refs/heads/master
2020-06-28T03:03:34.007000
2019-08-02T20:36:29
2019-08-02T20:36:29
200,127,660
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rockpaperscissors; import java.util.Random; public class ComputerGenerator { static Random Generator = new Random(); static int computerPick() { return (Generator.nextInt(3)); } }
UTF-8
Java
200
java
ComputerGenerator.java
Java
[]
null
[]
package rockpaperscissors; import java.util.Random; public class ComputerGenerator { static Random Generator = new Random(); static int computerPick() { return (Generator.nextInt(3)); } }
200
0.73
0.725
12
15.666667
15.129074
40
false
false
0
0
0
0
0
0
1
false
false
9
63a60ed7eee233ff3c0c0a4d900118058aec89dd
31,430,570,673,990
5c021dbb36e273d1f7bbff28983ce6453d7eab1f
/src/main/java/flow/TransfersFlow.java
5ac345769672135d1c76dd7e3a51a914e613a25a
[]
no_license
beteshnik/demo-project-full
https://github.com/beteshnik/demo-project-full
c7ceea2bb271daf1da0b0f70a9201cf4f5137419
73a4fb202cc006d28d7c1c4ec5327d29dd131699
refs/heads/master
2020-09-29T14:45:32.042000
2019-12-10T07:41:49
2019-12-10T07:41:49
227,056,714
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package flow; import common.Assertion; import common.Browser; import org.openqa.selenium.support.PageFactory; import pages.MainPage; import pages.FormPage; import pages.ListPage; import pages.navigationPages.LeftNavigationPage; import pages.navigationPages.ManagementNavigationPage; import pages.organizationsPages.OrganizationViewPage; import pages.transfersPages.TransferRequestCreatePage; import pages.transfersPages.TransferRequestViewPage; import pages.transfersPages.TransferRequestsListPage; import pages.transfersPages.TransferHistoryCreatePage; import pages.transfersPages.TransferHistoryListPage; import pages.transfersPages.RegistrationRequestViewPage; import pages.profilesPages.ProfileViewPage; import pages.WarningPage; import pages.NotificationPage; import parsing.Parser; import java.io.IOException; public class TransfersFlow { private static ProfileViewPage profileViewPage = PageFactory.initElements( Browser.getDriver(), ProfileViewPage.class ); private static OrganizationViewPage organizationViewPage = PageFactory.initElements( Browser.getDriver(), OrganizationViewPage.class ); private static TransferRequestCreatePage transferRequestCreatePage = PageFactory.initElements( Browser.getDriver(), TransferRequestCreatePage.class ); private static TransferRequestViewPage transferRequestViewPage = PageFactory.initElements( Browser.getDriver(), TransferRequestViewPage.class ); private static TransferRequestsListPage transferRequestsListPage = PageFactory.initElements( Browser.getDriver(), TransferRequestsListPage.class ); private static TransferHistoryCreatePage transferHistoryCreatePage = PageFactory.initElements( Browser.getDriver(), TransferHistoryCreatePage.class ); private static TransferHistoryListPage transferHistoryListPage = PageFactory.initElements( Browser.getDriver(), TransferHistoryListPage.class ); private static RegistrationRequestViewPage registrationRequestViewPage = PageFactory.initElements( Browser.getDriver(), RegistrationRequestViewPage.class ); private static NotificationPage notificationPage = PageFactory.initElements( Browser.getDriver(), NotificationPage.class ); private static WarningPage warningPage = PageFactory.initElements( Browser.getDriver(), WarningPage.class ); private static LeftNavigationPage leftNavigationPage = PageFactory.initElements( Browser.getDriver(), LeftNavigationPage.class ); private static ManagementNavigationPage managementNavigationPage = PageFactory.initElements( Browser.getDriver(), ManagementNavigationPage.class ); private static FormPage formPage = PageFactory.initElements( Browser.getDriver(), FormPage.class ); private static ListPage listPage = PageFactory.initElements( Browser.getDriver(), ListPage.class ); public static void clickByOrganizationSecondaryButton(String secondaryButtonName) { organizationViewPage.ensureOrganizationNameLoaded(); organizationViewPage.clickByOrganizationSecondaryButton(secondaryButtonName); } public static void fillTransferRequestFormByRfs(String profileData) throws IOException { transferRequestCreatePage.ensurePageLoaded(); String rfs = Parser.getKeyValueFromJsonFile(profileData, "rfsId"); transferRequestCreatePage.fillRfcField(rfs); } public static void addTransferRequestFile(String filePath) throws IOException { transferRequestCreatePage.ensurePageLoaded(); transferRequestCreatePage.addRequestFile(filePath); } public static void checkAttachedFileVisible(String fileName) { transferRequestCreatePage.checkAttachedFileVisible(fileName); } public static void sendTransferRequestAndAcceptWarning() { transferRequestCreatePage.clickSendRequestButton(); warningPage.ensureWarningLoaded(); warningPage.confirmWarning(); } public static void checkTransferRequestCreatedNotification() { notificationPage.ensureNotificationLoaded(); notificationPage.checkTransferRequestCreatedNotification(); } public static void openIncomingRequests() { leftNavigationPage.ensureControlMenuLoaded(); leftNavigationPage.clickByRequestsSection(); managementNavigationPage.ensureManagementTileElementLoaded(); managementNavigationPage.clickByRequestsLink(); formPage.clickTab("ะ’ั…ะพะดัั‰ะธะต ะทะฐัะฒะปะตะฝะธั"); } public static void openSentRequests() { leftNavigationPage.ensureControlMenuLoaded(); leftNavigationPage.clickByRequestsSection(); managementNavigationPage.ensureManagementTileElementLoaded(); managementNavigationPage.clickByRequestsLink(); formPage.clickTab("ะ˜ัั…ะพะดัั‰ะธะต ะทะฐัะฒะปะตะฝะธั"); } public static void checkTransferRequestDataPage(String status, String sender, String receiver) { MainPage.switchToNewWindow(); transferRequestViewPage.ensurePageLoaded(); String requestDataUI = "ะกั‚ะฐั‚ัƒั: " + transferRequestViewPage.getRequestStatus() + ", ะพั‚ะฟั€ะฐะฒะธั‚ะตะปัŒ: " + transferRequestViewPage.getFederationFrom() + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + transferRequestViewPage.getFederationTo(); String requestDataExpected = "ะกั‚ะฐั‚ัƒั: " + status + ", ะพั‚ะฟั€ะฐะฒะธั‚ะตะปัŒ: " + sender + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + receiver; Assertion.assertEqualWithMessage(requestDataUI,requestDataExpected); } public static void checkTransferRequestDataList(String lastName, String status) { transferRequestsListPage.ensurePageLoaded(); listPage.ensureNameWithStatusPresentInList(lastName,status); } public static void rejectTransferRequest(String rejectReason) { MainPage.switchToNewWindow(); transferRequestViewPage.ensurePageLoaded(); transferRequestViewPage.clickBySecondaryRejectButton(); transferRequestViewPage.fillRejectionReasonField(rejectReason); transferRequestViewPage.clickByPrimaryRejectButton(); } public static void rejectPlayerRequest() { MainPage.switchToNewWindow(); registrationRequestViewPage.ensurePageLoaded(); registrationRequestViewPage.clickBySecondaryDeclineButton(); } public static void approveTransferRequest() { MainPage.switchToNewWindow(); transferRequestViewPage.ensurePageLoaded(); transferRequestViewPage.clickByApproveButton(); } public static void approvePlayerRequest() { MainPage.switchToNewWindow(); registrationRequestViewPage.ensurePageLoaded(); registrationRequestViewPage.clickByApproveButton(); registrationRequestViewPage.fillDocumentNumber(); registrationRequestViewPage.fillDate(); registrationRequestViewPage.clickByApproveButton(); } public static void addTransferHistoryRecord(String action,String clubData, String date) { profileViewPage.ensurePageLoaded(); profileViewPage.clickBarContainerButton("ะคัƒั‚ะฑะพะปะธัั‚"); formPage.clickTab("ะ˜ัั‚ะพั€ะธั ะฟะตั€ะตั…ะพะดะพะฒ"); transferHistoryListPage.ensurePageLoaded(); transferHistoryListPage.clickAddTransferHistoryButton(); transferHistoryCreatePage.ensureCreatePageLoaded(); transferHistoryCreatePage.setAction(action); transferHistoryCreatePage.setTransferDate(date); if(action.equals("ะกะผะตะฝะฐ ัั‚ะฐั‚ัƒัะฐ")) {transferHistoryCreatePage.changeStatus();} transferHistoryCreatePage.setClub(clubData); transferHistoryCreatePage.clickSaveButton(); } public static void editTransferHistoryRecord(String actionFrom, String actionTo, String clubData, String date) { profileViewPage.ensurePageLoaded(); profileViewPage.clickBarContainerButton("ะคัƒั‚ะฑะพะปะธัั‚"); formPage.clickTab("ะ˜ัั‚ะพั€ะธั ะฟะตั€ะตั…ะพะดะพะฒ"); transferHistoryListPage.ensurePageLoaded(); transferHistoryListPage.clickEditRecordButton(actionFrom,clubData); transferHistoryCreatePage.ensureEditPageLoaded(); transferHistoryCreatePage.clearAction(); transferHistoryCreatePage.setAction(actionTo); transferHistoryCreatePage.clearClub(); transferHistoryCreatePage.setClub(clubData); transferHistoryCreatePage.setTransferDate(date); transferHistoryCreatePage.clickUpdateButton(); } public static void discardTransferHistoryRecord(String action,String clubData) { profileViewPage.ensurePageLoaded(); profileViewPage.clickBarContainerButton("ะคัƒั‚ะฑะพะปะธัั‚"); formPage.clickTab("ะ˜ัั‚ะพั€ะธั ะฟะตั€ะตั…ะพะดะพะฒ"); transferHistoryListPage.ensurePageLoaded(); transferHistoryListPage.clickDiscardRecordButton(action,clubData); } public static void checkTransferHistoryRecord(String status,String organization,String date) throws IOException { transferHistoryListPage.ensureRecordListLoaded(); transferHistoryListPage.ensureLastTransferHistoryRecord(status,organization,date); } public static void checkTransferHistoryRecordButtons() { transferHistoryListPage.ensureRecordListLoaded(); transferHistoryListPage.ensureLastRecordEditButtonAvailable(); transferHistoryListPage.ensureLastRecordDeleteButtonAvailable(); } public static void checkNoTransferHistoryRecord(String status) throws IOException { transferHistoryListPage.ensureRecordListLoaded(); transferHistoryListPage.ensureNoTransferHistoryRecord(status); } public static void checkPlayerRequestDataPage(String status, String receiver) { MainPage.switchToNewWindow(); registrationRequestViewPage.ensurePageLoaded(); String requestDataUI = "ะกั‚ะฐั‚ัƒั: " + registrationRequestViewPage.getRequestStatus() + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + registrationRequestViewPage.getReceiver(); String requestDataExpected = "ะกั‚ะฐั‚ัƒั: " + status + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + receiver; Assertion.assertEqualWithMessage(requestDataUI,requestDataExpected); } }
UTF-8
Java
10,312
java
TransfersFlow.java
Java
[]
null
[]
package flow; import common.Assertion; import common.Browser; import org.openqa.selenium.support.PageFactory; import pages.MainPage; import pages.FormPage; import pages.ListPage; import pages.navigationPages.LeftNavigationPage; import pages.navigationPages.ManagementNavigationPage; import pages.organizationsPages.OrganizationViewPage; import pages.transfersPages.TransferRequestCreatePage; import pages.transfersPages.TransferRequestViewPage; import pages.transfersPages.TransferRequestsListPage; import pages.transfersPages.TransferHistoryCreatePage; import pages.transfersPages.TransferHistoryListPage; import pages.transfersPages.RegistrationRequestViewPage; import pages.profilesPages.ProfileViewPage; import pages.WarningPage; import pages.NotificationPage; import parsing.Parser; import java.io.IOException; public class TransfersFlow { private static ProfileViewPage profileViewPage = PageFactory.initElements( Browser.getDriver(), ProfileViewPage.class ); private static OrganizationViewPage organizationViewPage = PageFactory.initElements( Browser.getDriver(), OrganizationViewPage.class ); private static TransferRequestCreatePage transferRequestCreatePage = PageFactory.initElements( Browser.getDriver(), TransferRequestCreatePage.class ); private static TransferRequestViewPage transferRequestViewPage = PageFactory.initElements( Browser.getDriver(), TransferRequestViewPage.class ); private static TransferRequestsListPage transferRequestsListPage = PageFactory.initElements( Browser.getDriver(), TransferRequestsListPage.class ); private static TransferHistoryCreatePage transferHistoryCreatePage = PageFactory.initElements( Browser.getDriver(), TransferHistoryCreatePage.class ); private static TransferHistoryListPage transferHistoryListPage = PageFactory.initElements( Browser.getDriver(), TransferHistoryListPage.class ); private static RegistrationRequestViewPage registrationRequestViewPage = PageFactory.initElements( Browser.getDriver(), RegistrationRequestViewPage.class ); private static NotificationPage notificationPage = PageFactory.initElements( Browser.getDriver(), NotificationPage.class ); private static WarningPage warningPage = PageFactory.initElements( Browser.getDriver(), WarningPage.class ); private static LeftNavigationPage leftNavigationPage = PageFactory.initElements( Browser.getDriver(), LeftNavigationPage.class ); private static ManagementNavigationPage managementNavigationPage = PageFactory.initElements( Browser.getDriver(), ManagementNavigationPage.class ); private static FormPage formPage = PageFactory.initElements( Browser.getDriver(), FormPage.class ); private static ListPage listPage = PageFactory.initElements( Browser.getDriver(), ListPage.class ); public static void clickByOrganizationSecondaryButton(String secondaryButtonName) { organizationViewPage.ensureOrganizationNameLoaded(); organizationViewPage.clickByOrganizationSecondaryButton(secondaryButtonName); } public static void fillTransferRequestFormByRfs(String profileData) throws IOException { transferRequestCreatePage.ensurePageLoaded(); String rfs = Parser.getKeyValueFromJsonFile(profileData, "rfsId"); transferRequestCreatePage.fillRfcField(rfs); } public static void addTransferRequestFile(String filePath) throws IOException { transferRequestCreatePage.ensurePageLoaded(); transferRequestCreatePage.addRequestFile(filePath); } public static void checkAttachedFileVisible(String fileName) { transferRequestCreatePage.checkAttachedFileVisible(fileName); } public static void sendTransferRequestAndAcceptWarning() { transferRequestCreatePage.clickSendRequestButton(); warningPage.ensureWarningLoaded(); warningPage.confirmWarning(); } public static void checkTransferRequestCreatedNotification() { notificationPage.ensureNotificationLoaded(); notificationPage.checkTransferRequestCreatedNotification(); } public static void openIncomingRequests() { leftNavigationPage.ensureControlMenuLoaded(); leftNavigationPage.clickByRequestsSection(); managementNavigationPage.ensureManagementTileElementLoaded(); managementNavigationPage.clickByRequestsLink(); formPage.clickTab("ะ’ั…ะพะดัั‰ะธะต ะทะฐัะฒะปะตะฝะธั"); } public static void openSentRequests() { leftNavigationPage.ensureControlMenuLoaded(); leftNavigationPage.clickByRequestsSection(); managementNavigationPage.ensureManagementTileElementLoaded(); managementNavigationPage.clickByRequestsLink(); formPage.clickTab("ะ˜ัั…ะพะดัั‰ะธะต ะทะฐัะฒะปะตะฝะธั"); } public static void checkTransferRequestDataPage(String status, String sender, String receiver) { MainPage.switchToNewWindow(); transferRequestViewPage.ensurePageLoaded(); String requestDataUI = "ะกั‚ะฐั‚ัƒั: " + transferRequestViewPage.getRequestStatus() + ", ะพั‚ะฟั€ะฐะฒะธั‚ะตะปัŒ: " + transferRequestViewPage.getFederationFrom() + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + transferRequestViewPage.getFederationTo(); String requestDataExpected = "ะกั‚ะฐั‚ัƒั: " + status + ", ะพั‚ะฟั€ะฐะฒะธั‚ะตะปัŒ: " + sender + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + receiver; Assertion.assertEqualWithMessage(requestDataUI,requestDataExpected); } public static void checkTransferRequestDataList(String lastName, String status) { transferRequestsListPage.ensurePageLoaded(); listPage.ensureNameWithStatusPresentInList(lastName,status); } public static void rejectTransferRequest(String rejectReason) { MainPage.switchToNewWindow(); transferRequestViewPage.ensurePageLoaded(); transferRequestViewPage.clickBySecondaryRejectButton(); transferRequestViewPage.fillRejectionReasonField(rejectReason); transferRequestViewPage.clickByPrimaryRejectButton(); } public static void rejectPlayerRequest() { MainPage.switchToNewWindow(); registrationRequestViewPage.ensurePageLoaded(); registrationRequestViewPage.clickBySecondaryDeclineButton(); } public static void approveTransferRequest() { MainPage.switchToNewWindow(); transferRequestViewPage.ensurePageLoaded(); transferRequestViewPage.clickByApproveButton(); } public static void approvePlayerRequest() { MainPage.switchToNewWindow(); registrationRequestViewPage.ensurePageLoaded(); registrationRequestViewPage.clickByApproveButton(); registrationRequestViewPage.fillDocumentNumber(); registrationRequestViewPage.fillDate(); registrationRequestViewPage.clickByApproveButton(); } public static void addTransferHistoryRecord(String action,String clubData, String date) { profileViewPage.ensurePageLoaded(); profileViewPage.clickBarContainerButton("ะคัƒั‚ะฑะพะปะธัั‚"); formPage.clickTab("ะ˜ัั‚ะพั€ะธั ะฟะตั€ะตั…ะพะดะพะฒ"); transferHistoryListPage.ensurePageLoaded(); transferHistoryListPage.clickAddTransferHistoryButton(); transferHistoryCreatePage.ensureCreatePageLoaded(); transferHistoryCreatePage.setAction(action); transferHistoryCreatePage.setTransferDate(date); if(action.equals("ะกะผะตะฝะฐ ัั‚ะฐั‚ัƒัะฐ")) {transferHistoryCreatePage.changeStatus();} transferHistoryCreatePage.setClub(clubData); transferHistoryCreatePage.clickSaveButton(); } public static void editTransferHistoryRecord(String actionFrom, String actionTo, String clubData, String date) { profileViewPage.ensurePageLoaded(); profileViewPage.clickBarContainerButton("ะคัƒั‚ะฑะพะปะธัั‚"); formPage.clickTab("ะ˜ัั‚ะพั€ะธั ะฟะตั€ะตั…ะพะดะพะฒ"); transferHistoryListPage.ensurePageLoaded(); transferHistoryListPage.clickEditRecordButton(actionFrom,clubData); transferHistoryCreatePage.ensureEditPageLoaded(); transferHistoryCreatePage.clearAction(); transferHistoryCreatePage.setAction(actionTo); transferHistoryCreatePage.clearClub(); transferHistoryCreatePage.setClub(clubData); transferHistoryCreatePage.setTransferDate(date); transferHistoryCreatePage.clickUpdateButton(); } public static void discardTransferHistoryRecord(String action,String clubData) { profileViewPage.ensurePageLoaded(); profileViewPage.clickBarContainerButton("ะคัƒั‚ะฑะพะปะธัั‚"); formPage.clickTab("ะ˜ัั‚ะพั€ะธั ะฟะตั€ะตั…ะพะดะพะฒ"); transferHistoryListPage.ensurePageLoaded(); transferHistoryListPage.clickDiscardRecordButton(action,clubData); } public static void checkTransferHistoryRecord(String status,String organization,String date) throws IOException { transferHistoryListPage.ensureRecordListLoaded(); transferHistoryListPage.ensureLastTransferHistoryRecord(status,organization,date); } public static void checkTransferHistoryRecordButtons() { transferHistoryListPage.ensureRecordListLoaded(); transferHistoryListPage.ensureLastRecordEditButtonAvailable(); transferHistoryListPage.ensureLastRecordDeleteButtonAvailable(); } public static void checkNoTransferHistoryRecord(String status) throws IOException { transferHistoryListPage.ensureRecordListLoaded(); transferHistoryListPage.ensureNoTransferHistoryRecord(status); } public static void checkPlayerRequestDataPage(String status, String receiver) { MainPage.switchToNewWindow(); registrationRequestViewPage.ensurePageLoaded(); String requestDataUI = "ะกั‚ะฐั‚ัƒั: " + registrationRequestViewPage.getRequestStatus() + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + registrationRequestViewPage.getReceiver(); String requestDataExpected = "ะกั‚ะฐั‚ัƒั: " + status + ", ะฟะพะปัƒั‡ะฐั‚ะตะปัŒ: " + receiver; Assertion.assertEqualWithMessage(requestDataUI,requestDataExpected); } }
10,312
0.760689
0.760689
234
42.183762
33.96423
216
false
false
0
0
0
0
0
0
0.692308
false
false
9
8be3437b31c64e0e9f335549ede2b33a6937427e
3,994,319,612,357
0135a6fad5d3cb142b485bb8a9afec86cb51d113
/src/projectCoronaHospital/main.java
26270fc9d72eeb2efbaa6777980558ea0e85905a
[ "MIT" ]
permissive
lee0507/projectCoronaHospital
https://github.com/lee0507/projectCoronaHospital
723742535641468227acdb04a0eccef36979f784
fc1e8e592520ba323713a1cce8b0797805d38eac
refs/heads/main
2023-04-30T14:14:08.167000
2021-04-29T04:43:51
2021-04-29T04:43:51
362,690,114
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package projectCoronaHospital; import java.io.IOException; import java.util.ArrayList; public class main { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub GetDataClass gd = new GetDataClass(); while(true) { String yc = gd.getCity(gd.getData()); String yc1 = gd.getDist(gd.getData(), yc); gd.getHosp(gd.getData(), yc, yc1); } } }
UTF-8
Java
409
java
main.java
Java
[]
null
[]
package projectCoronaHospital; import java.io.IOException; import java.util.ArrayList; public class main { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub GetDataClass gd = new GetDataClass(); while(true) { String yc = gd.getCity(gd.getData()); String yc1 = gd.getDist(gd.getData(), yc); gd.getHosp(gd.getData(), yc, yc1); } } }
409
0.682152
0.677262
19
20.473684
18.400139
60
false
false
0
0
0
0
0
0
1.947368
false
false
9
3caeff365eebf9206f450ae5e50df58f06d87a14
32,804,960,251,749
0b1cafd9fad260acac7008161c9aacb7fcdd5fea
/mario_java/src/Mario.java
3d106183b2490abd186eb2e7c7343279758c4bc9
[]
no_license
ManuelSerna/mario_game
https://github.com/ManuelSerna/mario_game
a4e65a1e38f5c32dc9984717de5cdb7ae0a40acd
24381b57a195261a329399d59d4a5de4c7c6ff7d
refs/heads/master
2020-04-20T04:16:07.816000
2020-01-10T23:20:12
2020-01-10T23:20:12
168,622,637
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.*; import java.util.ArrayList; class Mario extends Sprite { // Animation frames for drawing Mario // Note: adjust when modifying image array indexes private final int STILL_FRAME = 1; private final int RIGHT_FRAME1 = STILL_FRAME + 1; private final int RIGHT_FRAME2 = RIGHT_FRAME1 + 1; private final int LEFT_FRAME1 = RIGHT_FRAME2 + 1; private final int LEFT_FRAME2 = LEFT_FRAME1 + 1; private final double Y_DOWN_ACCEL = 2.2;// downward acceleration, 1.2 works private final int SCREEN_HEIGHT = 650; boolean goingRight;// is Mario going right? private int rightCounter;// count frames going right boolean goingLeft;// is Mario going left? private int leftCounter;// count frames going left // Get sprite list from Model to check for collisions private ArrayList<Sprite> modelSprites; //================================================================================================================= // Mario coordinate and JSON constructors //================================================================================================================= Mario(int startXPos, int startYPos, int spriteWidth, int spriteHeight, ArrayList<Sprite> inputList) { super(startXPos, startYPos, spriteWidth, spriteHeight); // Reference sprite list in model so we can check for all sprites when updating, makes update more clean this.modelSprites = inputList; this.goingRight = false; this.goingLeft = false; } Mario(Json j, ArrayList<Sprite> inputList) { super(j); // Reference sprite list in model so we can check for all sprites when updating, makes update more clean this.modelSprites = inputList; this.goingRight = false; this.goingLeft = false; } //================================================================================================================= // Check sprite type //================================================================================================================= @Override public boolean isMario() { return true; } //================================================================================================================= // Update Mario physics //================================================================================================================= @Override void update() { //------------------------------------------------------------------------------------------------------------- // Mario jumping mechanic //------------------------------------------------------------------------------------------------------------- this.yVelocity += Y_DOWN_ACCEL; this.y += yVelocity; // If sprite hits the ground, draw sprite above it (update y coord) if(this.y >= SCREEN_HEIGHT-127-h) { this.jumpFrames = 0;// reset counter when hitting the ground this.yVelocity = 0.0;// stop on the ground this.y = SCREEN_HEIGHT-127-h;// adjust Mario coords } this.jumpFrames++;// keep counting to get jump velocity //------------------------------------------------------------------------------------------------------------- // Mario collides with: Brick or coin block //------------------------------------------------------------------------------------------------------------- for(int i = 0; i < modelSprites.size(); i++) { Sprite s = modelSprites.get(i); if((s.isBrick() || s.isCoinBlock()) && collision(s)) { // Mark the target coin block as hit, only want one block to spit out coins at a time if(s.isCoinBlock()) { s.isHit = true; } getOutOfSprite(s); } else { Sprite.scrollSpeed = Sprite.SCROLL_CONST; s.isHit = false; } } } //================================================================================================================= // Draw Mario: animate Mario's movement according to direction //================================================================================================================= @Override void draw(Graphics g) { if(this.isMario()) { // Move horizontally RIGHT if (goingRight) { if (rightCounter % 9 == 0) { animationFrame = RIGHT_FRAME1; } else if (rightCounter % 9 == 4) { animationFrame = RIGHT_FRAME2; } g.drawImage(images[animationFrame], this.x, this.y, null); rightCounter++; } // Move horizontally LEFT else if (goingLeft) { if (leftCounter % 9 == 0) { animationFrame = LEFT_FRAME1; } else if (leftCounter % 9 == 4) { animationFrame = LEFT_FRAME2; } g.drawImage(images[animationFrame], this.x, this.y, null); leftCounter++; } // Remain STILL else { // Reset counters, and display idle Mario frame rightCounter = 0; leftCounter = 0; g.drawImage(images[STILL_FRAME], this.x, this.y, null); } } } }
UTF-8
Java
5,599
java
Mario.java
Java
[]
null
[]
import java.awt.*; import java.util.ArrayList; class Mario extends Sprite { // Animation frames for drawing Mario // Note: adjust when modifying image array indexes private final int STILL_FRAME = 1; private final int RIGHT_FRAME1 = STILL_FRAME + 1; private final int RIGHT_FRAME2 = RIGHT_FRAME1 + 1; private final int LEFT_FRAME1 = RIGHT_FRAME2 + 1; private final int LEFT_FRAME2 = LEFT_FRAME1 + 1; private final double Y_DOWN_ACCEL = 2.2;// downward acceleration, 1.2 works private final int SCREEN_HEIGHT = 650; boolean goingRight;// is Mario going right? private int rightCounter;// count frames going right boolean goingLeft;// is Mario going left? private int leftCounter;// count frames going left // Get sprite list from Model to check for collisions private ArrayList<Sprite> modelSprites; //================================================================================================================= // Mario coordinate and JSON constructors //================================================================================================================= Mario(int startXPos, int startYPos, int spriteWidth, int spriteHeight, ArrayList<Sprite> inputList) { super(startXPos, startYPos, spriteWidth, spriteHeight); // Reference sprite list in model so we can check for all sprites when updating, makes update more clean this.modelSprites = inputList; this.goingRight = false; this.goingLeft = false; } Mario(Json j, ArrayList<Sprite> inputList) { super(j); // Reference sprite list in model so we can check for all sprites when updating, makes update more clean this.modelSprites = inputList; this.goingRight = false; this.goingLeft = false; } //================================================================================================================= // Check sprite type //================================================================================================================= @Override public boolean isMario() { return true; } //================================================================================================================= // Update Mario physics //================================================================================================================= @Override void update() { //------------------------------------------------------------------------------------------------------------- // Mario jumping mechanic //------------------------------------------------------------------------------------------------------------- this.yVelocity += Y_DOWN_ACCEL; this.y += yVelocity; // If sprite hits the ground, draw sprite above it (update y coord) if(this.y >= SCREEN_HEIGHT-127-h) { this.jumpFrames = 0;// reset counter when hitting the ground this.yVelocity = 0.0;// stop on the ground this.y = SCREEN_HEIGHT-127-h;// adjust Mario coords } this.jumpFrames++;// keep counting to get jump velocity //------------------------------------------------------------------------------------------------------------- // Mario collides with: Brick or coin block //------------------------------------------------------------------------------------------------------------- for(int i = 0; i < modelSprites.size(); i++) { Sprite s = modelSprites.get(i); if((s.isBrick() || s.isCoinBlock()) && collision(s)) { // Mark the target coin block as hit, only want one block to spit out coins at a time if(s.isCoinBlock()) { s.isHit = true; } getOutOfSprite(s); } else { Sprite.scrollSpeed = Sprite.SCROLL_CONST; s.isHit = false; } } } //================================================================================================================= // Draw Mario: animate Mario's movement according to direction //================================================================================================================= @Override void draw(Graphics g) { if(this.isMario()) { // Move horizontally RIGHT if (goingRight) { if (rightCounter % 9 == 0) { animationFrame = RIGHT_FRAME1; } else if (rightCounter % 9 == 4) { animationFrame = RIGHT_FRAME2; } g.drawImage(images[animationFrame], this.x, this.y, null); rightCounter++; } // Move horizontally LEFT else if (goingLeft) { if (leftCounter % 9 == 0) { animationFrame = LEFT_FRAME1; } else if (leftCounter % 9 == 4) { animationFrame = LEFT_FRAME2; } g.drawImage(images[animationFrame], this.x, this.y, null); leftCounter++; } // Remain STILL else { // Reset counters, and display idle Mario frame rightCounter = 0; leftCounter = 0; g.drawImage(images[STILL_FRAME], this.x, this.y, null); } } } }
5,599
0.411323
0.403644
145
37.620689
34.574272
119
false
false
0
0
0
0
116
0.165744
0.496552
false
false
9
346483538795f4bc01c399f5cd2318c5b48a8d48
15,702,400,476,128
34bd2417b2ce3759249fd484da8e72405ce2a92b
/src/test/java/jeux/quarto/PlateauQuartoTest.java
2c06f0c1da76fa8dd447acbbd0abc8fed79b6f2a
[]
no_license
Synophride/Projet-apprentissage-L3
https://github.com/Synophride/Projet-apprentissage-L3
cffecc632e7d57cc2af850d42e8ef83c7910c6b4
27cc2a2679993f429c2d8c2fea16e97f8905d9a6
refs/heads/master
2021-04-09T10:46:13.869000
2018-04-23T15:28:30
2018-04-23T15:28:30
125,495,022
0
0
null
false
2020-10-13T17:32:54
2018-03-16T09:34:04
2019-11-18T14:07:21
2020-10-13T17:32:53
1,304
0
0
1
Java
false
false
package jeux.quarto; import iia.jeux.modele.joueur.Joueur; import static org.junit.Assert.*; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class PlateauQuartoTest { PlateauQuarto plateau_depart = new PlateauQuarto(new Joueur("blanc"), new Joueur("noir")); PlateauQuarto plateau_final; // Syntaxe des piรจces ("en commenรงant par les bits de poids fort=" // b/r -> bleu , rouge. resp. 1 et 0 en notation binaire. // g/p -> grand, petit. resp. 1 et 0 // p/t -> plein, trouรฉ. Resp. 1 et 0 // c/r -> carrรฉ, rond . Resp. 1 et 0 @Before public void init() { } @Test public void testPlateauQuarto() { } @Test public void testCoupValide() { } @Test public void testPieceToString() { } @Test public void testEstMoveValide() { } @Test public void testEstChoixValide() { } @Test public void testFinDePartie() { } @Test public void testPointsCommuns() { Assert.assertEquals(plateau_depart.points_communs((byte) 0x01, (byte) 0x0E), 0); Assert.assertEquals(plateau_depart.points_communs((byte) 0x02, (byte) 0x0E), 3); Assert.assertEquals(plateau_depart.points_communs((byte) 0x0F, (byte) 0x0F), 0x0F); } }
UTF-8
Java
1,301
java
PlateauQuartoTest.java
Java
[]
null
[]
package jeux.quarto; import iia.jeux.modele.joueur.Joueur; import static org.junit.Assert.*; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class PlateauQuartoTest { PlateauQuarto plateau_depart = new PlateauQuarto(new Joueur("blanc"), new Joueur("noir")); PlateauQuarto plateau_final; // Syntaxe des piรจces ("en commenรงant par les bits de poids fort=" // b/r -> bleu , rouge. resp. 1 et 0 en notation binaire. // g/p -> grand, petit. resp. 1 et 0 // p/t -> plein, trouรฉ. Resp. 1 et 0 // c/r -> carrรฉ, rond . Resp. 1 et 0 @Before public void init() { } @Test public void testPlateauQuarto() { } @Test public void testCoupValide() { } @Test public void testPieceToString() { } @Test public void testEstMoveValide() { } @Test public void testEstChoixValide() { } @Test public void testFinDePartie() { } @Test public void testPointsCommuns() { Assert.assertEquals(plateau_depart.points_communs((byte) 0x01, (byte) 0x0E), 0); Assert.assertEquals(plateau_depart.points_communs((byte) 0x02, (byte) 0x0E), 3); Assert.assertEquals(plateau_depart.points_communs((byte) 0x0F, (byte) 0x0F), 0x0F); } }
1,301
0.629915
0.609869
55
22.581818
24.7876
94
false
false
0
0
0
0
0
0
0.472727
false
false
9
b7bd9bab7bb9979822e19e35af854773b93dfab6
13,795,435,019,264
4b3487192a657e36df2d4e35a4927e3cfd1f287d
/server/oms/elf.server.trading.query/src/main/java/elf/server/trading/query/position/margintrading/cashasset/CashAssetsResult.java
4820e835ee1c266803bb39e0d7f0dc3f94626783
[ "BSD-3-Clause" ]
permissive
thoslin/ELF
https://github.com/thoslin/ELF
3fd9c6dcf84a069c457bc5b8f786f0f039e22385
c4199d156ce70d1b914bdc389190d047e59486e1
refs/heads/master
2017-03-22T10:00:26.195000
2014-04-17T10:35:37
2014-04-17T10:35:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package elf.server.trading.query.position.margintrading.cashasset; import java.math.BigDecimal; public class CashAssetsResult { private BigDecimal creditPositionAmount; private BigDecimal positionAmount; private BigDecimal availableAmount; private BigDecimal creditAvailableAmount; private BigDecimal marginAmountInprogress; public BigDecimal getCreditPositionAmount() { return creditPositionAmount; } public void setCreditPositionAmount(BigDecimal creditPositionBalance) { this.creditPositionAmount = creditPositionBalance; } public BigDecimal getPositionAmount() { return positionAmount; } public void setPositionAmount(BigDecimal positionBalance) { this.positionAmount = positionBalance; } public BigDecimal getAvailableAmount() { return availableAmount; } public void setAvailableAmount(BigDecimal availableBalance) { this.availableAmount = availableBalance; } public BigDecimal getCreditAvailableAmount() { return creditAvailableAmount; } public void setCreditAvailableAmount(BigDecimal creditAvailableBalance) { this.creditAvailableAmount = creditAvailableBalance; } public BigDecimal getMarginAmountInprogress() { return marginAmountInprogress; } public void setMarginAmountInprogress(BigDecimal marginAmountInprogress) { this.marginAmountInprogress = marginAmountInprogress; } }
UTF-8
Java
1,407
java
CashAssetsResult.java
Java
[]
null
[]
package elf.server.trading.query.position.margintrading.cashasset; import java.math.BigDecimal; public class CashAssetsResult { private BigDecimal creditPositionAmount; private BigDecimal positionAmount; private BigDecimal availableAmount; private BigDecimal creditAvailableAmount; private BigDecimal marginAmountInprogress; public BigDecimal getCreditPositionAmount() { return creditPositionAmount; } public void setCreditPositionAmount(BigDecimal creditPositionBalance) { this.creditPositionAmount = creditPositionBalance; } public BigDecimal getPositionAmount() { return positionAmount; } public void setPositionAmount(BigDecimal positionBalance) { this.positionAmount = positionBalance; } public BigDecimal getAvailableAmount() { return availableAmount; } public void setAvailableAmount(BigDecimal availableBalance) { this.availableAmount = availableBalance; } public BigDecimal getCreditAvailableAmount() { return creditAvailableAmount; } public void setCreditAvailableAmount(BigDecimal creditAvailableBalance) { this.creditAvailableAmount = creditAvailableBalance; } public BigDecimal getMarginAmountInprogress() { return marginAmountInprogress; } public void setMarginAmountInprogress(BigDecimal marginAmountInprogress) { this.marginAmountInprogress = marginAmountInprogress; } }
1,407
0.78607
0.78607
57
22.68421
24.552242
75
false
false
0
0
0
0
0
0
1.087719
false
false
9