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
cd36d4de4cc6b4b84fc8a6d6c3cee856074e332e
35,115,652,636,438
965a9f84a547091f6ed09ae7e092997a47397c73
/src/main/java/com/zking/ssm/kxj/service/IHousebasichireinfoService.java
65be48a967d50156e82673e1b391b45fa1a8b639
[]
no_license
XIEAHAO/ssm
https://github.com/XIEAHAO/ssm
91a3802b774ceb4d9b68d9b7b5d33e9a0844973a
7d69ed19cf06d21c5ceeaf15ce7a132aea99e523
refs/heads/master
2023-02-07T23:51:49.038000
2020-12-31T00:45:14
2020-12-31T00:45:14
323,043,054
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zking.ssm.kxj.service; import com.zking.ssm.kxj.model.Housebasichireinfo; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @author kxj * @createย  2020-12-23 15:11 */ @Transactional public interface IHousebasichireinfoService { int deleteByPrimaryKey(Integer infoId); int insert(Housebasichireinfo record); int insertSelective(Housebasichireinfo record); @Transactional(readOnly = true) Housebasichireinfo selectByPrimaryKey(Integer infoId); int updateByPrimaryKeySelective(Housebasichireinfo record); int updateByPrimaryKey(Housebasichireinfo record); @Transactional(readOnly = true) List query(Housebasichireinfo record); }
UTF-8
Java
729
java
IHousebasichireinfoService.java
Java
[ { "context": "sactional;\n\nimport java.util.List;\n\n/**\n * @author kxj\n * @createย  2020-12-23 15:11\n */\n@Transactional\np", "end": 195, "score": 0.9996546506881714, "start": 192, "tag": "USERNAME", "value": "kxj" } ]
null
[]
package com.zking.ssm.kxj.service; import com.zking.ssm.kxj.model.Housebasichireinfo; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @author kxj * @createย  2020-12-23 15:11 */ @Transactional public interface IHousebasichireinfoService { int deleteByPrimaryKey(Integer infoId); int insert(Housebasichireinfo record); int insertSelective(Housebasichireinfo record); @Transactional(readOnly = true) Housebasichireinfo selectByPrimaryKey(Integer infoId); int updateByPrimaryKeySelective(Housebasichireinfo record); int updateByPrimaryKey(Housebasichireinfo record); @Transactional(readOnly = true) List query(Housebasichireinfo record); }
729
0.78022
0.763736
27
25.962963
22.716419
64
false
false
0
0
0
0
0
0
0.407407
false
false
5
dda47952c8eb51be6978afdafa8918977d93b412
27,565,100,151,193
d647217d4a810dd041d4b48610d38b9a71031ad9
/lang_java/src/baekjoon/Baekjoon_12904.java
3052bf889c2b007d7ee89e161985f4d6fb50d888
[]
no_license
jiwoo-shin/Algorithm
https://github.com/jiwoo-shin/Algorithm
86d2e15be123531008a39e41a0af24218c392aca
272d97756d777368856a9e68ea68b8472b1a8a53
refs/heads/master
2021-12-26T04:38:26.626000
2021-10-26T12:44:46
2021-10-26T12:44:46
165,377,729
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package baekjoon; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import common.Solution; public class Baekjoon_12904 extends Solution { @Override public void solution() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder S = new StringBuilder(br.readLine()); StringBuilder T = new StringBuilder(br.readLine()); int tLength = T.length(); int sLength = S.length(); int answer = 0; // T๋ฅผ S๊ธธ์ด๋กœ ๋ณ€๊ฒฝํ•œ๋‹ค. ๋’ค์—์„œ๋งŒ ์•ŒํŒŒ๋ฒณ์„ ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ๋’ค์— ์˜ค๋Š” ์•ŒํŒŒ๋ฒณ์— ๋”ฐ๋ผ T๋ฅผ ๋’ค์ง‘์–ด์•ผ ํ•˜๋Š”์ง€, ์œ ์ง€ํ•˜๊ณ  ์ œ๊ฑฐํ•˜๋ฉด ๋˜๋Š”์ง€๊ฐ€ ์ •ํ•ด์ ธ์žˆ์Œ for(int i = tLength-1; i > sLength-1; i--) { // i๋Š” t์˜ ๊ธธ์ด๋ณด๋‹ค ํ•˜๋‚˜ ์ž‘์œผ๋ฏ€๋กœ i(=๋ณ€๊ฒฝ ํ›„ tLength-1) > sLength-1 char tmp = T.charAt(i); // ์ถ”๊ฐ€ํ•  ๋•Œ ๋’ค์ง‘์€ ํ›„ ์ถ”๊ฐ€์ด๋ฏ€๋กœ ๋ฐ˜๋Œ€๋กœ ์ œ๊ฑฐํ•  ๋•Œ์—๋Š” ์ œ๊ฑฐ ํ›„ ๋’ค์ง‘์–ด์•ผํ•จ T = T.delete(i, tLength); if(tmp == 'B') { T = T.reverse(); } } // S์™€ T๊ฐ€ ๊ฐ™์€์ง€ ๋น„๊ต if(S.toString().equals(T.toString())) answer = 1; System.out.println(answer); } }
UHC
Java
1,195
java
Baekjoon_12904.java
Java
[]
null
[]
package baekjoon; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import common.Solution; public class Baekjoon_12904 extends Solution { @Override public void solution() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder S = new StringBuilder(br.readLine()); StringBuilder T = new StringBuilder(br.readLine()); int tLength = T.length(); int sLength = S.length(); int answer = 0; // T๋ฅผ S๊ธธ์ด๋กœ ๋ณ€๊ฒฝํ•œ๋‹ค. ๋’ค์—์„œ๋งŒ ์•ŒํŒŒ๋ฒณ์„ ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ๋’ค์— ์˜ค๋Š” ์•ŒํŒŒ๋ฒณ์— ๋”ฐ๋ผ T๋ฅผ ๋’ค์ง‘์–ด์•ผ ํ•˜๋Š”์ง€, ์œ ์ง€ํ•˜๊ณ  ์ œ๊ฑฐํ•˜๋ฉด ๋˜๋Š”์ง€๊ฐ€ ์ •ํ•ด์ ธ์žˆ์Œ for(int i = tLength-1; i > sLength-1; i--) { // i๋Š” t์˜ ๊ธธ์ด๋ณด๋‹ค ํ•˜๋‚˜ ์ž‘์œผ๋ฏ€๋กœ i(=๋ณ€๊ฒฝ ํ›„ tLength-1) > sLength-1 char tmp = T.charAt(i); // ์ถ”๊ฐ€ํ•  ๋•Œ ๋’ค์ง‘์€ ํ›„ ์ถ”๊ฐ€์ด๋ฏ€๋กœ ๋ฐ˜๋Œ€๋กœ ์ œ๊ฑฐํ•  ๋•Œ์—๋Š” ์ œ๊ฑฐ ํ›„ ๋’ค์ง‘์–ด์•ผํ•จ T = T.delete(i, tLength); if(tmp == 'B') { T = T.reverse(); } } // S์™€ T๊ฐ€ ๊ฐ™์€์ง€ ๋น„๊ต if(S.toString().equals(T.toString())) answer = 1; System.out.println(answer); } }
1,195
0.658787
0.647482
42
22.190475
24.640499
99
false
false
0
0
0
0
0
0
2
false
false
5
c46b44df1144fe33980137986235283142221bd3
6,021,544,188,744
9a6f418bca6e0df29ced3c804b2212fdb5fe0d2f
/LegendsOfAndor/Client/src/Time.java
6d0a935021efa4bd5130624f03a888bf99f143db
[]
no_license
DongMZ1/JavaProject
https://github.com/DongMZ1/JavaProject
ca733cd30b5e70ef67470c2c427c9ef3ed8903d5
d4bef3b55089a198290487acf45101209da05067
refs/heads/master
2023-03-04T13:47:44.310000
2020-04-30T17:51:11
2020-04-30T17:51:11
337,876,207
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.Serializable; public class Time implements Serializable{ /** * */ private static final long serialVersionUID = -2177194751906316579L; public int time; public int x; public int y; public Time() { time = 0; x = 6020; y = 240; } public void advance() { if(time >= 7) { time++; x+= 650; Client.getMainHero().wp = Client.getMainHero().wp -2; }else { time++; x += 550; } } public int getTime() { return this.time; } public void reset() { time = 0; x = 6020; y = 240; } }
UTF-8
Java
579
java
Time.java
Java
[]
null
[]
import java.io.Serializable; public class Time implements Serializable{ /** * */ private static final long serialVersionUID = -2177194751906316579L; public int time; public int x; public int y; public Time() { time = 0; x = 6020; y = 240; } public void advance() { if(time >= 7) { time++; x+= 650; Client.getMainHero().wp = Client.getMainHero().wp -2; }else { time++; x += 550; } } public int getTime() { return this.time; } public void reset() { time = 0; x = 6020; y = 240; } }
579
0.549223
0.474957
39
12.846154
14.599856
68
false
false
0
0
0
0
0
0
1.74359
false
false
5
fec2f8fed70907c079dd795cbdb66b851231f8e8
29,429,115,949,910
448a7f3a1ec5d76ee47b97f343a5437c1d670eb9
/src/test/java/de/tuberlin/av/openteagle/api/TestOpenTeagleAPI.java
ebe162b00779bee7c38a52e932ab28af00bcc281
[]
no_license
tubav/OpenTeagle_API
https://github.com/tubav/OpenTeagle_API
80d5656c95bdfc7f987bb1b6ab8729d99131047a
a0da7e295b02f1a5cc7e1a42436b6d58fd7a0800
refs/heads/master
2021-01-13T02:31:59.370000
2012-07-02T07:13:27
2012-07-02T07:13:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.tuberlin.av.openteagle.api; import java.math.BigInteger; import java.util.List; import junit.framework.Assert; import org.junit.Test; import de.tuberlin.av.openteagle.model.vct.jaxb.Description; import de.tuberlin.av.openteagle.model.vct.jaxb.User; import de.tuberlin.av.openteagle.model.vct.jaxb.Vct; import de.tuberlin.av.openteagle.model.vct.jaxb.VctInstance; import de.tuberlin.av.openteagle.utils.TeagleProperties; public class TestOpenTeagleAPI { private final OpenTeagleAPI openteagle = new OpenTeagleAPI( TeagleProperties.getRepoUrl()); @Test public void testGetListOfVCTs() { final int expected = 3; final int numberOfVCTs = this.openteagle.getNumberOfVCTs(); Assert.assertEquals(expected, numberOfVCTs); } @Test public void testListOfVCTs() { boolean found = false; final String expected = "1"; final List<Vct> listOfVCTs = this.openteagle.getListOfVCTs(); for (Vct vct : listOfVCTs) { if (vct.getId().toString().equals(expected)) found = true; } Assert.assertTrue(found); } @Test public void testCreateEmptyVCT() { VctInstance requestedVCT = new VctInstance(); requestedVCT.setCommonName("my new vct via API"); requestedVCT.setShared(false); requestedVCT.setStateId(BigInteger.ONE); requestedVCT.setDescription(""); requestedVCT.setUser("1"); String result = this.openteagle.createVct(requestedVCT); Assert.assertEquals("", result); } }
UTF-8
Java
1,423
java
TestOpenTeagleAPI.java
Java
[]
null
[]
package de.tuberlin.av.openteagle.api; import java.math.BigInteger; import java.util.List; import junit.framework.Assert; import org.junit.Test; import de.tuberlin.av.openteagle.model.vct.jaxb.Description; import de.tuberlin.av.openteagle.model.vct.jaxb.User; import de.tuberlin.av.openteagle.model.vct.jaxb.Vct; import de.tuberlin.av.openteagle.model.vct.jaxb.VctInstance; import de.tuberlin.av.openteagle.utils.TeagleProperties; public class TestOpenTeagleAPI { private final OpenTeagleAPI openteagle = new OpenTeagleAPI( TeagleProperties.getRepoUrl()); @Test public void testGetListOfVCTs() { final int expected = 3; final int numberOfVCTs = this.openteagle.getNumberOfVCTs(); Assert.assertEquals(expected, numberOfVCTs); } @Test public void testListOfVCTs() { boolean found = false; final String expected = "1"; final List<Vct> listOfVCTs = this.openteagle.getListOfVCTs(); for (Vct vct : listOfVCTs) { if (vct.getId().toString().equals(expected)) found = true; } Assert.assertTrue(found); } @Test public void testCreateEmptyVCT() { VctInstance requestedVCT = new VctInstance(); requestedVCT.setCommonName("my new vct via API"); requestedVCT.setShared(false); requestedVCT.setStateId(BigInteger.ONE); requestedVCT.setDescription(""); requestedVCT.setUser("1"); String result = this.openteagle.createVct(requestedVCT); Assert.assertEquals("", result); } }
1,423
0.756852
0.754744
50
27.459999
20.795393
63
false
false
0
0
0
0
0
0
1.68
false
false
5
f0e2bb125d61154929905c498771c6077510dfb7
1,906,965,521,294
0fdae5e521d6420ad0222339528dca5cc2e14883
/RxBusDemo/EventBus/app/src/main/java/com/ryx/eventbus/MainActivity.java
127f0d02643a7a3359d6cb4a3403ac1c838d0d76
[]
no_license
taowuhua/Banner
https://github.com/taowuhua/Banner
58a8622e5cd5966f2d130847e0898a38317056f8
f2629150f9c906b5ed28a9b3cdb6850a6fc06352
refs/heads/master
2021-05-07T06:14:35.640000
2018-02-26T02:41:32
2018-02-26T02:41:32
111,645,533
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ryx.eventbus; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.wzgiceman.rxbuslibrary.rxbus.RxBus; import com.wzgiceman.rxbuslibrary.rxbus.Subscribe; import com.wzgiceman.rxbuslibrary.rxbus.ThreadMode; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button bt_post; private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bt_post = findViewById(R.id.bt_post); tv = findViewById(R.id.tv); bt_post.setOnClickListener(this); } @Override protected void onStart() { super.onStart(); /*่จปๅ†Š*/ RxBus.getDefault().register(this); } /*ๅธธ่ฆๆŽฅๅ—ไบ‹ไปถ*/ @Subscribe(threadMode = ThreadMode.MAIN) public void event(User changeText) { tv.setText(changeText.getName()); } @Override protected void onDestroy() { super.onDestroy(); /*่จป้Šท*/ RxBus.getDefault().unRegister(this); /*ๆณจ้”€ๆ‰€ๆœ‰็š„stickyๆถˆๆฏ*/ RxBus.getDefault().removeAllStickyEvents(); } @Override public void onClick(View v) { RxBus.getDefault().post(new User("ๆˆ‘ไฟฎๆ”นไบ†-Main")); Intent intent = new Intent(MainActivity.this,SecondActivity.class); startActivity(intent); } }
UTF-8
Java
1,571
java
MainActivity.java
Java
[]
null
[]
package com.ryx.eventbus; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.wzgiceman.rxbuslibrary.rxbus.RxBus; import com.wzgiceman.rxbuslibrary.rxbus.Subscribe; import com.wzgiceman.rxbuslibrary.rxbus.ThreadMode; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button bt_post; private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bt_post = findViewById(R.id.bt_post); tv = findViewById(R.id.tv); bt_post.setOnClickListener(this); } @Override protected void onStart() { super.onStart(); /*่จปๅ†Š*/ RxBus.getDefault().register(this); } /*ๅธธ่ฆๆŽฅๅ—ไบ‹ไปถ*/ @Subscribe(threadMode = ThreadMode.MAIN) public void event(User changeText) { tv.setText(changeText.getName()); } @Override protected void onDestroy() { super.onDestroy(); /*่จป้Šท*/ RxBus.getDefault().unRegister(this); /*ๆณจ้”€ๆ‰€ๆœ‰็š„stickyๆถˆๆฏ*/ RxBus.getDefault().removeAllStickyEvents(); } @Override public void onClick(View v) { RxBus.getDefault().post(new User("ๆˆ‘ไฟฎๆ”นไบ†-Main")); Intent intent = new Intent(MainActivity.this,SecondActivity.class); startActivity(intent); } }
1,571
0.680837
0.680183
54
27.314816
20.097746
85
false
false
0
0
0
0
0
0
0.5
false
false
5
7a417ac5a89db2f1bd018afbfc6d89d56badfa29
4,389,456,620,796
2f7d0dec222803d5580925825d4e12d555d4501c
/LVM/src/com/luna/core/module/ModuleLoader.java
a34356d6baed5b59ef96cc56a20969ffbb8e5cdd
[]
no_license
bizper/LUNA
https://github.com/bizper/LUNA
98700529443e0dd9b1bbd14831b3fb22c48df0ed
cdb19873f02fb491a987b08aca01550556eb3828
refs/heads/master
2021-11-18T00:37:44.304000
2021-11-09T14:25:38
2021-11-09T14:25:38
177,700,984
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.luna.core.module; public class ModuleLoader { public static void load(String path) { } }
UTF-8
Java
113
java
ModuleLoader.java
Java
[]
null
[]
package com.luna.core.module; public class ModuleLoader { public static void load(String path) { } }
113
0.681416
0.681416
9
11.555555
15.485557
42
false
false
0
0
0
0
0
0
0.111111
false
false
5
2bb146e0cef774fb087e778a9a33a85ee0b0f5d7
2,525,440,808,664
8acc7c3e35b852fac991321e61aaa9b62fb763d8
/src/main/java/com/vortexbird/vortexbird_prueba_backend/Dto/UsuarioDTO.java
d9f423a09fa8ed407296403ba8d439db377fd5d5
[]
no_license
DavidAnduquia/vortexbird_pruebaBackend
https://github.com/DavidAnduquia/vortexbird_pruebaBackend
73909ee5212096fcdcc5c2342065ceac300a285f
c2b5fede3cf449f9c5905fe65733d0b7d8899d63
refs/heads/master
2023-08-02T15:48:10.096000
2021-09-14T17:50:29
2021-09-14T17:50:29
406,466,531
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vortexbird.vortexbird_prueba_backend.Dto; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; public class UsuarioDTO { private String email; @NotEmpty private String password; @NotNull private String nombre; @NotNull private String apellido; @NotNull private String tipo_rol; private String enable; public UsuarioDTO() { } public UsuarioDTO(String email, @NotEmpty String password, @NotNull String nombre, @NotNull String apellido, @NotNull String tipo_rol, String enable) { super(); this.email = email; this.password = password; this.nombre = nombre; this.apellido = apellido; this.tipo_rol = tipo_rol; this.enable = enable; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellido() { return apellido; } public void setApellido(String apellido) { this.apellido = apellido; } public String getTipo_rol() { return tipo_rol; } public void setTipo_rol(String tipo_rol) { this.tipo_rol = tipo_rol; } public String getEnable() { return enable; } public void setEnable(String enable) { this.enable = enable; } }
UTF-8
Java
1,530
java
UsuarioDTO.java
Java
[ { "context": "\t\tsuper();\n\t\tthis.email = email;\n\t\tthis.password = password;\n\t\tthis.nombre = nombre;\n\t\tthis.apellido = apelli", "end": 649, "score": 0.9943891763687134, "start": 641, "tag": "PASSWORD", "value": "password" }, { "context": "d setPassword(String password) {\n\t\tthis.password = password;\n\t}\n\n\n\tpublic String getNombre() {\n\t\treturn nombr", "end": 999, "score": 0.9767717719078064, "start": 991, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.vortexbird.vortexbird_prueba_backend.Dto; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; public class UsuarioDTO { private String email; @NotEmpty private String password; @NotNull private String nombre; @NotNull private String apellido; @NotNull private String tipo_rol; private String enable; public UsuarioDTO() { } public UsuarioDTO(String email, @NotEmpty String password, @NotNull String nombre, @NotNull String apellido, @NotNull String tipo_rol, String enable) { super(); this.email = email; this.password = <PASSWORD>; this.nombre = nombre; this.apellido = apellido; this.tipo_rol = tipo_rol; this.enable = enable; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = <PASSWORD>; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellido() { return apellido; } public void setApellido(String apellido) { this.apellido = apellido; } public String getTipo_rol() { return tipo_rol; } public void setTipo_rol(String tipo_rol) { this.tipo_rol = tipo_rol; } public String getEnable() { return enable; } public void setEnable(String enable) { this.enable = enable; } }
1,534
0.681699
0.681699
105
13.561905
17.401108
109
false
false
0
0
0
0
0
0
0.961905
false
false
5
591563a9b46ae8a8deffdd2e1f1d670c5d243d70
841,813,634,295
981593e2d6297046b1dc1d3779019f34bd127e79
/app/src/main/java/datnguyen/lab/baithuchanh4application/GreenXmasFragment.java
9bd0edba6cbeb1541946f099cd752ff0102957f6
[]
no_license
datnguyennutte/BaiThucHanh4Application
https://github.com/datnguyennutte/BaiThucHanh4Application
8f56b85b806e1d933c487c5dcba1237dda140ea0
aa79628e1c3a996d0a1dd40dac34d06a5bf0dad7
refs/heads/master
2023-02-01T18:20:19.652000
2020-12-18T13:35:55
2020-12-18T13:35:55
322,604,554
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package datnguyen.lab.baithuchanh4application; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.ArrayList; import java.util.List; public class GreenXmasFragment extends Fragment { View v; private RecyclerView recyclerView; private List<Drink> drinkList; public GreenXmasFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); drinkList = new ArrayList<>(); drinkList.add(new Drink("Choco Xmas (L)", 55000, R.drawable.ic_choco_xmas)); drinkList.add(new Drink("Cookie XMas", 55000, R.drawable.ic_cooikie_xmas)); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment v = inflater.inflate(R.layout.fragment_green_xmas, container, false); recyclerView = v.findViewById(R.id.green_xmas_recycleview); RecycleOrderAdapter recyclerOrderAdapter = new RecycleOrderAdapter(getContext(), drinkList); GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2); gridLayoutManager.setOrientation(RecyclerView.VERTICAL); recyclerView.setLayoutManager(gridLayoutManager); recyclerView.setAdapter(recyclerOrderAdapter); return v; } }
UTF-8
Java
1,699
java
GreenXmasFragment.java
Java
[]
null
[]
package datnguyen.lab.baithuchanh4application; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.ArrayList; import java.util.List; public class GreenXmasFragment extends Fragment { View v; private RecyclerView recyclerView; private List<Drink> drinkList; public GreenXmasFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); drinkList = new ArrayList<>(); drinkList.add(new Drink("Choco Xmas (L)", 55000, R.drawable.ic_choco_xmas)); drinkList.add(new Drink("Cookie XMas", 55000, R.drawable.ic_cooikie_xmas)); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment v = inflater.inflate(R.layout.fragment_green_xmas, container, false); recyclerView = v.findViewById(R.id.green_xmas_recycleview); RecycleOrderAdapter recyclerOrderAdapter = new RecycleOrderAdapter(getContext(), drinkList); GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2); gridLayoutManager.setOrientation(RecyclerView.VERTICAL); recyclerView.setLayoutManager(gridLayoutManager); recyclerView.setAdapter(recyclerOrderAdapter); return v; } }
1,699
0.735138
0.728075
51
32.333332
28.115076
100
false
false
0
0
0
0
0
0
0.72549
false
false
5
b7e5b6cf92c209185ad0ca5a8c69638f901983ca
17,549,236,417,427
f85242af85d28727a0e9b662f70a7b296d04463b
/src/com/adamreeve/whattimeistwit/analysis/ClassificationProcessor.java
3b3e8ebaa3f96c6674d1b10f9aebe972d7a22894
[ "MIT" ]
permissive
reeve/whattimeistwit
https://github.com/reeve/whattimeistwit
da0deb3a6abe4cba603e91f5887d9020dbad7b60
88ca44089308d73f09428555409d901492bbb8b4
refs/heads/master
2020-04-27T17:58:41.056000
2014-03-13T19:24:20
2014-03-13T19:24:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.adamreeve.whattimeistwit.analysis; import com.adamreeve.whattimeistwit.analysis.classifiers.CharSetLanguageClassifier; import com.adamreeve.whattimeistwit.analysis.classifiers.LanguageClassifier; import com.adamreeve.whattimeistwit.analysis.classifiers.WordListLanguageClassifier; import com.adamreeve.whattimeistwit.tweet.MultiFileTweetSource; import com.adamreeve.whattimeistwit.tweet.Tweet; import com.adamreeve.whattimeistwit.tweet.TweetSource; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; /** * Main class for processing a set of tweets and generating language splits for each 1 minute period. * <p/> */ public class ClassificationProcessor { private static final int BATCH_SIZE = 2000; private static Logger LOGGER = LoggerFactory.getLogger(ClassificationProcessor.class); public static void main(String[] args) { ClassificationProcessor processor = new ClassificationProcessor(); LOGGER.info("Starting..."); CliOptions opts = new CliOptions(); try { // figure out the options CommandLine commandLine = opts.parseCommandLine(args); List<String> filenames = new ArrayList<>(); int threadCount = 1; if (commandLine.hasOption(CliOptions.OPT_FILENAME)) { filenames.add(commandLine.getOptionValue(CliOptions.OPT_FILENAME)); } else { String dirName = commandLine.getOptionValue(CliOptions.OPT_DIRNAME); File dir = new File(dirName); if (dir.isDirectory()) { for (File file : dir.listFiles(fileFilter)) { try { filenames.add(file.getCanonicalPath()); } catch (IOException e) { LOGGER.error(String.format("Error processing file %s", file.getName())); } } } else { throw new ParseException(String.format("%s is not a valid directory", dirName)); } } if (commandLine.hasOption(CliOptions.OPT_THREADS)) { threadCount = Integer.parseInt(commandLine.getOptionValue(CliOptions.OPT_THREADS)); } String dictBasePath = commandLine.getOptionValue(CliOptions.OPT_DICTBASE); // start processing processor.batchedRun(new MultiFileTweetSource(filenames), getClassifiers(dictBasePath), threadCount); } catch (ParseException e) { LOGGER.error("Error in command line", e); opts.printHelpText(); } LOGGER.info("Done."); } // filters a set of files into those we can actually read private static FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isFile() && file.canRead(); } }; /** * Do the work - split the incoming data into batches and run through the classifiers * * @param source data source for the tweets * @param classifiers the classifiers to use * @param threadCount max thread count for scheduling */ private void batchedRun(TweetSource source, List<LanguageClassifier> classifiers, int threadCount) { LOGGER.info("Starting batched run with {} threads", threadCount); // executor ExecutorService executor = Executors.newFixedThreadPool(threadCount); // count of incoming tweets int count = 0; // map of start date -> period summaries Map<Date, PeriodSummary> periods = new HashMap<>(); // list of futures from the scheduled tasks List<Future<Collection<PeriodSummary>>> futures = new ArrayList<>(); // holder for the current batch List<Tweet> batch = new ArrayList<>(); // iterate over all the tweets for (Tweet tweet : source) { // count and add to the current batch count++; batch.add(tweet); if (count % BATCH_SIZE == 0) { // schedule for execution and start a new one LOGGER.debug("Queueing batch"); futures.add(executor.submit(new BatchProcessor(batch, classifiers))); LOGGER.debug("Starting new batch"); batch = new ArrayList<>(); } } if (batch.size() > 0) { // clean up the last few tweets LOGGER.debug("Queueing final batch"); futures.add(executor.submit(new BatchProcessor(batch, classifiers))); } // wait for execution to end executor.shutdown(); // collect all the results and merge equivalent periods together for (Future<Collection<PeriodSummary>> future : futures) { try { Collection<PeriodSummary> summaries = future.get(); for (PeriodSummary summary : summaries) { PeriodSummary existing = periods.get(summary.getStart()); if (existing != null) { existing.merge(summary); } else { periods.put(summary.getStart(), summary); } } } catch (InterruptedException e) { LOGGER.error("Interrupted executing batch", e); } catch (ExecutionException e) { LOGGER.error("Error executing batch", e); } } // sort the output List<Date> startDates = new ArrayList<>(periods.keySet()); Collections.sort(startDates); // and print it out for (Date startDate : startDates) { LOGGER.info(periods.get(startDate).toString()); } } private static List<LanguageClassifier> getClassifiers(String basePath) { List<LanguageClassifier> result = new ArrayList<>(); result.add(new WordListLanguageClassifier("EN", "2of12inf.txt", basePath)); result.add(new WordListLanguageClassifier("FR", "liste_mots.txt", basePath)); result.add(new WordListLanguageClassifier("ES", "es.dic", basePath)); result.add(new WordListLanguageClassifier("DE", "de_neu.dic", basePath)); result.add(new WordListLanguageClassifier("AF", "words.afrikaans.txt", basePath)); result.add(new WordListLanguageClassifier("CS", "words.czech.txt", basePath)); result.add(new WordListLanguageClassifier("DA", "words.danish.txt", basePath)); result.add(new WordListLanguageClassifier("HR", "words.croatian.txt", basePath)); result.add(new WordListLanguageClassifier("IT", "words.italian.txt", basePath)); result.add(new WordListLanguageClassifier("NL", "words.dutch.txt", basePath)); result.add(new WordListLanguageClassifier("NO", "words.norwegian.txt", basePath)); result.add(new WordListLanguageClassifier("SV", "words.swedish.txt", basePath)); result.add(new CharSetLanguageClassifier("JP", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x3040, 0x309F)})); result.add(new CharSetLanguageClassifier("CN", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x4E00, 0x9FFF)}, new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x3040, 0x309F)})); result.add(new CharSetLanguageClassifier("TH", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x0E00, 0x0E7F)})); result.add(new CharSetLanguageClassifier("AR", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x0600, 0x06FF)})); result.add(new CharSetLanguageClassifier("KO", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0xAC00, 0xD7AF)})); result.add(new WordListLanguageClassifier("PT", "portugueseU.dic", basePath)); result.add(new WordListLanguageClassifier("ID", "00-indonesian-wordlist.lst", basePath)); return result; } }
UTF-8
Java
9,823
java
ClassificationProcessor.java
Java
[]
null
[]
package com.adamreeve.whattimeistwit.analysis; import com.adamreeve.whattimeistwit.analysis.classifiers.CharSetLanguageClassifier; import com.adamreeve.whattimeistwit.analysis.classifiers.LanguageClassifier; import com.adamreeve.whattimeistwit.analysis.classifiers.WordListLanguageClassifier; import com.adamreeve.whattimeistwit.tweet.MultiFileTweetSource; import com.adamreeve.whattimeistwit.tweet.Tweet; import com.adamreeve.whattimeistwit.tweet.TweetSource; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; /** * Main class for processing a set of tweets and generating language splits for each 1 minute period. * <p/> */ public class ClassificationProcessor { private static final int BATCH_SIZE = 2000; private static Logger LOGGER = LoggerFactory.getLogger(ClassificationProcessor.class); public static void main(String[] args) { ClassificationProcessor processor = new ClassificationProcessor(); LOGGER.info("Starting..."); CliOptions opts = new CliOptions(); try { // figure out the options CommandLine commandLine = opts.parseCommandLine(args); List<String> filenames = new ArrayList<>(); int threadCount = 1; if (commandLine.hasOption(CliOptions.OPT_FILENAME)) { filenames.add(commandLine.getOptionValue(CliOptions.OPT_FILENAME)); } else { String dirName = commandLine.getOptionValue(CliOptions.OPT_DIRNAME); File dir = new File(dirName); if (dir.isDirectory()) { for (File file : dir.listFiles(fileFilter)) { try { filenames.add(file.getCanonicalPath()); } catch (IOException e) { LOGGER.error(String.format("Error processing file %s", file.getName())); } } } else { throw new ParseException(String.format("%s is not a valid directory", dirName)); } } if (commandLine.hasOption(CliOptions.OPT_THREADS)) { threadCount = Integer.parseInt(commandLine.getOptionValue(CliOptions.OPT_THREADS)); } String dictBasePath = commandLine.getOptionValue(CliOptions.OPT_DICTBASE); // start processing processor.batchedRun(new MultiFileTweetSource(filenames), getClassifiers(dictBasePath), threadCount); } catch (ParseException e) { LOGGER.error("Error in command line", e); opts.printHelpText(); } LOGGER.info("Done."); } // filters a set of files into those we can actually read private static FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isFile() && file.canRead(); } }; /** * Do the work - split the incoming data into batches and run through the classifiers * * @param source data source for the tweets * @param classifiers the classifiers to use * @param threadCount max thread count for scheduling */ private void batchedRun(TweetSource source, List<LanguageClassifier> classifiers, int threadCount) { LOGGER.info("Starting batched run with {} threads", threadCount); // executor ExecutorService executor = Executors.newFixedThreadPool(threadCount); // count of incoming tweets int count = 0; // map of start date -> period summaries Map<Date, PeriodSummary> periods = new HashMap<>(); // list of futures from the scheduled tasks List<Future<Collection<PeriodSummary>>> futures = new ArrayList<>(); // holder for the current batch List<Tweet> batch = new ArrayList<>(); // iterate over all the tweets for (Tweet tweet : source) { // count and add to the current batch count++; batch.add(tweet); if (count % BATCH_SIZE == 0) { // schedule for execution and start a new one LOGGER.debug("Queueing batch"); futures.add(executor.submit(new BatchProcessor(batch, classifiers))); LOGGER.debug("Starting new batch"); batch = new ArrayList<>(); } } if (batch.size() > 0) { // clean up the last few tweets LOGGER.debug("Queueing final batch"); futures.add(executor.submit(new BatchProcessor(batch, classifiers))); } // wait for execution to end executor.shutdown(); // collect all the results and merge equivalent periods together for (Future<Collection<PeriodSummary>> future : futures) { try { Collection<PeriodSummary> summaries = future.get(); for (PeriodSummary summary : summaries) { PeriodSummary existing = periods.get(summary.getStart()); if (existing != null) { existing.merge(summary); } else { periods.put(summary.getStart(), summary); } } } catch (InterruptedException e) { LOGGER.error("Interrupted executing batch", e); } catch (ExecutionException e) { LOGGER.error("Error executing batch", e); } } // sort the output List<Date> startDates = new ArrayList<>(periods.keySet()); Collections.sort(startDates); // and print it out for (Date startDate : startDates) { LOGGER.info(periods.get(startDate).toString()); } } private static List<LanguageClassifier> getClassifiers(String basePath) { List<LanguageClassifier> result = new ArrayList<>(); result.add(new WordListLanguageClassifier("EN", "2of12inf.txt", basePath)); result.add(new WordListLanguageClassifier("FR", "liste_mots.txt", basePath)); result.add(new WordListLanguageClassifier("ES", "es.dic", basePath)); result.add(new WordListLanguageClassifier("DE", "de_neu.dic", basePath)); result.add(new WordListLanguageClassifier("AF", "words.afrikaans.txt", basePath)); result.add(new WordListLanguageClassifier("CS", "words.czech.txt", basePath)); result.add(new WordListLanguageClassifier("DA", "words.danish.txt", basePath)); result.add(new WordListLanguageClassifier("HR", "words.croatian.txt", basePath)); result.add(new WordListLanguageClassifier("IT", "words.italian.txt", basePath)); result.add(new WordListLanguageClassifier("NL", "words.dutch.txt", basePath)); result.add(new WordListLanguageClassifier("NO", "words.norwegian.txt", basePath)); result.add(new WordListLanguageClassifier("SV", "words.swedish.txt", basePath)); result.add(new CharSetLanguageClassifier("JP", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x3040, 0x309F)})); result.add(new CharSetLanguageClassifier("CN", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x4E00, 0x9FFF)}, new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x3040, 0x309F)})); result.add(new CharSetLanguageClassifier("TH", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x0E00, 0x0E7F)})); result.add(new CharSetLanguageClassifier("AR", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0x0600, 0x06FF)})); result.add(new CharSetLanguageClassifier("KO", new CharSetLanguageClassifier.Range[]{new CharSetLanguageClassifier.Range( 0xAC00, 0xD7AF)})); result.add(new WordListLanguageClassifier("PT", "portugueseU.dic", basePath)); result.add(new WordListLanguageClassifier("ID", "00-indonesian-wordlist.lst", basePath)); return result; } }
9,823
0.560928
0.55482
222
42.247749
32.287376
123
false
false
0
0
0
0
0
0
0.657658
false
false
5
83b13174af00ca4b5800fd9069e654de1e66f159
21,887,153,385,466
014cbee930e32da7018635b9dbd918085c981721
/src/com/psl/semicolon/bitsplease/exception/BitsPleaseException.java
2903850160120fbdd0ba5722a0bb83e2a022ad21
[]
no_license
sabyasachi087/bitsplease
https://github.com/sabyasachi087/bitsplease
1dc1d56fd8d97f14f5c7faa4cd6fe84e60fbd989
2d367af844e6fcd596f0040b2701b0f265104413
refs/heads/master
2021-04-27T15:04:05.295000
2018-02-25T02:19:33
2018-02-25T02:19:33
122,463,633
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.psl.semicolon.bitsplease.exception; public class BitsPleaseException extends RuntimeException{ /** * */ private static final long serialVersionUID = 6040625801202342940L; public BitsPleaseException(Exception ex){ super(ex); } }
UTF-8
Java
256
java
BitsPleaseException.java
Java
[]
null
[]
package com.psl.semicolon.bitsplease.exception; public class BitsPleaseException extends RuntimeException{ /** * */ private static final long serialVersionUID = 6040625801202342940L; public BitsPleaseException(Exception ex){ super(ex); } }
256
0.761719
0.6875
14
17.285715
23.665613
67
false
false
0
0
0
0
0
0
0.857143
false
false
5
d023919980e039ea3ed906accc39a8d1c6b8a7a2
30,966,714,245,785
1ea74ff282bba8f1bf0985c45cf2cd71b271cef2
/Day_20/Notes/src/com/dragontalker/java/StringTest1.java
241e858fd1853dccabd83dfca788a6dca44b6340
[ "MIT" ]
permissive
Dragontalker/JavaEE-study-notes
https://github.com/Dragontalker/JavaEE-study-notes
85d6361d4e3fd90eeacb78d56bfcb1e0885678d1
b6c334f4539b2d2f377146334667e5129ce28dd8
refs/heads/main
2023-05-03T02:55:42.221000
2021-05-27T01:11:10
2021-05-27T01:11:10
363,492,612
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dragontalker.java; /* ๆถ‰ๅŠๅˆฐString็ฑปไธŽๅ…ถไป–็ป“ๆž„ไน‹้—ด็š„่ฝฌๆข */ import org.junit.Test; import java.io.UnsupportedEncodingException; import java.util.Arrays; public class StringTest1 { @Test public void test1() { //String ---> ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹ใ€ๅŒ…่ฃ…็ฑป: ่ฐƒ็”จๅŒ…่ฃ…็ฑป็š„้™ๆ€ๆ–นๆณ•: parseXxx(str) String str1 = "123"; Integer int1 = Integer.parseInt(str1); System.out.println(str1); System.out.println(int1); //ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹ใ€ๅŒ…่ฃ…็ฑป ---> String: ่ฐƒ็”จString้‡่ฝฝ็š„valueOf(xxx) String str2 = String.valueOf(int1); System.out.println(str2); } @Test public void test2() { //String ---> charๅž‹ๆ•ฐ็ป„ String str1 = "abc123"; char[] charArray = str1.toCharArray(); for (char c : charArray) { System.out.println(c); } //charๅž‹ๆ•ฐ็ป„ ---> String char[] arr = new char[]{'h', 'e', 'l', 'l', 'o'}; String str2 = new String(arr); System.out.println(str2); } //Stringๅ’Œๅญ—่Š‚ๆ•ฐ็ป„็š„่ฝฌๆข //็ผ–็ : ๅญ—็ฌฆไธฒ ---> ๅญ—่Š‚ (็œ‹ๅพ—ๆ‡‚ ---> ็œ‹ไธๆ‡‚็š„ไบŒ่ฟ›ๅˆถๆ•ฐๆฎ) //่งฃ็ : ๅญ—่Š‚ ---> ๅญ—็ฌฆไธฒ (็œ‹ไธๆ‡‚็š„ไบŒ่ฟ›ๅˆถๆ•ฐๆฎ ---> ็œ‹ๅพ—ๆ‡‚) @Test public void test3() throws UnsupportedEncodingException { //String ---> byte[]: ่ฐƒ็”จString็š„getBytes() String str1 = "abc123ไธญๅ›ฝ"; byte[] bytes = str1.getBytes(); //ไฝฟ็”จ้ป˜่ฎค็š„utf-8่ฟ›่กŒ่ฝฌๆข System.out.println(Arrays.toString(bytes)); try { byte[] bytes1 = str1.getBytes("gbk"); //ไฝฟ็”จgbkๅญ—็ฌฆ้›†่ฟ›่กŒ็ผ–็  System.out.println(Arrays.toString(bytes1)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String str2 = new String(bytes); System.out.println(str2); String str3 = new String(str1.getBytes("gbk")); System.out.println(str3); //ๅ‡บ็Žฐไนฑ็ , ๅŽŸๅ› : ็ผ–็ ้›†ๅ’Œ่งฃ็ ้›†ไธไธ€่‡ด๏ผ String str4 = new String(str1.getBytes("gbk"), "gbk"); System.out.println(str4); //่ฏดๆ˜Ž: ่งฃ็ ๆ—ถ, ่ฆๆฑ‚่งฃ็ ไฝฟ็”จ็š„ๅญ—็ฌฆ้›†ๅฟ…้กปๅ’Œ็ผ–็ ๆ—ถไฝฟ็”จ็š„ๅญ—็ฌฆ้›†ไธ€่‡ด, ๅฆๅˆ™ไผšๅ‡บ็Žฐไนฑ็  } @Test public void test4() { String s1 = "javaEEhadoop"; String s2 = "javaEE"; String s3 = s2 + "hadoop"; System.out.println(s1 == s3); //false final String s4 = "javaEE"; String s5 = s4 + "hadoop"; // s4ไนŸๅ‡บไบŽๅธธ้‡ๆฑ ไธญ System.out.println(s1 == s5); //true } }
UTF-8
Java
2,603
java
StringTest1.java
Java
[]
null
[]
package com.dragontalker.java; /* ๆถ‰ๅŠๅˆฐString็ฑปไธŽๅ…ถไป–็ป“ๆž„ไน‹้—ด็š„่ฝฌๆข */ import org.junit.Test; import java.io.UnsupportedEncodingException; import java.util.Arrays; public class StringTest1 { @Test public void test1() { //String ---> ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹ใ€ๅŒ…่ฃ…็ฑป: ่ฐƒ็”จๅŒ…่ฃ…็ฑป็š„้™ๆ€ๆ–นๆณ•: parseXxx(str) String str1 = "123"; Integer int1 = Integer.parseInt(str1); System.out.println(str1); System.out.println(int1); //ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹ใ€ๅŒ…่ฃ…็ฑป ---> String: ่ฐƒ็”จString้‡่ฝฝ็š„valueOf(xxx) String str2 = String.valueOf(int1); System.out.println(str2); } @Test public void test2() { //String ---> charๅž‹ๆ•ฐ็ป„ String str1 = "abc123"; char[] charArray = str1.toCharArray(); for (char c : charArray) { System.out.println(c); } //charๅž‹ๆ•ฐ็ป„ ---> String char[] arr = new char[]{'h', 'e', 'l', 'l', 'o'}; String str2 = new String(arr); System.out.println(str2); } //Stringๅ’Œๅญ—่Š‚ๆ•ฐ็ป„็š„่ฝฌๆข //็ผ–็ : ๅญ—็ฌฆไธฒ ---> ๅญ—่Š‚ (็œ‹ๅพ—ๆ‡‚ ---> ็œ‹ไธๆ‡‚็š„ไบŒ่ฟ›ๅˆถๆ•ฐๆฎ) //่งฃ็ : ๅญ—่Š‚ ---> ๅญ—็ฌฆไธฒ (็œ‹ไธๆ‡‚็š„ไบŒ่ฟ›ๅˆถๆ•ฐๆฎ ---> ็œ‹ๅพ—ๆ‡‚) @Test public void test3() throws UnsupportedEncodingException { //String ---> byte[]: ่ฐƒ็”จString็š„getBytes() String str1 = "abc123ไธญๅ›ฝ"; byte[] bytes = str1.getBytes(); //ไฝฟ็”จ้ป˜่ฎค็š„utf-8่ฟ›่กŒ่ฝฌๆข System.out.println(Arrays.toString(bytes)); try { byte[] bytes1 = str1.getBytes("gbk"); //ไฝฟ็”จgbkๅญ—็ฌฆ้›†่ฟ›่กŒ็ผ–็  System.out.println(Arrays.toString(bytes1)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String str2 = new String(bytes); System.out.println(str2); String str3 = new String(str1.getBytes("gbk")); System.out.println(str3); //ๅ‡บ็Žฐไนฑ็ , ๅŽŸๅ› : ็ผ–็ ้›†ๅ’Œ่งฃ็ ้›†ไธไธ€่‡ด๏ผ String str4 = new String(str1.getBytes("gbk"), "gbk"); System.out.println(str4); //่ฏดๆ˜Ž: ่งฃ็ ๆ—ถ, ่ฆๆฑ‚่งฃ็ ไฝฟ็”จ็š„ๅญ—็ฌฆ้›†ๅฟ…้กปๅ’Œ็ผ–็ ๆ—ถไฝฟ็”จ็š„ๅญ—็ฌฆ้›†ไธ€่‡ด, ๅฆๅˆ™ไผšๅ‡บ็Žฐไนฑ็  } @Test public void test4() { String s1 = "javaEEhadoop"; String s2 = "javaEE"; String s3 = s2 + "hadoop"; System.out.println(s1 == s3); //false final String s4 = "javaEE"; String s5 = s4 + "hadoop"; // s4ไนŸๅ‡บไบŽๅธธ้‡ๆฑ ไธญ System.out.println(s1 == s5); //true } }
2,603
0.565996
0.542729
81
26.592592
20.118032
64
false
false
0
0
0
0
0
0
0.530864
false
false
5
f250595d9b1ccb2c2a58b6246b93cd15b8d44b77
9,354,438,832,008
436bbd2823506abcf3e92ec05827e91655e1dee1
/src/mx/com/recomendare/services/db/LabelsDAO.java
c8f5ca431f97ae5a35151bb9b972b33eed9934e2
[]
no_license
gmartinezgil/Recomendare-Website
https://github.com/gmartinezgil/Recomendare-Website
2bfadccaff1047044c1e762b50535262fb92f4ae
12f5952ec554f8678130ae7a84365a9df4b4076d
refs/heads/master
2020-06-30T05:55:46.504000
2013-09-23T00:17:39
2013-09-23T00:17:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package mx.com.recomendare.services.db; /** * @author jerry * */ public final class LabelsDAO extends AbstractDAO { /** * * @param labelCode * @param languageCode * @return */ public String getLabelByCodeLanguage(final String labelCode, final String languageCode) { return (String)session.createQuery( "SELECT label.value " + "FROM Label label, Language language " + "WHERE label.language = language " + "AND label.name = ? " + "AND language.code = ?" ).setParameter(0, labelCode).setParameter(1, languageCode).setCacheable(true).uniqueResult(); } /* (non-Javadoc) * @see mx.com.recomendare.services.db.AbstractDAO#count() */ @Override public int count() { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see mx.com.recomendare.services.db.AbstractDAO#load(long) */ @Override public Object load(long id) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see mx.com.recomendare.services.db.AbstractDAO#save(java.lang.Object) */ @Override public Object save(Object toSave) { // TODO Auto-generated method stub return null; } }//END OF FILE
UTF-8
Java
1,302
java
LabelsDAO.java
Java
[ { "context": ".com.recomendare.services.db;\r\n\r\n\r\n/**\r\n * @author jerry\r\n *\r\n */\r\npublic final class LabelsDAO extend", "end": 77, "score": 0.5991281270980835, "start": 76, "tag": "NAME", "value": "j" }, { "context": "om.recomendare.services.db;\r\n\r\n\r\n/**\r\n * @author jerry\r\n *\r\n */\r\npublic final class LabelsDAO extends Ab", "end": 81, "score": 0.7526108026504517, "start": 77, "tag": "USERNAME", "value": "erry" } ]
null
[]
/** * */ package mx.com.recomendare.services.db; /** * @author jerry * */ public final class LabelsDAO extends AbstractDAO { /** * * @param labelCode * @param languageCode * @return */ public String getLabelByCodeLanguage(final String labelCode, final String languageCode) { return (String)session.createQuery( "SELECT label.value " + "FROM Label label, Language language " + "WHERE label.language = language " + "AND label.name = ? " + "AND language.code = ?" ).setParameter(0, labelCode).setParameter(1, languageCode).setCacheable(true).uniqueResult(); } /* (non-Javadoc) * @see mx.com.recomendare.services.db.AbstractDAO#count() */ @Override public int count() { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see mx.com.recomendare.services.db.AbstractDAO#load(long) */ @Override public Object load(long id) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see mx.com.recomendare.services.db.AbstractDAO#save(java.lang.Object) */ @Override public Object save(Object toSave) { // TODO Auto-generated method stub return null; } }//END OF FILE
1,302
0.607527
0.605223
55
21.709091
24.31735
109
false
false
0
0
0
0
0
0
2.654546
false
false
5
34424184f08c8efaf1c1c710b53c6cfcd29bcdaf
6,305,012,000,053
519c4dc49067016edc00b1526acdde693220e78d
/nwclHT/.svn/pristine/bb/bb4518be89993842492ae5590f4c6bf21ba0e040.svn-base
9ccfb686ea8083a7e7da6fcb0c1ba3a02d733431
[]
no_license
zeng95xin/WorkSpaces
https://github.com/zeng95xin/WorkSpaces
686ea13a4374de743d017135a5a5a9d497bbf1f2
bccf5430754811d78f9e4d50fc03522053e04f39
refs/heads/master
2020-03-07T08:07:58.606000
2018-03-30T07:09:16
2018-03-30T07:09:16
127,368,334
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bola.nwcl.biz.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bola.nwcl.biz.PropertyManager; import com.bola.nwcl.common.manager.ManagerImpl; import com.bola.nwcl.dal.model.page.DataGrid; import com.bola.nwcl.dal.model.page.PageHelper; import com.bola.nwcl.dal.mybatis.mapper.PropertyMapper; import com.bola.nwcl.dal.mybatis.model.Property; import com.bola.nwcl.dal.mybatis.model.PropertyExample; @Service public class PropertyManagerImpl extends ManagerImpl<Property, PropertyExample, Long> implements PropertyManager{ private PropertyMapper propertyMapper; @Autowired public PropertyManagerImpl(PropertyMapper propertyMapper) { this.mapper = propertyMapper; this.propertyMapper = propertyMapper; } @Override public DataGrid dataGrid(Property property, PageHelper ph) { DataGrid dg = new DataGrid(); PropertyExample example=new PropertyExample(); example.setLimit(ph.getRows()); example.setOffset((ph.getPage()-1)*ph.getRows()); example.setOrderByClause("row_add_time DESC"); List<Property> list=propertyMapper.selectByExample(example); dg.setRows(list); int total=propertyMapper.countByExample(null); dg.setTotal(total); return dg; } }
UTF-8
Java
1,306
bb4518be89993842492ae5590f4c6bf21ba0e040.svn-base
Java
[]
null
[]
package com.bola.nwcl.biz.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bola.nwcl.biz.PropertyManager; import com.bola.nwcl.common.manager.ManagerImpl; import com.bola.nwcl.dal.model.page.DataGrid; import com.bola.nwcl.dal.model.page.PageHelper; import com.bola.nwcl.dal.mybatis.mapper.PropertyMapper; import com.bola.nwcl.dal.mybatis.model.Property; import com.bola.nwcl.dal.mybatis.model.PropertyExample; @Service public class PropertyManagerImpl extends ManagerImpl<Property, PropertyExample, Long> implements PropertyManager{ private PropertyMapper propertyMapper; @Autowired public PropertyManagerImpl(PropertyMapper propertyMapper) { this.mapper = propertyMapper; this.propertyMapper = propertyMapper; } @Override public DataGrid dataGrid(Property property, PageHelper ph) { DataGrid dg = new DataGrid(); PropertyExample example=new PropertyExample(); example.setLimit(ph.getRows()); example.setOffset((ph.getPage()-1)*ph.getRows()); example.setOrderByClause("row_add_time DESC"); List<Property> list=propertyMapper.selectByExample(example); dg.setRows(list); int total=propertyMapper.countByExample(null); dg.setTotal(total); return dg; } }
1,306
0.787136
0.786371
45
28.022223
25.657997
114
false
false
0
0
0
0
0
0
1.511111
false
false
5
188f0315141c895e000ae81706af6bdddaf9ad06
7,241,314,861,615
83e11ef00f849ae4ffaadf45557d3cb9abe5d7ed
/app/src/main/java/com/example/localnews/Youtube/ChannelModel.java
bf478f908ec2fb5b9e3e59c594f5318d6d17d816
[]
no_license
Kawleen/LocalNews
https://github.com/Kawleen/LocalNews
92c3e21f538c6a2a664ba9c99f8a3997c10e569c
5d306fd3717e21eee7456734006f1f912613aeb2
refs/heads/master
2020-12-09T20:10:24.496000
2020-01-12T14:38:20
2020-01-12T14:38:20
233,405,012
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.localnews.Youtube; public class ChannelModel { String urlID; String url; String country; public ChannelModel(){} public ChannelModel(String urlID, String url, String country) { this.urlID = urlID; this.url = url; this.country = country; } public String getUrlID() { return urlID; } public String getUrl() { return url; } public String getCountry() { return country; } }
UTF-8
Java
492
java
ChannelModel.java
Java
[]
null
[]
package com.example.localnews.Youtube; public class ChannelModel { String urlID; String url; String country; public ChannelModel(){} public ChannelModel(String urlID, String url, String country) { this.urlID = urlID; this.url = url; this.country = country; } public String getUrlID() { return urlID; } public String getUrl() { return url; } public String getCountry() { return country; } }
492
0.595528
0.595528
27
17.222221
15.654448
67
false
false
0
0
0
0
0
0
0.444444
false
false
5
d3ebdd1d5867d3af3f074adb77c206b7df7aed12
10,514,080,001,108
c8fb5ddb5fa99862a8fc5973b2fbda3ecd0d0aa6
/Gps2/app/src/main/java/com/example/jimmi/gps2/Destination.java
7df7ab2cafdd162b7b9e6ff77ab2dc5823c095a2
[]
no_license
jimmi280586/android_development
https://github.com/jimmi280586/android_development
e8286fdcfbdd43f8ab00a75aabc4b9ae9ecfe482
6418a19a4201e59cd211dadc00932ed0a44ae4c3
refs/heads/master
2021-01-10T19:37:28.686000
2016-08-29T20:11:00
2016-08-29T20:11:00
39,770,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.jimmi.gps2; import android.text.Editable; /** * Created by jimmi on 03-08-2015. */ public class Destination { private double latitude; private double longitude; private String name; public Destination(double latitude, double longitude, String name) { this.latitude = latitude; this.longitude = longitude; this.name = name; } public Destination(double latitude, double longitude, Editable text) { } public double getLatitude() { return this.latitude; } public double getLongitude() { return this.longitude; } public String getName() { return this.name; } }
UTF-8
Java
699
java
Destination.java
Java
[ { "context": "\n\nimport android.text.Editable;\n\n/**\n * Created by jimmi on 03-08-2015.\n */\npublic class Destination\n{\n ", "end": 87, "score": 0.9994988441467285, "start": 82, "tag": "USERNAME", "value": "jimmi" } ]
null
[]
package com.example.jimmi.gps2; import android.text.Editable; /** * Created by jimmi on 03-08-2015. */ public class Destination { private double latitude; private double longitude; private String name; public Destination(double latitude, double longitude, String name) { this.latitude = latitude; this.longitude = longitude; this.name = name; } public Destination(double latitude, double longitude, Editable text) { } public double getLatitude() { return this.latitude; } public double getLongitude() { return this.longitude; } public String getName() { return this.name; } }
699
0.632332
0.619456
36
18.416666
18.38232
74
false
false
0
0
0
0
0
0
0.416667
false
false
5
f8c7e8f4363ea6a789ad669a896616e8d1ac3bab
21,861,383,540,708
de8a442f9dd36909fda39cd9830b676f5ecbf817
/JogoDosPontinhos(ProjetoFinal)/model/Jogador.java
b2bb249482562f4ba02d3f11ae7d10903453f951
[]
no_license
HenriqueVmc/ads-poo
https://github.com/HenriqueVmc/ads-poo
c2398d9d215200931dce2cd88a89ec2c254c14d5
f66a29d2a3c67b8107f46ca7b88e646f2f42fc5b
refs/heads/master
2020-03-21T09:57:15.169000
2018-06-23T19:33:36
2018-06-23T19:33:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; import view.Tela; public abstract class Jogador { private String nome; private int pontos; public Jogador() { pontos = 0; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public void setPontos(int pontos) { this.pontos += pontos; } public int getPontos() { return pontos; } public boolean ganhou(Jogador j2) { return getPontos() > j2.getPontos(); } public abstract Linha escolheLinha(Matriz matriz, Tela tela); }
UTF-8
Java
597
java
Jogador.java
Java
[]
null
[]
package model; import view.Tela; public abstract class Jogador { private String nome; private int pontos; public Jogador() { pontos = 0; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public void setPontos(int pontos) { this.pontos += pontos; } public int getPontos() { return pontos; } public boolean ganhou(Jogador j2) { return getPontos() > j2.getPontos(); } public abstract Linha escolheLinha(Matriz matriz, Tela tela); }
597
0.589615
0.58459
37
15.135135
16.235035
65
false
false
0
0
0
0
0
0
0.324324
false
false
5
2d4e3fa8c06396cf042099ecb529e15433d9d4ad
29,815,663,035,777
5c68af64d39ccc773b349214c7f612872c3f1474
/src/main/java/by/belisa/server/entities/Napravl.java
aa3e314d3d41c0ca00f20ddc38afcbb19ca2ae66
[]
no_license
mrpencil/FondGwt
https://github.com/mrpencil/FondGwt
580079601505709f394604e9b5355dcc85be2b83
e7d3729a7480476067f6c52cca4714fbe7718a86
refs/heads/master
2020-01-05T10:43:41.586000
2016-06-10T08:26:48
2016-06-10T08:26:49
49,724,202
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.belisa.server.entities; import by.belisa.shared.model.NapravlModel; import lombok.Data; import javax.persistence.*; import java.util.ArrayList; import java.util.List; /** * Created by Rozhko on 16.05.2016. */ @Entity @Table(name="NAPRAVL") @SequenceGenerator(sequenceName="SEQ_UCH_STEPENI", name="PK") public @Data class Napravl implements Model<NapravlModel>{ @Id @Column(name = "ID") private Long id; @Column(name = "NAME") private String name; @ManyToMany(mappedBy = "napravlList") private List<Konkursy> konkursyList = new ArrayList<>(); @Override public NapravlModel getModel() { NapravlModel model = new NapravlModel(); model.setId(id); model.setName(name); return model; } }
UTF-8
Java
775
java
Napravl.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Rozhko on 16.05.2016.\n */\n@Entity\n@Table(name=\"NAPRAVL\")", "end": 205, "score": 0.9963805079460144, "start": 199, "tag": "USERNAME", "value": "Rozhko" } ]
null
[]
package by.belisa.server.entities; import by.belisa.shared.model.NapravlModel; import lombok.Data; import javax.persistence.*; import java.util.ArrayList; import java.util.List; /** * Created by Rozhko on 16.05.2016. */ @Entity @Table(name="NAPRAVL") @SequenceGenerator(sequenceName="SEQ_UCH_STEPENI", name="PK") public @Data class Napravl implements Model<NapravlModel>{ @Id @Column(name = "ID") private Long id; @Column(name = "NAME") private String name; @ManyToMany(mappedBy = "napravlList") private List<Konkursy> konkursyList = new ArrayList<>(); @Override public NapravlModel getModel() { NapravlModel model = new NapravlModel(); model.setId(id); model.setName(name); return model; } }
775
0.676129
0.665806
37
19.945946
17.559084
61
false
false
0
0
0
0
0
0
0.378378
false
false
5
6b110610eab7a16f80d532c122d4a94c83e811fc
29,815,663,036,881
be6593a4b8af6a81240f120f36d792ed112d4d28
/src/main/java/com/dbs/loyalty/service/ProvinceService.java
04a4cc2b8fc2ff5885c64e2df3369b1edca15c60
[]
no_license
ferrylinton/dbs-loyalty
https://github.com/ferrylinton/dbs-loyalty
4e54ae70a798b92edb9959eb97610931b2867b56
99433a4449bf8cf12b1a9a1305e8dc352abaf90a
refs/heads/master
2023-02-22T20:30:43.498000
2019-10-12T07:38:46
2019-10-12T07:38:46
245,748,769
0
0
null
false
2023-02-22T07:42:30
2020-03-08T04:00:28
2020-03-08T04:05:23
2023-02-22T07:42:29
5,930
0
0
1
Java
false
false
package com.dbs.loyalty.service; import java.util.Map; import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import com.dbs.loyalty.domain.Province; import com.dbs.loyalty.repository.ProvinceRepository; import com.dbs.loyalty.service.specification.ProvinceSpec; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor @Service public class ProvinceService{ private final ProvinceRepository provinceRepository; public Optional<Province> findById(Integer id){ return provinceRepository.findById(id); } public Optional<Province> findWithCountryById(Integer id){ return provinceRepository.findWithCountryById(id); } public Page<Province> findAll(Map<String, String> params, Pageable pageable) { return provinceRepository.findAll(new ProvinceSpec(params), pageable); } }
UTF-8
Java
914
java
ProvinceService.java
Java
[]
null
[]
package com.dbs.loyalty.service; import java.util.Map; import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import com.dbs.loyalty.domain.Province; import com.dbs.loyalty.repository.ProvinceRepository; import com.dbs.loyalty.service.specification.ProvinceSpec; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor @Service public class ProvinceService{ private final ProvinceRepository provinceRepository; public Optional<Province> findById(Integer id){ return provinceRepository.findById(id); } public Optional<Province> findWithCountryById(Integer id){ return provinceRepository.findWithCountryById(id); } public Page<Province> findAll(Map<String, String> params, Pageable pageable) { return provinceRepository.findAll(new ProvinceSpec(params), pageable); } }
914
0.817287
0.817287
34
25.882353
24.709805
79
false
false
0
0
0
0
0
0
0.970588
false
false
5
e0fb5c56f4bfaefbc9788b12dab5e0ed7fada4d5
22,101,901,775,625
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/ๅ็ผ–่ฏ‘ๆบ็ /ๆœชๅๆททๆท†/src/main/java/com/tencent/mm/modelsfs/SFSFileSystem.java
a0df73ba92cf3a19b46ccfaca0758c90d8e585f4
[]
no_license
xsren/AndroidReverseNotes
https://github.com/xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072000
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tencent.mm.modelsfs; import android.os.CancellationSignal; import android.os.Environment; import android.os.Parcel; import android.os.Parcelable.Creator; import android.os.StatFs; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.modelsfs.SFSContext.Builder; import com.tencent.mm.modelsfs.SFSContext.FileEntry; import com.tencent.mm.vfs.FileSystem; import com.tencent.mm.vfs.FileSystem.a; import com.tencent.mm.vfs.FileSystem.b; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; public class SFSFileSystem implements FileSystem { public static final Creator<SFSFileSystem> CREATOR = new Creator<SFSFileSystem>() { public final /* bridge */ /* synthetic */ Object[] newArray(int i) { return new SFSFileSystem[i]; } public final /* synthetic */ Object createFromParcel(Parcel parcel) { AppMethodBeat.i(93241); SFSFileSystem sFSFileSystem = new SFSFileSystem(parcel, (byte) 0); AppMethodBeat.o(93241); return sFSFileSystem; } }; private SFSContext fOk; private final Builder fOl; /* synthetic */ SFSFileSystem(Parcel parcel, byte b) { this(parcel); } private SFSFileSystem(Parcel parcel) { AppMethodBeat.i(93242); this.fOl = (Builder) parcel.readParcelable(SFSContext.class.getClassLoader()); AppMethodBeat.o(93242); } private void aiQ() { AppMethodBeat.i(93243); if (this.fOk == null) { this.fOk = this.fOl.create(); } AppMethodBeat.o(93243); } public final int aiR() { return 9; } public final b tn(String str) { AppMethodBeat.i(93244); StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath()); b bVar = new b(); bVar.xBy = (long) statFs.getBlockSize(); bVar.xBx = (long) statFs.getAvailableBlocks(); bVar.xBv = (long) statFs.getBlockCount(); bVar.zYP = bVar.xBx * bVar.xBy; bVar.zYQ = bVar.xBv * bVar.xBy; AppMethodBeat.o(93244); return bVar; } public final InputStream openRead(String str) { AppMethodBeat.i(93245); aiQ(); InputStream openRead = this.fOk.openRead(str); AppMethodBeat.o(93245); return openRead; } public final OutputStream L(String str, boolean z) { AppMethodBeat.i(93246); aiQ(); OutputStream pH = this.fOk.pH(str); AppMethodBeat.o(93246); return pH; } public final boolean exists(String str) { AppMethodBeat.i(93247); aiQ(); boolean exists = this.fOk.exists(str); AppMethodBeat.o(93247); return exists; } private a a(FileEntry fileEntry) { AppMethodBeat.i(93248); a aVar = new a(this, fileEntry.name, fileEntry.name.substring(fileEntry.name.lastIndexOf(47) + 1), fileEntry.size, (fileEntry.size + 4095) & -4096, fileEntry.timestamp, false); AppMethodBeat.o(93248); return aVar; } public final a to(String str) { AppMethodBeat.i(93249); aiQ(); FileEntry tm = this.fOk.tm(str); if (tm == null) { AppMethodBeat.o(93249); return null; } a a = a(tm); AppMethodBeat.o(93249); return a; } public final boolean t(String str, long j) { return false; } public final boolean pI(String str) { AppMethodBeat.i(93250); aiQ(); boolean pI = this.fOk.pI(str); AppMethodBeat.o(93250); return pI; } public final List<a> M(String str, boolean z) { AppMethodBeat.i(93251); aiQ(); try { List<FileEntry> tl = this.fOk.tl(str); ArrayList arrayList = new ArrayList(tl.size()); for (FileEntry a : tl) { arrayList.add(a(a)); } AppMethodBeat.o(93251); return arrayList; } catch (IOException e) { AppMethodBeat.o(93251); return null; } } public final boolean tf(String str) { return true; } public final boolean N(String str, boolean z) { AppMethodBeat.i(93252); aiQ(); try { for (FileEntry fileEntry : this.fOk.tl(str)) { this.fOk.pI(fileEntry.name); } AppMethodBeat.o(93252); return true; } catch (IOException e) { AppMethodBeat.o(93252); return false; } } public final boolean aS(String str, String str2) { return false; } public final String O(String str, boolean z) { return null; } public final void p(Map<String, String> map) { } public final void a(CancellationSignal cancellationSignal) { } public int describeContents() { return 0; } public void writeToParcel(Parcel parcel, int i) { AppMethodBeat.i(93253); parcel.writeParcelable(this.fOl, i); AppMethodBeat.o(93253); } static { AppMethodBeat.i(93254); AppMethodBeat.o(93254); } }
UTF-8
Java
5,321
java
SFSFileSystem.java
Java
[]
null
[]
package com.tencent.mm.modelsfs; import android.os.CancellationSignal; import android.os.Environment; import android.os.Parcel; import android.os.Parcelable.Creator; import android.os.StatFs; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.modelsfs.SFSContext.Builder; import com.tencent.mm.modelsfs.SFSContext.FileEntry; import com.tencent.mm.vfs.FileSystem; import com.tencent.mm.vfs.FileSystem.a; import com.tencent.mm.vfs.FileSystem.b; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; public class SFSFileSystem implements FileSystem { public static final Creator<SFSFileSystem> CREATOR = new Creator<SFSFileSystem>() { public final /* bridge */ /* synthetic */ Object[] newArray(int i) { return new SFSFileSystem[i]; } public final /* synthetic */ Object createFromParcel(Parcel parcel) { AppMethodBeat.i(93241); SFSFileSystem sFSFileSystem = new SFSFileSystem(parcel, (byte) 0); AppMethodBeat.o(93241); return sFSFileSystem; } }; private SFSContext fOk; private final Builder fOl; /* synthetic */ SFSFileSystem(Parcel parcel, byte b) { this(parcel); } private SFSFileSystem(Parcel parcel) { AppMethodBeat.i(93242); this.fOl = (Builder) parcel.readParcelable(SFSContext.class.getClassLoader()); AppMethodBeat.o(93242); } private void aiQ() { AppMethodBeat.i(93243); if (this.fOk == null) { this.fOk = this.fOl.create(); } AppMethodBeat.o(93243); } public final int aiR() { return 9; } public final b tn(String str) { AppMethodBeat.i(93244); StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath()); b bVar = new b(); bVar.xBy = (long) statFs.getBlockSize(); bVar.xBx = (long) statFs.getAvailableBlocks(); bVar.xBv = (long) statFs.getBlockCount(); bVar.zYP = bVar.xBx * bVar.xBy; bVar.zYQ = bVar.xBv * bVar.xBy; AppMethodBeat.o(93244); return bVar; } public final InputStream openRead(String str) { AppMethodBeat.i(93245); aiQ(); InputStream openRead = this.fOk.openRead(str); AppMethodBeat.o(93245); return openRead; } public final OutputStream L(String str, boolean z) { AppMethodBeat.i(93246); aiQ(); OutputStream pH = this.fOk.pH(str); AppMethodBeat.o(93246); return pH; } public final boolean exists(String str) { AppMethodBeat.i(93247); aiQ(); boolean exists = this.fOk.exists(str); AppMethodBeat.o(93247); return exists; } private a a(FileEntry fileEntry) { AppMethodBeat.i(93248); a aVar = new a(this, fileEntry.name, fileEntry.name.substring(fileEntry.name.lastIndexOf(47) + 1), fileEntry.size, (fileEntry.size + 4095) & -4096, fileEntry.timestamp, false); AppMethodBeat.o(93248); return aVar; } public final a to(String str) { AppMethodBeat.i(93249); aiQ(); FileEntry tm = this.fOk.tm(str); if (tm == null) { AppMethodBeat.o(93249); return null; } a a = a(tm); AppMethodBeat.o(93249); return a; } public final boolean t(String str, long j) { return false; } public final boolean pI(String str) { AppMethodBeat.i(93250); aiQ(); boolean pI = this.fOk.pI(str); AppMethodBeat.o(93250); return pI; } public final List<a> M(String str, boolean z) { AppMethodBeat.i(93251); aiQ(); try { List<FileEntry> tl = this.fOk.tl(str); ArrayList arrayList = new ArrayList(tl.size()); for (FileEntry a : tl) { arrayList.add(a(a)); } AppMethodBeat.o(93251); return arrayList; } catch (IOException e) { AppMethodBeat.o(93251); return null; } } public final boolean tf(String str) { return true; } public final boolean N(String str, boolean z) { AppMethodBeat.i(93252); aiQ(); try { for (FileEntry fileEntry : this.fOk.tl(str)) { this.fOk.pI(fileEntry.name); } AppMethodBeat.o(93252); return true; } catch (IOException e) { AppMethodBeat.o(93252); return false; } } public final boolean aS(String str, String str2) { return false; } public final String O(String str, boolean z) { return null; } public final void p(Map<String, String> map) { } public final void a(CancellationSignal cancellationSignal) { } public int describeContents() { return 0; } public void writeToParcel(Parcel parcel, int i) { AppMethodBeat.i(93253); parcel.writeParcelable(this.fOl, i); AppMethodBeat.o(93253); } static { AppMethodBeat.i(93254); AppMethodBeat.o(93254); } }
5,321
0.592558
0.560609
192
26.713541
22.727467
184
false
false
0
0
0
0
0
0
0.619792
false
false
5
abc33592df934b80b9f1e4951c909f5eaf5ace1d
11,192,684,837,597
9ee1726697b77c27e2223dd9a94aed52c57aff3f
/app/src/main/java/com/example/eros_demo/Matching.java
bc0abb1d1149ebbc2e7b8027e61ee7b856ea65bd
[]
no_license
thanhdat00/Eros-app
https://github.com/thanhdat00/Eros-app
7d5f3e3eb35313a0661df263fed2b0a5c159e128
a6b3111c812c6661c8d34bc4dc04f4c2dce236fe
refs/heads/master
2023-02-12T22:17:12.351000
2021-01-15T08:58:26
2021-01-15T08:58:26
321,341,247
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.eros_demo; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import android.content.Intent; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import java.util.ArrayList; public class Matching extends AppCompatActivity implements View.OnClickListener { private ArrayList<Question> questions = new ArrayList<Question>() ; int curentPos = 1; ProgressBar progressBar; TextView tv_progress, tv_question, tv_answerA,tv_answerB,tv_answerC,tv_answerD; Button btn_submit; private int mSelectedOptionPosition; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_matching); initComponents(); setQuestion(); tv_answerA.setOnClickListener(this); tv_answerB.setOnClickListener(this); tv_answerC.setOnClickListener(this); tv_answerD.setOnClickListener(this); btn_submit.setOnClickListener(this); } private void setQuestion() { Question question = questions.get(curentPos-1); tv_progress.setText(String.valueOf(curentPos) + "/5"); progressBar.setProgress(curentPos-1); defaultOptionView(); tv_question.setText(question.getQuestion()); tv_answerA.setText(question.getAnswerA()); tv_answerB.setText(question.getAnswerB()); tv_answerC.setText(question.getAnswerC()); tv_answerD.setText(question.getAnswerD()); } private void initComponents() { progressBar = findViewById(R.id.progressBar); tv_progress = findViewById(R.id.tv_progress); tv_question = findViewById(R.id.tv_question); tv_answerA = findViewById(R.id.tv_answer_A); tv_answerB = findViewById(R.id.tv_answer_B); tv_answerC = findViewById(R.id.tv_answer_C); tv_answerD = findViewById(R.id.tv_answer_D); btn_submit = findViewById(R.id.btn_submit); questions.add(new Question( "WHO PLAYS THE ROLE OF TONY STARK IN MCU", "Robert Downey,Jr.", "Christ Evans", "Christ Hemsworth", "Mark Ruffalo", "A")); questions.add(new Question( "Which thing is alive?", "Table", "Dog", "Rock", "Chair", "B" )); questions.add(new Question( "Do you like this app?", "So so", "Not at all", "Maybe", "Yes", "D" )); questions.add(new Question( "What is your country?", "Vietnam", "Laos", "Campuchia", "Phillipin", "D" )); questions.add(new Question( "Which kind of food you like?", "Chicken", "Fish", "Fruit", "Vegetable", "B" )); } private void defaultOptionView(){ ArrayList<TextView> options = new ArrayList<>(); options.add(tv_answerA); options.add(tv_answerB); options.add(tv_answerC); options.add(tv_answerD); for (int i = 0; i < options.size(); i++){ options.get(i).setTextColor(Color.parseColor("#7a8089")); options.get(i).setTypeface(Typeface.DEFAULT); options.get(i).setBackground(ContextCompat.getDrawable(this,R.drawable.default_option_border_bg)); } } @Override public void onClick(View v) { switch (v.getId()){ case R.id.tv_answer_A: selectdOptionView(tv_answerA,1); break; case R.id.tv_answer_B: selectdOptionView(tv_answerB,2); break; case R.id.tv_answer_C: selectdOptionView(tv_answerC,3); break; case R.id.tv_answer_D: selectdOptionView(tv_answerD,4); break; case R.id.btn_submit: curentPos++; if (curentPos <= questions.size()) setQuestion(); else{ Intent intent = new Intent(Matching.this, Matching_success.class); startActivity(intent); finish(); } } } private void selectdOptionView(TextView tv, int selectedNum){ defaultOptionView(); mSelectedOptionPosition = selectedNum; tv.setTextColor(Color.parseColor("#363a43")); tv.setTypeface(tv.getTypeface(), Typeface.BOLD); tv.setBackground(ContextCompat.getDrawable(this,R.drawable.selected_option_border_bg)); } }
UTF-8
Java
5,052
java
Matching.java
Java
[ { "context": " THE ROLE OF TONY STARK IN MCU\",\n \"Robert Downey,Jr.\",\n \"Christ Evans\",\n ", "end": 2289, "score": 0.9998436570167542, "start": 2276, "tag": "NAME", "value": "Robert Downey" }, { "context": " \"Robert Downey,Jr.\",\n \"Christ Evans\",\n \"Christ Hemsworth\",\n ", "end": 2325, "score": 0.9998688101768494, "start": 2313, "tag": "NAME", "value": "Christ Evans" }, { "context": "\n \"Christ Evans\",\n \"Christ Hemsworth\",\n \"Mark Ruffalo\",\n ", "end": 2361, "score": 0.9998763799667358, "start": 2345, "tag": "NAME", "value": "Christ Hemsworth" }, { "context": " \"Christ Hemsworth\",\n \"Mark Ruffalo\",\n \"A\"));\n\n questions.add(n", "end": 2393, "score": 0.9998595118522644, "start": 2381, "tag": "NAME", "value": "Mark Ruffalo" } ]
null
[]
package com.example.eros_demo; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import android.content.Intent; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import java.util.ArrayList; public class Matching extends AppCompatActivity implements View.OnClickListener { private ArrayList<Question> questions = new ArrayList<Question>() ; int curentPos = 1; ProgressBar progressBar; TextView tv_progress, tv_question, tv_answerA,tv_answerB,tv_answerC,tv_answerD; Button btn_submit; private int mSelectedOptionPosition; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_matching); initComponents(); setQuestion(); tv_answerA.setOnClickListener(this); tv_answerB.setOnClickListener(this); tv_answerC.setOnClickListener(this); tv_answerD.setOnClickListener(this); btn_submit.setOnClickListener(this); } private void setQuestion() { Question question = questions.get(curentPos-1); tv_progress.setText(String.valueOf(curentPos) + "/5"); progressBar.setProgress(curentPos-1); defaultOptionView(); tv_question.setText(question.getQuestion()); tv_answerA.setText(question.getAnswerA()); tv_answerB.setText(question.getAnswerB()); tv_answerC.setText(question.getAnswerC()); tv_answerD.setText(question.getAnswerD()); } private void initComponents() { progressBar = findViewById(R.id.progressBar); tv_progress = findViewById(R.id.tv_progress); tv_question = findViewById(R.id.tv_question); tv_answerA = findViewById(R.id.tv_answer_A); tv_answerB = findViewById(R.id.tv_answer_B); tv_answerC = findViewById(R.id.tv_answer_C); tv_answerD = findViewById(R.id.tv_answer_D); btn_submit = findViewById(R.id.btn_submit); questions.add(new Question( "WHO PLAYS THE ROLE OF TONY STARK IN MCU", "<NAME>,Jr.", "<NAME>", "<NAME>", "<NAME>", "A")); questions.add(new Question( "Which thing is alive?", "Table", "Dog", "Rock", "Chair", "B" )); questions.add(new Question( "Do you like this app?", "So so", "Not at all", "Maybe", "Yes", "D" )); questions.add(new Question( "What is your country?", "Vietnam", "Laos", "Campuchia", "Phillipin", "D" )); questions.add(new Question( "Which kind of food you like?", "Chicken", "Fish", "Fruit", "Vegetable", "B" )); } private void defaultOptionView(){ ArrayList<TextView> options = new ArrayList<>(); options.add(tv_answerA); options.add(tv_answerB); options.add(tv_answerC); options.add(tv_answerD); for (int i = 0; i < options.size(); i++){ options.get(i).setTextColor(Color.parseColor("#7a8089")); options.get(i).setTypeface(Typeface.DEFAULT); options.get(i).setBackground(ContextCompat.getDrawable(this,R.drawable.default_option_border_bg)); } } @Override public void onClick(View v) { switch (v.getId()){ case R.id.tv_answer_A: selectdOptionView(tv_answerA,1); break; case R.id.tv_answer_B: selectdOptionView(tv_answerB,2); break; case R.id.tv_answer_C: selectdOptionView(tv_answerC,3); break; case R.id.tv_answer_D: selectdOptionView(tv_answerD,4); break; case R.id.btn_submit: curentPos++; if (curentPos <= questions.size()) setQuestion(); else{ Intent intent = new Intent(Matching.this, Matching_success.class); startActivity(intent); finish(); } } } private void selectdOptionView(TextView tv, int selectedNum){ defaultOptionView(); mSelectedOptionPosition = selectedNum; tv.setTextColor(Color.parseColor("#363a43")); tv.setTypeface(tv.getTypeface(), Typeface.BOLD); tv.setBackground(ContextCompat.getDrawable(this,R.drawable.selected_option_border_bg)); } }
5,023
0.562154
0.558393
166
29.439758
21.481134
110
false
false
0
0
0
0
0
0
0.704819
false
false
5
0c3b931301fc06c917df2d0e1082cb59f74e7b42
38,689,065,428,746
02c471d0d2e08aed71a309bf9535609b46d5f4df
/src/main/java/com/example/testcasenotdoable/services/PersonServiceImpl.java
7306a9033b56c4b2690e9c3a55c72dd337332358
[]
no_license
jasilva03/SpringMVC-Simple-UnitTest
https://github.com/jasilva03/SpringMVC-Simple-UnitTest
0630862a9d380707ee25b3ed77be274c6775ccc7
5fd35dc04402ae3f08052b9b43da00f645ba4de8
refs/heads/master
2022-11-23T19:38:15.511000
2020-07-28T00:25:20
2020-07-28T00:25:20
283,051,462
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.testcasenotdoable.services; import com.example.testcasenotdoable.model.Person; import com.example.testcasenotdoable.services.PersonService; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; @Service public class PersonServiceImpl implements PersonService { @Override public List<Person> getAll() { Person p1 = new Person("p1","p1"); Person p2 = new Person("p2","p2"); return Arrays.asList(p1, p2); } }
UTF-8
Java
511
java
PersonServiceImpl.java
Java
[]
null
[]
package com.example.testcasenotdoable.services; import com.example.testcasenotdoable.model.Person; import com.example.testcasenotdoable.services.PersonService; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; @Service public class PersonServiceImpl implements PersonService { @Override public List<Person> getAll() { Person p1 = new Person("p1","p1"); Person p2 = new Person("p2","p2"); return Arrays.asList(p1, p2); } }
511
0.726027
0.710372
23
21.217392
21.560747
60
false
false
0
0
0
0
0
0
0.521739
false
false
5
63dec2469d7c9c69d3a0391a71015456c4c0985c
39,513,699,130,399
61e1e65b49c8923796f49d7c9f270f84b66af7d1
/app/src/main/java/com/example/workfinder/confirmAppPage.java
3c2b88c466418612f84cd2224e15e6f28c908214
[]
no_license
ekarati/Work_Finder-Android-App-ESD-Project
https://github.com/ekarati/Work_Finder-Android-App-ESD-Project
a4edcd81d7d4d1eed817e5161928a7a36042319d
0ab686d0f560278b5209d940406c96c7392accba
refs/heads/master
2021-05-17T12:31:32.137000
2020-03-31T12:31:52
2020-03-31T12:31:52
250,777,274
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.workfinder; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import org.w3c.dom.Text; public class confirmAppPage extends AppCompatActivity { TextView company, applyDt, duration, jobTitle, location, stipend, type; Button apply; String key; DatabaseReference ref; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_confirm_app_page); applyDt = (TextView)findViewById(R.id.appA); duration = (TextView)findViewById(R.id.appD); jobTitle = (TextView)findViewById(R.id.appP); location = (TextView)findViewById(R.id.appL); stipend = (TextView)findViewById(R.id.appS); company = (TextView)findViewById(R.id.appC); type = (TextView) findViewById(R.id.appT); apply = (Button)findViewById(R.id.applyBtn); key = getIntent().getStringExtra("key"); ref= FirebaseDatabase.getInstance().getReference().child("Jobs").child(key); applyDt.setText(getIntent().getStringExtra("apply by")); duration.setText(getIntent().getStringExtra("duration")); jobTitle.setText(getIntent().getStringExtra("position")); location.setText(getIntent().getStringExtra("location")); stipend.setText(getIntent().getStringExtra("stipend")); type.setText(getIntent().getStringExtra("type")); company.setText(getIntent().getStringExtra("company")); apply.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { btnApply(); } }); } public void btnApply(){ ref.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { FirebaseDatabase.getInstance().getReference("Users").child(FirebaseAuth.getInstance().getUid()).child(key).setValue("T"); FirebaseDatabase.getInstance().getReference("Jobs").child(key).child(FirebaseAuth.getInstance().getUid()).setValue("T"); Toast.makeText(confirmAppPage.this,"Successfully Applied",Toast.LENGTH_LONG).show(); finish(); startActivity(new Intent(getApplicationContext(), jobUserPage.class)); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } }
UTF-8
Java
3,086
java
confirmAppPage.java
Java
[]
null
[]
package com.example.workfinder; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import org.w3c.dom.Text; public class confirmAppPage extends AppCompatActivity { TextView company, applyDt, duration, jobTitle, location, stipend, type; Button apply; String key; DatabaseReference ref; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_confirm_app_page); applyDt = (TextView)findViewById(R.id.appA); duration = (TextView)findViewById(R.id.appD); jobTitle = (TextView)findViewById(R.id.appP); location = (TextView)findViewById(R.id.appL); stipend = (TextView)findViewById(R.id.appS); company = (TextView)findViewById(R.id.appC); type = (TextView) findViewById(R.id.appT); apply = (Button)findViewById(R.id.applyBtn); key = getIntent().getStringExtra("key"); ref= FirebaseDatabase.getInstance().getReference().child("Jobs").child(key); applyDt.setText(getIntent().getStringExtra("apply by")); duration.setText(getIntent().getStringExtra("duration")); jobTitle.setText(getIntent().getStringExtra("position")); location.setText(getIntent().getStringExtra("location")); stipend.setText(getIntent().getStringExtra("stipend")); type.setText(getIntent().getStringExtra("type")); company.setText(getIntent().getStringExtra("company")); apply.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { btnApply(); } }); } public void btnApply(){ ref.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { FirebaseDatabase.getInstance().getReference("Users").child(FirebaseAuth.getInstance().getUid()).child(key).setValue("T"); FirebaseDatabase.getInstance().getReference("Jobs").child(key).child(FirebaseAuth.getInstance().getUid()).setValue("T"); Toast.makeText(confirmAppPage.this,"Successfully Applied",Toast.LENGTH_LONG).show(); finish(); startActivity(new Intent(getApplicationContext(), jobUserPage.class)); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } }
3,086
0.684057
0.683409
78
38.564102
29.73196
137
false
false
0
0
0
0
0
0
0.730769
false
false
5
85dbc98803eefbaa6ac5dacdd7818c2895dd00c7
38,972,533,290,771
4a8d831da56fb668664ee810ec0bcc8cce930491
/level2/[3์ฐจ]_n์ง„์ˆ˜_๊ฒŒ์ž„/Solution077.java
51938fea5ddc70657f61995c3ae8ddce8d87a80b
[]
no_license
yongbok78/kyb-coding-test
https://github.com/yongbok78/kyb-coding-test
a30bc0b848324e7321d0255bd61b74a08e3d9dc8
39aea47304760a2a7ac88781ab8e929d25e8be09
refs/heads/master
2023-02-28T09:55:34.752000
2021-02-06T11:58:57
2021-02-06T11:58:57
334,563,984
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Solution077 { public String solution(int n, int t, int m, int p) { String answer = ""; int i = 0; int pointer = p - 1; StringBuilder nums = new StringBuilder(); while (answer.length() < t) { nums.append(Integer.toString(i, n).toUpperCase()); i++; if (nums.length() <= pointer) continue; answer += nums.charAt(pointer); pointer += m; } return answer; } public static void main(String[] args) { Solution077 s = new Solution077(); System.out.println(s.solution(2, 4, 2, 1)); System.out.println(s.solution(16, 16, 2, 1)); System.out.println(s.solution(16, 16, 2, 2)); } }
UTF-8
Java
755
java
Solution077.java
Java
[]
null
[]
class Solution077 { public String solution(int n, int t, int m, int p) { String answer = ""; int i = 0; int pointer = p - 1; StringBuilder nums = new StringBuilder(); while (answer.length() < t) { nums.append(Integer.toString(i, n).toUpperCase()); i++; if (nums.length() <= pointer) continue; answer += nums.charAt(pointer); pointer += m; } return answer; } public static void main(String[] args) { Solution077 s = new Solution077(); System.out.println(s.solution(2, 4, 2, 1)); System.out.println(s.solution(16, 16, 2, 1)); System.out.println(s.solution(16, 16, 2, 2)); } }
755
0.513907
0.478146
24
30.458334
18.544943
62
false
false
0
0
0
0
0
0
1.125
false
false
5
110461110a9b56cc29c482170a4be38de00f4c8f
18,837,726,603,252
f35ccf00f20ce8ed27898a8c49aaece431a75f2c
/hospital/src/main/java/com/kkb/bean/Hosregister.java
90475e37fd90625ea1fad80cbda49a83e3ebe78f
[]
no_license
Shuaishuaizai/hospital
https://github.com/Shuaishuaizai/hospital
d27a279b6855f36b178b3f8a71f8889da8d366dd
3c9e5ff177598d8204417d9204d38df2a11be819
refs/heads/master
2023-04-30T08:44:54.307000
2021-05-09T13:13:00
2021-05-09T13:13:00
366,288,737
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kkb.bean; import javax.persistence.Id; /** * @author xiaoyou * */ public class Hosregister { @Id private Integer hosrId; private String hosrIdcar; private String hosrMedical; private Double hosrRegprice; private String hosrPhone; private Integer hosrSelfprice; private Integer hosrSex; private Integer hosrAge; private String hosrWork; private String hosrLookdoctor; private Integer dId; private String hosrRemark; private Integer hosrState; public Integer getHosrId() { return hosrId; } public void setHosrId(Integer hosrId) { this.hosrId = hosrId; } public String getHosrIdcar() { return hosrIdcar; } public void setHosrIdcar(String hosrIdcar) { this.hosrIdcar = hosrIdcar == null ? null : hosrIdcar.trim(); } public String getHosrMedical() { return hosrMedical; } public void setHosrMedical(String hosrMedical) { this.hosrMedical = hosrMedical == null ? null : hosrMedical.trim(); } public Double getHosrRegprice() { return hosrRegprice; } public void setHosrRegprice(Double hosrRegprice) { this.hosrRegprice = hosrRegprice; } public String getHosrPhone() { return hosrPhone; } public void setHosrPhone(String hosrPhone) { this.hosrPhone = hosrPhone == null ? null : hosrPhone.trim(); } public Integer getHosrSelfprice() { return hosrSelfprice; } public void setHosrSelfprice(Integer hosrSelfprice) { this.hosrSelfprice = hosrSelfprice; } public Integer getHosrSex() { return hosrSex; } public void setHosrSex(Integer hosrSex) { this.hosrSex = hosrSex; } public Integer getHosrAge() { return hosrAge; } public void setHosrAge(Integer hosrAge) { this.hosrAge = hosrAge; } public String getHosrWork() { return hosrWork; } public void setHosrWork(String hosrWork) { this.hosrWork = hosrWork == null ? null : hosrWork.trim(); } public String getHosrLookdoctor() { return hosrLookdoctor; } public void setHosrLookdoctor(String hosrLookdoctor) { this.hosrLookdoctor = hosrLookdoctor == null ? null : hosrLookdoctor.trim(); } public Integer getdId() { return dId; } public void setdId(Integer dId) { this.dId = dId; } public String getHosrRemark() { return hosrRemark; } public void setHosrRemark(String hosrRemark) { this.hosrRemark = hosrRemark == null ? null : hosrRemark.trim(); } public Integer getHosrState() { return hosrState; } public void setHosrState(Integer hosrState) { this.hosrState = hosrState; } }
UTF-8
Java
2,837
java
Hosregister.java
Java
[ { "context": "ean;\n\nimport javax.persistence.Id;\n\n/**\n * @author xiaoyou\n *\n */\npublic class Hosregister {\n @Id\n pri", "end": 75, "score": 0.9992508292198181, "start": 68, "tag": "USERNAME", "value": "xiaoyou" } ]
null
[]
package com.kkb.bean; import javax.persistence.Id; /** * @author xiaoyou * */ public class Hosregister { @Id private Integer hosrId; private String hosrIdcar; private String hosrMedical; private Double hosrRegprice; private String hosrPhone; private Integer hosrSelfprice; private Integer hosrSex; private Integer hosrAge; private String hosrWork; private String hosrLookdoctor; private Integer dId; private String hosrRemark; private Integer hosrState; public Integer getHosrId() { return hosrId; } public void setHosrId(Integer hosrId) { this.hosrId = hosrId; } public String getHosrIdcar() { return hosrIdcar; } public void setHosrIdcar(String hosrIdcar) { this.hosrIdcar = hosrIdcar == null ? null : hosrIdcar.trim(); } public String getHosrMedical() { return hosrMedical; } public void setHosrMedical(String hosrMedical) { this.hosrMedical = hosrMedical == null ? null : hosrMedical.trim(); } public Double getHosrRegprice() { return hosrRegprice; } public void setHosrRegprice(Double hosrRegprice) { this.hosrRegprice = hosrRegprice; } public String getHosrPhone() { return hosrPhone; } public void setHosrPhone(String hosrPhone) { this.hosrPhone = hosrPhone == null ? null : hosrPhone.trim(); } public Integer getHosrSelfprice() { return hosrSelfprice; } public void setHosrSelfprice(Integer hosrSelfprice) { this.hosrSelfprice = hosrSelfprice; } public Integer getHosrSex() { return hosrSex; } public void setHosrSex(Integer hosrSex) { this.hosrSex = hosrSex; } public Integer getHosrAge() { return hosrAge; } public void setHosrAge(Integer hosrAge) { this.hosrAge = hosrAge; } public String getHosrWork() { return hosrWork; } public void setHosrWork(String hosrWork) { this.hosrWork = hosrWork == null ? null : hosrWork.trim(); } public String getHosrLookdoctor() { return hosrLookdoctor; } public void setHosrLookdoctor(String hosrLookdoctor) { this.hosrLookdoctor = hosrLookdoctor == null ? null : hosrLookdoctor.trim(); } public Integer getdId() { return dId; } public void setdId(Integer dId) { this.dId = dId; } public String getHosrRemark() { return hosrRemark; } public void setHosrRemark(String hosrRemark) { this.hosrRemark = hosrRemark == null ? null : hosrRemark.trim(); } public Integer getHosrState() { return hosrState; } public void setHosrState(Integer hosrState) { this.hosrState = hosrState; } }
2,837
0.633063
0.633063
140
19.271429
20.211327
84
false
false
0
0
0
0
0
0
0.292857
false
false
5
0f684671c55b921c2eb91fc9738538023116a275
10,617,159,212,831
67932fb255c5063f5bde80e1c221d30cac4d7125
/src/main/java/pages/ProductPage.java
29d44b5ed660651cb3cd6378dc550468440b9d30
[]
no_license
ElenaGh/UrnAutomation
https://github.com/ElenaGh/UrnAutomation
e9f1c71069e36d57d5d42997e534f8441ff8c773
d13f51640a76f42b74e7e317e46172a6a4d8f3ca
refs/heads/master
2021-08-28T00:43:37.243000
2017-12-10T22:42:50
2017-12-10T22:42:50
113,736,988
0
0
null
false
2017-12-10T22:42:51
2017-12-10T09:12:38
2017-12-10T12:41:57
2017-12-10T22:42:51
6,287
0
0
0
Java
false
null
package pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class ProductPage { public static boolean checkProductName(WebDriver browser, String productDesc) { return browser.findElement(By.id("ProductName")).getText().contains(productDesc); } }
UTF-8
Java
304
java
ProductPage.java
Java
[]
null
[]
package pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class ProductPage { public static boolean checkProductName(WebDriver browser, String productDesc) { return browser.findElement(By.id("ProductName")).getText().contains(productDesc); } }
304
0.736842
0.736842
14
19.714285
28.237333
84
false
false
0
0
0
0
0
0
0.857143
false
false
5
6a96561d82a8c9acdea1d5c4eca251797a78008e
11,149,735,158,990
cc8635edbc3a1d8bbfab47f7772d2557d106cdd8
/AVLDriver.java
dea2ba43bed8aa67b66b5fd12e1cf10c686bee73
[]
no_license
sophielandver/AVLTree
https://github.com/sophielandver/AVLTree
267c91a9b7ac3bf70ef74e065f0491b55bc9994c
6e3e7f27b07bddcca17964dba5abedf5d92cebc1
refs/heads/master
2020-04-02T23:28:40.338000
2016-07-10T00:53:17
2016-07-10T00:53:17
62,975,397
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class AVLDriver { /** * This main function reads in instructions on what to do with a * AVL tree. The instructions must be given in the format * "insert n" or "delete n" or "search n" or "traverse" or "exit" where n is an * integer. This method will continually accept instructions * until exit is entered. * @param args */ public static void main(String[] args) { AVLTree tree = new AVLTree(); String command; String operation = " "; Scanner input = new Scanner(System.in); do { command = input.nextLine(); String[] command_array = command.split(" "); operation = command_array[0]; if (operation.equals("insert")) { int number = Integer.parseInt(command_array[1]); Node node = new Node(number); tree.insert(node); } else if (operation.equals("delete")) { int number = Integer.parseInt(command_array[1]); Node node = new Node(number); tree.delete(node); } else if (operation.equals("search")) { int number = Integer.parseInt(command_array[1]); Node node = new Node(number); tree.search(node); } else if (operation.equals("traverse")) { tree.PreOrderTraversal(tree.getRoot()); System.out.println(); } } while (!(operation.equals("exit"))); System.out.println("Exiting!"); input.close(); } }
UTF-8
Java
1,390
java
AVLDriver.java
Java
[]
null
[]
import java.util.Scanner; public class AVLDriver { /** * This main function reads in instructions on what to do with a * AVL tree. The instructions must be given in the format * "insert n" or "delete n" or "search n" or "traverse" or "exit" where n is an * integer. This method will continually accept instructions * until exit is entered. * @param args */ public static void main(String[] args) { AVLTree tree = new AVLTree(); String command; String operation = " "; Scanner input = new Scanner(System.in); do { command = input.nextLine(); String[] command_array = command.split(" "); operation = command_array[0]; if (operation.equals("insert")) { int number = Integer.parseInt(command_array[1]); Node node = new Node(number); tree.insert(node); } else if (operation.equals("delete")) { int number = Integer.parseInt(command_array[1]); Node node = new Node(number); tree.delete(node); } else if (operation.equals("search")) { int number = Integer.parseInt(command_array[1]); Node node = new Node(number); tree.search(node); } else if (operation.equals("traverse")) { tree.PreOrderTraversal(tree.getRoot()); System.out.println(); } } while (!(operation.equals("exit"))); System.out.println("Exiting!"); input.close(); } }
1,390
0.628058
0.62518
61
21.770493
20.281942
80
false
false
0
0
0
0
0
0
2.672131
false
false
5
5b94282ecd9ad3092ab291083e985aadd84a0762
19,679,540,204,068
4a1d631a9811580da7191b219e80850b5b2864c4
/src/org/jgll/grammar/slot/BodyGrammarSlot.java
ba08e74137aa307469faa1dd9b944b3411710493
[]
no_license
seba--/iguana
https://github.com/seba--/iguana
ef7ed01af1bc416f6548d6be891b920e236d5b55
206f29141379f29ff54f351b31253e5a16a56b06
refs/heads/master
2021-01-17T21:57:45.827000
2013-09-15T23:44:08
2013-09-15T23:44:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.jgll.grammar.slot; import java.io.IOException; import java.io.Serializable; import java.io.Writer; import java.util.ArrayList; import java.util.List; import org.jgll.grammar.Symbol; import org.jgll.grammar.slotaction.SlotAction; import org.jgll.parser.GLLParserInternals; import org.jgll.util.Input; /** * * @author Ali Afroozeh * */ public abstract class BodyGrammarSlot extends GrammarSlot implements Serializable { private static final long serialVersionUID = 1L; protected BodyGrammarSlot previous; protected BodyGrammarSlot next; /** * The position from the beginning of the alternate. * Positions start from zero. * TODO: see if can be removed */ protected final int position; protected HeadGrammarSlot head; protected List<SlotAction<Boolean>> preConditions; protected List<SlotAction<Boolean>> popActions; private String label; public BodyGrammarSlot(int position, BodyGrammarSlot previous, HeadGrammarSlot head) { if(position < 0) { throw new IllegalArgumentException("Position cannot be negative."); } this.position = position; this.head = head; if(previous != null) { previous.next = this; } this.previous = previous; this.preConditions = new ArrayList<>(); this.popActions = new ArrayList<>(); } public void addPopAction(SlotAction<Boolean> popAction) { popActions.add(popAction); } public Iterable<SlotAction<Boolean>> getPopActions() { return popActions; } public void addPreCondition(SlotAction<Boolean> preCondition) { preConditions.add(preCondition); } public List<SlotAction<Boolean>> getPreConditions() { return preConditions; } protected boolean executePreConditions(GLLParserInternals parser, Input input) { for(SlotAction<Boolean> preCondition : preConditions) { if(preCondition.execute(parser, input)) { return true; } } return false; } /** * Checks whether the character at the provided input index belongs to the first set */ public abstract boolean testFirstSet(int index, Input input); /** * Checks whether the character at the provided input index belongs to the follow set. * This method should be called if the nonterminal is nullable. */ public abstract boolean testFollowSet(int index, Input input); public abstract void codeIfTestSetCheck(Writer writer) throws IOException; public boolean isFirst() { return previous == null; } public void codeElseTestSetCheck(Writer writer) throws IOException { writer.append("} else { newParseError(grammar.getGrammarSlot(" + this.id + "), ci); label = L0; return; } \n"); } public BodyGrammarSlot next() { return next; } public BodyGrammarSlot previous() { return previous; } public void setPrevious(BodyGrammarSlot previous) { this.previous = previous; } public void setNext(BodyGrammarSlot next) { this.next = next; } public int getPosition() { return position; } public HeadGrammarSlot getHead() { return head; } /** * Returns the grammar symbol after this slot */ public abstract Symbol getSymbol(); public abstract boolean isNullable(); public abstract boolean isNameEqual(BodyGrammarSlot slot); public void setLabel(String label) { this.label = label; } @Override public String toString() { return label; } }
UTF-8
Java
3,321
java
BodyGrammarSlot.java
Java
[ { "context": "s;\nimport org.jgll.util.Input;\n\n/**\n * \n * @author Ali Afroozeh\n *\n */\npublic abstract class BodyGrammarSlot exte", "end": 346, "score": 0.9998825192451477, "start": 334, "tag": "NAME", "value": "Ali Afroozeh" } ]
null
[]
package org.jgll.grammar.slot; import java.io.IOException; import java.io.Serializable; import java.io.Writer; import java.util.ArrayList; import java.util.List; import org.jgll.grammar.Symbol; import org.jgll.grammar.slotaction.SlotAction; import org.jgll.parser.GLLParserInternals; import org.jgll.util.Input; /** * * @author <NAME> * */ public abstract class BodyGrammarSlot extends GrammarSlot implements Serializable { private static final long serialVersionUID = 1L; protected BodyGrammarSlot previous; protected BodyGrammarSlot next; /** * The position from the beginning of the alternate. * Positions start from zero. * TODO: see if can be removed */ protected final int position; protected HeadGrammarSlot head; protected List<SlotAction<Boolean>> preConditions; protected List<SlotAction<Boolean>> popActions; private String label; public BodyGrammarSlot(int position, BodyGrammarSlot previous, HeadGrammarSlot head) { if(position < 0) { throw new IllegalArgumentException("Position cannot be negative."); } this.position = position; this.head = head; if(previous != null) { previous.next = this; } this.previous = previous; this.preConditions = new ArrayList<>(); this.popActions = new ArrayList<>(); } public void addPopAction(SlotAction<Boolean> popAction) { popActions.add(popAction); } public Iterable<SlotAction<Boolean>> getPopActions() { return popActions; } public void addPreCondition(SlotAction<Boolean> preCondition) { preConditions.add(preCondition); } public List<SlotAction<Boolean>> getPreConditions() { return preConditions; } protected boolean executePreConditions(GLLParserInternals parser, Input input) { for(SlotAction<Boolean> preCondition : preConditions) { if(preCondition.execute(parser, input)) { return true; } } return false; } /** * Checks whether the character at the provided input index belongs to the first set */ public abstract boolean testFirstSet(int index, Input input); /** * Checks whether the character at the provided input index belongs to the follow set. * This method should be called if the nonterminal is nullable. */ public abstract boolean testFollowSet(int index, Input input); public abstract void codeIfTestSetCheck(Writer writer) throws IOException; public boolean isFirst() { return previous == null; } public void codeElseTestSetCheck(Writer writer) throws IOException { writer.append("} else { newParseError(grammar.getGrammarSlot(" + this.id + "), ci); label = L0; return; } \n"); } public BodyGrammarSlot next() { return next; } public BodyGrammarSlot previous() { return previous; } public void setPrevious(BodyGrammarSlot previous) { this.previous = previous; } public void setNext(BodyGrammarSlot next) { this.next = next; } public int getPosition() { return position; } public HeadGrammarSlot getHead() { return head; } /** * Returns the grammar symbol after this slot */ public abstract Symbol getSymbol(); public abstract boolean isNullable(); public abstract boolean isNameEqual(BodyGrammarSlot slot); public void setLabel(String label) { this.label = label; } @Override public String toString() { return label; } }
3,315
0.728696
0.727793
148
21.43919
24.345272
114
false
false
0
0
0
0
0
0
1.506757
false
false
5
e4579a57a86e617ad5966e0cdc33dc0eb7a19418
33,225,867,053,457
51208458940cf15883f8287841d498e23a41606a
/a1755144/2018/s1/fcs/week-10/practical-06/MySearchAlg/Main.java
e272bc98e548d70600e33a3d06ef7602ce203085
[]
no_license
chengen1213/uniwork
https://github.com/chengen1213/uniwork
dc72a92daaf7d8a7e11873b1f181f500220787dc
1456477360c958cad13ee32cc6a94ed03a6eed1f
refs/heads/master
2022-04-06T18:15:05.197000
2020-03-05T09:57:45
2020-03-05T09:57:45
230,687,212
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; public class Main { public static void main(String[] args) { int numOfElements = 10; ArrayList<MySearchAlg> mySearchAlgs = new ArrayList<>(); MySearchAlg linearSearch = new LinearSearch(); MySearchAlg binarySearch = new BinarySearch(); mySearchAlgs.add(linearSearch); mySearchAlgs.add(binarySearch); SortAlgs sortAlg = new QuickSort(); for (MySearchAlg mySearchAlg : mySearchAlgs) { System.out.println(); System.out.println(mySearchAlg.getClass().getName()); System.out.println(); //test each search algorithm for 3 times for (int i = 0; i < 3; i++) { int[] targetArray = randomArrayGenerator(numOfElements, 1); System.out.println("Test case " + (i + 1)); System.out.print("Target array: "); printArray(targetArray); int ans = randomNumGenerator(targetArray.length); int result; //process for binary search if (mySearchAlg.getClass().getName().equals("BinarySearch")) { //sorted index array int[] indices = sortAlg.sortIndex(targetArray); //sorted target array int[] sortedArray = sortAlg.sort(targetArray); //index of sorted array result = mySearchAlg.search(sortedArray, targetArray[ans]); //index of original array result = indices[result]; } else { result = mySearchAlg.search(targetArray, targetArray[ans]); } //print test result System.out.println("Target value = " + targetArray[ans] + ", result = " + result + ", ans = " + ans + ", test: " + test(result, ans)); System.out.println("------------------------------------------"); } } System.out.println(); System.out.println("findMaxVal"); System.out.println(); //test the method for three times for (int i = 0; i < 3; i++) { System.out.println("Test case " + (i + 1)); int[] randomArray = randomArrayGenerator(10, 2); System.out.print("Target array: "); printArray(randomArray); System.out.println("Max value = " + randomArray[findMaxVal(randomArray)] + ", index = " + findMaxVal(randomArray) + "."); System.out.println("------------------------------------------"); } } private static boolean test(int result, int ans) { return result == ans; } private static int findMaxVal(int[] array) { for (int i = 0; i < array.length - 1; i++) { if (array[i] > array[i + 1]) { return i; } } return array.length - 1; // SortAlgs sortAlgs = new QuickSort(); // MySearchAlg mySearchAlg = new LinearSearch(); // int[] result = sortAlgs.sort(array); // return mySearchAlg.search(array, result[array.length - 1]); } private static void printArray(int[] array) { String output; if (array.length > 0) { output = "["; for (int value : array) { output += value + ","; } output = output.trim(); output = output.substring(0, output.length() - 1) + "]"; } else { output = "[]"; } System.out.println(output); } private static int[] randomArrayGenerator(int arrayLength, int function) { int[] randomArray = new int[arrayLength]; //function 0: simple random numbers if (function == 0) { for (int i = 0; i < arrayLength; i++) { int randomNum = (int) (Math.random() * 20); randomArray[i] = randomNum; } } //function 1: none repeated random numbers for (int i = 0; i < arrayLength; i++) { if (function == 1) { Boolean test = true; int randomNum = 0; while (test) { test = false; randomNum = (int) (Math.random() * 20); for (int j = 0; j < i; j++) { if (randomArray[j] == randomNum) { test = true; break; } } } randomArray[i] = randomNum; } } //function 2: none repeated, first ascending then descending int highpoint = (int) (Math.random() * (arrayLength - 2)) + 1; int prev = 0; for (int i = 0; i < arrayLength; i++) { if (function == 2) { if (i <= highpoint) { int randomNum = (int) (Math.random() * 100); randomArray[i] = randomNum + prev + 1; prev = randomArray[i]; } else { int randomNum = (int) (Math.random() * 100); randomArray[i] = prev - randomNum - 1; prev = randomArray[i]; } } } return randomArray; } private static int randomNumGenerator(int maxValue) { return (int) (Math.random() * maxValue); } }
UTF-8
Java
5,505
java
Main.java
Java
[]
null
[]
import java.util.ArrayList; public class Main { public static void main(String[] args) { int numOfElements = 10; ArrayList<MySearchAlg> mySearchAlgs = new ArrayList<>(); MySearchAlg linearSearch = new LinearSearch(); MySearchAlg binarySearch = new BinarySearch(); mySearchAlgs.add(linearSearch); mySearchAlgs.add(binarySearch); SortAlgs sortAlg = new QuickSort(); for (MySearchAlg mySearchAlg : mySearchAlgs) { System.out.println(); System.out.println(mySearchAlg.getClass().getName()); System.out.println(); //test each search algorithm for 3 times for (int i = 0; i < 3; i++) { int[] targetArray = randomArrayGenerator(numOfElements, 1); System.out.println("Test case " + (i + 1)); System.out.print("Target array: "); printArray(targetArray); int ans = randomNumGenerator(targetArray.length); int result; //process for binary search if (mySearchAlg.getClass().getName().equals("BinarySearch")) { //sorted index array int[] indices = sortAlg.sortIndex(targetArray); //sorted target array int[] sortedArray = sortAlg.sort(targetArray); //index of sorted array result = mySearchAlg.search(sortedArray, targetArray[ans]); //index of original array result = indices[result]; } else { result = mySearchAlg.search(targetArray, targetArray[ans]); } //print test result System.out.println("Target value = " + targetArray[ans] + ", result = " + result + ", ans = " + ans + ", test: " + test(result, ans)); System.out.println("------------------------------------------"); } } System.out.println(); System.out.println("findMaxVal"); System.out.println(); //test the method for three times for (int i = 0; i < 3; i++) { System.out.println("Test case " + (i + 1)); int[] randomArray = randomArrayGenerator(10, 2); System.out.print("Target array: "); printArray(randomArray); System.out.println("Max value = " + randomArray[findMaxVal(randomArray)] + ", index = " + findMaxVal(randomArray) + "."); System.out.println("------------------------------------------"); } } private static boolean test(int result, int ans) { return result == ans; } private static int findMaxVal(int[] array) { for (int i = 0; i < array.length - 1; i++) { if (array[i] > array[i + 1]) { return i; } } return array.length - 1; // SortAlgs sortAlgs = new QuickSort(); // MySearchAlg mySearchAlg = new LinearSearch(); // int[] result = sortAlgs.sort(array); // return mySearchAlg.search(array, result[array.length - 1]); } private static void printArray(int[] array) { String output; if (array.length > 0) { output = "["; for (int value : array) { output += value + ","; } output = output.trim(); output = output.substring(0, output.length() - 1) + "]"; } else { output = "[]"; } System.out.println(output); } private static int[] randomArrayGenerator(int arrayLength, int function) { int[] randomArray = new int[arrayLength]; //function 0: simple random numbers if (function == 0) { for (int i = 0; i < arrayLength; i++) { int randomNum = (int) (Math.random() * 20); randomArray[i] = randomNum; } } //function 1: none repeated random numbers for (int i = 0; i < arrayLength; i++) { if (function == 1) { Boolean test = true; int randomNum = 0; while (test) { test = false; randomNum = (int) (Math.random() * 20); for (int j = 0; j < i; j++) { if (randomArray[j] == randomNum) { test = true; break; } } } randomArray[i] = randomNum; } } //function 2: none repeated, first ascending then descending int highpoint = (int) (Math.random() * (arrayLength - 2)) + 1; int prev = 0; for (int i = 0; i < arrayLength; i++) { if (function == 2) { if (i <= highpoint) { int randomNum = (int) (Math.random() * 100); randomArray[i] = randomNum + prev + 1; prev = randomArray[i]; } else { int randomNum = (int) (Math.random() * 100); randomArray[i] = prev - randomNum - 1; prev = randomArray[i]; } } } return randomArray; } private static int randomNumGenerator(int maxValue) { return (int) (Math.random() * maxValue); } }
5,505
0.470663
0.462125
149
35.946308
23.278236
102
false
false
0
0
0
0
0
0
0.644295
false
false
5
cbe51f0a8d44200f213d14c78b5ce585a3a09ba0
10,376,641,042,557
e30a0fddcd2a98731a84caf7736d3a9634e7c55f
/src/main/java/com/chocobo/composite/util/ShipIdGenerator.java
a72d3f652985f792018216099f9326a6122e618d
[]
no_license
ChoCoBo1712/epam-threading
https://github.com/ChoCoBo1712/epam-threading
8ad468cd3c6305c6877f809fcb990537d091d397
8533a3cf8f43794f3cc408488d17a11830d6f1d4
refs/heads/master
2023-06-30T09:50:30.112000
2021-07-28T11:46:53
2021-07-28T11:46:53
372,309,269
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chocobo.composite.util; public class ShipIdGenerator { private static long counter; private ShipIdGenerator() { } public static long generateId() { return ++counter; } }
UTF-8
Java
210
java
ShipIdGenerator.java
Java
[]
null
[]
package com.chocobo.composite.util; public class ShipIdGenerator { private static long counter; private ShipIdGenerator() { } public static long generateId() { return ++counter; } }
210
0.671429
0.671429
12
16.5
15.787653
37
false
false
0
0
0
0
0
0
0.25
false
false
5
02d10999c38e88c39aab63b9efac2f924c36cb23
26,036,091,790,863
823732a62781bae4aa5335fcb06823cdb01b4ce7
/SearchFileContents_Toni.java
7fee072651bfa9e520ffbda5a0439625c4deda33
[]
no_license
Hyonsok/ubc-cpsc213
https://github.com/Hyonsok/ubc-cpsc213
c6a2821d744376669cf9d24f440319927c638b41
fbc34480fbfde0541c77039d8b8358794affd266
refs/heads/master
2022-07-25T04:47:48.373000
2019-07-04T18:12:13
2019-07-04T18:12:13
195,284,507
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.io.*; public class SearchFileContents extends JFrame { private DefaultListModel<File> fileListModel; private JList<File> fileList; private JLabel searchTextLabel; private JTextField searchTextField; private JLabel directoryLabel; private JTextField directoryTextField; private JButton directorySelectButton; private JButton startSearchButton; private JButton stopButton; private JLabel resultCountLabel; private boolean searchInProgress = false; private boolean searchInterrupted = false; public SearchFileContents() { super("Search File Contents"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800, 600); JPanel searchTextPanel = new JPanel(new FlowLayout()); this.getContentPane().add(searchTextPanel, BorderLayout.NORTH); JPanel part2 = new JPanel(new BorderLayout()); this.getContentPane().add(part2, BorderLayout.CENTER); JPanel directoryPanel = new JPanel(new FlowLayout()); part2.add(directoryPanel, BorderLayout.NORTH); JPanel part3 = new JPanel(new BorderLayout()); part2.add(part3, BorderLayout.CENTER); JPanel buttons = new JPanel(new FlowLayout()); part3.add(buttons, BorderLayout.NORTH); // TODO Add list to part 3 searchTextLabel = new JLabel("Search files with text:"); searchTextPanel.add(searchTextLabel); searchTextField = new JTextField(40); searchTextLabel.setLabelFor(searchTextField); searchTextPanel.add(searchTextField); directoryLabel = new JLabel("In directory:"); directoryPanel.add(directoryLabel); String currentDirectory = null; try { currentDirectory = new File(".").getCanonicalPath(); } catch (IOException e) { currentDirectory = new File(".").getAbsolutePath(); } directoryTextField = new JTextField(currentDirectory, 50); directoryLabel.setLabelFor(directoryTextField); directoryPanel.add(directoryTextField); directorySelectButton = new JButton("Select..."); directorySelectButton.addActionListener((ActionEvent e) -> { selectDirectory(); }); directoryPanel.add(directorySelectButton); startSearchButton = new JButton("Search"); startSearchButton.addActionListener((ActionEvent e) -> { startSearch(); }); buttons.add(startSearchButton); this.getRootPane().setDefaultButton(startSearchButton); stopButton = new JButton("Stop Search"); stopButton.addActionListener((ActionEvent e) -> { searchInterrupted = true; }); buttons.add(stopButton); fileListModel = new DefaultListModel<File>(); fileList = new JList<File>(fileListModel); part3.add(new JScrollPane(fileList), BorderLayout.CENTER); resultCountLabel = new JLabel(""); part3.add(resultCountLabel, BorderLayout.SOUTH); } private void startSearch() { if (searchInProgress) { searchInterrupted = true; return; } File file = new File(directoryTextField.getText()); if (!file.exists() || !file.isDirectory()) { JOptionPane.showMessageDialog(this, "The provided name is not a valid directory in your system.", "Error", JOptionPane.ERROR_MESSAGE); return; } searchInProgress = true; searchInterrupted = false; searchTextField.setEnabled(false); directoryTextField.setEnabled(false); directorySelectButton.setEnabled(false); startSearchButton.setText("Stop Searching"); fileList.requestFocus(); fileListModel.removeAllElements(); resultCountLabel.setText(""); processFile(file, searchTextField.getText()); searchInProgress = false; searchTextField.setEnabled(true); directoryTextField.setEnabled(true); directorySelectButton.setEnabled(true); startSearchButton.setText("Search"); } private void processFile(File file, String textToSearch) { Thread t = new Thread() { public void run(){ if (file.isDirectory()) { for (File dirEntry : file.listFiles()) { processFile(dirEntry, textToSearch); if (searchInterrupted) return; } } else { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { String line; while (!searchInterrupted && (line = reader.readLine()) != null) { if (line.contains(textToSearch)) { // The following two lines MUST execute in Swing's Event Dispatch Thread fileListModel.addElement(file); resultCountLabel.setText(fileListModel.getSize() + " file(s) found."); break; } } } catch (FileNotFoundException e) { // Skip file } catch (IOException e) { // Skip file } } } }; t.start(); } private void selectDirectory() { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new File(directoryTextField.getText())); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int rv = chooser.showOpenDialog(this); if (rv != JFileChooser.APPROVE_OPTION) return; File file = chooser.getSelectedFile(); directoryTextField.setText(file.getAbsolutePath()); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> { SearchFileContents window = new SearchFileContents(); window.setVisible(true); }); } }
UTF-8
Java
6,215
java
SearchFileContents_Toni.java
Java
[]
null
[]
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.io.*; public class SearchFileContents extends JFrame { private DefaultListModel<File> fileListModel; private JList<File> fileList; private JLabel searchTextLabel; private JTextField searchTextField; private JLabel directoryLabel; private JTextField directoryTextField; private JButton directorySelectButton; private JButton startSearchButton; private JButton stopButton; private JLabel resultCountLabel; private boolean searchInProgress = false; private boolean searchInterrupted = false; public SearchFileContents() { super("Search File Contents"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800, 600); JPanel searchTextPanel = new JPanel(new FlowLayout()); this.getContentPane().add(searchTextPanel, BorderLayout.NORTH); JPanel part2 = new JPanel(new BorderLayout()); this.getContentPane().add(part2, BorderLayout.CENTER); JPanel directoryPanel = new JPanel(new FlowLayout()); part2.add(directoryPanel, BorderLayout.NORTH); JPanel part3 = new JPanel(new BorderLayout()); part2.add(part3, BorderLayout.CENTER); JPanel buttons = new JPanel(new FlowLayout()); part3.add(buttons, BorderLayout.NORTH); // TODO Add list to part 3 searchTextLabel = new JLabel("Search files with text:"); searchTextPanel.add(searchTextLabel); searchTextField = new JTextField(40); searchTextLabel.setLabelFor(searchTextField); searchTextPanel.add(searchTextField); directoryLabel = new JLabel("In directory:"); directoryPanel.add(directoryLabel); String currentDirectory = null; try { currentDirectory = new File(".").getCanonicalPath(); } catch (IOException e) { currentDirectory = new File(".").getAbsolutePath(); } directoryTextField = new JTextField(currentDirectory, 50); directoryLabel.setLabelFor(directoryTextField); directoryPanel.add(directoryTextField); directorySelectButton = new JButton("Select..."); directorySelectButton.addActionListener((ActionEvent e) -> { selectDirectory(); }); directoryPanel.add(directorySelectButton); startSearchButton = new JButton("Search"); startSearchButton.addActionListener((ActionEvent e) -> { startSearch(); }); buttons.add(startSearchButton); this.getRootPane().setDefaultButton(startSearchButton); stopButton = new JButton("Stop Search"); stopButton.addActionListener((ActionEvent e) -> { searchInterrupted = true; }); buttons.add(stopButton); fileListModel = new DefaultListModel<File>(); fileList = new JList<File>(fileListModel); part3.add(new JScrollPane(fileList), BorderLayout.CENTER); resultCountLabel = new JLabel(""); part3.add(resultCountLabel, BorderLayout.SOUTH); } private void startSearch() { if (searchInProgress) { searchInterrupted = true; return; } File file = new File(directoryTextField.getText()); if (!file.exists() || !file.isDirectory()) { JOptionPane.showMessageDialog(this, "The provided name is not a valid directory in your system.", "Error", JOptionPane.ERROR_MESSAGE); return; } searchInProgress = true; searchInterrupted = false; searchTextField.setEnabled(false); directoryTextField.setEnabled(false); directorySelectButton.setEnabled(false); startSearchButton.setText("Stop Searching"); fileList.requestFocus(); fileListModel.removeAllElements(); resultCountLabel.setText(""); processFile(file, searchTextField.getText()); searchInProgress = false; searchTextField.setEnabled(true); directoryTextField.setEnabled(true); directorySelectButton.setEnabled(true); startSearchButton.setText("Search"); } private void processFile(File file, String textToSearch) { Thread t = new Thread() { public void run(){ if (file.isDirectory()) { for (File dirEntry : file.listFiles()) { processFile(dirEntry, textToSearch); if (searchInterrupted) return; } } else { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { String line; while (!searchInterrupted && (line = reader.readLine()) != null) { if (line.contains(textToSearch)) { // The following two lines MUST execute in Swing's Event Dispatch Thread fileListModel.addElement(file); resultCountLabel.setText(fileListModel.getSize() + " file(s) found."); break; } } } catch (FileNotFoundException e) { // Skip file } catch (IOException e) { // Skip file } } } }; t.start(); } private void selectDirectory() { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new File(directoryTextField.getText())); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int rv = chooser.showOpenDialog(this); if (rv != JFileChooser.APPROVE_OPTION) return; File file = chooser.getSelectedFile(); directoryTextField.setText(file.getAbsolutePath()); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> { SearchFileContents window = new SearchFileContents(); window.setVisible(true); }); } }
6,215
0.601448
0.59823
171
35.345028
24.067236
109
false
false
0
0
0
0
0
0
0.672515
false
false
5
1cb3d4313d33436a24d50b97d19e068f070a4905
21,474,836,546,646
7c8fac40ed6ab5d0843652a4a172561ffb708a92
/PoC-result/src/main/java/com/aufbau/PoCresult/service/VoteService.java
76f3c4d3d9a3cca58f2d817856ea499d83ae9a6c
[]
no_license
Aufbau/PoC-result
https://github.com/Aufbau/PoC-result
d27a0aa5bbfb1bac2442656788f00ce845775e3b
5d55558d0389a971ff79545ba35972f72b2e0590
refs/heads/master
2023-03-02T12:20:51.569000
2021-02-01T10:34:37
2021-02-01T10:34:37
332,652,732
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aufbau.PoCresult.service; import com.aufbau.PoCresult.dao.VoteRepository; import com.aufbau.PoCresult.models.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /* VoteRepository (which is an interface) is auto implemented by Spring. That implementation provides the countVotes() function. */ @Service public class VoteService { private final VoteRepository voteRepository; @Autowired public VoteService(VoteRepository voteRepository) { this.voteRepository = voteRepository; } public List<Result> countVotes() { /* VoteRepository.countVotes() return a List<Object[]> Object[0] is the String voteOption Object[1] is the Number countOfVoteOption List<Object[]> contains the Object[] for every vote option. */ List<Object[]> lst = voteRepository.countVotes(); List<Result> res = new ArrayList<>(); for (Object[] o : lst) { Result r = new Result((String) o[0], ((Number) o[1]).intValue()); res.add(r); } return res; } }
UTF-8
Java
1,228
java
VoteService.java
Java
[]
null
[]
package com.aufbau.PoCresult.service; import com.aufbau.PoCresult.dao.VoteRepository; import com.aufbau.PoCresult.models.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /* VoteRepository (which is an interface) is auto implemented by Spring. That implementation provides the countVotes() function. */ @Service public class VoteService { private final VoteRepository voteRepository; @Autowired public VoteService(VoteRepository voteRepository) { this.voteRepository = voteRepository; } public List<Result> countVotes() { /* VoteRepository.countVotes() return a List<Object[]> Object[0] is the String voteOption Object[1] is the Number countOfVoteOption List<Object[]> contains the Object[] for every vote option. */ List<Object[]> lst = voteRepository.countVotes(); List<Result> res = new ArrayList<>(); for (Object[] o : lst) { Result r = new Result((String) o[0], ((Number) o[1]).intValue()); res.add(r); } return res; } }
1,228
0.660423
0.657166
47
25.127659
24.754641
77
false
false
0
0
0
0
0
0
0.319149
false
false
5
e5e4bed828d308e21d8ad6b4fe390019da83ead5
32,873,679,739,849
88d12ff2fa5d301cfadc205483e5723111b57788
/app/repositories/JpaRegionRepository.java
25d0c88c1644271fa013f3cde5c289024bf02fe5
[ "Apache-2.0" ]
permissive
AsuraMedia/tradepackers.api
https://github.com/AsuraMedia/tradepackers.api
e4b27e81a6987caa1ce86aae414a0eb902cee000
72ce7779f5fc8b893ebde8e013e0ed1ec0b56eae
refs/heads/master
2021-05-02T09:34:11.368000
2017-02-17T02:41:46
2017-02-17T02:41:46
72,882,231
1
0
null
false
2017-02-17T02:41:47
2016-11-04T20:16:37
2016-11-21T07:37:45
2017-02-17T02:41:47
149
0
0
0
Java
null
null
package repositories; import models.Region; import play.db.jpa.JPAApi; import repositories.base.JpaRepository; import repositories.interfaces.RegionRepository; import javax.inject.Inject; import javax.inject.Singleton; /** * Created by eduardo on 12/02/17. */ @Singleton public class JpaRegionRepository extends JpaRepository<Region> implements RegionRepository { @Inject public JpaRegionRepository(final JPAApi jpaApi) { super(jpaApi, Region.class); } }
UTF-8
Java
473
java
JpaRegionRepository.java
Java
[ { "context": "\nimport javax.inject.Singleton;\n\n/**\n * Created by eduardo on 12/02/17.\n */\n@Singleton\npublic class JpaRegio", "end": 247, "score": 0.9089893102645874, "start": 240, "tag": "USERNAME", "value": "eduardo" } ]
null
[]
package repositories; import models.Region; import play.db.jpa.JPAApi; import repositories.base.JpaRepository; import repositories.interfaces.RegionRepository; import javax.inject.Inject; import javax.inject.Singleton; /** * Created by eduardo on 12/02/17. */ @Singleton public class JpaRegionRepository extends JpaRepository<Region> implements RegionRepository { @Inject public JpaRegionRepository(final JPAApi jpaApi) { super(jpaApi, Region.class); } }
473
0.784355
0.77167
23
19.565218
21.975927
90
false
false
0
0
0
0
0
0
0.391304
false
false
5
fe383c63f8d7d065fed4761bdc3270aa02e6565c
206,158,433,305
e29dfefcccf63126a328ebafad29701e8724f53c
/talleres/taller01/DigraphAM.java
bb0dae2a166d2e55e3155a5d565db6e92f9dbc44
[]
no_license
DavidLakeT/ST0247-002
https://github.com/DavidLakeT/ST0247-002
7c2c8a769fd474fad063ef4361526ac4b6dbf9c7
ccbaee735a500d4aac9d01ffb424b9eba27a39fc
refs/heads/master
2023-04-26T01:51:33.591000
2021-06-02T02:14:11
2021-06-02T02:14:11
332,781,655
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.DavidLake.DatosAlgoritmos2.Taller01; import java.lang.reflect.Array; import java.util.ArrayList; public class DigraphAM extends Digraph { private int size; private int[][] matriz; public DigraphAM(int size) { super(size); this.size = size; matriz = new int[size][size]; for(int i = 0; i < size; i++){ for(int k = 0; k < size; k++){ matriz[i][k] = 0; } } } public void addArc(int source, int destination, int weight) { matriz[source][destination] = weight; } public ArrayList<Integer> getSuccessors(int vertex) { ArrayList<Integer> sucesores = new ArrayList<>(); ArrayList<Integer> sucesoresAux = new ArrayList<>(); for(int i = 0; i < this.size; i++){ sucesores.add(matriz[vertex][i]); if(sucesores.get(i) != 0){ sucesoresAux.add(i); } } return sucesoresAux; } public int getWeight(int source, int destination) { return matriz[source][destination]; } }
UTF-8
Java
1,161
java
DigraphAM.java
Java
[ { "context": "package me.DavidLake.DatosAlgoritmos2.Taller01;\r\n\r\nimport java.lang.re", "end": 20, "score": 0.7303975820541382, "start": 11, "tag": "USERNAME", "value": "DavidLake" } ]
null
[]
package me.DavidLake.DatosAlgoritmos2.Taller01; import java.lang.reflect.Array; import java.util.ArrayList; public class DigraphAM extends Digraph { private int size; private int[][] matriz; public DigraphAM(int size) { super(size); this.size = size; matriz = new int[size][size]; for(int i = 0; i < size; i++){ for(int k = 0; k < size; k++){ matriz[i][k] = 0; } } } public void addArc(int source, int destination, int weight) { matriz[source][destination] = weight; } public ArrayList<Integer> getSuccessors(int vertex) { ArrayList<Integer> sucesores = new ArrayList<>(); ArrayList<Integer> sucesoresAux = new ArrayList<>(); for(int i = 0; i < this.size; i++){ sucesores.add(matriz[vertex][i]); if(sucesores.get(i) != 0){ sucesoresAux.add(i); } } return sucesoresAux; } public int getWeight(int source, int destination) { return matriz[source][destination]; } }
1,161
0.530577
0.523686
52
20.326923
20.624594
65
false
false
0
0
0
0
0
0
0.480769
false
false
5
e7d56c09eea9a977362d0785b6832ac2b0b4ae90
5,162,550,712,860
6e5a8fd3002ac526d4c2a7e9f567974594d0c006
/src/test/java/com/xu/tao/service/Impl/UserServiceImplTest.java
b91dc5ef0acc96ea0d305bda6c2fd4aa42c59459
[]
no_license
xubyxiaobao/change_data_source
https://github.com/xubyxiaobao/change_data_source
1c76c08813faffed5996b34f7f0ccdfebf0f2932
117a13d66ec00f70770564950af2d9671712595b
refs/heads/master
2021-08-30T06:21:04.643000
2017-12-16T12:51:16
2017-12-16T12:51:16
114,460,521
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xu.tao.service.Impl; import com.xu.tao.pojo.User; import com.xu.tao.service.IUserService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import static org.junit.Assert.*; /** * Created by xutao on 2017/12/16. */ @RunWith(SpringRunner.class) @SpringBootTest public class UserServiceImplTest { @Autowired private IUserService service; @Test public void savePrimary() throws Exception { User user = new User(); user.setUsername("ไธปๅบ“"); user.setPassword("primary"); service.savePrimary(user); } @Test public void saveSlave() throws Exception { User primary = new User(); primary.setUsername("ไธปๅบ“"); primary.setPassword("primary"); User slave = new User(); slave.setUsername("ไปŽๅบ“"); slave.setPassword("slave"); service.savePrimary(primary); service.saveSlave(slave); } }
UTF-8
Java
1,119
java
UserServiceImplTest.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n * Created by xutao on 2017/12/16.\n */\n@RunWith(SpringRunner.class)\n@", "end": 403, "score": 0.9993395805358887, "start": 398, "tag": "USERNAME", "value": "xutao" }, { "context": "User user = new User();\n user.setUsername(\"ไธปๅบ“\");\n user.setPassword(\"primary\");\n s", "end": 672, "score": 0.9943289160728455, "start": 670, "tag": "USERNAME", "value": "ไธปๅบ“" }, { "context": "user.setUsername(\"ไธปๅบ“\");\n user.setPassword(\"primary\");\n service.savePrimary(user);\n }\n\n ", "end": 709, "score": 0.9991685152053833, "start": 702, "tag": "PASSWORD", "value": "primary" }, { "context": "rimary = new User();\n primary.setUsername(\"ไธปๅบ“\");\n primary.setPassword(\"primary\");\n\n ", "end": 880, "score": 0.9919777512550354, "start": 878, "tag": "USERNAME", "value": "ไธปๅบ“" }, { "context": "y.setUsername(\"ไธปๅบ“\");\n primary.setPassword(\"primary\");\n\n User slave = new User();\n slav", "end": 920, "score": 0.9990319013595581, "start": 913, "tag": "PASSWORD", "value": "primary" }, { "context": "er slave = new User();\n slave.setUsername(\"ไปŽๅบ“\");\n slave.setPassword(\"slave\");\n se", "end": 987, "score": 0.9938162565231323, "start": 985, "tag": "USERNAME", "value": "ไปŽๅบ“" }, { "context": "ave.setUsername(\"ไปŽๅบ“\");\n slave.setPassword(\"slave\");\n service.savePrimary(primary);\n ", "end": 1023, "score": 0.9992544054985046, "start": 1018, "tag": "PASSWORD", "value": "slave" } ]
null
[]
package com.xu.tao.service.Impl; import com.xu.tao.pojo.User; import com.xu.tao.service.IUserService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import static org.junit.Assert.*; /** * Created by xutao on 2017/12/16. */ @RunWith(SpringRunner.class) @SpringBootTest public class UserServiceImplTest { @Autowired private IUserService service; @Test public void savePrimary() throws Exception { User user = new User(); user.setUsername("ไธปๅบ“"); user.setPassword("<PASSWORD>"); service.savePrimary(user); } @Test public void saveSlave() throws Exception { User primary = new User(); primary.setUsername("ไธปๅบ“"); primary.setPassword("<PASSWORD>"); User slave = new User(); slave.setUsername("ไปŽๅบ“"); slave.setPassword("<PASSWORD>"); service.savePrimary(primary); service.saveSlave(slave); } }
1,130
0.684734
0.676603
45
23.622223
18.290604
62
false
false
0
0
0
0
0
0
0.488889
false
false
5
d8aecd0df277ef9ba94785c6e5c91d01c1774ce5
13,572,096,678,492
238f71529804f85ae4cc78575d579bd4aeffc3f6
/src/test/resources/expectations/java/testjava/TestIgnoreInInterfaceBase.java
01c9476b53ae1dfc0387440d813e346cd83fbd7c
[]
no_license
Catalysts/cdoclet
https://github.com/Catalysts/cdoclet
c6e2e09234e16c41ba4d670f9b23f269af77a98a
d9f82a6ac6b0179bfd419e2510a6cea3b63b7e92
refs/heads/master
2016-09-06T02:44:31.551000
2015-03-15T21:16:47
2015-03-15T21:16:47
3,842,400
0
0
null
false
2015-03-18T12:22:54
2012-03-27T10:00:37
2015-03-15T21:16:54
2015-03-18T12:21:21
976
1
0
1
Java
null
null
package testjava; /** * Generated by CDoclet from test.TestIgnoreInInterfaceBase. Do not edit. */ public interface TestIgnoreInInterfaceBase<T> extends testjava.TestOverrideInterfaceBase<T> { }
UTF-8
Java
198
java
TestIgnoreInInterfaceBase.java
Java
[]
null
[]
package testjava; /** * Generated by CDoclet from test.TestIgnoreInInterfaceBase. Do not edit. */ public interface TestIgnoreInInterfaceBase<T> extends testjava.TestOverrideInterfaceBase<T> { }
198
0.792929
0.792929
6
31.666666
37.124416
93
false
false
0
0
0
0
0
0
0.166667
false
false
5
0a3af486cc7515c40704c55f1cae111888993abd
8,358,006,377,591
20fd58ae2446f0e7c710f0864f5d6d230fabed07
/app/src/main/java/art/ozandmlr/vkmessenger/VKFirebaseMessaginingServer.java
2d71e83b34bef6dc520b0e587e046ee586f4afc1
[]
no_license
tima2015/VKMessenger
https://github.com/tima2015/VKMessenger
8285233efa316ef360aee01c4f9a5bfbbda5d4d2
5eaef618391c50c1f23854b7fbfb5090d504b9da
refs/heads/master
2020-09-01T08:06:51.689000
2019-11-07T08:30:14
2019-11-07T08:30:14
218,916,126
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package art.ozandmlr.vkmessenger; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; import androidx.annotation.NonNull; import com.google.firebase.messaging.FirebaseMessagingService; public class VKFirebaseMessaginingServer extends FirebaseMessagingService { private static final String TAG = "VKFirebaseMessaginingSe"; public VKFirebaseMessaginingServer() { } @Override public void onNewToken(@NonNull String s) { Log.d(TAG, "onNewToken() called with: s = [" + s + "]"); } }
UTF-8
Java
579
java
VKFirebaseMessaginingServer.java
Java
[]
null
[]
package art.ozandmlr.vkmessenger; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; import androidx.annotation.NonNull; import com.google.firebase.messaging.FirebaseMessagingService; public class VKFirebaseMessaginingServer extends FirebaseMessagingService { private static final String TAG = "VKFirebaseMessaginingSe"; public VKFirebaseMessaginingServer() { } @Override public void onNewToken(@NonNull String s) { Log.d(TAG, "onNewToken() called with: s = [" + s + "]"); } }
579
0.74266
0.74266
26
21.26923
24.248011
75
false
false
0
0
0
0
0
0
0.384615
false
false
5
95e02f239c7669edb4810e27301e1eb979a362e7
6,305,012,034,849
6fc1023105c1db9f47338d0edd9524dcce3ca438
/src/aprisma/akirah/bingung/MainActivity.java
246693472cec0dc4319798f7301caa30c34ff4b1
[]
no_license
akipmaulana/ProgramKB
https://github.com/akipmaulana/ProgramKB
b8be2f8334eed83ef853426f2cdacee4e480441a
eab08dc1e4f6a793722ec74d3c2a115e05cab9ce
refs/heads/master
2020-12-24T15:22:09.861000
2014-12-02T01:45:56
2014-12-02T01:45:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package aprisma.akirah.bingung; import org.json.JSONException; import org.json.JSONObject; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import aprisma.akirah.bingung.detail.DetailActivity; import aprisma.akirah.bingung.holder.Klasifikasi; import aprisma.akirah.bingung.holder.User; public class MainActivity extends Activity { private EditText etmail; private EditText etpass; private String email; private String userpass; private ProgressDialog pDialog; private User user; private int isBackDetail; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Hide Header action bar getActionBar().hide(); etmail = (EditText) findViewById(R.id.etmail); etpass = (EditText) findViewById(R.id.etpass); if (getIntent().getIntExtra("detail", 0) != 0) { isBackDetail = getIntent().getIntExtra("detail", 0); } user = new User(); TextView tvRegist = (TextView) findViewById(R.id.registrasi_link); tvRegist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), RegistrasiActivity.class); intent.putExtra(User.TAG_USER, user); startActivity(intent); overridePendingTransition(R.anim.slide_in, R.anim.slide_in); } }); } /* * Button Action Login */ public void Login(View view) { email = etmail.getText().toString(); userpass = etpass.getText().toString(); if (email.isEmpty() || userpass.isEmpty()) { Toast.makeText(getApplicationContext(), "Masukan Email dan Password Anda", Toast.LENGTH_SHORT) .show(); } else { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo nf = cm.getActiveNetworkInfo(); if (nf != null && nf.isConnected() == true) { new Login().execute(); } else { Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_SHORT).show(); } } } private void backDetail(){ Intent intent = new Intent( this, DetailActivity.class); intent.putExtra(Klasifikasi.TAG_NAME, DetailActivity.namaku); startActivity(intent); } private class Login extends AsyncTask<Void, Void, Void> { private int tag_error; @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage("Please wait . . ."); pDialog.setCancelable(false); pDialog.show(); } @Override protected Void doInBackground(Void... params) { try { JSONObject jsonObj = user.loginUser(email, userpass); tag_error = jsonObj.getInt(User.TAG_ERROR); user.fetchDataUser(jsonObj); } catch (JSONException e) { e.printStackTrace(); } return null; } @SuppressWarnings("deprecation") @Override protected void onPostExecute(Void result) { super.onPostExecute(result); // Dismiss the progress dialog if (pDialog.isShowing()) pDialog.dismiss(); switch (tag_error) { case 0: User.ISLOGIN = true; if (isBackDetail != 0){ backDetail(); } else { onBackPressed(); } break; case 1: Toast.makeText(getApplicationContext(), "Password Salah", Toast.LENGTH_SHORT).show(); break; case 2: AlertDialog alertDialog = new AlertDialog.Builder( MainActivity.this).create(); alertDialog.setTitle("Aktivasi Akun"); alertDialog .setMessage("Akun tidak terdaftar. Silahkan klik Registrasi untuk daftar"); alertDialog.setButton("Registrasi", new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { Intent intent = new Intent( getApplicationContext(), RegistrasiActivity.class); intent.putExtra(User.TAG_USER, user); startActivity(intent); overridePendingTransition(R.anim.slide_in, R.anim.slide_in); } }); alertDialog.setIcon(R.drawable.ic_launcher); alertDialog.show(); break; default: break; } } } }
UTF-8
Java
4,680
java
MainActivity.java
Java
[]
null
[]
package aprisma.akirah.bingung; import org.json.JSONException; import org.json.JSONObject; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import aprisma.akirah.bingung.detail.DetailActivity; import aprisma.akirah.bingung.holder.Klasifikasi; import aprisma.akirah.bingung.holder.User; public class MainActivity extends Activity { private EditText etmail; private EditText etpass; private String email; private String userpass; private ProgressDialog pDialog; private User user; private int isBackDetail; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Hide Header action bar getActionBar().hide(); etmail = (EditText) findViewById(R.id.etmail); etpass = (EditText) findViewById(R.id.etpass); if (getIntent().getIntExtra("detail", 0) != 0) { isBackDetail = getIntent().getIntExtra("detail", 0); } user = new User(); TextView tvRegist = (TextView) findViewById(R.id.registrasi_link); tvRegist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), RegistrasiActivity.class); intent.putExtra(User.TAG_USER, user); startActivity(intent); overridePendingTransition(R.anim.slide_in, R.anim.slide_in); } }); } /* * Button Action Login */ public void Login(View view) { email = etmail.getText().toString(); userpass = etpass.getText().toString(); if (email.isEmpty() || userpass.isEmpty()) { Toast.makeText(getApplicationContext(), "Masukan Email dan Password Anda", Toast.LENGTH_SHORT) .show(); } else { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo nf = cm.getActiveNetworkInfo(); if (nf != null && nf.isConnected() == true) { new Login().execute(); } else { Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_SHORT).show(); } } } private void backDetail(){ Intent intent = new Intent( this, DetailActivity.class); intent.putExtra(Klasifikasi.TAG_NAME, DetailActivity.namaku); startActivity(intent); } private class Login extends AsyncTask<Void, Void, Void> { private int tag_error; @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage("Please wait . . ."); pDialog.setCancelable(false); pDialog.show(); } @Override protected Void doInBackground(Void... params) { try { JSONObject jsonObj = user.loginUser(email, userpass); tag_error = jsonObj.getInt(User.TAG_ERROR); user.fetchDataUser(jsonObj); } catch (JSONException e) { e.printStackTrace(); } return null; } @SuppressWarnings("deprecation") @Override protected void onPostExecute(Void result) { super.onPostExecute(result); // Dismiss the progress dialog if (pDialog.isShowing()) pDialog.dismiss(); switch (tag_error) { case 0: User.ISLOGIN = true; if (isBackDetail != 0){ backDetail(); } else { onBackPressed(); } break; case 1: Toast.makeText(getApplicationContext(), "Password Salah", Toast.LENGTH_SHORT).show(); break; case 2: AlertDialog alertDialog = new AlertDialog.Builder( MainActivity.this).create(); alertDialog.setTitle("Aktivasi Akun"); alertDialog .setMessage("Akun tidak terdaftar. Silahkan klik Registrasi untuk daftar"); alertDialog.setButton("Registrasi", new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { Intent intent = new Intent( getApplicationContext(), RegistrasiActivity.class); intent.putExtra(User.TAG_USER, user); startActivity(intent); overridePendingTransition(R.anim.slide_in, R.anim.slide_in); } }); alertDialog.setIcon(R.drawable.ic_launcher); alertDialog.show(); break; default: break; } } } }
4,680
0.701496
0.7
183
24.573771
19.611355
97
false
false
0
0
0
0
0
0
2.945355
false
false
5
f8380eedef5a8869169852e4f872bcf686388505
30,425,548,344,154
fa25efe48b63ed9d936fca443eda3ed583939268
/src/com/example/java/panels/EnemyPanel.java
9ec49b78a92f97c1a9978851342d7d85834af384
[]
no_license
PuceEdgar/FightGame
https://github.com/PuceEdgar/FightGame
fd8c2dce75d498db950d4955b6fbbce20f04753a
4e3776dc0658f4118e6775de9734a938fc641ed7
refs/heads/master
2021-05-14T01:33:53.002000
2018-01-07T14:20:55
2018-01-07T14:20:55
114,936,621
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.java.panels; import com.example.java.enemy.Enemy; import javax.swing.*; public class EnemyPanel { private Enemy enemy; private JPanel enemyPanel; private JLabel enemyName, enemyHealth; public EnemyPanel(Enemy enemy) { this.enemy = enemy; this.enemyPanel = new JPanel(); this.enemyName = new JLabel("Name: " + enemy.getName()); this.enemyHealth = new JLabel(String.valueOf(enemy.getCurrentHealth())); Box enemyBox = Box.createVerticalBox(); enemyBox.add(enemyName); enemyBox.add(enemyHealth); this.enemyPanel.add(enemyBox); } public Enemy getEnemy() { return enemy; } public void setEnemy(Enemy enemy) { this.enemy = enemy; } public JPanel getEnemyPanel() { return enemyPanel; } public void setEnemyPanel(JPanel enemyPanel) { this.enemyPanel = enemyPanel; } public JLabel getEnemyName() { return enemyName; } public void setEnemyName(JLabel enemyName) { this.enemyName = enemyName; } public JLabel getEnemyHealth() { return enemyHealth; } public void setEnemyHealth(JLabel enemyHealth) { this.enemyHealth = enemyHealth; } }
UTF-8
Java
1,268
java
EnemyPanel.java
Java
[]
null
[]
package com.example.java.panels; import com.example.java.enemy.Enemy; import javax.swing.*; public class EnemyPanel { private Enemy enemy; private JPanel enemyPanel; private JLabel enemyName, enemyHealth; public EnemyPanel(Enemy enemy) { this.enemy = enemy; this.enemyPanel = new JPanel(); this.enemyName = new JLabel("Name: " + enemy.getName()); this.enemyHealth = new JLabel(String.valueOf(enemy.getCurrentHealth())); Box enemyBox = Box.createVerticalBox(); enemyBox.add(enemyName); enemyBox.add(enemyHealth); this.enemyPanel.add(enemyBox); } public Enemy getEnemy() { return enemy; } public void setEnemy(Enemy enemy) { this.enemy = enemy; } public JPanel getEnemyPanel() { return enemyPanel; } public void setEnemyPanel(JPanel enemyPanel) { this.enemyPanel = enemyPanel; } public JLabel getEnemyName() { return enemyName; } public void setEnemyName(JLabel enemyName) { this.enemyName = enemyName; } public JLabel getEnemyHealth() { return enemyHealth; } public void setEnemyHealth(JLabel enemyHealth) { this.enemyHealth = enemyHealth; } }
1,268
0.637224
0.637224
55
22.054546
19.464109
80
false
false
0
0
0
0
0
0
0.418182
false
false
5
dcc07e9d6ae8376f2925f6ced31f25f2c628820c
644,245,103,535
cc2ff3f2e20dd673ed7593dd68ceb625c44fdb57
/jaxrs/eagledns/src/main/java/se/unlogic/standardutils/dao/GenericDAO.java
d764b98eabc40ba10d2cb6d09fb4c7b89956fcea
[ "Apache-2.0" ]
permissive
raphaelning/resteasy-client-android
https://github.com/raphaelning/resteasy-client-android
c0051e6fa921bb62754b3c49e8ea23d3b0813362
428bef2352710afaad2f3a3b7f6798eaf2c4fe2b
refs/heads/master
2016-09-06T10:37:56.680000
2013-11-19T06:50:41
2013-11-19T06:50:41
14,515,445
2
4
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright (c) 2010 Robert "Unlogic" Olofsson (unlogic@unlogic.se). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0-standalone.html ******************************************************************************/ package se.unlogic.standardutils.dao; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.SQLException; import java.util.List; @Deprecated public interface GenericDAO<KeyType,BeanType> { public void add(BeanType bean) throws SQLException; public void add(BeanType bean, TransactionHandler transactionHandler) throws SQLException; public void add(BeanType bean, Connection connection) throws SQLException; public void update(BeanType bean) throws SQLException; public void update(BeanType bean, TransactionHandler transactionHandler) throws SQLException; public void update(BeanType bean, Connection connection) throws SQLException; public BeanType get(KeyType id, Field... relations) throws SQLException; public BeanType get(KeyType id, TransactionHandler transactionHandler, Field... relations) throws SQLException; public BeanType get(KeyType id, Connection connection, Field... relations) throws SQLException; public List<BeanType> getAll(Field... relations) throws SQLException; public List<BeanType> getAll(TransactionHandler transactionHandler, Field... relations) throws SQLException; public List<BeanType> getAll(Connection connection, Field... relations) throws SQLException; public void delete(BeanType bean) throws SQLException; public void delete(BeanType bean, TransactionHandler transactionHandler) throws SQLException; public void delete(BeanType bean, Connection connection) throws SQLException; }
UTF-8
Java
1,960
java
GenericDAO.java
Java
[ { "context": "****************************\n * Copyright (c) 2010 Robert \"Unlogic\" Olofsson (unlogic@unlogic.se).\n * All r", "end": 109, "score": 0.8857623338699341, "start": 103, "tag": "NAME", "value": "Robert" }, { "context": "*******************\n * Copyright (c) 2010 Robert \"Unlogic\" Olofsson (unlogic@unlogic.se).\n * All rights res", "end": 118, "score": 0.6811115741729736, "start": 111, "tag": "USERNAME", "value": "Unlogic" }, { "context": "***********\n * Copyright (c) 2010 Robert \"Unlogic\" Olofsson (unlogic@unlogic.se).\n * All rights reserved. Thi", "end": 128, "score": 0.9996078014373779, "start": 120, "tag": "NAME", "value": "Olofsson" }, { "context": "\n * Copyright (c) 2010 Robert \"Unlogic\" Olofsson (unlogic@unlogic.se).\n * All rights reserved. This program and the ac", "end": 148, "score": 0.9999221563339233, "start": 130, "tag": "EMAIL", "value": "unlogic@unlogic.se" } ]
null
[]
/******************************************************************************* * Copyright (c) 2010 Robert "Unlogic" Olofsson (<EMAIL>). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0-standalone.html ******************************************************************************/ package se.unlogic.standardutils.dao; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.SQLException; import java.util.List; @Deprecated public interface GenericDAO<KeyType,BeanType> { public void add(BeanType bean) throws SQLException; public void add(BeanType bean, TransactionHandler transactionHandler) throws SQLException; public void add(BeanType bean, Connection connection) throws SQLException; public void update(BeanType bean) throws SQLException; public void update(BeanType bean, TransactionHandler transactionHandler) throws SQLException; public void update(BeanType bean, Connection connection) throws SQLException; public BeanType get(KeyType id, Field... relations) throws SQLException; public BeanType get(KeyType id, TransactionHandler transactionHandler, Field... relations) throws SQLException; public BeanType get(KeyType id, Connection connection, Field... relations) throws SQLException; public List<BeanType> getAll(Field... relations) throws SQLException; public List<BeanType> getAll(TransactionHandler transactionHandler, Field... relations) throws SQLException; public List<BeanType> getAll(Connection connection, Field... relations) throws SQLException; public void delete(BeanType bean) throws SQLException; public void delete(BeanType bean, TransactionHandler transactionHandler) throws SQLException; public void delete(BeanType bean, Connection connection) throws SQLException; }
1,949
0.741837
0.738265
47
40.702129
37.968586
112
false
false
0
0
0
0
0
0
1.06383
false
false
5
ccae8886d5c07d3d321d8cfedfb15bc2c8453cdf
18,648,748,017,869
40bee1b0df9c094884a50632d48fa6937b9f6592
/src/main/java/com/siti/enterprise/vo/PositionReleaseVo.java
239466e2a76fef4745f0a627cda274489a76eb1c
[]
no_license
Ahellblack/recruit_assemble
https://github.com/Ahellblack/recruit_assemble
44ca505f8f9a801c0ad5b04601e6bf3c45975832
c5767622c22f8c51acf929e01b36ed5fe4c577cb
refs/heads/master
2022-07-11T04:12:08.342000
2020-02-27T07:25:20
2020-02-27T07:25:20
242,373,964
0
0
null
false
2022-06-29T17:58:42
2020-02-22T16:31:44
2020-02-27T07:25:37
2022-06-29T17:58:41
239
0
0
7
Java
false
false
package com.siti.enterprise.vo; import java.sql.Timestamp; public class PositionReleaseVo { private long id; private long entId; private long postId; private String postName; private String entName; private String salary; private String city; private String province; private long recruitNum; private String ageRange; private String minEducation; private String otherRequire; private String postDscrpt; private long minSalary; private long maxSalary; private long isNegotiable; private String workHour; private String workShift; private String socialBenefit; private String workExperience; private String contactPpl; private String contactTel; private long isPub; private java.sql.Timestamp inputTime; private String entFullname; private String entAddress; private String entPic; private double lng; private double lat; private String contactName; private String tel; private String emailAddress; private String industry; private String entType; private String staffAmount; private java.sql.Timestamp enterTime; private String qualiCertificate; private long isVerify; private java.sql.Timestamp updateTime; private String remark; public String getEntFullname() { return entFullname; } public PositionReleaseVo setEntFullname(String entFullname) { this.entFullname = entFullname; return this; } public String getEntAddress() { return entAddress; } public PositionReleaseVo setEntAddress(String entAddress) { this.entAddress = entAddress; return this; } public String getEntPic() { return entPic; } public PositionReleaseVo setEntPic(String entPic) { this.entPic = entPic; return this; } public double getLng() { return lng; } public PositionReleaseVo setLng(double lng) { this.lng = lng; return this; } public double getLat() { return lat; } public PositionReleaseVo setLat(double lat) { this.lat = lat; return this; } public String getContactName() { return contactName; } public PositionReleaseVo setContactName(String contactName) { this.contactName = contactName; return this; } public String getTel() { return tel; } public PositionReleaseVo setTel(String tel) { this.tel = tel; return this; } public String getEmailAddress() { return emailAddress; } public PositionReleaseVo setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; return this; } public String getIndustry() { return industry; } public PositionReleaseVo setIndustry(String industry) { this.industry = industry; return this; } public String getEntType() { return entType; } public PositionReleaseVo setEntType(String entType) { this.entType = entType; return this; } public String getStaffAmount() { return staffAmount; } public PositionReleaseVo setStaffAmount(String staffAmount) { this.staffAmount = staffAmount; return this; } public Timestamp getEnterTime() { return enterTime; } public PositionReleaseVo setEnterTime(Timestamp enterTime) { this.enterTime = enterTime; return this; } public String getQualiCertificate() { return qualiCertificate; } public PositionReleaseVo setQualiCertificate(String qualiCertificate) { this.qualiCertificate = qualiCertificate; return this; } public long getIsVerify() { return isVerify; } public PositionReleaseVo setIsVerify(long isVerify) { this.isVerify = isVerify; return this; } public String getCity() { return city; } public PositionReleaseVo setCity(String city) { this.city = city; return this; } public String getProvince() { return province; } public PositionReleaseVo setProvince(String province) { this.province = province; return this; } public String getEntName() { return entName; } public PositionReleaseVo setEntName(String entName) { this.entName = entName; return this; } public PositionReleaseVo setWorkExperience(String workExperience) { this.workExperience = workExperience; return this; } public String getPostName() { return postName; } public PositionReleaseVo setPostName(String postName) { this.postName = postName; return this; } public String getSalary() { return salary; } public PositionReleaseVo setSalary(String salary) { this.salary = salary; return this; } public long getId() { return id; } public void setId(long id) { this.id = id; } public long getEntId() { return entId; } public void setEntId(long entId) { this.entId = entId; } public long getPostId() { return postId; } public void setPostId(long postId) { this.postId = postId; } public long getRecruitNum() { return recruitNum; } public void setRecruitNum(long recruitNum) { this.recruitNum = recruitNum; } public String getAgeRange() { return ageRange; } public void setAgeRange(String ageRange) { this.ageRange = ageRange; } public String getMinEducation() { return minEducation; } public void setMinEducation(String minEducation) { this.minEducation = minEducation; } public String getOtherRequire() { return otherRequire; } public void setOtherRequire(String otherRequire) { this.otherRequire = otherRequire; } public String getPostDscrpt() { return postDscrpt; } public void setPostDscrpt(String postDscrpt) { this.postDscrpt = postDscrpt; } public long getMinSalary() { return minSalary; } public void setMinSalary(long minSalary) { this.minSalary = minSalary; } public long getMaxSalary() { return maxSalary; } public void setMaxSalary(long maxSalary) { this.maxSalary = maxSalary; } public long getIsNegotiable() { return isNegotiable; } public void setIsNegotiable(long isNegotiable) { this.isNegotiable = isNegotiable; } public String getWorkHour() { return workHour; } public void setWorkHour(String workHour) { this.workHour = workHour; } public String getWorkShift() { return workShift; } public void setWorkShift(String workShift) { this.workShift = workShift; } public String getSocialBenefit() { return socialBenefit; } public void setSocialBenefit(String socialBenefit) { this.socialBenefit = socialBenefit; } public String getWorkExperience() { return workExperience; } public String getContactPpl() { return contactPpl; } public void setContactPpl(String contactPpl) { this.contactPpl = contactPpl; } public String getContactTel() { return contactTel; } public void setContactTel(String contactTel) { this.contactTel = contactTel; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public long getIsPub() { return isPub; } public void setIsPub(long isPub) { this.isPub = isPub; } public java.sql.Timestamp getInputTime() { return inputTime; } public void setInputTime(java.sql.Timestamp inputTime) { this.inputTime = inputTime; } public java.sql.Timestamp getUpdateTime() { return updateTime; } public void setUpdateTime(java.sql.Timestamp updateTime) { this.updateTime = updateTime; } }
UTF-8
Java
7,493
java
PositionReleaseVo.java
Java
[]
null
[]
package com.siti.enterprise.vo; import java.sql.Timestamp; public class PositionReleaseVo { private long id; private long entId; private long postId; private String postName; private String entName; private String salary; private String city; private String province; private long recruitNum; private String ageRange; private String minEducation; private String otherRequire; private String postDscrpt; private long minSalary; private long maxSalary; private long isNegotiable; private String workHour; private String workShift; private String socialBenefit; private String workExperience; private String contactPpl; private String contactTel; private long isPub; private java.sql.Timestamp inputTime; private String entFullname; private String entAddress; private String entPic; private double lng; private double lat; private String contactName; private String tel; private String emailAddress; private String industry; private String entType; private String staffAmount; private java.sql.Timestamp enterTime; private String qualiCertificate; private long isVerify; private java.sql.Timestamp updateTime; private String remark; public String getEntFullname() { return entFullname; } public PositionReleaseVo setEntFullname(String entFullname) { this.entFullname = entFullname; return this; } public String getEntAddress() { return entAddress; } public PositionReleaseVo setEntAddress(String entAddress) { this.entAddress = entAddress; return this; } public String getEntPic() { return entPic; } public PositionReleaseVo setEntPic(String entPic) { this.entPic = entPic; return this; } public double getLng() { return lng; } public PositionReleaseVo setLng(double lng) { this.lng = lng; return this; } public double getLat() { return lat; } public PositionReleaseVo setLat(double lat) { this.lat = lat; return this; } public String getContactName() { return contactName; } public PositionReleaseVo setContactName(String contactName) { this.contactName = contactName; return this; } public String getTel() { return tel; } public PositionReleaseVo setTel(String tel) { this.tel = tel; return this; } public String getEmailAddress() { return emailAddress; } public PositionReleaseVo setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; return this; } public String getIndustry() { return industry; } public PositionReleaseVo setIndustry(String industry) { this.industry = industry; return this; } public String getEntType() { return entType; } public PositionReleaseVo setEntType(String entType) { this.entType = entType; return this; } public String getStaffAmount() { return staffAmount; } public PositionReleaseVo setStaffAmount(String staffAmount) { this.staffAmount = staffAmount; return this; } public Timestamp getEnterTime() { return enterTime; } public PositionReleaseVo setEnterTime(Timestamp enterTime) { this.enterTime = enterTime; return this; } public String getQualiCertificate() { return qualiCertificate; } public PositionReleaseVo setQualiCertificate(String qualiCertificate) { this.qualiCertificate = qualiCertificate; return this; } public long getIsVerify() { return isVerify; } public PositionReleaseVo setIsVerify(long isVerify) { this.isVerify = isVerify; return this; } public String getCity() { return city; } public PositionReleaseVo setCity(String city) { this.city = city; return this; } public String getProvince() { return province; } public PositionReleaseVo setProvince(String province) { this.province = province; return this; } public String getEntName() { return entName; } public PositionReleaseVo setEntName(String entName) { this.entName = entName; return this; } public PositionReleaseVo setWorkExperience(String workExperience) { this.workExperience = workExperience; return this; } public String getPostName() { return postName; } public PositionReleaseVo setPostName(String postName) { this.postName = postName; return this; } public String getSalary() { return salary; } public PositionReleaseVo setSalary(String salary) { this.salary = salary; return this; } public long getId() { return id; } public void setId(long id) { this.id = id; } public long getEntId() { return entId; } public void setEntId(long entId) { this.entId = entId; } public long getPostId() { return postId; } public void setPostId(long postId) { this.postId = postId; } public long getRecruitNum() { return recruitNum; } public void setRecruitNum(long recruitNum) { this.recruitNum = recruitNum; } public String getAgeRange() { return ageRange; } public void setAgeRange(String ageRange) { this.ageRange = ageRange; } public String getMinEducation() { return minEducation; } public void setMinEducation(String minEducation) { this.minEducation = minEducation; } public String getOtherRequire() { return otherRequire; } public void setOtherRequire(String otherRequire) { this.otherRequire = otherRequire; } public String getPostDscrpt() { return postDscrpt; } public void setPostDscrpt(String postDscrpt) { this.postDscrpt = postDscrpt; } public long getMinSalary() { return minSalary; } public void setMinSalary(long minSalary) { this.minSalary = minSalary; } public long getMaxSalary() { return maxSalary; } public void setMaxSalary(long maxSalary) { this.maxSalary = maxSalary; } public long getIsNegotiable() { return isNegotiable; } public void setIsNegotiable(long isNegotiable) { this.isNegotiable = isNegotiable; } public String getWorkHour() { return workHour; } public void setWorkHour(String workHour) { this.workHour = workHour; } public String getWorkShift() { return workShift; } public void setWorkShift(String workShift) { this.workShift = workShift; } public String getSocialBenefit() { return socialBenefit; } public void setSocialBenefit(String socialBenefit) { this.socialBenefit = socialBenefit; } public String getWorkExperience() { return workExperience; } public String getContactPpl() { return contactPpl; } public void setContactPpl(String contactPpl) { this.contactPpl = contactPpl; } public String getContactTel() { return contactTel; } public void setContactTel(String contactTel) { this.contactTel = contactTel; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public long getIsPub() { return isPub; } public void setIsPub(long isPub) { this.isPub = isPub; } public java.sql.Timestamp getInputTime() { return inputTime; } public void setInputTime(java.sql.Timestamp inputTime) { this.inputTime = inputTime; } public java.sql.Timestamp getUpdateTime() { return updateTime; } public void setUpdateTime(java.sql.Timestamp updateTime) { this.updateTime = updateTime; } }
7,493
0.696383
0.696383
407
17.41032
17.277365
73
false
false
0
0
0
0
0
0
0.348894
false
false
5
d134b2fb1c09ac8f507e9a78cd9e827db39a2328
5,016,521,849,272
0093d534ce85e7959629e86f136bab4fac5ad1ef
/src/main/java/webprobe/pages/Page.java
c298cc0890a870bef9ea7c84b87128340acd67f0
[]
no_license
Pleshivtsev/WebProbe
https://github.com/Pleshivtsev/WebProbe
465231b2ab2089999c47d71fcbfc2f0f4bab5a82
6d9af08e430bf2a27a07f83c0aa1b7e820125834
refs/heads/master
2020-03-21T13:31:53.238000
2019-11-14T07:41:46
2019-11-14T07:41:46
138,610,873
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package webprobe.pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import webprobe.WebProbe; import webprobe.utils.Assert; import java.util.ArrayList; import java.util.List; public class Page { protected WebProbe webProbe; protected Integer pageTimeOut; //ะ’ั€ะตะผั ะพะถะธะดะฐะฝะธั ะฟะพัะฒะปะตะฝะธั ัะปะตะผะตะฝั‚ะพะฒ ะฝะฐ ัั‚ั€ะฐะฝะธั†ะต protected String pageUrl; // ะพั‚ะฝะพัะธั‚ะตะปัŒะฝั‹ะน ัƒั€ะป ัั‚ั€ะฐะฝะธั†ั‹ //------------------------------------------------------------------------------------------------------------------ private List<PageBlock> pageBlocks; // ะ‘ะปะพะบะธ ัั‚ั€ะฐะฝะธั†ั‹ private List<String> errorStrings; // ะœะฐััะธะฒ ัั‚ั€ะพะบ-ั‚ั€ะธะณะณะตั€ะพะฒ, ะบะพั‚ะพั€ั‹ะต ะฝะต ะดะพะปะถะฝั‹ ะพั‚ะพะฑั€ะฐะถะฐั‚ัŒัั ะฝะฐ ัั‚ั€ะฐะฝะธั†ะต //------------------------------------------------------------------------------------------------------------------ private PageElement lastLoadElement; // ะญะปะตะผะตะฝั‚ ัั‚ั€ะฐะฝะธั†ั‹, ะบะพั‚ะพั€ั‹ะน ะฟั€ะตะดะฟะพะปะพะถะธั‚ะตะปัŒะฝะพ ะทะฐะณั€ัƒะถะฐะตั‚ัั ะฟะพัะปะตะดะฝะธะผ private PageElement invisibleElement; // ะญะปะตะผะตะฝั‚ ัั‚ั€ะฐะฝะธั†ั‹, ะบะพั‚ะพั€ั‹ะน ะดะพะปะถะตะฝ ะฑั‹ั‚ัŒ ะฝะตะฒะธะดะธะผั‹ะผ ะฟะตั€ะตะด ะฝะฐั‡ะฐะปะพะผ ะฟั€ะพะฒะตั€ะพะบ //------------------------------------------------------------------------------------------------------------------ public Page(WebProbe webProbe){ setPageTimeOut(30); pageBlocks = new ArrayList<>(); errorStrings = new ArrayList<>(); this.webProbe = webProbe; } //**************************** ะ“ะตั‚ั‚ะตั€ั‹ ******************************************************************************* public Integer getPageTimeOut() { return pageTimeOut; } public String getPageUrl() { return pageUrl; } public PageElement getLastLoadElement() { return lastLoadElement; } public PageElement getInvisibleElement() { return invisibleElement; } public String getName() { return this.getClass().getName(); } //**************************** Cะตั‚ั‚ะตั€ั‹ ******************************************************************************* public void setPageTimeOut(Integer pageTimeOut) { this.pageTimeOut = pageTimeOut; } public void setPageUrl(String pageUrl) { this.pageUrl = pageUrl; } public void setLastLoadElement(PageElement lastLoadElement) { this.lastLoadElement = lastLoadElement; } public void setInvisibleElement(PageElement invisibleElement) { this.invisibleElement = invisibleElement; } //**************************** ะœะพะดะตะปะธั€ะพะฒะฐะฝะธะต ัั‚ั€ะฐะฝะธั†ั‹ ******************************************************************************* public void addPageBlock(PageBlock pageBlock){ pageBlocks.add(pageBlock); } public void addErrorString(String errorString){ errorStrings.add(errorString); } public void clearErrorStrings(){ errorStrings.clear(); } //**************************** ะŸั€ะพะฒะตั€ะบะธ ******************************************************************************* public void checkForErrorStrings(){ String bodyText; // ะขะตะบัั‚ ัั‚ั€ะฐะฝะธั†ั‹ String errorMessage; // ะ“ะตะฝะตั€ะธั€ัƒะตะผะฐั ัั‚ั€ะพะบะฐ ั ั‚ะตะบัั‚ะพะผ ะพัˆะธะฑะบะธ ะดะปั Assert List<String> existingErrorStrings = new ArrayList<String>(); // ะœะฐััะธะฒ ัั‚ั€ะพะบ-ั‚ั€ะธะณะณะตั€ะพะฒ ะบะพั‚ะพั€ั‹ะต ะฝะฐะนะดะตะฝั‹ ะฝะฐ ัั‚ั€ะฐะฝะธั†ะต By bodyLocator = By.cssSelector("body"); waitForElementToBeVisible(bodyLocator); bodyText = webProbe.getText(bodyLocator); for (String errStr : errorStrings){ if (bodyText.contains(errStr)) { existingErrorStrings.add(errStr); } } if (existingErrorStrings.size() > 0){ errorMessage = getName() + ": Error strings found: "; for (String exErrStr : existingErrorStrings){ errorMessage = errorMessage + "\"" + exErrStr + "\"; "; } Assert.pageAssert(errorMessage); } } private void waitForLastLoadElementAppears(){ if (! (lastLoadElement == null)){ waitForElementToBeVisible(lastLoadElement); /*webProbe.waitForElementIsVisible(lastLoadElement, pageTimeOut);*/ } } private void waitForInvisibleElementDisappears(){ if (! (invisibleElement == null)){ waitForElementToBeNotVisible(invisibleElement); /* webProbe.waitForElementIsNotVisible(invisibleElement, pageTimeOut);*/ } } public String verify(){ //String resultMessage = getName() + " page check result:" + "\r\n"; String resultMessage = ""; Boolean verifyResult = true; checkForErrorStrings(); waitForInvisibleElementDisappears(); waitForLastLoadElementAppears(); webProbe.setImplicitlyWait(0); WebDriver driver = webProbe.getDriver(); for (PageBlock pageBlock: pageBlocks){ pageBlock.fillWebElements(driver); pageBlock.verify(); if (pageBlock.getVerifyResult() == false){ verifyResult = false; resultMessage += pageBlock.getResultMessage(); } } if (verifyResult == false){ Assert.pageAssert(resultMessage); } webProbe.setImplicitlyWait(pageTimeOut); if (!resultMessage.equals("")){ resultMessage = getName() + " page check result:" + "\r\n" + resultMessage; } return resultMessage; } private By assertElementLocator(PageElement pageElement){ Assert.pageAssertTrue(pageElement != null, "Page element is null"); Assert.pageAssertTrue(pageElement.getLocator() != null, "Locator of this page element is null"); return pageElement.getLocator(); } public void verifyElement(PageElement pageElement){ assertElementLocator(pageElement); webProbe.fillWebElement(pageElement); pageElement.assertElement(); } //**************************** ะšะปะธะบะธ ******************************************************************************* public void click(By locator){ WebElement webElement = webProbe.waitForElementToBeClickableBy(locator, pageTimeOut); webElement.click(); } public void click(PageElement pageElement){ By locator = assertElementLocator(pageElement); click(locator); } public void clickAfterVerify(PageElement pageElement){ By locator = assertElementLocator(pageElement); WebElement webElement = webProbe.waitForElementToBeClickableBy(locator, pageTimeOut); verifyElement(pageElement); pageElement.click(); } public void clickElementContainsText(By parentLocator, String subString){ webProbe.clickElementContainsText(parentLocator, subString, pageTimeOut); } public void clickElementContainsText(PageElement pageElement, String subString){ By parentLocator = assertElementLocator(pageElement); webProbe.clickElementContainsText(parentLocator, subString, pageTimeOut); } //**************************** ะžะถะธะดะฐะฝะธั ัะปะตะผะตะฝั‚ะพะฒ ************************************************************ private WebDriverWait getWait(){ WebDriverWait wait = new WebDriverWait(webProbe.getDriver(), pageTimeOut); return wait; } public void waitForElementToBeVisible(By locator){ getWait().until(ExpectedConditions.visibilityOfElementLocated(locator)); } public void waitForElementToBeVisible(PageElement pageElement){ By locator = assertElementLocator(pageElement); waitForElementToBeVisible(locator); } public void waitForElementToBeNotVisible(By locator){ getWait().until(ExpectedConditions.invisibilityOfElementLocated(locator)); } public void waitForElementToBeNotVisible(PageElement pageElement){ By locator = assertElementLocator(pageElement); waitForElementToBeNotVisible(locator); } public void waitForElementToBeClickable(By locator){ getWait().until(ExpectedConditions.elementToBeClickable(locator)); } public void waitForElementToBeClickable(PageElement pageElement){ By locator = assertElementLocator(pageElement); getWait().until(ExpectedConditions.elementToBeClickable(locator)); } public void waitForStalenessOfElement(PageElement pageElement){ Assert.pageAssertTrue(pageElement != null, "Page element is null"); WebElement webElement = pageElement.getWebElement(); Assert.pageAssertTrue(webElement != null, "Web element of page element is null"); getWait().until(ExpectedConditions.stalenessOf(webElement)); } }
UTF-8
Java
9,234
java
Page.java
Java
[]
null
[]
package webprobe.pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import webprobe.WebProbe; import webprobe.utils.Assert; import java.util.ArrayList; import java.util.List; public class Page { protected WebProbe webProbe; protected Integer pageTimeOut; //ะ’ั€ะตะผั ะพะถะธะดะฐะฝะธั ะฟะพัะฒะปะตะฝะธั ัะปะตะผะตะฝั‚ะพะฒ ะฝะฐ ัั‚ั€ะฐะฝะธั†ะต protected String pageUrl; // ะพั‚ะฝะพัะธั‚ะตะปัŒะฝั‹ะน ัƒั€ะป ัั‚ั€ะฐะฝะธั†ั‹ //------------------------------------------------------------------------------------------------------------------ private List<PageBlock> pageBlocks; // ะ‘ะปะพะบะธ ัั‚ั€ะฐะฝะธั†ั‹ private List<String> errorStrings; // ะœะฐััะธะฒ ัั‚ั€ะพะบ-ั‚ั€ะธะณะณะตั€ะพะฒ, ะบะพั‚ะพั€ั‹ะต ะฝะต ะดะพะปะถะฝั‹ ะพั‚ะพะฑั€ะฐะถะฐั‚ัŒัั ะฝะฐ ัั‚ั€ะฐะฝะธั†ะต //------------------------------------------------------------------------------------------------------------------ private PageElement lastLoadElement; // ะญะปะตะผะตะฝั‚ ัั‚ั€ะฐะฝะธั†ั‹, ะบะพั‚ะพั€ั‹ะน ะฟั€ะตะดะฟะพะปะพะถะธั‚ะตะปัŒะฝะพ ะทะฐะณั€ัƒะถะฐะตั‚ัั ะฟะพัะปะตะดะฝะธะผ private PageElement invisibleElement; // ะญะปะตะผะตะฝั‚ ัั‚ั€ะฐะฝะธั†ั‹, ะบะพั‚ะพั€ั‹ะน ะดะพะปะถะตะฝ ะฑั‹ั‚ัŒ ะฝะตะฒะธะดะธะผั‹ะผ ะฟะตั€ะตะด ะฝะฐั‡ะฐะปะพะผ ะฟั€ะพะฒะตั€ะพะบ //------------------------------------------------------------------------------------------------------------------ public Page(WebProbe webProbe){ setPageTimeOut(30); pageBlocks = new ArrayList<>(); errorStrings = new ArrayList<>(); this.webProbe = webProbe; } //**************************** ะ“ะตั‚ั‚ะตั€ั‹ ******************************************************************************* public Integer getPageTimeOut() { return pageTimeOut; } public String getPageUrl() { return pageUrl; } public PageElement getLastLoadElement() { return lastLoadElement; } public PageElement getInvisibleElement() { return invisibleElement; } public String getName() { return this.getClass().getName(); } //**************************** Cะตั‚ั‚ะตั€ั‹ ******************************************************************************* public void setPageTimeOut(Integer pageTimeOut) { this.pageTimeOut = pageTimeOut; } public void setPageUrl(String pageUrl) { this.pageUrl = pageUrl; } public void setLastLoadElement(PageElement lastLoadElement) { this.lastLoadElement = lastLoadElement; } public void setInvisibleElement(PageElement invisibleElement) { this.invisibleElement = invisibleElement; } //**************************** ะœะพะดะตะปะธั€ะพะฒะฐะฝะธะต ัั‚ั€ะฐะฝะธั†ั‹ ******************************************************************************* public void addPageBlock(PageBlock pageBlock){ pageBlocks.add(pageBlock); } public void addErrorString(String errorString){ errorStrings.add(errorString); } public void clearErrorStrings(){ errorStrings.clear(); } //**************************** ะŸั€ะพะฒะตั€ะบะธ ******************************************************************************* public void checkForErrorStrings(){ String bodyText; // ะขะตะบัั‚ ัั‚ั€ะฐะฝะธั†ั‹ String errorMessage; // ะ“ะตะฝะตั€ะธั€ัƒะตะผะฐั ัั‚ั€ะพะบะฐ ั ั‚ะตะบัั‚ะพะผ ะพัˆะธะฑะบะธ ะดะปั Assert List<String> existingErrorStrings = new ArrayList<String>(); // ะœะฐััะธะฒ ัั‚ั€ะพะบ-ั‚ั€ะธะณะณะตั€ะพะฒ ะบะพั‚ะพั€ั‹ะต ะฝะฐะนะดะตะฝั‹ ะฝะฐ ัั‚ั€ะฐะฝะธั†ะต By bodyLocator = By.cssSelector("body"); waitForElementToBeVisible(bodyLocator); bodyText = webProbe.getText(bodyLocator); for (String errStr : errorStrings){ if (bodyText.contains(errStr)) { existingErrorStrings.add(errStr); } } if (existingErrorStrings.size() > 0){ errorMessage = getName() + ": Error strings found: "; for (String exErrStr : existingErrorStrings){ errorMessage = errorMessage + "\"" + exErrStr + "\"; "; } Assert.pageAssert(errorMessage); } } private void waitForLastLoadElementAppears(){ if (! (lastLoadElement == null)){ waitForElementToBeVisible(lastLoadElement); /*webProbe.waitForElementIsVisible(lastLoadElement, pageTimeOut);*/ } } private void waitForInvisibleElementDisappears(){ if (! (invisibleElement == null)){ waitForElementToBeNotVisible(invisibleElement); /* webProbe.waitForElementIsNotVisible(invisibleElement, pageTimeOut);*/ } } public String verify(){ //String resultMessage = getName() + " page check result:" + "\r\n"; String resultMessage = ""; Boolean verifyResult = true; checkForErrorStrings(); waitForInvisibleElementDisappears(); waitForLastLoadElementAppears(); webProbe.setImplicitlyWait(0); WebDriver driver = webProbe.getDriver(); for (PageBlock pageBlock: pageBlocks){ pageBlock.fillWebElements(driver); pageBlock.verify(); if (pageBlock.getVerifyResult() == false){ verifyResult = false; resultMessage += pageBlock.getResultMessage(); } } if (verifyResult == false){ Assert.pageAssert(resultMessage); } webProbe.setImplicitlyWait(pageTimeOut); if (!resultMessage.equals("")){ resultMessage = getName() + " page check result:" + "\r\n" + resultMessage; } return resultMessage; } private By assertElementLocator(PageElement pageElement){ Assert.pageAssertTrue(pageElement != null, "Page element is null"); Assert.pageAssertTrue(pageElement.getLocator() != null, "Locator of this page element is null"); return pageElement.getLocator(); } public void verifyElement(PageElement pageElement){ assertElementLocator(pageElement); webProbe.fillWebElement(pageElement); pageElement.assertElement(); } //**************************** ะšะปะธะบะธ ******************************************************************************* public void click(By locator){ WebElement webElement = webProbe.waitForElementToBeClickableBy(locator, pageTimeOut); webElement.click(); } public void click(PageElement pageElement){ By locator = assertElementLocator(pageElement); click(locator); } public void clickAfterVerify(PageElement pageElement){ By locator = assertElementLocator(pageElement); WebElement webElement = webProbe.waitForElementToBeClickableBy(locator, pageTimeOut); verifyElement(pageElement); pageElement.click(); } public void clickElementContainsText(By parentLocator, String subString){ webProbe.clickElementContainsText(parentLocator, subString, pageTimeOut); } public void clickElementContainsText(PageElement pageElement, String subString){ By parentLocator = assertElementLocator(pageElement); webProbe.clickElementContainsText(parentLocator, subString, pageTimeOut); } //**************************** ะžะถะธะดะฐะฝะธั ัะปะตะผะตะฝั‚ะพะฒ ************************************************************ private WebDriverWait getWait(){ WebDriverWait wait = new WebDriverWait(webProbe.getDriver(), pageTimeOut); return wait; } public void waitForElementToBeVisible(By locator){ getWait().until(ExpectedConditions.visibilityOfElementLocated(locator)); } public void waitForElementToBeVisible(PageElement pageElement){ By locator = assertElementLocator(pageElement); waitForElementToBeVisible(locator); } public void waitForElementToBeNotVisible(By locator){ getWait().until(ExpectedConditions.invisibilityOfElementLocated(locator)); } public void waitForElementToBeNotVisible(PageElement pageElement){ By locator = assertElementLocator(pageElement); waitForElementToBeNotVisible(locator); } public void waitForElementToBeClickable(By locator){ getWait().until(ExpectedConditions.elementToBeClickable(locator)); } public void waitForElementToBeClickable(PageElement pageElement){ By locator = assertElementLocator(pageElement); getWait().until(ExpectedConditions.elementToBeClickable(locator)); } public void waitForStalenessOfElement(PageElement pageElement){ Assert.pageAssertTrue(pageElement != null, "Page element is null"); WebElement webElement = pageElement.getWebElement(); Assert.pageAssertTrue(webElement != null, "Web element of page element is null"); getWait().until(ExpectedConditions.stalenessOf(webElement)); } }
9,234
0.596328
0.595875
243
35.316872
33.996647
135
false
false
0
0
0
0
0
0
0.469136
false
false
5
8b8766b2aeb61b5356b7c04851bda4c20e4a0243
5,016,521,848,019
0271a8d6fe08d82647adde66f385528cbeccfc2e
/phone/video/src/com/miui/video/widget/recommend/BaseMediaView.java
6a790c32de2cc304a2568e5fecb43f06348ab8a1
[]
no_license
eltld/MiuiVideo
https://github.com/eltld/MiuiVideo
8ac9bb2e5b3545c0a18964e7bb5e014d2197988c
ce578e51833268bc65091d14d630e6bf6cf62af4
refs/heads/master
2020-05-29T11:06:37.612000
2015-03-06T01:47:07
2015-03-06T01:47:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright(c) 2014 XiaoMi TV Group * * BaseMediaView.java * * @author tianli(tianli@xiaomi.com) * * @date 2014-11-6 */ package com.miui.video.widget.recommend; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.RelativeLayout; import android.widget.TextView; import com.miui.video.R; import com.miui.video.controller.MediaViewClickListener; import com.miui.video.controller.content.MediaContentBuilder; import com.miui.video.type.BaseMediaInfo; import com.miui.video.util.DKLog; import com.miui.video.widget.media.MediaEditView; import com.miui.video.widget.media.MediaPosterView; /** * @author tianli * */ public class BaseMediaView extends RelativeLayout { public static final String TAG = "BaseMediaView"; protected Context mContext; protected BaseMediaInfo mMediaInfo; protected MediaPosterView mPosterView; protected MediaEditView mEditView; protected MediaContentBuilder mContentBuilder; protected View mMaskView; private MediaViewClickListener mViewClickListener; public BaseMediaView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public BaseMediaView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public BaseMediaView(Context context) { super(context); init(); } private void init(){ mContext = getContext(); setOnClickListener(mOnClickListener); setOnLongClickListener(mOnLongClickListener); } public void setInEditMode(boolean inEditMode){ if(mEditView != null){ mEditView.setInEditMode(inEditMode); } } public void setMediaInfo(BaseMediaInfo mediaInfo){ mMediaInfo = mediaInfo; if(mContentBuilder != null){ mContentBuilder.setMediaInfo(mediaInfo); } if(mPosterView != null){ mPosterView.setMediaInfo(mediaInfo); } if(mEditView != null){ mEditView.setMediaInfo(mediaInfo); } refreshMask(); } private void refreshMask(){ if(mContentBuilder != null && mContentBuilder.isMaskVisible()){ if(mMaskView != null){ mMaskView.setVisibility(View.VISIBLE); } }else{ if(mMaskView != null){ mMaskView.setVisibility(View.INVISIBLE); } } } public void setMediaContentBuilder(MediaContentBuilder contentBuilder) { mContentBuilder = contentBuilder; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); DKLog.d(TAG, "onLayout"); } @Override protected void onFinishInflate() { super.onFinishInflate(); View view = findViewById(R.id.poster); if(view instanceof MediaPosterView){ mPosterView = (MediaPosterView)view; } view = findViewById(R.id.edit_selector); if(view instanceof MediaEditView){ mEditView = (MediaEditView)view; } mMaskView = findViewById(R.id.mask); } public void setViewClickListener( MediaViewClickListener viewClickHandler) { this.mViewClickListener = viewClickHandler; } private OnClickListener mOnClickListener = new OnClickListener() { @Override public void onClick(View view) { // Log.d(TAG, "onClick"); View mediaView = BaseMediaView.this; if(mViewClickListener == null){ return; } if(view == mediaView){ mViewClickListener.onMediaClick(mediaView, mMediaInfo); } } }; private OnLongClickListener mOnLongClickListener = new OnLongClickListener() { @Override public boolean onLongClick(View view) { View mediaView = BaseMediaView.this; if(mViewClickListener != null){ if(view == mediaView){ mViewClickListener.onMediaLongClick(mediaView, mMediaInfo); } } return true; } }; final protected void setText(TextView view, String text){ if(view != null){ if(view.getVisibility() != View.VISIBLE){ view.setVisibility(View.VISIBLE); } view.setText(text); } } }
UTF-8
Java
4,622
java
BaseMediaView.java
Java
[ { "context": "up\n * \n * BaseMediaView.java\n * \n * @author tianli(tianli@xiaomi.com)\n * \n * @date 2014-11-6\n */\np", "end": 97, "score": 0.9972270131111145, "start": 91, "tag": "USERNAME", "value": "tianli" }, { "context": "\n * BaseMediaView.java\n * \n * @author tianli(tianli@xiaomi.com)\n * \n * @date 2014-11-6\n */\npackage com.miui.vi", "end": 115, "score": 0.999924898147583, "start": 98, "tag": "EMAIL", "value": "tianli@xiaomi.com" }, { "context": "ideo.widget.media.MediaPosterView;\n\n/**\n * @author tianli\n *\n */\npublic class BaseMediaView extends Relativ", "end": 695, "score": 0.9990547299385071, "start": 689, "tag": "USERNAME", "value": "tianli" } ]
null
[]
/** * Copyright(c) 2014 XiaoMi TV Group * * BaseMediaView.java * * @author tianli(<EMAIL>) * * @date 2014-11-6 */ package com.miui.video.widget.recommend; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.RelativeLayout; import android.widget.TextView; import com.miui.video.R; import com.miui.video.controller.MediaViewClickListener; import com.miui.video.controller.content.MediaContentBuilder; import com.miui.video.type.BaseMediaInfo; import com.miui.video.util.DKLog; import com.miui.video.widget.media.MediaEditView; import com.miui.video.widget.media.MediaPosterView; /** * @author tianli * */ public class BaseMediaView extends RelativeLayout { public static final String TAG = "BaseMediaView"; protected Context mContext; protected BaseMediaInfo mMediaInfo; protected MediaPosterView mPosterView; protected MediaEditView mEditView; protected MediaContentBuilder mContentBuilder; protected View mMaskView; private MediaViewClickListener mViewClickListener; public BaseMediaView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public BaseMediaView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public BaseMediaView(Context context) { super(context); init(); } private void init(){ mContext = getContext(); setOnClickListener(mOnClickListener); setOnLongClickListener(mOnLongClickListener); } public void setInEditMode(boolean inEditMode){ if(mEditView != null){ mEditView.setInEditMode(inEditMode); } } public void setMediaInfo(BaseMediaInfo mediaInfo){ mMediaInfo = mediaInfo; if(mContentBuilder != null){ mContentBuilder.setMediaInfo(mediaInfo); } if(mPosterView != null){ mPosterView.setMediaInfo(mediaInfo); } if(mEditView != null){ mEditView.setMediaInfo(mediaInfo); } refreshMask(); } private void refreshMask(){ if(mContentBuilder != null && mContentBuilder.isMaskVisible()){ if(mMaskView != null){ mMaskView.setVisibility(View.VISIBLE); } }else{ if(mMaskView != null){ mMaskView.setVisibility(View.INVISIBLE); } } } public void setMediaContentBuilder(MediaContentBuilder contentBuilder) { mContentBuilder = contentBuilder; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); DKLog.d(TAG, "onLayout"); } @Override protected void onFinishInflate() { super.onFinishInflate(); View view = findViewById(R.id.poster); if(view instanceof MediaPosterView){ mPosterView = (MediaPosterView)view; } view = findViewById(R.id.edit_selector); if(view instanceof MediaEditView){ mEditView = (MediaEditView)view; } mMaskView = findViewById(R.id.mask); } public void setViewClickListener( MediaViewClickListener viewClickHandler) { this.mViewClickListener = viewClickHandler; } private OnClickListener mOnClickListener = new OnClickListener() { @Override public void onClick(View view) { // Log.d(TAG, "onClick"); View mediaView = BaseMediaView.this; if(mViewClickListener == null){ return; } if(view == mediaView){ mViewClickListener.onMediaClick(mediaView, mMediaInfo); } } }; private OnLongClickListener mOnLongClickListener = new OnLongClickListener() { @Override public boolean onLongClick(View view) { View mediaView = BaseMediaView.this; if(mViewClickListener != null){ if(view == mediaView){ mViewClickListener.onMediaLongClick(mediaView, mMediaInfo); } } return true; } }; final protected void setText(TextView view, String text){ if(view != null){ if(view.getVisibility() != View.VISIBLE){ view.setVisibility(View.VISIBLE); } view.setText(text); } } }
4,612
0.615102
0.612722
162
27.530865
21.264116
82
false
false
0
0
0
0
0
0
0.481481
false
false
5
b0aec2a932dce7df5d234cc2926bdabecc23561e
24,756,191,539,226
9cd2819c3cf778e6699ee8c979b2d823ce7784b9
/doc/src/com/company/Main.java
272850fbd048ba8fe10c4a73ecb65e8bb7bb4436
[]
no_license
taniarailll/test
https://github.com/taniarailll/test
749b7807091ecd4c5ba897c69601e0e8f4d59de7
561495c0f7f6e14d9f4950048ca14ac727ab5ce4
refs/heads/main
2023-02-16T15:32:01.694000
2021-01-17T18:48:06
2021-01-17T18:48:06
330,459,489
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { System.out.println("ะทะฐะดะฐะฝะธะต 1"); Task1.task1(); System.out.println("ะทะฐะดะฐะฝะธะต 2"); Task2.task2(); System.out.println("ะทะฐะดะฐะฝะธะต 3"); Task3.task3(); System.out.println("ะทะฐะดะฐะฝะธะต 4"); Task4.task4(); System.out.println("ะทะฐะดะฐะฝะธะต 5"); Task5.task5(); System.out.println("ะทะฐะดะฐะฝะธะต 6"); Task6.task6(); } }
UTF-8
Java
570
java
Main.java
Java
[]
null
[]
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { System.out.println("ะทะฐะดะฐะฝะธะต 1"); Task1.task1(); System.out.println("ะทะฐะดะฐะฝะธะต 2"); Task2.task2(); System.out.println("ะทะฐะดะฐะฝะธะต 3"); Task3.task3(); System.out.println("ะทะฐะดะฐะฝะธะต 4"); Task4.task4(); System.out.println("ะทะฐะดะฐะฝะธะต 5"); Task5.task5(); System.out.println("ะทะฐะดะฐะฝะธะต 6"); Task6.task6(); } }
570
0.543561
0.50947
21
23.142857
14.80761
44
false
false
0
0
0
0
0
0
0.666667
false
false
5
51bc1decf7ebb7beadd5bb22b2e4a7b701bb4f40
21,912,923,201,824
85911ffc87894bb0dabf555cda34ed0c79b67f05
/src/mp/exceptions/suscripciones/SuscripcionActivada.java
9e8efe24d0a01639b1f47d45773aecdd8913dcf0
[]
no_license
IsraelSonseca/P2-Grupo05
https://github.com/IsraelSonseca/P2-Grupo05
a98cf7e9e2f80803389d86cb89be42bf6481026a
420fbb131f0025ee07ea0a1a944902b06f5d9c4d
refs/heads/master
2021-04-11T06:20:28.250000
2020-05-13T15:48:16
2020-05-13T15:48:16
248,998,951
2
1
null
false
2020-04-22T12:34:11
2020-03-21T15:00:46
2020-04-16T23:17:28
2020-04-22T12:34:11
298
2
0
4
Java
false
false
package mp.exceptions.suscripciones; import mp.exceptions.Result; import mp.subforos.SubForo; import mp.users.MiembroURJC; public class SuscripcionActivada extends Result { public SuscripcionActivada(MiembroURJC user, SubForo subForo) { super("El usuario: " + user.getNick() + ", ha sido suscrito al SUBFORO " + subForo.getId() + " -> " + subForo.getNombre() + " correctamente. SUSCRIPCION ACTIVADA"); } }
UTF-8
Java
424
java
SuscripcionActivada.java
Java
[]
null
[]
package mp.exceptions.suscripciones; import mp.exceptions.Result; import mp.subforos.SubForo; import mp.users.MiembroURJC; public class SuscripcionActivada extends Result { public SuscripcionActivada(MiembroURJC user, SubForo subForo) { super("El usuario: " + user.getNick() + ", ha sido suscrito al SUBFORO " + subForo.getId() + " -> " + subForo.getNombre() + " correctamente. SUSCRIPCION ACTIVADA"); } }
424
0.726415
0.726415
11
37.545456
47.277447
172
false
false
0
0
0
0
0
0
0.636364
false
false
5
34c96ef18d8c1fe396f6dfdb0f8008c1512886a3
21,912,923,201,288
f3649bb3264163b205a056ed73b9c0f10e9e358c
/app/src/main/java/com/cs/cardwhere/ScanCardActivity.java
b624b5b9cbef4c88036fa9e504f21e3c26f08457
[]
no_license
wongchiksum/CardWhere
https://github.com/wongchiksum/CardWhere
41bf5cba1183f71254056336fb4c8275c3ffe179
84aad6fcf8b6fbf7075d7c24c4aed1aa40346dc5
refs/heads/master
2022-01-09T00:42:20.019000
2019-05-08T06:47:30
2019-05-08T06:47:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cs.cardwhere; import android.Manifest; import android.app.AlertDialog; import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.location.Address; import android.location.Geocoder; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import com.cloudinary.android.MediaManager; import com.cloudinary.android.callback.ErrorInfo; import com.cloudinary.android.callback.UploadCallback; import com.cs.cardwhere.Controller.CardController; import com.cs.cardwhere.Bean.CardBean; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.ml.vision.FirebaseVision; import com.google.firebase.ml.vision.common.FirebaseVisionImage; import com.google.firebase.ml.vision.text.FirebaseVisionText; import com.google.firebase.ml.vision.text.FirebaseVisionTextRecognizer; import com.theartofdev.edmodo.cropper.CropImage; import com.theartofdev.edmodo.cropper.CropImageView; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; public class ScanCardActivity extends AppCompatActivity { private static final String TAG = "ScanCardActivity"; EditText nameEt; EditText companyEt; EditText telEt; EditText addressEt; EditText emailEt; ImageView cardIv; private static final int CAMERA_REQUEST_CODE = 200; private static final int STORAGE_REQUEST_CODE = 400; private static final int IMAGE_PICK_GALLERY_CODE = 1000; private static final int IMAGE_PICK_CAMERA_CODE = 1001; String cameraPermission[]; String storagePermission[]; Uri image_uri; private Bitmap mSelectedImage; ArrayList<String> outputLine = new ArrayList<>(); CardBean card = new CardBean(); Uri imageUpload; String imageUrl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scan_card); companyEt = findViewById(R.id.et_company); nameEt = findViewById(R.id.et_name); telEt = findViewById(R.id.et_tel); emailEt = findViewById(R.id.et_email); addressEt = findViewById(R.id.et_address); cardIv = findViewById(R.id.iv_card_image); // Camera Permission cameraPermission = new String [] {Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}; //Storage Permission storagePermission = new String [] {Manifest.permission.WRITE_EXTERNAL_STORAGE}; } // actionbar menu @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.scan_card_toolbar_menu, menu); return super.onCreateOptionsMenu(menu); } // handle actionbar item clicks @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.done_button: // Connect to API AddCard(); // Go to home page Intent intent = new Intent(this, MainActivity.class); startActivity(intent); return true; case R.id.camera_button: showImageImportDialog(); return true; default: return super.onOptionsItemSelected(item); } } private void showImageImportDialog(){ String Camera = this.getString(R.string.scan_camera); String Gallery = this.getString(R.string.scan_gallery); String messageTitle = this.getString(R.string.scan_message); String [] options = {Camera, Gallery}; AlertDialog.Builder dialog = new AlertDialog.Builder(this); // set dialog's title dialog.setTitle(messageTitle); dialog.setItems(options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(which == 0){ // select camera if(!checkCameraPermission()){ requestCameraPermission(); }else{ pickCamera(); } } if(which == 1){ // select gallery if(!checkStoragePermission()){ requestStoragePermission(); }else{ pickGallery(); } } } }); dialog.create().show(); } private void pickGallery() { // intent to pick image from gallery Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, IMAGE_PICK_GALLERY_CODE); } private void pickCamera() { ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, "CardWhere"); // title of picture values.put(MediaStore.Images.Media.DESCRIPTION, "Scan by CardWhere"); // description of picture image_uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri); startActivityForResult(cameraIntent, IMAGE_PICK_CAMERA_CODE); } private void requestStoragePermission() { ActivityCompat.requestPermissions(this, storagePermission, STORAGE_REQUEST_CODE); } private boolean checkStoragePermission() { boolean result_storage_permission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED); return result_storage_permission; } private void requestCameraPermission() { ActivityCompat.requestPermissions(this, cameraPermission, CAMERA_REQUEST_CODE); } private boolean checkCameraPermission() { boolean result_camera_permission = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED; boolean result_storage_permission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED); return result_camera_permission && result_storage_permission; } // handle permission result @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { switch (requestCode){ case CAMERA_REQUEST_CODE: if(grantResults.length >0){ boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; if (cameraAccepted && writeStorageAccepted){ pickCamera(); }else { Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show(); } } break; case STORAGE_REQUEST_CODE: if(grantResults.length >0){ boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; if (writeStorageAccepted){ pickGallery(); }else { Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show(); } } break; } } // handle image result @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { // got image from camera if (resultCode == RESULT_OK){ if (requestCode == IMAGE_PICK_GALLERY_CODE){ CropImage.activity(data.getData()).setGuidelines(CropImageView.Guidelines.ON).start(this); } if (requestCode == IMAGE_PICK_CAMERA_CODE){ CropImage.activity(image_uri).setGuidelines(CropImageView.Guidelines.ON).start(this); } } //got cropped image if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE){ CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK){ // get image uri Uri resultUri = result.getUri(); imageUpload = resultUri; // set image to image view cardIv.setImageURI(resultUri); // get drawable bitmap from text recognition BitmapDrawable bitmapDrawable = (BitmapDrawable) cardIv.getDrawable(); Bitmap bitmap = bitmapDrawable.getBitmap(); // text recognition mSelectedImage = bitmap; runTextRecognition(); }else if(resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE){ // if there is any error Exception error = result.getError(); Toast.makeText(this, " "+ error, Toast.LENGTH_LONG).show(); } } } private void runTextRecognition() { FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(mSelectedImage); FirebaseVisionTextRecognizer recognizer = FirebaseVision.getInstance() .getOnDeviceTextRecognizer(); recognizer.processImage(image) .addOnSuccessListener( new OnSuccessListener<FirebaseVisionText>() { @Override public void onSuccess(FirebaseVisionText texts) { processTextRecognitionResult(texts); } }) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { e.printStackTrace(); } }); } private void processTextRecognitionResult(FirebaseVisionText texts) { List<FirebaseVisionText.TextBlock> blocks = texts.getTextBlocks(); if (blocks.size() == 0) { Toast.makeText(this, "No text found", Toast.LENGTH_LONG).show(); Log.d("TAG", "No text found"); return; } //blocks for (int i = 0; i < blocks.size(); i++) { List<FirebaseVisionText.Line> lines = blocks.get(i).getLines(); // lines for (int j = 0; j < lines.size(); j++) { // get each line for auto input outputLine.add(lines.get(j).getText()); } } // Get Text if(outputLine.size() > 0){ card.setCompany(outputLine.get(0)); card.setName(outputLine.get(1)); card.setTel(outputLine.get(2)); card.setEmail(outputLine.get(3)); card.setAddress(outputLine.get(4)); } // Set Text companyEt.setText(card.getCompany()); nameEt.setText(card.getName()); telEt.setText(card.getTel()); emailEt.setText(card.getEmail()); addressEt.setText(card.getAddress()); } private void AddCard(){ final Context context = this; // get address latitude and longitude Geocoder geoCoder = new Geocoder(context, Locale.getDefault()); try { List<Address> geoResults = geoCoder.getFromLocationName(card.getAddress(), 1); while (geoResults.size()==0) { geoResults = geoCoder.getFromLocationName(card.getAddress(), 1); } if (geoResults.size()>0) { Address address = geoResults.get(0); card.setLatitude(address.getLatitude()); card.setLongitude(address.getLongitude()); } } catch (Exception e) { System.out.print(e.getMessage()); } if(imageUpload != null){ // init Cloudinary for upload card image MediaManager.init(this); // upload card to Cloudinary MediaManager.get().upload(imageUpload) .unsigned("drfll21r") .option("resource_type", "image") .option("folder", "CardWhere") .callback(new UploadCallback() { @Override public void onStart(String requestId) { Log.d(TAG, "onStart: Image Upload"); } @Override public void onProgress(String requestId, long bytes, long totalBytes) { } @Override public void onSuccess(String requestId, Map resultData) { imageUrl = resultData.get("url").toString(); Log.d(TAG, "Image upload success: result Url :" + imageUrl); card.setImageUri(imageUrl); card.setUserId(getUserIdFromLocalStorage()); //connect Api CardController cardController = new CardController(context); cardController.addCard(card); } @Override public void onError(String requestId, ErrorInfo error) { Log.d(TAG, "onError: image upload" + error.getDescription()); } @Override public void onReschedule(String requestId, ErrorInfo error) { } }) .dispatch(); }else { //connect Api CardController cardController = new CardController(context); cardController.addCard(card); } } private String getUserIdFromLocalStorage(){ SharedPreferences sharedPreferences; sharedPreferences = getSharedPreferences("UserInfo", Context.MODE_PRIVATE); return sharedPreferences.getString("USER_ID", ""); } }
UTF-8
Java
15,126
java
ScanCardActivity.java
Java
[]
null
[]
package com.cs.cardwhere; import android.Manifest; import android.app.AlertDialog; import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.location.Address; import android.location.Geocoder; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import com.cloudinary.android.MediaManager; import com.cloudinary.android.callback.ErrorInfo; import com.cloudinary.android.callback.UploadCallback; import com.cs.cardwhere.Controller.CardController; import com.cs.cardwhere.Bean.CardBean; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.ml.vision.FirebaseVision; import com.google.firebase.ml.vision.common.FirebaseVisionImage; import com.google.firebase.ml.vision.text.FirebaseVisionText; import com.google.firebase.ml.vision.text.FirebaseVisionTextRecognizer; import com.theartofdev.edmodo.cropper.CropImage; import com.theartofdev.edmodo.cropper.CropImageView; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; public class ScanCardActivity extends AppCompatActivity { private static final String TAG = "ScanCardActivity"; EditText nameEt; EditText companyEt; EditText telEt; EditText addressEt; EditText emailEt; ImageView cardIv; private static final int CAMERA_REQUEST_CODE = 200; private static final int STORAGE_REQUEST_CODE = 400; private static final int IMAGE_PICK_GALLERY_CODE = 1000; private static final int IMAGE_PICK_CAMERA_CODE = 1001; String cameraPermission[]; String storagePermission[]; Uri image_uri; private Bitmap mSelectedImage; ArrayList<String> outputLine = new ArrayList<>(); CardBean card = new CardBean(); Uri imageUpload; String imageUrl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scan_card); companyEt = findViewById(R.id.et_company); nameEt = findViewById(R.id.et_name); telEt = findViewById(R.id.et_tel); emailEt = findViewById(R.id.et_email); addressEt = findViewById(R.id.et_address); cardIv = findViewById(R.id.iv_card_image); // Camera Permission cameraPermission = new String [] {Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}; //Storage Permission storagePermission = new String [] {Manifest.permission.WRITE_EXTERNAL_STORAGE}; } // actionbar menu @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.scan_card_toolbar_menu, menu); return super.onCreateOptionsMenu(menu); } // handle actionbar item clicks @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.done_button: // Connect to API AddCard(); // Go to home page Intent intent = new Intent(this, MainActivity.class); startActivity(intent); return true; case R.id.camera_button: showImageImportDialog(); return true; default: return super.onOptionsItemSelected(item); } } private void showImageImportDialog(){ String Camera = this.getString(R.string.scan_camera); String Gallery = this.getString(R.string.scan_gallery); String messageTitle = this.getString(R.string.scan_message); String [] options = {Camera, Gallery}; AlertDialog.Builder dialog = new AlertDialog.Builder(this); // set dialog's title dialog.setTitle(messageTitle); dialog.setItems(options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(which == 0){ // select camera if(!checkCameraPermission()){ requestCameraPermission(); }else{ pickCamera(); } } if(which == 1){ // select gallery if(!checkStoragePermission()){ requestStoragePermission(); }else{ pickGallery(); } } } }); dialog.create().show(); } private void pickGallery() { // intent to pick image from gallery Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, IMAGE_PICK_GALLERY_CODE); } private void pickCamera() { ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, "CardWhere"); // title of picture values.put(MediaStore.Images.Media.DESCRIPTION, "Scan by CardWhere"); // description of picture image_uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri); startActivityForResult(cameraIntent, IMAGE_PICK_CAMERA_CODE); } private void requestStoragePermission() { ActivityCompat.requestPermissions(this, storagePermission, STORAGE_REQUEST_CODE); } private boolean checkStoragePermission() { boolean result_storage_permission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED); return result_storage_permission; } private void requestCameraPermission() { ActivityCompat.requestPermissions(this, cameraPermission, CAMERA_REQUEST_CODE); } private boolean checkCameraPermission() { boolean result_camera_permission = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED; boolean result_storage_permission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED); return result_camera_permission && result_storage_permission; } // handle permission result @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { switch (requestCode){ case CAMERA_REQUEST_CODE: if(grantResults.length >0){ boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; if (cameraAccepted && writeStorageAccepted){ pickCamera(); }else { Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show(); } } break; case STORAGE_REQUEST_CODE: if(grantResults.length >0){ boolean writeStorageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED; if (writeStorageAccepted){ pickGallery(); }else { Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show(); } } break; } } // handle image result @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { // got image from camera if (resultCode == RESULT_OK){ if (requestCode == IMAGE_PICK_GALLERY_CODE){ CropImage.activity(data.getData()).setGuidelines(CropImageView.Guidelines.ON).start(this); } if (requestCode == IMAGE_PICK_CAMERA_CODE){ CropImage.activity(image_uri).setGuidelines(CropImageView.Guidelines.ON).start(this); } } //got cropped image if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE){ CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK){ // get image uri Uri resultUri = result.getUri(); imageUpload = resultUri; // set image to image view cardIv.setImageURI(resultUri); // get drawable bitmap from text recognition BitmapDrawable bitmapDrawable = (BitmapDrawable) cardIv.getDrawable(); Bitmap bitmap = bitmapDrawable.getBitmap(); // text recognition mSelectedImage = bitmap; runTextRecognition(); }else if(resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE){ // if there is any error Exception error = result.getError(); Toast.makeText(this, " "+ error, Toast.LENGTH_LONG).show(); } } } private void runTextRecognition() { FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(mSelectedImage); FirebaseVisionTextRecognizer recognizer = FirebaseVision.getInstance() .getOnDeviceTextRecognizer(); recognizer.processImage(image) .addOnSuccessListener( new OnSuccessListener<FirebaseVisionText>() { @Override public void onSuccess(FirebaseVisionText texts) { processTextRecognitionResult(texts); } }) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { e.printStackTrace(); } }); } private void processTextRecognitionResult(FirebaseVisionText texts) { List<FirebaseVisionText.TextBlock> blocks = texts.getTextBlocks(); if (blocks.size() == 0) { Toast.makeText(this, "No text found", Toast.LENGTH_LONG).show(); Log.d("TAG", "No text found"); return; } //blocks for (int i = 0; i < blocks.size(); i++) { List<FirebaseVisionText.Line> lines = blocks.get(i).getLines(); // lines for (int j = 0; j < lines.size(); j++) { // get each line for auto input outputLine.add(lines.get(j).getText()); } } // Get Text if(outputLine.size() > 0){ card.setCompany(outputLine.get(0)); card.setName(outputLine.get(1)); card.setTel(outputLine.get(2)); card.setEmail(outputLine.get(3)); card.setAddress(outputLine.get(4)); } // Set Text companyEt.setText(card.getCompany()); nameEt.setText(card.getName()); telEt.setText(card.getTel()); emailEt.setText(card.getEmail()); addressEt.setText(card.getAddress()); } private void AddCard(){ final Context context = this; // get address latitude and longitude Geocoder geoCoder = new Geocoder(context, Locale.getDefault()); try { List<Address> geoResults = geoCoder.getFromLocationName(card.getAddress(), 1); while (geoResults.size()==0) { geoResults = geoCoder.getFromLocationName(card.getAddress(), 1); } if (geoResults.size()>0) { Address address = geoResults.get(0); card.setLatitude(address.getLatitude()); card.setLongitude(address.getLongitude()); } } catch (Exception e) { System.out.print(e.getMessage()); } if(imageUpload != null){ // init Cloudinary for upload card image MediaManager.init(this); // upload card to Cloudinary MediaManager.get().upload(imageUpload) .unsigned("drfll21r") .option("resource_type", "image") .option("folder", "CardWhere") .callback(new UploadCallback() { @Override public void onStart(String requestId) { Log.d(TAG, "onStart: Image Upload"); } @Override public void onProgress(String requestId, long bytes, long totalBytes) { } @Override public void onSuccess(String requestId, Map resultData) { imageUrl = resultData.get("url").toString(); Log.d(TAG, "Image upload success: result Url :" + imageUrl); card.setImageUri(imageUrl); card.setUserId(getUserIdFromLocalStorage()); //connect Api CardController cardController = new CardController(context); cardController.addCard(card); } @Override public void onError(String requestId, ErrorInfo error) { Log.d(TAG, "onError: image upload" + error.getDescription()); } @Override public void onReschedule(String requestId, ErrorInfo error) { } }) .dispatch(); }else { //connect Api CardController cardController = new CardController(context); cardController.addCard(card); } } private String getUserIdFromLocalStorage(){ SharedPreferences sharedPreferences; sharedPreferences = getSharedPreferences("UserInfo", Context.MODE_PRIVATE); return sharedPreferences.getString("USER_ID", ""); } }
15,126
0.590969
0.588523
419
35.100239
27.393177
121
false
false
0
0
0
0
0
0
0.541766
false
false
5
3bcb4856b38c0382ddc1cdb638cd842fc7109139
34,789,235,134,383
cfbd5f49dab34a02ebc7a743dd61cc62ff2f69e4
/src/main/java/mx/company/code/model/BcomServiceRequestBean.java
181e937390999773d497682eda24827864557824
[]
no_license
apalmag/springExample
https://github.com/apalmag/springExample
64853c1b19eadb235401f04148b94bc310cdb329
0f9edda8e84726f86968ea08be651dbf101e2a61
refs/heads/master
2020-04-10T06:29:45.656000
2018-12-07T18:08:02
2018-12-07T18:08:02
160,856,021
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * ISBAN Mexico - (c) Banco Santander Central Hispano * * Creado el 21/06/2018 17:26:34 (dd/mm/aaaa hh:mm) * * Copyright (C) ISBAN All rights reserved. Todos los derechos reservados. * */ package mx.company.code.model; import java.io.Serializable; /** * * * @Proyecto: bcom-operacion-service * @Paquete: mx.isban.bcom.operacion.model * @Clase: BcomServiceRequestBean.java. * <br/> * * @version 1.0.0 * @author <a href=โ€mailto:jnieves@visionconsulting.com.mxโ€>Uriel Nieves</a> */ public class BcomServiceRequestBean implements Serializable{ /** * id de serializacion */ private static final long serialVersionUID = -8120509176181671046L; private String sucursal; private String tipoOper; private String canal; private String app; /* * Getters & setters */ /** * Obtener valor. * @return El valor de sucursal. */ public String getSucursal() { return sucursal; } /** * Fija el valor. * * @param sucursal el valor de sucursal a colocar */ public void setSucursal(String sucursal) { this.sucursal = sucursal; } /** * Obtener valor. * @return El valor de tipoOper. */ public String getTipoOper() { return tipoOper; } /** * Fija el valor. * * @param tipoOper el valor de tipoOper a colocar */ public void setTipoOper(String tipoOper) { this.tipoOper = tipoOper; } /** * Obtener valor. * @return El valor de canal. */ public String getCanal() { return canal; } /** * Fija el valor. * * @param canal el valor de canal a colocar */ public void setCanal(String canal) { this.canal = canal; } /** * Obtener valor. * @return El valor de app. */ public String getApp() { return app; } /** * Fija el valor. * * @param app el valor de app a colocar */ public void setApp(String app) { this.app = app; } }
UTF-8
Java
1,846
java
BcomServiceRequestBean.java
Java
[ { "context": " *\n * @version 1.0.0\n * @author <a href=โ€mailto:jnieves@visionconsulting.com.mxโ€>Uriel Nieves</a>\n */\npublic class BcomServiceReq", "end": 481, "score": 0.9999277591705322, "start": 450, "tag": "EMAIL", "value": "jnieves@visionconsulting.com.mx" }, { "context": " <a href=โ€mailto:jnieves@visionconsulting.com.mxโ€>Uriel Nieves</a>\n */\npublic class BcomServiceRequestBean imple", "end": 495, "score": 0.9998936653137207, "start": 483, "tag": "NAME", "value": "Uriel Nieves" } ]
null
[]
/** * ISBAN Mexico - (c) Banco Santander Central Hispano * * Creado el 21/06/2018 17:26:34 (dd/mm/aaaa hh:mm) * * Copyright (C) ISBAN All rights reserved. Todos los derechos reservados. * */ package mx.company.code.model; import java.io.Serializable; /** * * * @Proyecto: bcom-operacion-service * @Paquete: mx.isban.bcom.operacion.model * @Clase: BcomServiceRequestBean.java. * <br/> * * @version 1.0.0 * @author <a href=โ€mailto:<EMAIL>โ€><NAME></a> */ public class BcomServiceRequestBean implements Serializable{ /** * id de serializacion */ private static final long serialVersionUID = -8120509176181671046L; private String sucursal; private String tipoOper; private String canal; private String app; /* * Getters & setters */ /** * Obtener valor. * @return El valor de sucursal. */ public String getSucursal() { return sucursal; } /** * Fija el valor. * * @param sucursal el valor de sucursal a colocar */ public void setSucursal(String sucursal) { this.sucursal = sucursal; } /** * Obtener valor. * @return El valor de tipoOper. */ public String getTipoOper() { return tipoOper; } /** * Fija el valor. * * @param tipoOper el valor de tipoOper a colocar */ public void setTipoOper(String tipoOper) { this.tipoOper = tipoOper; } /** * Obtener valor. * @return El valor de canal. */ public String getCanal() { return canal; } /** * Fija el valor. * * @param canal el valor de canal a colocar */ public void setCanal(String canal) { this.canal = canal; } /** * Obtener valor. * @return El valor de app. */ public String getApp() { return app; } /** * Fija el valor. * * @param app el valor de app a colocar */ public void setApp(String app) { this.app = app; } }
1,816
0.647666
0.628122
101
17.237623
18.151806
77
false
false
0
0
0
0
0
0
0.970297
false
false
5
ebf4b8c7fda897fb1f6c3460f3ebc685e6c45afe
38,843,684,231,006
4bf752f654c2fe508264811cf50b4f4b3c0f6610
/FourSquareCipher.java
878bf312a5d9d6cf76bada28ad196caceb80b701
[]
no_license
kamilBrodziak/enigma
https://github.com/kamilBrodziak/enigma
2ca736db02a466f200d3cd172555a01897a63a0c
921610f0854f95980299af3867791647d8c1bd4c
refs/heads/master
2020-03-26T21:28:53.516000
2018-08-24T09:06:40
2018-08-24T09:06:40
145,391,182
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; public class FourSquareCipher{ private String message; final String alphabetTXT="abcdefghiklmnopqrstuvwxyz"; private String key; private String key2; private String decision; public char[][] alphabet= new char[5][5]; public char[][] ciphertext1=new char[5][5]; public char[][] ciphertext2=new char[5][5]; public String getMessage(){ return message; } FourSquareCipher(String message, String key, String key2, String decision){ if(message.length()%2==0) this.message=message; else this.message=message+'x'; this.key=key; this.key2=key2; this.decision=decision; alphabet=makeArrayFull(alphabetTXT, alphabet.length, alphabet[0].length); ciphertext1=makekey(key, ciphertext1.length, ciphertext1[0].length); ciphertext2=makekey(key2,ciphertext2.length,ciphertext2[0].length); System.out.println(encrypt(getMessage())); } public String encrypt(String Word){ String encrypted=""; char currentChar; String newString=""; int firstletterX=0,firstletterY=0,secondletterX=0,secondletterY=0; ArrayList<Character> newWord = new ArrayList<Character>(); newWord=SimpleSubstitutionChiper.makeList(Word); for(char letter: newWord){ if(letter=='j'){ letter='i'; } newString+=letter; } Word=newString; if(decision.equals("b")){ for(int k=0; k<Word.length()-1;k+=2){ for(int i=0; i<alphabet.length;i++) { for(int j=0; j<alphabet[0].length;j++){ if(alphabet[i][j]==Word.charAt(k)) { firstletterX=i; firstletterY=j; } if(alphabet[i][j]==Word.charAt(k+1)) { secondletterX=i; secondletterY=j; } } } encrypted+=ciphertext1[firstletterX][secondletterY]; encrypted+=ciphertext2[secondletterX][firstletterY]; } } if(decision.equals("d")){ for(int k=0; k<Word.length()-1;k+=2){ for(int i=0; i<ciphertext1.length;i++) { for(int j=0; j<ciphertext1[0].length;j++){ if(ciphertext1[i][j]==Word.charAt(k)) { firstletterX=i; firstletterY=j; } if(ciphertext2[i][j]==Word.charAt(k+1)) { secondletterX=i; secondletterY=j; } } } encrypted+=alphabet[firstletterX][secondletterY]; encrypted+=alphabet[secondletterX][firstletterY]; } } // System.out.println(firstletterX); return encrypted; } public char[][] makekey(String key,int x, int y){ char[][] keyArray=new char[x][y]; int count=0; String newWord=key+alphabetTXT; //String newWord2=""; LinkedHashSet<Character> newWord2 = new LinkedHashSet<Character>(); for(int i=0; i<newWord.length();i++){ if(newWord.charAt(i)=='j'){ newWord2.add('i'); } else{ newWord2.add(newWord.charAt(i)); } } ArrayList<Character> setToList= new ArrayList<Character>(newWord2); for(int i=0; i<x; i++){ for(int j=0; j<y; j++){ if (newWord.length()>count){ keyArray[i][j]=setToList.get(count); count++; } } } return keyArray; } public char[][] makeArrayFull(String content,int x, int y){ int count=0; char[][] returnedarray=new char[x][y]; for(int i=0; i<x; i++){ for(int j=0; j<y; j++){ if (content.length()>count){ returnedarray[i][j]=content.charAt(count); count++; } } } return returnedarray; } public static void main(String[] args) { FourSquareCipher a = new FourSquareCipher("pWCKcfdlUp", "KLUCZJEDEN","KLUCZDWA", "d"); //FourSquareCipher a = new FourSquareCipher("wiadomosc", "KLUCZJEDEN","KLUCZDWA", "b"); //d to ODSZYFROWYWANIE, b to SZYFROWANIE. } }
UTF-8
Java
4,867
java
FourSquareCipher.java
Java
[]
null
[]
import java.util.*; public class FourSquareCipher{ private String message; final String alphabetTXT="abcdefghiklmnopqrstuvwxyz"; private String key; private String key2; private String decision; public char[][] alphabet= new char[5][5]; public char[][] ciphertext1=new char[5][5]; public char[][] ciphertext2=new char[5][5]; public String getMessage(){ return message; } FourSquareCipher(String message, String key, String key2, String decision){ if(message.length()%2==0) this.message=message; else this.message=message+'x'; this.key=key; this.key2=key2; this.decision=decision; alphabet=makeArrayFull(alphabetTXT, alphabet.length, alphabet[0].length); ciphertext1=makekey(key, ciphertext1.length, ciphertext1[0].length); ciphertext2=makekey(key2,ciphertext2.length,ciphertext2[0].length); System.out.println(encrypt(getMessage())); } public String encrypt(String Word){ String encrypted=""; char currentChar; String newString=""; int firstletterX=0,firstletterY=0,secondletterX=0,secondletterY=0; ArrayList<Character> newWord = new ArrayList<Character>(); newWord=SimpleSubstitutionChiper.makeList(Word); for(char letter: newWord){ if(letter=='j'){ letter='i'; } newString+=letter; } Word=newString; if(decision.equals("b")){ for(int k=0; k<Word.length()-1;k+=2){ for(int i=0; i<alphabet.length;i++) { for(int j=0; j<alphabet[0].length;j++){ if(alphabet[i][j]==Word.charAt(k)) { firstletterX=i; firstletterY=j; } if(alphabet[i][j]==Word.charAt(k+1)) { secondletterX=i; secondletterY=j; } } } encrypted+=ciphertext1[firstletterX][secondletterY]; encrypted+=ciphertext2[secondletterX][firstletterY]; } } if(decision.equals("d")){ for(int k=0; k<Word.length()-1;k+=2){ for(int i=0; i<ciphertext1.length;i++) { for(int j=0; j<ciphertext1[0].length;j++){ if(ciphertext1[i][j]==Word.charAt(k)) { firstletterX=i; firstletterY=j; } if(ciphertext2[i][j]==Word.charAt(k+1)) { secondletterX=i; secondletterY=j; } } } encrypted+=alphabet[firstletterX][secondletterY]; encrypted+=alphabet[secondletterX][firstletterY]; } } // System.out.println(firstletterX); return encrypted; } public char[][] makekey(String key,int x, int y){ char[][] keyArray=new char[x][y]; int count=0; String newWord=key+alphabetTXT; //String newWord2=""; LinkedHashSet<Character> newWord2 = new LinkedHashSet<Character>(); for(int i=0; i<newWord.length();i++){ if(newWord.charAt(i)=='j'){ newWord2.add('i'); } else{ newWord2.add(newWord.charAt(i)); } } ArrayList<Character> setToList= new ArrayList<Character>(newWord2); for(int i=0; i<x; i++){ for(int j=0; j<y; j++){ if (newWord.length()>count){ keyArray[i][j]=setToList.get(count); count++; } } } return keyArray; } public char[][] makeArrayFull(String content,int x, int y){ int count=0; char[][] returnedarray=new char[x][y]; for(int i=0; i<x; i++){ for(int j=0; j<y; j++){ if (content.length()>count){ returnedarray[i][j]=content.charAt(count); count++; } } } return returnedarray; } public static void main(String[] args) { FourSquareCipher a = new FourSquareCipher("pWCKcfdlUp", "KLUCZJEDEN","KLUCZDWA", "d"); //FourSquareCipher a = new FourSquareCipher("wiadomosc", "KLUCZJEDEN","KLUCZDWA", "b"); //d to ODSZYFROWYWANIE, b to SZYFROWANIE. } }
4,867
0.472159
0.459832
164
28.682926
22.778294
95
false
false
0
0
0
0
0
0
0.640244
false
false
5
c85bdf723d5dc8bde820e2626a33be687faf3970
38,843,684,230,367
52c975e2af64621284b070e3a5e855dfa062e5a9
/test/src/main/java/edu/nju/test/exception/TimeExceededException.java
e871538b9b273887948840b6ee65817156604591
[]
no_license
dongyibo/OnlineTestSystem
https://github.com/dongyibo/OnlineTestSystem
ad1ac319cc2724b58c57c7993e1bb07ff57b1fa5
30fd64e219b10033e8c0a6fd7f4675ec40943f70
refs/heads/master
2021-05-11T13:58:53.952000
2018-01-16T14:07:20
2018-01-16T14:07:20
117,690,947
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.nju.test.exception; public class TimeExceededException extends RuntimeException{ public TimeExceededException(String message){ super(message); } }
UTF-8
Java
176
java
TimeExceededException.java
Java
[]
null
[]
package edu.nju.test.exception; public class TimeExceededException extends RuntimeException{ public TimeExceededException(String message){ super(message); } }
176
0.755682
0.755682
7
24.142857
22.15806
60
false
false
0
0
0
0
0
0
0.285714
false
false
5
e5cd1e3a797924e4bfae139801e3dd887a6dbe69
22,849,226,073,996
2c6b840a23566f143b1fb150b32b10f2aa2f7765
/src/com/koreaap/rms/tr/rp/utiUpdate/web/UtiUpdateController.java
2acec9b1669b6b8935aacf7300fb82bf8f6d253c
[]
no_license
Lee-Myung-Chul/mc
https://github.com/Lee-Myung-Chul/mc
45d1145cb240e2b38df87921d1f19309bdf0832a
39da1fb35275de269b9c5dd8b2c01f46a8d95dad
refs/heads/master
2021-08-02T12:20:57.907000
2021-07-27T00:07:24
2021-07-27T00:07:24
67,489,237
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.koreaap.rms.tr.rp.utiUpdate.web; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.koreaap.rms.framework.ui.MroRequest; import com.koreaap.rms.framework.ui.MroResponse; import com.koreaap.rms.tr.rp.utiUpdate.service.UtiUpdateService; @Controller @RequestMapping("/tr/rp/utiUpdate") public class UtiUpdateController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private UtiUpdateService service; /** * UTI ์—…๋ฐ์ดํŠธ */ @RequestMapping("/saveUpdateUti") @ResponseBody public MroResponse saveUpdateUti(@RequestBody MroRequest req) { List<HashMap> list = req.getDataSet("list", HashMap.class); service.saveUpdateUti(list); return new MroResponse(); } }
UTF-8
Java
1,142
java
UtiUpdateController.java
Java
[]
null
[]
package com.koreaap.rms.tr.rp.utiUpdate.web; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.koreaap.rms.framework.ui.MroRequest; import com.koreaap.rms.framework.ui.MroResponse; import com.koreaap.rms.tr.rp.utiUpdate.service.UtiUpdateService; @Controller @RequestMapping("/tr/rp/utiUpdate") public class UtiUpdateController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private UtiUpdateService service; /** * UTI ์—…๋ฐ์ดํŠธ */ @RequestMapping("/saveUpdateUti") @ResponseBody public MroResponse saveUpdateUti(@RequestBody MroRequest req) { List<HashMap> list = req.getDataSet("list", HashMap.class); service.saveUpdateUti(list); return new MroResponse(); } }
1,142
0.793651
0.791887
44
24.795454
22.847897
64
false
false
0
0
0
0
0
0
1
false
false
5
06f1740abb98e06f74bb90138a696818236ff35e
4,939,212,458,748
28c62c40a23f1212cb51ace078afae475e4b0559
/lichkin-spring-boot-demo-web-api/src/main/java/com/lichkin/ErrorCodes.java
a03b602386546f753c20b599a023be97423cafb5
[ "MIT" ]
permissive
LichKinContributor/lichkin-spring-boot-demos
https://github.com/LichKinContributor/lichkin-spring-boot-demos
11116f776ccdd487ae1240b9cfbdbd5ab70efacd
81e27be7e3203716a1cb33897abc586be597b70b
refs/heads/master
2018-09-07T19:41:30.697000
2018-06-08T14:48:09
2018-06-08T14:48:09
128,640,279
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lichkin; import com.lichkin.framework.defines.enums.LKCodeEnum; import lombok.Getter; import lombok.RequiredArgsConstructor; /** * ้”™่ฏฏ็ผ–็  * * <pre> * ่ง„่Œƒๅ‘ฝๅๅบ”ไฝฟ็”จไธ‹ๅˆ’็บฟๅคงๅ†™่กจ็คบ้™ๆ€ๅธธ้‡๏ผŒไธบๅขžๅŠ ๅฏ่ฏปๆ€งๆœฌ็ฑป้‡‡็”จๅŽŸๅใ€‚ * ๅ‚ๆ•ฐ้”™่ฏฏ็ฑปๆ็คบๅฐ†code่ฎพ็ฝฎไธบnull๏ผŒๅˆ™ไธ้œ€่ฆ้…็ฝฎi18nๆ–‡ไปถไธญ็š„ๅ†…ๅฎนใ€‚ * ่‡ชๅฎšไน‰codeไธ่ƒฝๅฐไบŽ10000ใ€‚ * </pre> * * @author SuZhou LichKin Information Technology Co., Ltd. */ @Getter @RequiredArgsConstructor public enum ErrorCodes implements LKCodeEnum { /** ๆฒกๆœ‰ๅฏ็”จ็‰ˆๆœฌ */ no_version_found(10000), /** ๅ›ฝ้™…ๅŒ– */ locale(null), /** ๅฎขๆˆท็ซฏๅ”ฏไธ€ๆ ‡่ฏ† */ appKey(null), /** ๅฎขๆˆท็ซฏ็‰ˆๆœฌ */ versionX(null), /** ๅฎขๆˆท็ซฏ็‰ˆๆœฌ */ versionY(null), /** ๅฎขๆˆท็ซฏ็‰ˆๆœฌ */ versionZ(null), /** ็™ปๅฝ•ๅŽ่Žทๅ–ๅพ— */ token(null), /** ๅฎขๆˆท็ซฏ็ฑปๅž‹ */ clientType(null), /** ๅฎขๆˆท็ซฏ็ณป็ปŸ็‰ˆๆœฌ */ osVersion(null), /** ็”ŸไบงๅŽ‚ๅ•† */ brand(null), /** ๆœบๅž‹ไฟกๆฏ */ model(null), /** ่ฎพๅค‡ๅ”ฏไธ€ๆ ‡่ฏ† */ uuid(null), /** ๅฑๅน•ๅฎฝ */ screenWidth(null), /** ๅฑๅน•้ซ˜ */ screenHeight(null); /** ็ผ–็  */ private final Integer code; }
UTF-8
Java
1,191
java
ErrorCodes.java
Java
[ { "context": "ไธญ็š„ๅ†…ๅฎนใ€‚\n * ่‡ชๅฎšไน‰codeไธ่ƒฝๅฐไบŽ10000ใ€‚\n * </pre>\n *\n * @author SuZhou LichKin Information Technology Co., Ltd.\n */\n@Getter\n@Req", "end": 300, "score": 0.9663195013999939, "start": 286, "tag": "NAME", "value": "SuZhou LichKin" } ]
null
[]
package com.lichkin; import com.lichkin.framework.defines.enums.LKCodeEnum; import lombok.Getter; import lombok.RequiredArgsConstructor; /** * ้”™่ฏฏ็ผ–็  * * <pre> * ่ง„่Œƒๅ‘ฝๅๅบ”ไฝฟ็”จไธ‹ๅˆ’็บฟๅคงๅ†™่กจ็คบ้™ๆ€ๅธธ้‡๏ผŒไธบๅขžๅŠ ๅฏ่ฏปๆ€งๆœฌ็ฑป้‡‡็”จๅŽŸๅใ€‚ * ๅ‚ๆ•ฐ้”™่ฏฏ็ฑปๆ็คบๅฐ†code่ฎพ็ฝฎไธบnull๏ผŒๅˆ™ไธ้œ€่ฆ้…็ฝฎi18nๆ–‡ไปถไธญ็š„ๅ†…ๅฎนใ€‚ * ่‡ชๅฎšไน‰codeไธ่ƒฝๅฐไบŽ10000ใ€‚ * </pre> * * @author <NAME> Information Technology Co., Ltd. */ @Getter @RequiredArgsConstructor public enum ErrorCodes implements LKCodeEnum { /** ๆฒกๆœ‰ๅฏ็”จ็‰ˆๆœฌ */ no_version_found(10000), /** ๅ›ฝ้™…ๅŒ– */ locale(null), /** ๅฎขๆˆท็ซฏๅ”ฏไธ€ๆ ‡่ฏ† */ appKey(null), /** ๅฎขๆˆท็ซฏ็‰ˆๆœฌ */ versionX(null), /** ๅฎขๆˆท็ซฏ็‰ˆๆœฌ */ versionY(null), /** ๅฎขๆˆท็ซฏ็‰ˆๆœฌ */ versionZ(null), /** ็™ปๅฝ•ๅŽ่Žทๅ–ๅพ— */ token(null), /** ๅฎขๆˆท็ซฏ็ฑปๅž‹ */ clientType(null), /** ๅฎขๆˆท็ซฏ็ณป็ปŸ็‰ˆๆœฌ */ osVersion(null), /** ็”ŸไบงๅŽ‚ๅ•† */ brand(null), /** ๆœบๅž‹ไฟกๆฏ */ model(null), /** ่ฎพๅค‡ๅ”ฏไธ€ๆ ‡่ฏ† */ uuid(null), /** ๅฑๅน•ๅฎฝ */ screenWidth(null), /** ๅฑๅน•้ซ˜ */ screenHeight(null); /** ็ผ–็  */ private final Integer code; }
1,183
0.641054
0.627881
68
12.397058
12.925282
58
false
false
0
0
0
0
0
0
0.735294
false
false
5
c36233ad7d9d55d450a7a0b74e91268cdae370d1
24,275,155,221,249
2289c90b71c5291049391ea88941b59ecfbba6c7
/.svn/pristine/d4/d435a5d656711d358d4bad3d787d2052a3a5a45f.svn-base
9c29205c53c960a3f9be17ac85fdb3e58b6a2964
[]
no_license
samakin/car-parent
https://github.com/samakin/car-parent
388762472282b5e5258c01dbdc782b40df980880
76130221e27c91f098684350b57d48bbcd1a8643
refs/heads/master
2020-04-29T05:01:08.127000
2019-01-16T02:41:02
2019-01-16T02:41:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.emate.shop.rpc.dto; import java.util.List; public class RpcRequest implements java.io.Serializable { private static final long serialVersionUID = -8643757230663618215L; // private Class<?> serviceClazz; private String serviceClazz; // private Method serviceMethod; private String methedName; // private Class<?>[] methedParameterTypes; private String[] methedParameterTypes; private List<Object> args; public List<Object> getArgs() { return args; } public void setArgs(List<Object> args) { this.args = args; } // public Class<?> getServiceClazz() { // return serviceClazz; // } // // public void setServiceClazz(Class<?> serviceClazz) { // this.serviceClazz = serviceClazz; // } public String getMethedName() { return methedName; } public String getServiceClazz() { return serviceClazz; } public void setServiceClazz(String serviceClazz) { this.serviceClazz = serviceClazz; } public void setMethedName(String methedName) { this.methedName = methedName; } public String[] getMethedParameterTypes() { return methedParameterTypes; } public void setMethedParameterTypes(String[] methedParameterTypes) { this.methedParameterTypes = methedParameterTypes; } // public Method getServiceMethod() { // return serviceMethod; // } // // public void setServiceMethod(Method serviceMethod) { // this.serviceMethod = serviceMethod; // } }
UTF-8
Java
1,697
d435a5d656711d358d4bad3d787d2052a3a5a45f.svn-base
Java
[]
null
[]
package com.emate.shop.rpc.dto; import java.util.List; public class RpcRequest implements java.io.Serializable { private static final long serialVersionUID = -8643757230663618215L; // private Class<?> serviceClazz; private String serviceClazz; // private Method serviceMethod; private String methedName; // private Class<?>[] methedParameterTypes; private String[] methedParameterTypes; private List<Object> args; public List<Object> getArgs() { return args; } public void setArgs(List<Object> args) { this.args = args; } // public Class<?> getServiceClazz() { // return serviceClazz; // } // // public void setServiceClazz(Class<?> serviceClazz) { // this.serviceClazz = serviceClazz; // } public String getMethedName() { return methedName; } public String getServiceClazz() { return serviceClazz; } public void setServiceClazz(String serviceClazz) { this.serviceClazz = serviceClazz; } public void setMethedName(String methedName) { this.methedName = methedName; } public String[] getMethedParameterTypes() { return methedParameterTypes; } public void setMethedParameterTypes(String[] methedParameterTypes) { this.methedParameterTypes = methedParameterTypes; } // public Method getServiceMethod() { // return serviceMethod; // } // // public void setServiceMethod(Method serviceMethod) { // this.serviceMethod = serviceMethod; // } }
1,697
0.606953
0.595757
71
22.901409
22.531452
72
false
false
0
0
0
0
0
0
0.309859
false
false
5
b33b77f46aa879ceb63964027653d29995296024
38,843,684,266,347
ab5052b0daba62b84ae1d76cf63e4d1f6b52552f
/audioFile.java
139ba6f589e72e2de367eff90c46fcbcf53397ad
[]
no_license
mariaguyde/lecteur-de-fichiers
https://github.com/mariaguyde/lecteur-de-fichiers
7bb8e8e7de58e8b50f3057edf2c76fbfd271a02e
eb311b44e15ca8c18d35415bb82bea86a40347ad
refs/heads/main
2023-08-13T07:42:20.799000
2021-10-14T17:55:10
2021-10-14T17:55:10
416,657,408
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package file_reader; public abstract class audioFile extends file implements lecteurFichiers{ public audioFile(String path, String nameFile) { super(path, nameFile); } }
UTF-8
Java
179
java
audioFile.java
Java
[]
null
[]
package file_reader; public abstract class audioFile extends file implements lecteurFichiers{ public audioFile(String path, String nameFile) { super(path, nameFile); } }
179
0.765363
0.765363
11
15.272727
23.351429
72
false
false
0
0
0
0
0
0
0.727273
false
false
5
5e48dac97e57e8f51516636afb5fa9f841197125
37,684,043,075,398
c06c8e62e66c15a8215d73cc02aa6d97a3fd15b4
/src_hashimoto/Ex04/prac_04_08.java
f1d6f821c0c79ba6ca2db561f9fce06ebef78be2
[]
no_license
jmas1524/schoo
https://github.com/jmas1524/schoo
ab2226bcb4bb87e503411bf59d143757c50f948a
884a8dea6a8baf4b87581b3559f7750639be2817
refs/heads/master
2022-07-16T08:45:28.481000
2020-05-21T07:36:38
2020-05-21T07:36:38
265,781,215
0
0
null
true
2020-05-21T07:16:03
2020-05-21T07:16:02
2020-05-21T07:12:01
2020-05-21T07:11:58
0
0
0
0
null
false
false
import java.util.Scanner; public class prac_04_08 { public static void main(String[] args) { Scanner stdln = new Scanner(System.in); int n; do { System.out.print("ๆ•ดๆ•ฐๅ€ค๏ผš"); n = stdln.nextInt(); } while (n < 0); int i = 0; do { n /= 10; i++; } while (n > 0); System.out.println("ใใฎๅ€คใฏ"+ i +"ๆกใงใ™ใ€‚"); } }
UTF-8
Java
444
java
prac_04_08.java
Java
[]
null
[]
import java.util.Scanner; public class prac_04_08 { public static void main(String[] args) { Scanner stdln = new Scanner(System.in); int n; do { System.out.print("ๆ•ดๆ•ฐๅ€ค๏ผš"); n = stdln.nextInt(); } while (n < 0); int i = 0; do { n /= 10; i++; } while (n > 0); System.out.println("ใใฎๅ€คใฏ"+ i +"ๆกใงใ™ใ€‚"); } }
444
0.440476
0.419048
22
18.136364
15.157642
47
false
false
0
0
0
0
0
0
0.545455
false
false
5
e40663da349cf0ead2cd1c3aca106eda338b3613
38,096,359,928,206
48601d6a5e542d94382d38eafc05dc90f4681e9f
/src/main/java/com/javaweb/service/impl/BaseDataManageService.java
0672e65aec6cce218acc038d6e455f564685ada3
[]
no_license
chen0860310/vmm
https://github.com/chen0860310/vmm
39971871b201938e4fbe9062ce0bb135a39fe121
082ecac3870e2d42ffab78dd27581f50540d58c2
refs/heads/master
2023-08-15T12:35:01.581000
2021-09-13T09:22:15
2021-09-13T09:22:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javaweb.service.impl; import java.text.SimpleDateFormat; import java.util.List; import javax.annotation.Resource; import org.apache.tools.ant.taskdefs.condition.And; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.github.pagehelper.PageHelper; import com.javaweb.dao.DaoFactory; import com.javaweb.entity.Customer; import com.javaweb.entity.Mainitem; import com.javaweb.entity.Part; import com.javaweb.entity.Partcategory; import com.javaweb.entity.Partstorage; import com.javaweb.entity.Permission; import com.javaweb.entity.Projcategory; import com.javaweb.entity.Supplier; import com.javaweb.entity.Vehicle; import com.javaweb.entity.Warehouse; import com.javaweb.service.IBaseDataManageService; import com.javaweb.utils.BeanUtil; import com.javaweb.utils.PagedResult; import com.javaweb.utils.StringUtils; import com.javaweb.views.CustomerView; import com.javaweb.views.MainItemView; /** * ๅŸบ็ก€ๆ•ฐๆฎ็š„ๆœๅŠก * * @author PengChan * */ @Service public class BaseDataManageService implements IBaseDataManageService { private static final Logger logger = LoggerFactory.getLogger(BaseDataManageService.class); @Resource private DaoFactory daoFactory; /** * ๅˆ†้กตๆŸฅ่ฏข็”จๆˆท็š„ไฟกๆฏ */ @Override public PagedResult<CustomerView> queryPagedCustomerView(String key, String sort, String order, Integer pageNo, Integer pageSize) { pageNo = pageNo == null ? 0 : pageNo; pageSize = pageSize == null ? 10 : pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getCustomerMapper().selectCustomer(key, sort, order)); } /** * ๆŸฅ่ฏข็”จๆˆท็š„ไฟกๆฏ */ @Override public List<CustomerView> queryAllCustomer() { return daoFactory.getCustomerMapper().selectCustomer(null, null, null); } /** * ไฟฎๆ”น็”จๆˆทไฟกๆฏ */ @Transactional @Override public boolean modifyCustomer(CustomerView customerView) { boolean flag = true; int i = 0; try { Customer customer = daoFactory.getCustomerMapper() .selectByPrimaryKey(StringUtils.getIntegerValue(customerView.getCustomerid(), -1)); if (customer != null) { customer.setContactadd(customerView.getContactadd()); customer.setContactinfo(customerView.getContactinfo()); customer.setNumbering(customerView.getCustomername()); // ๆ›ดๆ–ฐ็”จๆˆท็š„ไฟกๆฏ daoFactory.getCustomerMapper().updateByPrimaryKeySelective(customer); ++i; } Vehicle vehicle = daoFactory.getVehicleMapper() .selectByPrimaryKey(StringUtils.getIntegerValue(customerView.getVehicleid(), -1)); if (vehicle != null) { vehicle.setPlatenum(customerView.getPlatenum()); vehicle.setInspectiondate(new SimpleDateFormat("yyyy-MM-dd").parse(customerView.getInspectiondate())); vehicle.setMilage(StringUtils.getDoubleValue(customerView.getMilage(), -1d)); vehicle.setVehflag(customerView.getVehflag()); // ๆ›ดๆ–ฐ่ฝฆ่พ†ไฟกๆฏ daoFactory.getVehicleMapper().updateByPrimaryKeySelective(vehicle); ++i; } } catch (Exception e) { logger.info("ไฟฎๆ”น็”จๆˆทไฟกๆฏๅคฑ่ดฅ!"); } return (i == 2); } /** * ๆŸฅ่ฏขๆƒ้™ */ @Override public List<Permission> queryPermission() { return daoFactory.getPermissionMapper().selectAllPermission(); } /** * ไฟฎๆ”นๆƒ้™็š„็Šถๆ€ */ @Override public boolean modifyPermission(Permission permission) { boolean flag = false; if (permission != null) { Permission perm = daoFactory.getPermissionMapper().selectByPrimaryKey(permission.getId()); perm.setPerflag(permission.getPerflag()); flag = daoFactory.getPermissionMapper().updateByPrimaryKeySelective(perm) > 0; } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„็ปดไฟฎ้กน็›ฎ */ @Override public List<MainItemView> queryAllMainItem() { return daoFactory.getMainitemMapper().selectallMainitem(); } @Override public boolean modifyMainitem(Mainitem mainitem, String type) { boolean flag = false; if (mainitem != null) { try { if ("C".equals(type)) {// ๆทปๅŠ ไฟกๆฏ flag = daoFactory.getMainitemMapper().insertSelective(mainitem) > 0; } else if ("U".equals(type)) { flag = daoFactory.getMainitemMapper().updateByPrimaryKeySelective(mainitem) > 0; } else if ("D".equals(type)) { Mainitem mt = daoFactory.getMainitemMapper().selectByPrimaryKey(mainitem.getId()); if (mt != null) { mt.setMainflag(mainitem.getMainflag()); flag = daoFactory.getMainitemMapper().updateByPrimaryKeySelective(mt) > 0; } } } catch (Exception e) { logger.error("ไฟฎๆ”น็ปดไฟฎ้กน็›ฎ็ฑปๅˆซ็š„ไฟกๆฏๅคฑ่ดฅ!"); } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็ปดไฟฎ็š„็ฑปๅˆซ */ @Override public List<Projcategory> queryAllProjCategory() { return daoFactory.getProjcategoryMapper().selectAllCategory(); } /** * ไฟฎๆ”น็ปดไฟฎ้กน็›ฎๅคง็ฑป */ @Override public boolean modifyPartCategory(Projcategory projcategory, String type) { boolean flag = false; if (projcategory != null) { try { if ("C".equals(type)) {// ๆทปๅŠ ไฟกๆฏ flag = daoFactory.getProjcategoryMapper().insertSelective(projcategory) > 0; } else if ("U".equals(type)) { flag = daoFactory.getProjcategoryMapper().updateByPrimaryKeySelective(projcategory) > 0; } else if ("D".equals(type)) { Projcategory pg = daoFactory.getProjcategoryMapper().selectByPrimaryKey(projcategory.getId()); if (pg != null) { pg.setCatflag(projcategory.getCatflag()); flag = daoFactory.getProjcategoryMapper().updateByPrimaryKeySelective(projcategory) > 0; } } } catch (Exception e) { logger.error("ไฟฎๆ”น็ปดไฟฎ้กน็›ฎ็ฑปๅˆซ็š„ไฟกๆฏๅคฑ่ดฅ!"); } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไพ›ๅบ”ๅ•† */ @Override public PagedResult<Supplier> queryAllSupplier(String key, String sort, String order, String flag, Integer pageNo, Integer pageSize) { pageNo = pageNo == null ? 0 : pageNo; pageSize = pageSize == null ? 10 : pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getSupplierMapper().selectAllSupplier(key, sort, order, flag)); } /** * ไฟฎๆ”นไพ›ๅบ”ๅ•†็š„ไฟกๆฏ */ @Override public boolean modifySupplier(Supplier supplier, String type) { boolean flag = false; if(supplier!=null&&org.apache.commons.lang.StringUtils.isNotBlank(type)){ try { if("C".equals(type)){// ๆทปๅŠ ็”จๆˆท็š„ไฟกๆฏ supplier.setSuppflag("1"); flag = daoFactory.getSupplierMapper().insertSelective(supplier)>0; }else if("U".equals(type)){// ไฟฎๆ”น็”จๆˆท็š„ไฟกๆฏ flag = daoFactory.getSupplierMapper().updateByPrimaryKeySelective(supplier)>0; }else if("D".equals(type)){// ๅˆ ้™ค็”จๆˆท็š„ไฟกๆฏ(flag=0) Supplier sp = daoFactory.getSupplierMapper().selectByPrimaryKey(supplier.getId()); if(sp!=null){ sp.setSuppflag(supplier.getSuppflag()); flag = daoFactory.getSupplierMapper().updateByPrimaryKeySelective(sp)>0; } } } catch (Exception e) { logger.error("ไฟฎๆ”นไพ›ๅบ”ๅ•†ไฟกๆฏๅคฑ่ดฅ!"); } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไพ›ๅบ”ๅ•† */ @Override public List<Supplier> queryAllSupplier() { return daoFactory.getSupplierMapper().selectAllSupplier(null, null, null, null); } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„้…ไปถ็š„็ฑปๅˆซ */ @Override public PagedResult<Partcategory> queryPagedPartCategory(Integer pageNo, Integer pageSize, String status) { pageNo = pageNo==null?0:pageNo; pageSize = pageSize==null?0:pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getPartcategoryMapper().selectAllPartCategory(status)); } /** * ไฟฎๆ”น้›ถไปถ็ฑปๅˆซไฟกๆฏ */ @Override public boolean modifyPartCategory(Partcategory partcategory, String type) { boolean flag = false; if(partcategory!=null && org.apache.commons.lang.StringUtils.isNotBlank(type)){ if("C".equals(type)){// ๆทปๅŠ  partcategory.setPartcatflag("1"); flag = daoFactory.getPartcategoryMapper().insertSelective(partcategory)>0; }else if("U".equals(type)){// ไฟฎๆ”น flag = daoFactory.getPartcategoryMapper().updateByPrimaryKeySelective(partcategory)>0; }else if("D".equals(type)){// ๅˆ ้™ค Partcategory pt = daoFactory.getPartcategoryMapper().selectByPrimaryKey(partcategory.getId()); if(pt!=null){ pt.setPartcatflag(partcategory.getPartcatflag()); flag = daoFactory.getPartcategoryMapper().updateByPrimaryKeySelective(pt)>0; } } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไป“ๅบ“็š„ไฟกๆฏ */ @Override public PagedResult<Warehouse> queryPagedWarehouse(Integer pageNo, Integer pageSize, String status) { pageNo = pageNo==null?0:pageNo; pageSize = pageSize==null?0:pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getWarehouseMapper().selectAllWarehouse(status)); } /** * ไฟฎๆ”นไป“ๅบ“็š„ไฟกๆฏ */ @Override public boolean modifyWarehouse(Warehouse warehouse, String type) { boolean flag = false; if(warehouse!=null && org.apache.commons.lang.StringUtils.isNotBlank(type)){ if("C".equals(type)){// ๆทปๅŠ  warehouse.setWareflag("1"); flag = daoFactory.getWarehouseMapper().insertSelective(warehouse)>0; }else if("U".equals(type)){// ไฟฎๆ”น flag = daoFactory.getWarehouseMapper().updateByPrimaryKeySelective(warehouse)>0; }else if("D".equals(type)){// ๅˆ ้™ค Warehouse wh = daoFactory.getWarehouseMapper().selectByPrimaryKey(warehouse.getId()); if(wh!=null){ wh.setWareflag(warehouse.getWareflag()); flag = daoFactory.getWarehouseMapper().updateByPrimaryKeySelective(wh)>0; } } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰้›ถไปถ็š„็ฑปๅˆซ */ @Override public List<Partcategory> queryAllPartCategory() { return daoFactory.getPartcategoryMapper().selectAllPartCategory(""); } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไป“ๅบ“ */ @Override public List<Warehouse> queryAllWareHouse() { return daoFactory.getWarehouseMapper().selectAllWarehouse(""); } /** * ๆทปๅŠ ้›ถไปถๅญ˜ๅ‚จ็š„ไฟกๆฏ */ @Override public boolean addPartStorage(Part part, Partstorage partstorage) { boolean flag = false; if(part!=null&&partstorage!=null){ try { // ๆทปๅŠ ้›ถไปถ็š„ไฟกๆฏ int partid = daoFactory.getPartMapper().insertSelective(part); // partstorage ่ฎพ็ฝฎpartid partstorage.setPartid(part.getId()); logger.info("======>้›ถไปถๅญ˜ๅ‚จ่ฟ”ๅ›ž็š„้›ถไปถ็š„็ผ–ๅทไธบ๏ผš"+part.getId()); // ๆทปๅŠ ้›ถไปถๅญ˜ๅ‚จ็š„ไฟกๆฏ daoFactory.getPartstorageMapper().insertSelective(partstorage); flag = true; } catch (Exception e) { logger.info("ๆทปๅŠ ๆๆ–™ไฟกๆฏๆœ‰่ฏฏ..."); } } return flag; } /** * ๅˆ ้™ค้›ถไปถ */ @Override public boolean delPart(String partid) { boolean flag = false; try { // ๆŸฅ่ฏข Part part = daoFactory.getPartMapper().selectByPrimaryKey(Integer.valueOf(partid)); if(part!=null){ part.setPartflag("0"); // ๆ›ดๆ–ฐๆ•ฐๆฎๅบ“ daoFactory.getPartMapper().updateByPrimaryKeySelective(part); flag = true; } } catch (Exception e) { logger.info("ๅˆ ้™ค้›ถไปถไฟกๆฏๅผ‚ๅธธ!"); } return flag; } }
UTF-8
Java
11,531
java
BaseDataManageService.java
Java
[ { "context": ".MainItemView;\r\n\r\n/**\r\n * ๅŸบ็ก€ๆ•ฐๆฎ็š„ๆœๅŠก\r\n * \r\n * @author PengChan\r\n *\r\n */\r\n@Service\r\npublic class BaseDataManageSe", "end": 1110, "score": 0.9986957907676697, "start": 1102, "tag": "NAME", "value": "PengChan" } ]
null
[]
package com.javaweb.service.impl; import java.text.SimpleDateFormat; import java.util.List; import javax.annotation.Resource; import org.apache.tools.ant.taskdefs.condition.And; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.github.pagehelper.PageHelper; import com.javaweb.dao.DaoFactory; import com.javaweb.entity.Customer; import com.javaweb.entity.Mainitem; import com.javaweb.entity.Part; import com.javaweb.entity.Partcategory; import com.javaweb.entity.Partstorage; import com.javaweb.entity.Permission; import com.javaweb.entity.Projcategory; import com.javaweb.entity.Supplier; import com.javaweb.entity.Vehicle; import com.javaweb.entity.Warehouse; import com.javaweb.service.IBaseDataManageService; import com.javaweb.utils.BeanUtil; import com.javaweb.utils.PagedResult; import com.javaweb.utils.StringUtils; import com.javaweb.views.CustomerView; import com.javaweb.views.MainItemView; /** * ๅŸบ็ก€ๆ•ฐๆฎ็š„ๆœๅŠก * * @author PengChan * */ @Service public class BaseDataManageService implements IBaseDataManageService { private static final Logger logger = LoggerFactory.getLogger(BaseDataManageService.class); @Resource private DaoFactory daoFactory; /** * ๅˆ†้กตๆŸฅ่ฏข็”จๆˆท็š„ไฟกๆฏ */ @Override public PagedResult<CustomerView> queryPagedCustomerView(String key, String sort, String order, Integer pageNo, Integer pageSize) { pageNo = pageNo == null ? 0 : pageNo; pageSize = pageSize == null ? 10 : pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getCustomerMapper().selectCustomer(key, sort, order)); } /** * ๆŸฅ่ฏข็”จๆˆท็š„ไฟกๆฏ */ @Override public List<CustomerView> queryAllCustomer() { return daoFactory.getCustomerMapper().selectCustomer(null, null, null); } /** * ไฟฎๆ”น็”จๆˆทไฟกๆฏ */ @Transactional @Override public boolean modifyCustomer(CustomerView customerView) { boolean flag = true; int i = 0; try { Customer customer = daoFactory.getCustomerMapper() .selectByPrimaryKey(StringUtils.getIntegerValue(customerView.getCustomerid(), -1)); if (customer != null) { customer.setContactadd(customerView.getContactadd()); customer.setContactinfo(customerView.getContactinfo()); customer.setNumbering(customerView.getCustomername()); // ๆ›ดๆ–ฐ็”จๆˆท็š„ไฟกๆฏ daoFactory.getCustomerMapper().updateByPrimaryKeySelective(customer); ++i; } Vehicle vehicle = daoFactory.getVehicleMapper() .selectByPrimaryKey(StringUtils.getIntegerValue(customerView.getVehicleid(), -1)); if (vehicle != null) { vehicle.setPlatenum(customerView.getPlatenum()); vehicle.setInspectiondate(new SimpleDateFormat("yyyy-MM-dd").parse(customerView.getInspectiondate())); vehicle.setMilage(StringUtils.getDoubleValue(customerView.getMilage(), -1d)); vehicle.setVehflag(customerView.getVehflag()); // ๆ›ดๆ–ฐ่ฝฆ่พ†ไฟกๆฏ daoFactory.getVehicleMapper().updateByPrimaryKeySelective(vehicle); ++i; } } catch (Exception e) { logger.info("ไฟฎๆ”น็”จๆˆทไฟกๆฏๅคฑ่ดฅ!"); } return (i == 2); } /** * ๆŸฅ่ฏขๆƒ้™ */ @Override public List<Permission> queryPermission() { return daoFactory.getPermissionMapper().selectAllPermission(); } /** * ไฟฎๆ”นๆƒ้™็š„็Šถๆ€ */ @Override public boolean modifyPermission(Permission permission) { boolean flag = false; if (permission != null) { Permission perm = daoFactory.getPermissionMapper().selectByPrimaryKey(permission.getId()); perm.setPerflag(permission.getPerflag()); flag = daoFactory.getPermissionMapper().updateByPrimaryKeySelective(perm) > 0; } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„็ปดไฟฎ้กน็›ฎ */ @Override public List<MainItemView> queryAllMainItem() { return daoFactory.getMainitemMapper().selectallMainitem(); } @Override public boolean modifyMainitem(Mainitem mainitem, String type) { boolean flag = false; if (mainitem != null) { try { if ("C".equals(type)) {// ๆทปๅŠ ไฟกๆฏ flag = daoFactory.getMainitemMapper().insertSelective(mainitem) > 0; } else if ("U".equals(type)) { flag = daoFactory.getMainitemMapper().updateByPrimaryKeySelective(mainitem) > 0; } else if ("D".equals(type)) { Mainitem mt = daoFactory.getMainitemMapper().selectByPrimaryKey(mainitem.getId()); if (mt != null) { mt.setMainflag(mainitem.getMainflag()); flag = daoFactory.getMainitemMapper().updateByPrimaryKeySelective(mt) > 0; } } } catch (Exception e) { logger.error("ไฟฎๆ”น็ปดไฟฎ้กน็›ฎ็ฑปๅˆซ็š„ไฟกๆฏๅคฑ่ดฅ!"); } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็ปดไฟฎ็š„็ฑปๅˆซ */ @Override public List<Projcategory> queryAllProjCategory() { return daoFactory.getProjcategoryMapper().selectAllCategory(); } /** * ไฟฎๆ”น็ปดไฟฎ้กน็›ฎๅคง็ฑป */ @Override public boolean modifyPartCategory(Projcategory projcategory, String type) { boolean flag = false; if (projcategory != null) { try { if ("C".equals(type)) {// ๆทปๅŠ ไฟกๆฏ flag = daoFactory.getProjcategoryMapper().insertSelective(projcategory) > 0; } else if ("U".equals(type)) { flag = daoFactory.getProjcategoryMapper().updateByPrimaryKeySelective(projcategory) > 0; } else if ("D".equals(type)) { Projcategory pg = daoFactory.getProjcategoryMapper().selectByPrimaryKey(projcategory.getId()); if (pg != null) { pg.setCatflag(projcategory.getCatflag()); flag = daoFactory.getProjcategoryMapper().updateByPrimaryKeySelective(projcategory) > 0; } } } catch (Exception e) { logger.error("ไฟฎๆ”น็ปดไฟฎ้กน็›ฎ็ฑปๅˆซ็š„ไฟกๆฏๅคฑ่ดฅ!"); } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไพ›ๅบ”ๅ•† */ @Override public PagedResult<Supplier> queryAllSupplier(String key, String sort, String order, String flag, Integer pageNo, Integer pageSize) { pageNo = pageNo == null ? 0 : pageNo; pageSize = pageSize == null ? 10 : pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getSupplierMapper().selectAllSupplier(key, sort, order, flag)); } /** * ไฟฎๆ”นไพ›ๅบ”ๅ•†็š„ไฟกๆฏ */ @Override public boolean modifySupplier(Supplier supplier, String type) { boolean flag = false; if(supplier!=null&&org.apache.commons.lang.StringUtils.isNotBlank(type)){ try { if("C".equals(type)){// ๆทปๅŠ ็”จๆˆท็š„ไฟกๆฏ supplier.setSuppflag("1"); flag = daoFactory.getSupplierMapper().insertSelective(supplier)>0; }else if("U".equals(type)){// ไฟฎๆ”น็”จๆˆท็š„ไฟกๆฏ flag = daoFactory.getSupplierMapper().updateByPrimaryKeySelective(supplier)>0; }else if("D".equals(type)){// ๅˆ ้™ค็”จๆˆท็š„ไฟกๆฏ(flag=0) Supplier sp = daoFactory.getSupplierMapper().selectByPrimaryKey(supplier.getId()); if(sp!=null){ sp.setSuppflag(supplier.getSuppflag()); flag = daoFactory.getSupplierMapper().updateByPrimaryKeySelective(sp)>0; } } } catch (Exception e) { logger.error("ไฟฎๆ”นไพ›ๅบ”ๅ•†ไฟกๆฏๅคฑ่ดฅ!"); } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไพ›ๅบ”ๅ•† */ @Override public List<Supplier> queryAllSupplier() { return daoFactory.getSupplierMapper().selectAllSupplier(null, null, null, null); } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„้…ไปถ็š„็ฑปๅˆซ */ @Override public PagedResult<Partcategory> queryPagedPartCategory(Integer pageNo, Integer pageSize, String status) { pageNo = pageNo==null?0:pageNo; pageSize = pageSize==null?0:pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getPartcategoryMapper().selectAllPartCategory(status)); } /** * ไฟฎๆ”น้›ถไปถ็ฑปๅˆซไฟกๆฏ */ @Override public boolean modifyPartCategory(Partcategory partcategory, String type) { boolean flag = false; if(partcategory!=null && org.apache.commons.lang.StringUtils.isNotBlank(type)){ if("C".equals(type)){// ๆทปๅŠ  partcategory.setPartcatflag("1"); flag = daoFactory.getPartcategoryMapper().insertSelective(partcategory)>0; }else if("U".equals(type)){// ไฟฎๆ”น flag = daoFactory.getPartcategoryMapper().updateByPrimaryKeySelective(partcategory)>0; }else if("D".equals(type)){// ๅˆ ้™ค Partcategory pt = daoFactory.getPartcategoryMapper().selectByPrimaryKey(partcategory.getId()); if(pt!=null){ pt.setPartcatflag(partcategory.getPartcatflag()); flag = daoFactory.getPartcategoryMapper().updateByPrimaryKeySelective(pt)>0; } } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไป“ๅบ“็š„ไฟกๆฏ */ @Override public PagedResult<Warehouse> queryPagedWarehouse(Integer pageNo, Integer pageSize, String status) { pageNo = pageNo==null?0:pageNo; pageSize = pageSize==null?0:pageSize; PageHelper.startPage(pageNo, pageSize); return BeanUtil.topagedResult(daoFactory.getWarehouseMapper().selectAllWarehouse(status)); } /** * ไฟฎๆ”นไป“ๅบ“็š„ไฟกๆฏ */ @Override public boolean modifyWarehouse(Warehouse warehouse, String type) { boolean flag = false; if(warehouse!=null && org.apache.commons.lang.StringUtils.isNotBlank(type)){ if("C".equals(type)){// ๆทปๅŠ  warehouse.setWareflag("1"); flag = daoFactory.getWarehouseMapper().insertSelective(warehouse)>0; }else if("U".equals(type)){// ไฟฎๆ”น flag = daoFactory.getWarehouseMapper().updateByPrimaryKeySelective(warehouse)>0; }else if("D".equals(type)){// ๅˆ ้™ค Warehouse wh = daoFactory.getWarehouseMapper().selectByPrimaryKey(warehouse.getId()); if(wh!=null){ wh.setWareflag(warehouse.getWareflag()); flag = daoFactory.getWarehouseMapper().updateByPrimaryKeySelective(wh)>0; } } } return flag; } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰้›ถไปถ็š„็ฑปๅˆซ */ @Override public List<Partcategory> queryAllPartCategory() { return daoFactory.getPartcategoryMapper().selectAllPartCategory(""); } /** * ๆŸฅ่ฏขๆ‰€ๆœ‰็š„ไป“ๅบ“ */ @Override public List<Warehouse> queryAllWareHouse() { return daoFactory.getWarehouseMapper().selectAllWarehouse(""); } /** * ๆทปๅŠ ้›ถไปถๅญ˜ๅ‚จ็š„ไฟกๆฏ */ @Override public boolean addPartStorage(Part part, Partstorage partstorage) { boolean flag = false; if(part!=null&&partstorage!=null){ try { // ๆทปๅŠ ้›ถไปถ็š„ไฟกๆฏ int partid = daoFactory.getPartMapper().insertSelective(part); // partstorage ่ฎพ็ฝฎpartid partstorage.setPartid(part.getId()); logger.info("======>้›ถไปถๅญ˜ๅ‚จ่ฟ”ๅ›ž็š„้›ถไปถ็š„็ผ–ๅทไธบ๏ผš"+part.getId()); // ๆทปๅŠ ้›ถไปถๅญ˜ๅ‚จ็š„ไฟกๆฏ daoFactory.getPartstorageMapper().insertSelective(partstorage); flag = true; } catch (Exception e) { logger.info("ๆทปๅŠ ๆๆ–™ไฟกๆฏๆœ‰่ฏฏ..."); } } return flag; } /** * ๅˆ ้™ค้›ถไปถ */ @Override public boolean delPart(String partid) { boolean flag = false; try { // ๆŸฅ่ฏข Part part = daoFactory.getPartMapper().selectByPrimaryKey(Integer.valueOf(partid)); if(part!=null){ part.setPartflag("0"); // ๆ›ดๆ–ฐๆ•ฐๆฎๅบ“ daoFactory.getPartMapper().updateByPrimaryKeySelective(part); flag = true; } } catch (Exception e) { logger.info("ๅˆ ้™ค้›ถไปถไฟกๆฏๅผ‚ๅธธ!"); } return flag; } }
11,531
0.68944
0.68596
367
27.752043
28.450369
114
false
false
0
0
0
0
0
0
2.425068
false
false
5
0f0e9c59272ba2dbe1c950e05449c36e3b8932c1
38,096,359,924,314
b4fa45fd56da5c448ce731da53597b70d348eb28
/src/main/java/com/imlewis/repository/SettingsRepository.java
f5796e0ad1a51760080fdf148ce90a28ab75a550
[]
no_license
MrMagik/progettoweb
https://github.com/MrMagik/progettoweb
1893d71fe5bc4cab2b9bede95cc5b5aed299f339
3a728f5334af582af064f4b82f5bfbad28e4a5ef
refs/heads/master
2021-05-09T05:11:46.301000
2018-01-28T22:25:33
2018-01-28T22:25:33
119,302,965
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.imlewis.repository; import com.imlewis.model.Settings; import org.springframework.data.repository.CrudRepository; public interface SettingsRepository extends CrudRepository<Settings, Long> { Settings findByKey(String key); }
UTF-8
Java
243
java
SettingsRepository.java
Java
[]
null
[]
package com.imlewis.repository; import com.imlewis.model.Settings; import org.springframework.data.repository.CrudRepository; public interface SettingsRepository extends CrudRepository<Settings, Long> { Settings findByKey(String key); }
243
0.823045
0.823045
8
29.375
26.409929
76
false
false
0
0
0
0
0
0
0.625
false
false
5
6d6c2857009b649972f4c02d0ec6cc8b18dfe764
35,158,602,324,958
69ca230138d587d43d867079c80e1c88c8d5678c
/net.colloquia/src/net/colloquia/menu/Action_Exit.java
68d340487baa2c8c1d73511a3f96a7e3537d3f24
[]
no_license
Phillipus/colloquia
https://github.com/Phillipus/colloquia
cc6138c44e02425407a5986cfe1b1ad0ca93bb21
d1dcc5440ae9fb621a853fc8d43f7fad48c3da0d
refs/heads/master
2022-12-04T17:57:31.197000
2020-08-31T21:51:50
2020-08-31T21:51:50
281,718,827
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.colloquia.menu; import java.awt.event.*; import net.colloquia.*; import net.colloquia.util.*; /** * Exits the program by calling {@link MainFrame#closeApp}. */ public class Action_Exit extends MenuAction { public Action_Exit() { super(LanguageManager.getString("EXIT"), null); } /** * Triggered from the Menu. Calls {@link MainFrame#closeApp}. <p> */ public void actionPerformed(ActionEvent e) { MainFrame.getInstance().closeApp(); } }
UTF-8
Java
503
java
Action_Exit.java
Java
[]
null
[]
package net.colloquia.menu; import java.awt.event.*; import net.colloquia.*; import net.colloquia.util.*; /** * Exits the program by calling {@link MainFrame#closeApp}. */ public class Action_Exit extends MenuAction { public Action_Exit() { super(LanguageManager.getString("EXIT"), null); } /** * Triggered from the Menu. Calls {@link MainFrame#closeApp}. <p> */ public void actionPerformed(ActionEvent e) { MainFrame.getInstance().closeApp(); } }
503
0.654076
0.654076
23
20.826086
21.93796
70
false
false
0
0
0
0
0
0
0.304348
false
false
5
fe15ee50b48de0236bcfbd39c367fdbf6407709d
35,158,602,327,766
17c30fed606a8b1c8f07f3befbef6ccc78288299
/Mate10_8_1_0/src/main/java/com/huawei/android/provider/SettingsEx.java
cac614e5dcdf7e766e6851cfbddbafa7f56e0f0f
[]
no_license
EggUncle/HwFrameWorkSource
https://github.com/EggUncle/HwFrameWorkSource
4e67f1b832a2f68f5eaae065c90215777b8633a7
162e751d0952ca13548f700aad987852b969a4ad
refs/heads/master
2020-04-06T14:29:22.781000
2018-11-09T05:05:03
2018-11-09T05:05:03
157,543,151
1
0
null
true
2018-11-14T12:08:01
2018-11-14T12:08:01
2018-11-14T12:07:41
2018-11-09T05:05:10
26,058
0
0
0
null
false
null
package com.huawei.android.provider; import android.content.ContentResolver; import android.net.Uri; import android.os.Debug; import android.provider.Settings.SettingNotFoundException; import android.util.Slog; public final class SettingsEx { public static final String AUTHORITY = "settings"; public static final String TAG = "SettingsEx"; public static final class Global { public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; public static final String MOBILE_DATA = "mobile_data"; public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms"; public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; public static final String PREFERRED_NETWORK_MODE = "preferred_network_mode"; public static final String SINGLE_HAND_MODE = "single_hand_mode"; public static final String VT_IMS_ENABLED = "vt_ims_enabled"; public static final String WFC_IMS_ENABLED = "wfc_ims_enabled"; public static int getZenModeOff() { return 0; } public static String getZen_Mode() { return "zen_mode"; } } public static final class Secure { public static final String PREFERRED_TTY_MODE = "preferred_tty_mode"; public static final String WIFI_AP_IGNOREBROADCASTSSID = "wifi_ap_ignorebroadcastssid"; public static final String WIFI_P2P_ON = "wifi_p2p_on"; public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { return android.provider.Settings.Secure.getIntForUser(cr, name, def, userHandle); } public static boolean putIntForUser(ContentResolver cr, String name, int value, int userHandle) { return android.provider.Settings.Secure.putIntForUser(cr, name, value, userHandle); } public static String getStringForUser(ContentResolver cr, String name, int userHandle) { return android.provider.Settings.Secure.getStringForUser(cr, name, userHandle); } public static boolean putStringForUser(ContentResolver cr, String name, String value, int userHandle) { return android.provider.Settings.Secure.putStringForUser(cr, name, value, userHandle); } public static String getUserSetupComplete() { return "user_setup_complete"; } } public static final class System { public static final String AUTO_ANSWER_TIMEOUT = "auto_answer"; public static final String AUTO_CONNECT_ATT = "auto_connect_att"; public static final String AUTO_HIDE_NAVIGATIONBAR = "auto_hide_navigationbar_enable"; public static final int AUTO_HIDE_NAVIGATIONBAR_DEFAULT = 0; public static final String AUTO_HIDE_NAVIGATIONBAR_TIMEOUT = "auto_hide_navigationbar_timeout"; public static final int AUTO_HIDE_NAVIGATIONBAR_TIMEOUT_DEFAULT = 2000; public static final String ENABLE_EXPAND_ON_HUAWEI_UNLOCK = "enable_expand_on_huawei_unlock"; public static final String FIRST_DAY_OF_WEEK = "first_day_of_week"; public static final String HIDE_VIRTUAL_KEY = "hide_virtual_key"; public static final String HUAWEI_FORCEMINNAVIGATIONBAR = "forceMinNavigationBar"; public static final String HUAWEI_MINNAVIGATIONBAR = "minNavigationBar"; public static final String HUAWEI_NAVIGATIONBAR_STATUSCHANGE = "com.huawei.navigationbar.statuschange"; public static final Uri HUAWEI_RINGTONE2_URI = huawei.android.provider.HwSettings.System.HUAWEI_RINGTONE2_URI; public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; public static final String NAVIGATIONBAR_HEIGHT_MIN = "navigationbar_height_min"; public static final int NAVIGATIONBAR_HEIGHT_MIN_DEFAULT = 0; public static final String NAVIGATIONBAR_IS_MIN = "navigationbar_is_min"; public static final int NAVIGATIONBAR_IS_MIN_DEFAULT = 0; public static final String NAVIGATIONBAR_MIN_PROMPT = "navigationbar_min_prompt"; public static final int NAVIGATIONBAR_MIN_PROMPT_DEFAULT = 0; public static final String NAVIGATIONBAR_WIDTH_MIN = "navigationbar_width_min"; public static final int NAVIGATIONBAR_WIDTH_MIN_DEFAULT = 0; public static final String RINGTONE2 = "ringtone2"; public static final String RTSP_MAX_PORT = "rtsp_max_udp_port"; public static final String RTSP_MIN_PORT = "rtsp_min_udp_port"; public static final String RTSP_PROXY_HOST = "rtsp_proxy_host"; public static final String RTSP_PROXY_PORT = "rtsp_proxy_port"; public static final String SHOW_HWLOCK_FIRST = "show_hwlock_first"; public static final String SHOW_NAVIGATIONBAR_CHECKBOK = "show_navigationbar_checkbox"; public static final int SHOW_NAVIGATIONBAR_CHECKBOK_DEFAULT = 0; public static final String SIMPLEUI_MODE = "simpleui_mode"; public static final String SINGLE_HAND_MODE = "single_hand_mode"; public static final int SINGLE_HAND_MODE_LEFT = 1; public static final int SINGLE_HAND_MODE_RIGHT = 2; public static final String SINGLE_HAND_SWITCH = "single_hand_switch"; public static final int SINGLE_HAND_SWITCH_OFF = 0; public static final int SINGLE_HAND_SWITCH_ON = 1; public static final String VOLUME_FM = "volume_fm"; public static final String WEEKEND = "weekend"; public static String getScreenAutoBrightness() { return com.huawei.systemmanager.common.HwSystemManagerSettings.System.SCREEN_AUTO_BRIGHTNESS; } public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { return android.provider.Settings.System.getIntForUser(cr, name, def, userHandle); } public static boolean putIntForUser(ContentResolver cr, String name, int value, int userHandle) { return android.provider.Settings.System.putIntForUser(cr, name, value, userHandle); } public static String getStringForUser(ContentResolver cr, String name, int userHandle) { return android.provider.Settings.System.getStringForUser(cr, name, userHandle); } } public static final class Systemex { public static final String ATTWIFI_HOTSPOT = "attwifi_hotspot"; public static final Uri CONTENT_URI = huawei.android.provider.HwSettings.Systemex.CONTENT_URI; public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; public static final String SHOW_BROADCAST_SSID_CONFIG = "show_broadcast_ssid_config"; public static final String SYS_PROP_SETTINGEX_VERSION = "sys.settings_system_version"; public static synchronized String getString(ContentResolver resolver, String name) { String string; synchronized (Systemex.class) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getString deprecated use Settings.System.getString instead ;callers=" + Debug.getCallers(3)); string = android.provider.Settings.System.getString(resolver, name); } return string; } public static boolean putString(ContentResolver resolver, String name, String value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putString deprecated use Settings.System.putString instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putString(resolver, name, value); } public static Uri getUriFor(String name) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getUriFor deprecated use Settings.System.getUriFor instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getUriFor(name); } public static int getInt(ContentResolver cr, String name, int def) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getInt deprecated use Settings.System.getInt instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getInt(cr, name, def); } public static int getInt(ContentResolver cr, String name) throws SettingNotFoundException { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getInt deprecated use Settings.System.getInt instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getInt(cr, name); } public static boolean putInt(ContentResolver cr, String name, int value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putInt deprecated use Settings.System.putInt instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putInt(cr, name, value); } public static long getLong(ContentResolver cr, String name, long def) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getLong deprecated use Settings.System.getLong instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getLong(cr, name, def); } public static long getLong(ContentResolver cr, String name) throws SettingNotFoundException { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getLong deprecated use Settings.System.getLong instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getLong(cr, name); } public static boolean putLong(ContentResolver cr, String name, long value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putLong deprecated use Settings.System.putLong instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putLong(cr, name, value); } public static float getFloat(ContentResolver cr, String name, float def) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getFloat deprecated use Settings.System.getFloat instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getFloat(cr, name, def); } public static float getFloat(ContentResolver cr, String name) throws SettingNotFoundException { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getFloat deprecated use Settings.System.getFloat instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getFloat(cr, name); } public static boolean putFloat(ContentResolver cr, String name, float value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putFloat deprecated use Settings.System.putFloat instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putFloat(cr, name, value); } public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) throws SettingNotFoundException { return android.provider.Settings.System.getIntForUser(cr, name, def, userHandle); } public static boolean putIntForUser(ContentResolver cr, String name, int value, int userHandle) { return android.provider.Settings.System.putIntForUser(cr, name, value, userHandle); } } public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { return android.provider.Settings.System.getIntForUser(cr, name, def, userHandle); } }
UTF-8
Java
11,500
java
SettingsEx.java
Java
[]
null
[]
package com.huawei.android.provider; import android.content.ContentResolver; import android.net.Uri; import android.os.Debug; import android.provider.Settings.SettingNotFoundException; import android.util.Slog; public final class SettingsEx { public static final String AUTHORITY = "settings"; public static final String TAG = "SettingsEx"; public static final class Global { public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; public static final String MOBILE_DATA = "mobile_data"; public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms"; public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; public static final String PREFERRED_NETWORK_MODE = "preferred_network_mode"; public static final String SINGLE_HAND_MODE = "single_hand_mode"; public static final String VT_IMS_ENABLED = "vt_ims_enabled"; public static final String WFC_IMS_ENABLED = "wfc_ims_enabled"; public static int getZenModeOff() { return 0; } public static String getZen_Mode() { return "zen_mode"; } } public static final class Secure { public static final String PREFERRED_TTY_MODE = "preferred_tty_mode"; public static final String WIFI_AP_IGNOREBROADCASTSSID = "wifi_ap_ignorebroadcastssid"; public static final String WIFI_P2P_ON = "wifi_p2p_on"; public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { return android.provider.Settings.Secure.getIntForUser(cr, name, def, userHandle); } public static boolean putIntForUser(ContentResolver cr, String name, int value, int userHandle) { return android.provider.Settings.Secure.putIntForUser(cr, name, value, userHandle); } public static String getStringForUser(ContentResolver cr, String name, int userHandle) { return android.provider.Settings.Secure.getStringForUser(cr, name, userHandle); } public static boolean putStringForUser(ContentResolver cr, String name, String value, int userHandle) { return android.provider.Settings.Secure.putStringForUser(cr, name, value, userHandle); } public static String getUserSetupComplete() { return "user_setup_complete"; } } public static final class System { public static final String AUTO_ANSWER_TIMEOUT = "auto_answer"; public static final String AUTO_CONNECT_ATT = "auto_connect_att"; public static final String AUTO_HIDE_NAVIGATIONBAR = "auto_hide_navigationbar_enable"; public static final int AUTO_HIDE_NAVIGATIONBAR_DEFAULT = 0; public static final String AUTO_HIDE_NAVIGATIONBAR_TIMEOUT = "auto_hide_navigationbar_timeout"; public static final int AUTO_HIDE_NAVIGATIONBAR_TIMEOUT_DEFAULT = 2000; public static final String ENABLE_EXPAND_ON_HUAWEI_UNLOCK = "enable_expand_on_huawei_unlock"; public static final String FIRST_DAY_OF_WEEK = "first_day_of_week"; public static final String HIDE_VIRTUAL_KEY = "hide_virtual_key"; public static final String HUAWEI_FORCEMINNAVIGATIONBAR = "forceMinNavigationBar"; public static final String HUAWEI_MINNAVIGATIONBAR = "minNavigationBar"; public static final String HUAWEI_NAVIGATIONBAR_STATUSCHANGE = "com.huawei.navigationbar.statuschange"; public static final Uri HUAWEI_RINGTONE2_URI = huawei.android.provider.HwSettings.System.HUAWEI_RINGTONE2_URI; public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call"; public static final String NAVIGATIONBAR_HEIGHT_MIN = "navigationbar_height_min"; public static final int NAVIGATIONBAR_HEIGHT_MIN_DEFAULT = 0; public static final String NAVIGATIONBAR_IS_MIN = "navigationbar_is_min"; public static final int NAVIGATIONBAR_IS_MIN_DEFAULT = 0; public static final String NAVIGATIONBAR_MIN_PROMPT = "navigationbar_min_prompt"; public static final int NAVIGATIONBAR_MIN_PROMPT_DEFAULT = 0; public static final String NAVIGATIONBAR_WIDTH_MIN = "navigationbar_width_min"; public static final int NAVIGATIONBAR_WIDTH_MIN_DEFAULT = 0; public static final String RINGTONE2 = "ringtone2"; public static final String RTSP_MAX_PORT = "rtsp_max_udp_port"; public static final String RTSP_MIN_PORT = "rtsp_min_udp_port"; public static final String RTSP_PROXY_HOST = "rtsp_proxy_host"; public static final String RTSP_PROXY_PORT = "rtsp_proxy_port"; public static final String SHOW_HWLOCK_FIRST = "show_hwlock_first"; public static final String SHOW_NAVIGATIONBAR_CHECKBOK = "show_navigationbar_checkbox"; public static final int SHOW_NAVIGATIONBAR_CHECKBOK_DEFAULT = 0; public static final String SIMPLEUI_MODE = "simpleui_mode"; public static final String SINGLE_HAND_MODE = "single_hand_mode"; public static final int SINGLE_HAND_MODE_LEFT = 1; public static final int SINGLE_HAND_MODE_RIGHT = 2; public static final String SINGLE_HAND_SWITCH = "single_hand_switch"; public static final int SINGLE_HAND_SWITCH_OFF = 0; public static final int SINGLE_HAND_SWITCH_ON = 1; public static final String VOLUME_FM = "volume_fm"; public static final String WEEKEND = "weekend"; public static String getScreenAutoBrightness() { return com.huawei.systemmanager.common.HwSystemManagerSettings.System.SCREEN_AUTO_BRIGHTNESS; } public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { return android.provider.Settings.System.getIntForUser(cr, name, def, userHandle); } public static boolean putIntForUser(ContentResolver cr, String name, int value, int userHandle) { return android.provider.Settings.System.putIntForUser(cr, name, value, userHandle); } public static String getStringForUser(ContentResolver cr, String name, int userHandle) { return android.provider.Settings.System.getStringForUser(cr, name, userHandle); } } public static final class Systemex { public static final String ATTWIFI_HOTSPOT = "attwifi_hotspot"; public static final Uri CONTENT_URI = huawei.android.provider.HwSettings.Systemex.CONTENT_URI; public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; public static final String SHOW_BROADCAST_SSID_CONFIG = "show_broadcast_ssid_config"; public static final String SYS_PROP_SETTINGEX_VERSION = "sys.settings_system_version"; public static synchronized String getString(ContentResolver resolver, String name) { String string; synchronized (Systemex.class) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getString deprecated use Settings.System.getString instead ;callers=" + Debug.getCallers(3)); string = android.provider.Settings.System.getString(resolver, name); } return string; } public static boolean putString(ContentResolver resolver, String name, String value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putString deprecated use Settings.System.putString instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putString(resolver, name, value); } public static Uri getUriFor(String name) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getUriFor deprecated use Settings.System.getUriFor instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getUriFor(name); } public static int getInt(ContentResolver cr, String name, int def) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getInt deprecated use Settings.System.getInt instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getInt(cr, name, def); } public static int getInt(ContentResolver cr, String name) throws SettingNotFoundException { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getInt deprecated use Settings.System.getInt instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getInt(cr, name); } public static boolean putInt(ContentResolver cr, String name, int value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putInt deprecated use Settings.System.putInt instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putInt(cr, name, value); } public static long getLong(ContentResolver cr, String name, long def) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getLong deprecated use Settings.System.getLong instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getLong(cr, name, def); } public static long getLong(ContentResolver cr, String name) throws SettingNotFoundException { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getLong deprecated use Settings.System.getLong instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getLong(cr, name); } public static boolean putLong(ContentResolver cr, String name, long value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putLong deprecated use Settings.System.putLong instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putLong(cr, name, value); } public static float getFloat(ContentResolver cr, String name, float def) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getFloat deprecated use Settings.System.getFloat instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getFloat(cr, name, def); } public static float getFloat(ContentResolver cr, String name) throws SettingNotFoundException { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.getFloat deprecated use Settings.System.getFloat instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.getFloat(cr, name); } public static boolean putFloat(ContentResolver cr, String name, float value) { Slog.w(SettingsEx.TAG, "SettingsEx.Systemex.putFloat deprecated use Settings.System.putFloat instead ;callers=" + Debug.getCallers(3)); return android.provider.Settings.System.putFloat(cr, name, value); } public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) throws SettingNotFoundException { return android.provider.Settings.System.getIntForUser(cr, name, def, userHandle); } public static boolean putIntForUser(ContentResolver cr, String name, int value, int userHandle) { return android.provider.Settings.System.putIntForUser(cr, name, value, userHandle); } } public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { return android.provider.Settings.System.getIntForUser(cr, name, def, userHandle); } }
11,500
0.700783
0.697826
200
56.5
43.562485
153
false
false
0
0
0
0
0
0
1.1
false
false
5
755466aa6e784ee8580b5d5ac4ffb306319e59db
26,963,804,695,095
5ac7b60ef19664b2a2dec5c0a4c52519a9ed6e96
/src/main/java/com/thinkgem/jeesite/modules/sys/entity/User.java
1db474a9097071db0efceaeee35ca85b69ca05d0
[ "Apache-2.0" ]
permissive
wangyingjiao/apiservice
https://github.com/wangyingjiao/apiservice
ccf333503225ac82fda024a7f7db2f84d5544527
6261e593866be787d9ac016ce16824f8e8c805d7
refs/heads/master
2020-03-19T06:04:46.696000
2018-05-17T09:56:47
2018-05-17T09:56:47
135,988,833
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.thinkgem.jeesite.modules.sys.entity; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.Lists; import com.thinkgem.jeesite.common.config.Global; import com.thinkgem.jeesite.common.persistence.DataEntity; import com.thinkgem.jeesite.common.supcan.annotation.treelist.cols.SupCol; import com.thinkgem.jeesite.common.utils.Collections3; import com.thinkgem.jeesite.common.utils.RegexTool; import com.thinkgem.jeesite.common.utils.StringUtils; import com.thinkgem.jeesite.common.utils.excel.annotation.ExcelField; import com.thinkgem.jeesite.common.utils.excel.fieldtype.RoleListType; import com.thinkgem.jeesite.modules.service.entity.basic.BasicOrganization; import com.thinkgem.jeesite.modules.service.entity.station.BasicServiceStation; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import java.util.Date; import java.util.List; /** * ็”จๆˆทEntity * * @author ThinkGem * @version 2013-12-05 */ public class User extends DataEntity<User> { private static final long serialVersionUID = 1L; private String companyId;//ๅ…ฌๅธid private String companyName;//ๅ…ฌๅธๅ็งฐ private BasicOrganization organization; // ๅฝ’ๅฑž้ƒจ้—จ private String orgId;//ๆœบๆž„id private String officeId; //ๆœบๆž„id private String officeName; //ๆœบๆž„ๅ็งฐ private BasicServiceStation station;//ๆœๅŠก็ซ™ private String stationId; //ๆœๅŠก็ซ™id private String stationName; //ๆœๅŠก็ซ™ๅ็งฐ private String loginName;// ็™ปๅฝ•ๅ private String password;// ๅฏ†็  private String no; // ๅทฅๅท private String name; // ๅง“ๅ private String email; // ้‚ฎ็ฎฑ private String phone; // ็”ต่ฏ private String mobile; // ๆ‰‹ๆœบ private String userType;// ็”จๆˆท็ฑปๅž‹ private String loginIp; // ๆœ€ๅŽ็™ป้™†IP private Date loginDate; // ๆœ€ๅŽ็™ป้™†ๆ—ฅๆœŸ private String loginFlag; // ๆ˜ฏๅฆๅ…่ฎธ็™ป้™† private String photo; // ๅคดๅƒ private String useable; //ๆ˜ฏๅฆๅฏ็”จ private String roleName; private String roleId; private String oldLoginName;// ๅŽŸ็™ปๅฝ•ๅ private String newPassword; // ๆ–ฐๅฏ†็  private String oldLoginIp; // ไธŠๆฌก็™ป้™†IP private Date oldLoginDate; // ไธŠๆฌก็™ป้™†ๆ—ฅๆœŸ public String updateOwnFlag;//ๆ˜ฏๅฆ็ผ–่พ‘่‡ชๅทฑ public String getUpdateOwnFlag() { return updateOwnFlag; } public void setUpdateOwnFlag(String updateOwnFlag) { this.updateOwnFlag = updateOwnFlag; } private Role role; // ๆ นๆฎ่ง’่‰ฒๆŸฅ่ฏข็”จๆˆทๆกไปถ private List<Role> roleList = Lists.newArrayList(); // ๆ‹ฅๆœ‰่ง’่‰ฒๅˆ—่กจ private String[] roles; public String[] getRoles() { return roles; } public void setRoles(String[] roles) { this.roles = roles; } public User() { super(); this.loginFlag = Global.YES; } public User(String id) { super(id); } public User(String id, String loginName) { super(id); this.loginName = loginName; } public User(Role role) { super(); this.role = role; } public String getCompanyId() { return companyId; } public void setCompanyId(String companyId) { this.companyId = companyId; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getOfficeId() { return officeId; } public void setOfficeId(String officeId) { this.officeId = officeId; } public String getOfficeName() { return officeName; } public void setOfficeName(String officeName) { this.officeName = officeName; } @NotBlank(message = "ไธ่ƒฝไธบ็ฉบ") public String getStationId() { return stationId; } public void setStationId(String stationId) { this.stationId = stationId; } public String getStationName() { return stationName; } public void setStationName(String stationName) { this.stationName = stationName; } public String getPhoto() { return photo; } public void setPhoto(String photo) { this.photo = photo; } public String getLoginFlag() { return loginFlag; } public void setLoginFlag(String loginFlag) { this.loginFlag = loginFlag; } @Override @SupCol(isUnique = "true", isHide = "true") @ExcelField(title = "ID", type = 1, align = 2, sort = 1) public String getId() { return id; } //@JsonIgnore @NotNull(message = "ๅฝ’ๅฑž้ƒจ้—จไธ่ƒฝไธบ็ฉบ") @ExcelField(title = "ๅฝ’ๅฑž้ƒจ้—จ", align = 2, sort = 25) public BasicOrganization getOrganization() { return organization; } public void setOrganization(BasicOrganization organization) { this.organization = organization; } //@NotNull(message = "ๅฝ’ๅฑžๆœๅŠก็ซ™ไธ่ƒฝไธบ็ฉบ") @ExcelField(title = "ๅฝ’ๅฑžๆœๅŠก็ซ™", align = 2, sort = 25) public BasicServiceStation getStation() { return station; } public void setStation(BasicServiceStation station) { this.station = station; } //@Length(min = 1, max = 100, message = "็™ปๅฝ•ๅ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "็™ปๅฝ•ๅ", align = 2, sort = 30) public String getLoginName() { return StringUtils.isNotBlank(loginName) ? loginName : mobile; } public void setLoginName(String loginName) { this.loginName = loginName; } @JsonIgnore @Length(min = 1, max = 100, message = "ๅฏ†็ ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @NotBlank(message = "็”จๆˆทๅง“ๅไธๅฏไธบ็ฉบใ€‚") @Length(min = 1, max = 100, message = "ๅง“ๅ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "ๅง“ๅ", align = 2, sort = 40) public String getName() { return name; } //@Length(min = 1, max = 100, message = "ๅทฅๅท้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "ๅทฅๅท", align = 2, sort = 45) public String getNo() { return no; } public void setNo(String no) { this.no = no; } public void setName(String name) { this.name = name; } @Email(message = "้‚ฎ็ฎฑๆ ผๅผไธๆญฃ็กฎ") @Length(min = 0, max = 200, message = "้‚ฎ็ฎฑ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 200 ไน‹้—ด") @ExcelField(title = "้‚ฎ็ฎฑ", align = 1, sort = 50) public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Length(min = 0, max = 200, message = "็”ต่ฏ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 200 ไน‹้—ด") @ExcelField(title = "็”ต่ฏ", align = 2, sort = 60) public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @NotBlank(message = "ๅ‘˜ๅทฅๆ‰‹ๆœบๅทไธๅฏไธบ็ฉบใ€‚") @Pattern(regexp = RegexTool.REGEX_MOBILE,message = "ๆ‰‹ๆœบๅทๆ ผๅผไธๆญฃ็กฎ๏ผ") @Length(min = 0, max = 200, message = "ๆ‰‹ๆœบ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 200 ไน‹้—ด") @ExcelField(title = "ๆ‰‹ๆœบ", align = 2, sort = 70) public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } @Override @ExcelField(title = "ๅค‡ๆณจ", align = 1, sort = 900) public String getRemarks() { return remarks; } @Length(min = 0, max = 100, message = "็”จๆˆท็ฑปๅž‹้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "็”จๆˆท็ฑปๅž‹", align = 2, sort = 80, dictType = "sys_user_type") public String getUserType() { return userType; } public void setUserType(String userType) { this.userType = userType; } @Override @ExcelField(title = "ๅˆ›ๅปบๆ—ถ้—ด", type = 0, align = 1, sort = 90) public Date getCreateDate() { return createDate; } @ExcelField(title = "ๆœ€ๅŽ็™ปๅฝ•IP", type = 1, align = 1, sort = 100) public String getLoginIp() { return loginIp; } public void setLoginIp(String loginIp) { this.loginIp = loginIp; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelField(title = "ๆœ€ๅŽ็™ปๅฝ•ๆ—ฅๆœŸ", type = 1, align = 1, sort = 110) public Date getLoginDate() { return loginDate; } public void setLoginDate(Date loginDate) { this.loginDate = loginDate; } public String getOldLoginName() { return oldLoginName; } public void setOldLoginName(String oldLoginName) { this.oldLoginName = oldLoginName; } public String getNewPassword() { return newPassword; } public void setNewPassword(String newPassword) { this.newPassword = newPassword; } public String getOldLoginIp() { if (oldLoginIp == null) { return loginIp; } return oldLoginIp; } public void setOldLoginIp(String oldLoginIp) { this.oldLoginIp = oldLoginIp; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") public Date getOldLoginDate() { if (oldLoginDate == null) { return loginDate; } return oldLoginDate; } public void setOldLoginDate(Date oldLoginDate) { this.oldLoginDate = oldLoginDate; } public Role getRole() { return role; } public void setRole(Role role) { this.role = role; } //@JsonIgnore @ExcelField(title = "ๆ‹ฅๆœ‰่ง’่‰ฒ", align = 1, sort = 800, fieldType = RoleListType.class) public List<Role> getRoleList() { return roleList; } public void setRoleList(List<Role> roleList) { this.roleList = roleList; } @JsonIgnore public List<String> getRoleIdList() { List<String> roleIdList = Lists.newArrayList(); for (Role role : roleList) { roleIdList.add(role.getId()); } return roleIdList; } public void setRoleIdList(List<String> roleIdList) { roleList = Lists.newArrayList(); for (String roleId : roleIdList) { Role role = new Role(); role.setId(roleId); roleList.add(role); } } /** * ็”จๆˆทๆ‹ฅๆœ‰็š„่ง’่‰ฒๅ็งฐๅญ—็ฌฆไธฒ, ๅคšไธช่ง’่‰ฒๅ็งฐ็”จ','ๅˆ†้š”. */ public String getRoleNames() { return Collections3.extractToString(roleList, "name", ","); } public boolean isAdmin() { return isAdmin(this.id); } public static boolean isAdmin(String id) { return id != null && "1".equals(id); } /* public boolean isAdmin() { return isAdmin(this.type); } public static boolean isAdmin(String type) { return type != null && "sys".equals(type); }*/ @Override public String toString() { return id; } public String getUseable() { return useable; } public void setUseable(String useable) { this.useable = useable; } public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } // public String getRoleId() { return roleId; } public void setRoleId(String roleId) { this.roleId = roleId; } public String getOrgId() { return orgId; } public void setOrgId(String orgId) { this.orgId = orgId; } //add by wyr ็”จๆˆท็ฑปๅž‹๏ผš'sys','business') private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } }
UTF-8
Java
12,165
java
User.java
Java
[ { "context": "ight &copy; 2012-2016 <a href=\"https://github.com/thinkgem/jeesite\">JeeSite</a> All rights reserved.\n */\npac", "end": 70, "score": 0.9992668032646179, "start": 62, "tag": "USERNAME", "value": "thinkgem" }, { "context": "ort java.util.List;\n\n/**\n * ็”จๆˆทEntity\n *\n * @author ThinkGem\n * @version 2013-12-05\n */\npublic class User exte", "end": 1283, "score": 0.9989253282546997, "start": 1275, "tag": "USERNAME", "value": "ThinkGem" }, { "context": "g loginName;// ็™ปๅฝ•ๅ\n private String password;// ๅฏ†็ \n private String no; // ๅทฅๅท\n private S", "end": 1838, "score": 0.9597025513648987, "start": 1836, "tag": "PASSWORD", "value": "ๅฏ†็ " }, { "context": "ame;// ๅŽŸ็™ปๅฝ•ๅ\n private String newPassword; // ๆ–ฐๅฏ†็ \n\n private String oldLoginIp; // ไธŠๆฌก็™ป้™†IP\n ", "end": 2385, "score": 0.9615575075149536, "start": 2382, "tag": "PASSWORD", "value": "ๆ–ฐๅฏ†็ " }, { "context": " public String getNewPassword() {\n return newPassword;\n }\n\n public void setNewPassword(St", "end": 8650, "score": 0.8414352536201477, "start": 8647, "tag": "PASSWORD", "value": "new" }, { "context": "d(String newPassword) {\n this.newPassword = newPassword;\n }\n\n public String getOldLoginIp()", "end": 8750, "score": 0.9520202875137329, "start": 8747, "tag": "PASSWORD", "value": "new" } ]
null
[]
/** * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.thinkgem.jeesite.modules.sys.entity; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.Lists; import com.thinkgem.jeesite.common.config.Global; import com.thinkgem.jeesite.common.persistence.DataEntity; import com.thinkgem.jeesite.common.supcan.annotation.treelist.cols.SupCol; import com.thinkgem.jeesite.common.utils.Collections3; import com.thinkgem.jeesite.common.utils.RegexTool; import com.thinkgem.jeesite.common.utils.StringUtils; import com.thinkgem.jeesite.common.utils.excel.annotation.ExcelField; import com.thinkgem.jeesite.common.utils.excel.fieldtype.RoleListType; import com.thinkgem.jeesite.modules.service.entity.basic.BasicOrganization; import com.thinkgem.jeesite.modules.service.entity.station.BasicServiceStation; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import java.util.Date; import java.util.List; /** * ็”จๆˆทEntity * * @author ThinkGem * @version 2013-12-05 */ public class User extends DataEntity<User> { private static final long serialVersionUID = 1L; private String companyId;//ๅ…ฌๅธid private String companyName;//ๅ…ฌๅธๅ็งฐ private BasicOrganization organization; // ๅฝ’ๅฑž้ƒจ้—จ private String orgId;//ๆœบๆž„id private String officeId; //ๆœบๆž„id private String officeName; //ๆœบๆž„ๅ็งฐ private BasicServiceStation station;//ๆœๅŠก็ซ™ private String stationId; //ๆœๅŠก็ซ™id private String stationName; //ๆœๅŠก็ซ™ๅ็งฐ private String loginName;// ็™ปๅฝ•ๅ private String password;// ๅฏ†็  private String no; // ๅทฅๅท private String name; // ๅง“ๅ private String email; // ้‚ฎ็ฎฑ private String phone; // ็”ต่ฏ private String mobile; // ๆ‰‹ๆœบ private String userType;// ็”จๆˆท็ฑปๅž‹ private String loginIp; // ๆœ€ๅŽ็™ป้™†IP private Date loginDate; // ๆœ€ๅŽ็™ป้™†ๆ—ฅๆœŸ private String loginFlag; // ๆ˜ฏๅฆๅ…่ฎธ็™ป้™† private String photo; // ๅคดๅƒ private String useable; //ๆ˜ฏๅฆๅฏ็”จ private String roleName; private String roleId; private String oldLoginName;// ๅŽŸ็™ปๅฝ•ๅ private String newPassword; // ๆ–ฐๅฏ†็  private String oldLoginIp; // ไธŠๆฌก็™ป้™†IP private Date oldLoginDate; // ไธŠๆฌก็™ป้™†ๆ—ฅๆœŸ public String updateOwnFlag;//ๆ˜ฏๅฆ็ผ–่พ‘่‡ชๅทฑ public String getUpdateOwnFlag() { return updateOwnFlag; } public void setUpdateOwnFlag(String updateOwnFlag) { this.updateOwnFlag = updateOwnFlag; } private Role role; // ๆ นๆฎ่ง’่‰ฒๆŸฅ่ฏข็”จๆˆทๆกไปถ private List<Role> roleList = Lists.newArrayList(); // ๆ‹ฅๆœ‰่ง’่‰ฒๅˆ—่กจ private String[] roles; public String[] getRoles() { return roles; } public void setRoles(String[] roles) { this.roles = roles; } public User() { super(); this.loginFlag = Global.YES; } public User(String id) { super(id); } public User(String id, String loginName) { super(id); this.loginName = loginName; } public User(Role role) { super(); this.role = role; } public String getCompanyId() { return companyId; } public void setCompanyId(String companyId) { this.companyId = companyId; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getOfficeId() { return officeId; } public void setOfficeId(String officeId) { this.officeId = officeId; } public String getOfficeName() { return officeName; } public void setOfficeName(String officeName) { this.officeName = officeName; } @NotBlank(message = "ไธ่ƒฝไธบ็ฉบ") public String getStationId() { return stationId; } public void setStationId(String stationId) { this.stationId = stationId; } public String getStationName() { return stationName; } public void setStationName(String stationName) { this.stationName = stationName; } public String getPhoto() { return photo; } public void setPhoto(String photo) { this.photo = photo; } public String getLoginFlag() { return loginFlag; } public void setLoginFlag(String loginFlag) { this.loginFlag = loginFlag; } @Override @SupCol(isUnique = "true", isHide = "true") @ExcelField(title = "ID", type = 1, align = 2, sort = 1) public String getId() { return id; } //@JsonIgnore @NotNull(message = "ๅฝ’ๅฑž้ƒจ้—จไธ่ƒฝไธบ็ฉบ") @ExcelField(title = "ๅฝ’ๅฑž้ƒจ้—จ", align = 2, sort = 25) public BasicOrganization getOrganization() { return organization; } public void setOrganization(BasicOrganization organization) { this.organization = organization; } //@NotNull(message = "ๅฝ’ๅฑžๆœๅŠก็ซ™ไธ่ƒฝไธบ็ฉบ") @ExcelField(title = "ๅฝ’ๅฑžๆœๅŠก็ซ™", align = 2, sort = 25) public BasicServiceStation getStation() { return station; } public void setStation(BasicServiceStation station) { this.station = station; } //@Length(min = 1, max = 100, message = "็™ปๅฝ•ๅ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "็™ปๅฝ•ๅ", align = 2, sort = 30) public String getLoginName() { return StringUtils.isNotBlank(loginName) ? loginName : mobile; } public void setLoginName(String loginName) { this.loginName = loginName; } @JsonIgnore @Length(min = 1, max = 100, message = "ๅฏ†็ ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @NotBlank(message = "็”จๆˆทๅง“ๅไธๅฏไธบ็ฉบใ€‚") @Length(min = 1, max = 100, message = "ๅง“ๅ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "ๅง“ๅ", align = 2, sort = 40) public String getName() { return name; } //@Length(min = 1, max = 100, message = "ๅทฅๅท้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "ๅทฅๅท", align = 2, sort = 45) public String getNo() { return no; } public void setNo(String no) { this.no = no; } public void setName(String name) { this.name = name; } @Email(message = "้‚ฎ็ฎฑๆ ผๅผไธๆญฃ็กฎ") @Length(min = 0, max = 200, message = "้‚ฎ็ฎฑ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 200 ไน‹้—ด") @ExcelField(title = "้‚ฎ็ฎฑ", align = 1, sort = 50) public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Length(min = 0, max = 200, message = "็”ต่ฏ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 200 ไน‹้—ด") @ExcelField(title = "็”ต่ฏ", align = 2, sort = 60) public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @NotBlank(message = "ๅ‘˜ๅทฅๆ‰‹ๆœบๅทไธๅฏไธบ็ฉบใ€‚") @Pattern(regexp = RegexTool.REGEX_MOBILE,message = "ๆ‰‹ๆœบๅทๆ ผๅผไธๆญฃ็กฎ๏ผ") @Length(min = 0, max = 200, message = "ๆ‰‹ๆœบ้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 200 ไน‹้—ด") @ExcelField(title = "ๆ‰‹ๆœบ", align = 2, sort = 70) public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } @Override @ExcelField(title = "ๅค‡ๆณจ", align = 1, sort = 900) public String getRemarks() { return remarks; } @Length(min = 0, max = 100, message = "็”จๆˆท็ฑปๅž‹้•ฟๅบฆๅฟ…้กปไป‹ไบŽ 1 ๅ’Œ 100 ไน‹้—ด") @ExcelField(title = "็”จๆˆท็ฑปๅž‹", align = 2, sort = 80, dictType = "sys_user_type") public String getUserType() { return userType; } public void setUserType(String userType) { this.userType = userType; } @Override @ExcelField(title = "ๅˆ›ๅปบๆ—ถ้—ด", type = 0, align = 1, sort = 90) public Date getCreateDate() { return createDate; } @ExcelField(title = "ๆœ€ๅŽ็™ปๅฝ•IP", type = 1, align = 1, sort = 100) public String getLoginIp() { return loginIp; } public void setLoginIp(String loginIp) { this.loginIp = loginIp; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelField(title = "ๆœ€ๅŽ็™ปๅฝ•ๆ—ฅๆœŸ", type = 1, align = 1, sort = 110) public Date getLoginDate() { return loginDate; } public void setLoginDate(Date loginDate) { this.loginDate = loginDate; } public String getOldLoginName() { return oldLoginName; } public void setOldLoginName(String oldLoginName) { this.oldLoginName = oldLoginName; } public String getNewPassword() { return newPassword; } public void setNewPassword(String newPassword) { this.newPassword = newPassword; } public String getOldLoginIp() { if (oldLoginIp == null) { return loginIp; } return oldLoginIp; } public void setOldLoginIp(String oldLoginIp) { this.oldLoginIp = oldLoginIp; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") public Date getOldLoginDate() { if (oldLoginDate == null) { return loginDate; } return oldLoginDate; } public void setOldLoginDate(Date oldLoginDate) { this.oldLoginDate = oldLoginDate; } public Role getRole() { return role; } public void setRole(Role role) { this.role = role; } //@JsonIgnore @ExcelField(title = "ๆ‹ฅๆœ‰่ง’่‰ฒ", align = 1, sort = 800, fieldType = RoleListType.class) public List<Role> getRoleList() { return roleList; } public void setRoleList(List<Role> roleList) { this.roleList = roleList; } @JsonIgnore public List<String> getRoleIdList() { List<String> roleIdList = Lists.newArrayList(); for (Role role : roleList) { roleIdList.add(role.getId()); } return roleIdList; } public void setRoleIdList(List<String> roleIdList) { roleList = Lists.newArrayList(); for (String roleId : roleIdList) { Role role = new Role(); role.setId(roleId); roleList.add(role); } } /** * ็”จๆˆทๆ‹ฅๆœ‰็š„่ง’่‰ฒๅ็งฐๅญ—็ฌฆไธฒ, ๅคšไธช่ง’่‰ฒๅ็งฐ็”จ','ๅˆ†้š”. */ public String getRoleNames() { return Collections3.extractToString(roleList, "name", ","); } public boolean isAdmin() { return isAdmin(this.id); } public static boolean isAdmin(String id) { return id != null && "1".equals(id); } /* public boolean isAdmin() { return isAdmin(this.type); } public static boolean isAdmin(String type) { return type != null && "sys".equals(type); }*/ @Override public String toString() { return id; } public String getUseable() { return useable; } public void setUseable(String useable) { this.useable = useable; } public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } // public String getRoleId() { return roleId; } public void setRoleId(String roleId) { this.roleId = roleId; } public String getOrgId() { return orgId; } public void setOrgId(String orgId) { this.orgId = orgId; } //add by wyr ็”จๆˆท็ฑปๅž‹๏ผš'sys','business') private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } }
12,165
0.623381
0.61156
465
23.744085
20.772839
108
false
false
0
0
0
0
0
0
0.505376
false
false
12
288a7955cb40bf96d374822168e73ec0b991e436
2,310,692,406,447
c49399acbc00d570d2701c3a2c855a8448ba7a3e
/war/src/main/java/com/dev/project2/Generics.java
68e215787f55802215c207ea8da1c45c16365134
[]
no_license
Lazzo1984/JenkinsPipelineTest
https://github.com/Lazzo1984/JenkinsPipelineTest
878f69b67476014337c6bc86f76719943ce4399d
8155f50d65f66f96d28ddf1ad715ec0c36ae4551
refs/heads/master
2022-11-28T12:57:25.569000
2020-02-13T13:21:12
2020-02-13T13:21:12
240,236,382
0
0
null
false
2022-11-16T09:22:03
2020-02-13T10:43:25
2020-02-13T13:21:15
2022-11-16T09:21:59
14,693
0
0
4
HTML
false
false
package com.dev.project2; public class Generics implements IOrdinable{ // qualsiasi tipo purche implementi Comparable es String Integer oppure tipi definiti dall'utente public <T extends Comparable<T>> T[] selectionSort(T[] array) { T temp; for (int i = 0; i < array.length - 1; i++) { for (int j = i + 1; j < array.length; j++) { if (array[j].compareTo(array[i]) <= 0) { temp = array[i]; array[i] = array[j]; array[j] = temp; } } } return array; } }
UTF-8
Java
654
java
Generics.java
Java
[]
null
[]
package com.dev.project2; public class Generics implements IOrdinable{ // qualsiasi tipo purche implementi Comparable es String Integer oppure tipi definiti dall'utente public <T extends Comparable<T>> T[] selectionSort(T[] array) { T temp; for (int i = 0; i < array.length - 1; i++) { for (int j = i + 1; j < array.length; j++) { if (array[j].compareTo(array[i]) <= 0) { temp = array[i]; array[i] = array[j]; array[j] = temp; } } } return array; } }
654
0.463303
0.455657
24
26.25
24.700287
98
false
false
0
0
0
0
0
0
0.75
false
false
12
11a5b1d7a95b8d318785c727c2209a28f751a0b4
18,897,856,168,977
6de3e2dd6e12dabaa02cded3dfc972339869d4e9
/panda-core/src/main/java/panda/idx/lucene/LuceneQuery.java
72e1359e0087cbe6bff9032448691ec27bf8693d
[ "Apache-2.0" ]
permissive
ulrye1dev/panda
https://github.com/ulrye1dev/panda
3757a37e7815a57de43e37636997752611719809
3c58a5775697ddade0dfb12f2929178393ef6283
refs/heads/master
2020-06-05T14:49:47.647000
2019-06-17T02:46:39
2019-06-17T03:34:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package panda.idx.lucene; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.Query; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; import org.apache.lucene.search.TopDocsCollector; import org.apache.lucene.search.TopFieldCollector; import org.apache.lucene.search.TopScoreDocCollector; import panda.idx.IQuery; import panda.idx.IndexException; import panda.lang.Collections; public class LuceneQuery extends IQuery { protected Analyzer analyzer; protected QueryParser parser; protected List<SortField> sorts; public LuceneQuery(Analyzer analyzer) { this.analyzer = analyzer; } @Override public IQuery field(String field) { if (parser == null) { parser = new QueryParser(field, analyzer); } return super.field(field); } @Override public IQuery value(String value) { addSpace(); query.append('"').append(Lucenes.escapeText(value)).append('"'); return this; } @Override public IQuery sort(String field, SortType type, boolean desc) { if (sorts == null) { sorts = new ArrayList<SortField>(); } SortField sf = new SortField(field, toSortFieldType(type), desc); sorts.add(sf); return null; } protected SortField.Type toSortFieldType(SortType type) { switch (type) { case SCORE: return SortField.Type.SCORE; case DOC: return SortField.Type.DOC; case STRING: return SortField.Type.STRING; case INT: return SortField.Type.INT; case FLOAT: return SortField.Type.FLOAT; case DATE: case LONG: return SortField.Type.LONG; case DOUBLE: return SortField.Type.DOUBLE; default: throw new IndexException("Invalid sort type: " + type); } } /** * @return query */ protected Query buildQuery() { try { return parser.parse(getQuery()); } catch (ParseException e) { throw new IndexException("Failed to parse query: " + getQuery(), e); } } protected TopDocsCollector buildCollector() { TopDocsCollector collector; if (Collections.isEmpty(sorts)) { collector = TopScoreDocCollector.create((int)(getLimit())); } else { Sort sort = new Sort(sorts.toArray(new SortField[0])); try { collector = TopFieldCollector.create(sort, (int)(getStart() + getLimit()), true, false, false); } catch (IOException e) { throw new IndexException("Failed to create TopFieldCollector: " + sorts); } } return collector; } }
UTF-8
Java
2,604
java
LuceneQuery.java
Java
[]
null
[]
package panda.idx.lucene; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.Query; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; import org.apache.lucene.search.TopDocsCollector; import org.apache.lucene.search.TopFieldCollector; import org.apache.lucene.search.TopScoreDocCollector; import panda.idx.IQuery; import panda.idx.IndexException; import panda.lang.Collections; public class LuceneQuery extends IQuery { protected Analyzer analyzer; protected QueryParser parser; protected List<SortField> sorts; public LuceneQuery(Analyzer analyzer) { this.analyzer = analyzer; } @Override public IQuery field(String field) { if (parser == null) { parser = new QueryParser(field, analyzer); } return super.field(field); } @Override public IQuery value(String value) { addSpace(); query.append('"').append(Lucenes.escapeText(value)).append('"'); return this; } @Override public IQuery sort(String field, SortType type, boolean desc) { if (sorts == null) { sorts = new ArrayList<SortField>(); } SortField sf = new SortField(field, toSortFieldType(type), desc); sorts.add(sf); return null; } protected SortField.Type toSortFieldType(SortType type) { switch (type) { case SCORE: return SortField.Type.SCORE; case DOC: return SortField.Type.DOC; case STRING: return SortField.Type.STRING; case INT: return SortField.Type.INT; case FLOAT: return SortField.Type.FLOAT; case DATE: case LONG: return SortField.Type.LONG; case DOUBLE: return SortField.Type.DOUBLE; default: throw new IndexException("Invalid sort type: " + type); } } /** * @return query */ protected Query buildQuery() { try { return parser.parse(getQuery()); } catch (ParseException e) { throw new IndexException("Failed to parse query: " + getQuery(), e); } } protected TopDocsCollector buildCollector() { TopDocsCollector collector; if (Collections.isEmpty(sorts)) { collector = TopScoreDocCollector.create((int)(getLimit())); } else { Sort sort = new Sort(sorts.toArray(new SortField[0])); try { collector = TopFieldCollector.create(sort, (int)(getStart() + getLimit()), true, false, false); } catch (IOException e) { throw new IndexException("Failed to create TopFieldCollector: " + sorts); } } return collector; } }
2,604
0.721198
0.720814
106
23.566038
21.180277
99
false
false
0
0
0
0
0
0
2
false
false
12
e801aa3ed854670a024e3ca036236f3dd912cf93
18,906,446,037,205
cf97facff5508dbef46de86eb3ca16441dcfeddd
/airback-web/src/main/java/com/airback/module/user/accountsettings/team/view/UserAddViewImpl.java
fcb49dff27af0f13f5ec00ac623f951b04987418
[ "MIT" ]
permissive
am2nh/airback
https://github.com/am2nh/airback
bffcc024aa15d5cc5990c93d1965572df17dd834
782b1ac49b343d8c497d3dae5be3eb812d151772
refs/heads/master
2023-04-08T05:14:55.670000
2021-07-05T17:34:52
2021-07-05T17:34:52
246,276,311
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright ยฉ airback * <p> * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * <p> * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * <p> * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.airback.module.user.accountsettings.team.view; import com.airback.common.i18n.GenericI18Enum; import com.airback.common.i18n.ShellI18nEnum; import com.airback.form.view.LayoutType; import com.airback.form.view.builder.DynaSectionBuilder; import com.airback.form.view.builder.TextDynaFieldBuilder; import com.airback.form.view.builder.type.DynaForm; import com.airback.form.view.builder.type.DynaSection; import com.airback.module.user.accountsettings.localization.UserI18nEnum; import com.airback.module.user.domain.SimpleRole; import com.airback.module.user.domain.SimpleUser; import com.airback.module.user.domain.User; import com.airback.module.user.view.component.RoleComboBox; import com.airback.vaadin.UserUIContext; import com.airback.vaadin.event.HasEditFormHandlers; import com.airback.vaadin.mvp.AbstractVerticalPageView; import com.airback.vaadin.mvp.ViewComponent; import com.airback.vaadin.ui.*; import com.airback.vaadin.web.ui.*; import com.airback.vaadin.web.ui.grid.GridFormLayoutHelper; import com.vaadin.data.HasValue; import com.vaadin.icons.VaadinIcons; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.*; import org.vaadin.viritin.button.MButton; import org.vaadin.viritin.fields.MTextField; import org.vaadin.viritin.layouts.MHorizontalLayout; import org.vaadin.viritin.layouts.MVerticalLayout; import static com.airback.vaadin.web.ui.utils.FormControlsGenerator.generateEditFormControls; /** * @author airback Ltd. * @since 1.0 */ @ViewComponent public class UserAddViewImpl extends AbstractVerticalPageView implements UserAddView { private static final long serialVersionUID = 1L; private EditUserForm editUserForm; private SimpleUser user; public UserAddViewImpl() { withMargin(new MarginInfo(false, true, true, true)); editUserForm = new EditUserForm(); } @Override public void editItem(SimpleUser item) { editItem(item, true); } @Override public void editItem(SimpleUser item, boolean isBasicForm) { this.user = item; this.removeAllComponents(); this.addComponent(editUserForm); if (isBasicForm) { editUserForm.displayBasicForm(user); } else { editUserForm.displayAdvancedForm(user); } } private void displayRolePermission(SimpleRole role) { editUserForm.displayRolePermission(role); } @Override public HasEditFormHandlers<SimpleUser> getEditFormHandlers() { return editUserForm; } private class EditUserForm extends AdvancedEditBeanForm<SimpleUser> { private static final long serialVersionUID = 1L; private void displayBasicForm(SimpleUser newDataSource) { this.setFormLayoutFactory(new BasicFormLayoutFactory()); this.setBeanFormFieldFactory(new BasicEditFormFieldFactory(editUserForm)); super.setBean(newDataSource); } private void displayAdvancedForm(SimpleUser newDataSource) { this.setFormLayoutFactory(new AdvancedFormLayoutFactory()); this.setBeanFormFieldFactory(new AdvancedEditFormFieldFactory(editUserForm)); super.setBean(newDataSource); } private void displayRolePermission(SimpleRole role) { if (this.getLayoutFactory() instanceof BasicFormLayoutFactory) { ((BasicFormLayoutFactory) getLayoutFactory()).displayRolePermission(role); } else if (this.getLayoutFactory() instanceof AdvancedFormLayoutFactory) { ((AdvancedFormLayoutFactory) getLayoutFactory()).displayRolePermission(role); } } private class BasicFormLayoutFactory extends WrappedFormLayoutFactory { private RolePermissionContainer rolePermissionLayout; @Override public AbstractComponent getLayout() { String title = (user.getUsername() == null) ? UserUIContext.getMessage(UserI18nEnum.NEW) : user.getDisplayName(); AddViewLayout formAddLayout = new AddViewLayout(title, VaadinIcons.USER); wrappedLayoutFactory = buildFormLayout(); formAddLayout.addHeaderRight(generateEditFormControls(editUserForm, true, false, true)); formAddLayout.addBody(wrappedLayoutFactory.getLayout()); formAddLayout.addBottom(createBottomPanel()); return formAddLayout; } private Layout createBottomPanel() { MVerticalLayout bottomPanel = new MVerticalLayout().withMargin(false); Button moreInfoBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.ACTION_MORE_INFORMATION), event -> { editUserForm.displayAdvancedForm(user); }).withStyleName(WebThemes.BUTTON_LINK); MHorizontalLayout linkWrap = new MHorizontalLayout(moreInfoBtn).withMargin(true); bottomPanel.with(linkWrap).withAlign(linkWrap, Alignment.MIDDLE_LEFT); rolePermissionLayout = new RolePermissionContainer(); bottomPanel.addComponent(rolePermissionLayout); return bottomPanel; } void displayRolePermission(SimpleRole role) { rolePermissionLayout.displayRolePermission(role); } private DefaultDynaFormLayout buildFormLayout() { DynaForm defaultForm = new DynaForm(); DynaSection mainSection = new DynaSectionBuilder().header(UserI18nEnum.SECTION_BASIC_INFORMATION) .layoutType(LayoutType.TWO_COLUMN).build(); mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.firstname).displayName(UserI18nEnum.FORM_FIRST_NAME) .fieldIndex(0).build()); mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.username).displayName(GenericI18Enum.FORM_EMAIL) .fieldIndex(1).build()); mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.lastname).displayName(UserI18nEnum.FORM_LAST_NAME) .fieldIndex(2).build()); mainSection.fields(new TextDynaFieldBuilder().fieldName(SimpleUser.Field.roleId).displayName(UserI18nEnum.FORM_ROLE) .fieldIndex(3).build()); if (user.getUsername() == null) { mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.password).displayName (ShellI18nEnum.FORM_PASSWORD).contextHelp(ShellI18nEnum.FORM_PASSWORD_HELP).fieldIndex(4).build()); } defaultForm.sections(mainSection); return new DefaultDynaFormLayout(defaultForm); } } private class BasicEditFormFieldFactory extends AbstractBeanFieldGroupEditFieldFactory<SimpleUser> { private static final long serialVersionUID = 1L; BasicEditFormFieldFactory(GenericBeanForm<SimpleUser> form) { super(form); } @Override protected HasValue<?> onCreateField(Object propertyId) { if (SimpleUser.Field.roleId.equalTo(propertyId)) { return new RoleSelectionField(); } else if (User.Field.username.equalTo(propertyId) || User.Field.firstname.equalTo(propertyId) || User.Field.lastname.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH).withRequiredIndicatorVisible(true); } else if (User.Field.password.equalTo(propertyId)) { PasswordField field = new PasswordField(); field.setWidth(WebThemes.FORM_CONTROL_WIDTH); return field; } return null; } } private class AdvancedFormLayoutFactory extends AbstractFormLayoutFactory { private GridFormLayoutHelper basicInformationLayout; private GridFormLayoutHelper advancedInformationLayout; private GridFormLayoutHelper contactInformationLayout; private RolePermissionContainer rolePermissionLayout; @Override public AbstractComponent getLayout() { String title = (user.getUsername() == null) ? UserUIContext.getMessage(UserI18nEnum.NEW) : user.getDisplayName(); AddViewLayout formAddLayout = new AddViewLayout(title, VaadinIcons.USER); formAddLayout.addHeaderRight(generateEditFormControls(editUserForm, true, false, true)); FormContainer formContainer = new FormContainer(); basicInformationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN); formContainer.addSection(UserUIContext.getMessage(UserI18nEnum.SECTION_BASIC_INFORMATION), basicInformationLayout.getLayout()); contactInformationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN); formContainer.addSection(UserUIContext.getMessage(UserI18nEnum.SECTION_CONTACT_INFORMATION), contactInformationLayout.getLayout()); advancedInformationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN); formContainer.addSection(UserUIContext.getMessage(UserI18nEnum.SECTION_ADVANCED_INFORMATION), advancedInformationLayout.getLayout()); formAddLayout.addBody(formContainer); rolePermissionLayout = new RolePermissionContainer(); formAddLayout.addBottom(rolePermissionLayout); return formAddLayout; } void displayRolePermission(SimpleRole role) { rolePermissionLayout.displayRolePermission(role); } @Override protected HasValue<?> onAttachField(Object propertyId, HasValue<?> field) { if (propertyId.equals("firstname")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_FIRST_NAME), 0, 0); } else if (propertyId.equals("lastname")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_LAST_NAME), 0, 1); } else if (propertyId.equals("nickname")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_NICK_NAME), 1, 0); } else if (propertyId.equals("birthday")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 1, 1); } else if (propertyId.equals("username")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2); } else if (SimpleUser.Field.roleId.equalTo(propertyId)) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_ROLE), 1, 2); } else if (propertyId.equals("timezone")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 3); } else if (User.Field.password.equalTo(propertyId) && (user.getUsername() == null)) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD), UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD_HELP), 1, 3); } else if (propertyId.equals("company")) { return advancedInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 0); } else if (propertyId.equals("country")) { return advancedInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 1, 2); } else if (propertyId.equals("website")) { return advancedInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_WEBSITE), 1, 0); } else if (propertyId.equals("workphone")) { return contactInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_WORK_PHONE), 0, 0); } else if (propertyId.equals("homephone")) { return contactInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_HOME_PHONE), 0, 1); } else if (propertyId.equals("facebookaccount")) { return contactInformationLayout.addComponent(field, "Facebook", 1, 0); } else if (propertyId.equals("twitteraccount")) { return contactInformationLayout.addComponent(field, "Twitter", 1, 1); } else if (propertyId.equals("skypecontact")) { return contactInformationLayout.addComponent(field, "Skype", 0, 2); } return null; } } private class AdvancedEditFormFieldFactory extends AbstractBeanFieldGroupEditFieldFactory<SimpleUser> { private static final long serialVersionUID = 1L; AdvancedEditFormFieldFactory(GenericBeanForm<SimpleUser> form) { super(form); } @Override protected HasValue<?> onCreateField(Object propertyId) { if (SimpleUser.Field.roleId.equalTo(propertyId)) { return new RoleSelectionField(); } else if (User.Field.username.equalTo(propertyId) || User.Field.firstname.equalTo(propertyId) || User.Field.lastname.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH).withRequiredIndicatorVisible(true); } else if (User.Field.nickname.equalTo(propertyId) || User.Field.website.equalTo(propertyId) || User.Field.homephone.equalTo(propertyId) || User.Field.workphone.equalTo(propertyId) || User.Field.facebookaccount.equalTo(propertyId) || User.Field.twitteraccount.equalTo(propertyId) || User.Field.skypecontact.equalTo(propertyId) || User.Field.company.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if (User.Field.birthday.equalTo(propertyId)) { return new DateField(); } else if (propertyId.equals("timezone")) { return new TimeZoneSelectionField(false); } else if (propertyId.equals("country")) { CountryComboBox cboCountry = new CountryComboBox(); cboCountry.addValueChangeListener(valueChangeEvent -> user.setCountry((String) cboCountry.getValue())); return cboCountry; } else if (User.Field.password.equalTo(propertyId)) { PasswordField field = new PasswordField(); field.setWidth(WebThemes.FORM_CONTROL_WIDTH); return field; } return null; } } } private class RoleSelectionField extends CustomField<Integer> { private static final long serialVersionUID = 1L; private RoleComboBox roleBox; RoleSelectionField() { roleBox = new RoleComboBox(); roleBox.addValueChangeListener(valueChangeEvent -> { SimpleRole role = roleBox.getValue(); displayRolePermission(role); }); SimpleRole role = roleBox.getValue(); displayRolePermission(role); } @Override protected Component initContent() { return roleBox; } @Override protected void doSetValue(Integer roleId) { if (roleId != null) { roleBox.selectRoleById(roleId); } } @Override public Integer getValue() { SimpleRole role = roleBox.getValue(); return (role != null) ? role.getId() : null; } } }
UTF-8
Java
17,154
java
UserAddViewImpl.java
Java
[]
null
[]
/** * Copyright ยฉ airback * <p> * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * <p> * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * <p> * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.airback.module.user.accountsettings.team.view; import com.airback.common.i18n.GenericI18Enum; import com.airback.common.i18n.ShellI18nEnum; import com.airback.form.view.LayoutType; import com.airback.form.view.builder.DynaSectionBuilder; import com.airback.form.view.builder.TextDynaFieldBuilder; import com.airback.form.view.builder.type.DynaForm; import com.airback.form.view.builder.type.DynaSection; import com.airback.module.user.accountsettings.localization.UserI18nEnum; import com.airback.module.user.domain.SimpleRole; import com.airback.module.user.domain.SimpleUser; import com.airback.module.user.domain.User; import com.airback.module.user.view.component.RoleComboBox; import com.airback.vaadin.UserUIContext; import com.airback.vaadin.event.HasEditFormHandlers; import com.airback.vaadin.mvp.AbstractVerticalPageView; import com.airback.vaadin.mvp.ViewComponent; import com.airback.vaadin.ui.*; import com.airback.vaadin.web.ui.*; import com.airback.vaadin.web.ui.grid.GridFormLayoutHelper; import com.vaadin.data.HasValue; import com.vaadin.icons.VaadinIcons; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.*; import org.vaadin.viritin.button.MButton; import org.vaadin.viritin.fields.MTextField; import org.vaadin.viritin.layouts.MHorizontalLayout; import org.vaadin.viritin.layouts.MVerticalLayout; import static com.airback.vaadin.web.ui.utils.FormControlsGenerator.generateEditFormControls; /** * @author airback Ltd. * @since 1.0 */ @ViewComponent public class UserAddViewImpl extends AbstractVerticalPageView implements UserAddView { private static final long serialVersionUID = 1L; private EditUserForm editUserForm; private SimpleUser user; public UserAddViewImpl() { withMargin(new MarginInfo(false, true, true, true)); editUserForm = new EditUserForm(); } @Override public void editItem(SimpleUser item) { editItem(item, true); } @Override public void editItem(SimpleUser item, boolean isBasicForm) { this.user = item; this.removeAllComponents(); this.addComponent(editUserForm); if (isBasicForm) { editUserForm.displayBasicForm(user); } else { editUserForm.displayAdvancedForm(user); } } private void displayRolePermission(SimpleRole role) { editUserForm.displayRolePermission(role); } @Override public HasEditFormHandlers<SimpleUser> getEditFormHandlers() { return editUserForm; } private class EditUserForm extends AdvancedEditBeanForm<SimpleUser> { private static final long serialVersionUID = 1L; private void displayBasicForm(SimpleUser newDataSource) { this.setFormLayoutFactory(new BasicFormLayoutFactory()); this.setBeanFormFieldFactory(new BasicEditFormFieldFactory(editUserForm)); super.setBean(newDataSource); } private void displayAdvancedForm(SimpleUser newDataSource) { this.setFormLayoutFactory(new AdvancedFormLayoutFactory()); this.setBeanFormFieldFactory(new AdvancedEditFormFieldFactory(editUserForm)); super.setBean(newDataSource); } private void displayRolePermission(SimpleRole role) { if (this.getLayoutFactory() instanceof BasicFormLayoutFactory) { ((BasicFormLayoutFactory) getLayoutFactory()).displayRolePermission(role); } else if (this.getLayoutFactory() instanceof AdvancedFormLayoutFactory) { ((AdvancedFormLayoutFactory) getLayoutFactory()).displayRolePermission(role); } } private class BasicFormLayoutFactory extends WrappedFormLayoutFactory { private RolePermissionContainer rolePermissionLayout; @Override public AbstractComponent getLayout() { String title = (user.getUsername() == null) ? UserUIContext.getMessage(UserI18nEnum.NEW) : user.getDisplayName(); AddViewLayout formAddLayout = new AddViewLayout(title, VaadinIcons.USER); wrappedLayoutFactory = buildFormLayout(); formAddLayout.addHeaderRight(generateEditFormControls(editUserForm, true, false, true)); formAddLayout.addBody(wrappedLayoutFactory.getLayout()); formAddLayout.addBottom(createBottomPanel()); return formAddLayout; } private Layout createBottomPanel() { MVerticalLayout bottomPanel = new MVerticalLayout().withMargin(false); Button moreInfoBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.ACTION_MORE_INFORMATION), event -> { editUserForm.displayAdvancedForm(user); }).withStyleName(WebThemes.BUTTON_LINK); MHorizontalLayout linkWrap = new MHorizontalLayout(moreInfoBtn).withMargin(true); bottomPanel.with(linkWrap).withAlign(linkWrap, Alignment.MIDDLE_LEFT); rolePermissionLayout = new RolePermissionContainer(); bottomPanel.addComponent(rolePermissionLayout); return bottomPanel; } void displayRolePermission(SimpleRole role) { rolePermissionLayout.displayRolePermission(role); } private DefaultDynaFormLayout buildFormLayout() { DynaForm defaultForm = new DynaForm(); DynaSection mainSection = new DynaSectionBuilder().header(UserI18nEnum.SECTION_BASIC_INFORMATION) .layoutType(LayoutType.TWO_COLUMN).build(); mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.firstname).displayName(UserI18nEnum.FORM_FIRST_NAME) .fieldIndex(0).build()); mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.username).displayName(GenericI18Enum.FORM_EMAIL) .fieldIndex(1).build()); mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.lastname).displayName(UserI18nEnum.FORM_LAST_NAME) .fieldIndex(2).build()); mainSection.fields(new TextDynaFieldBuilder().fieldName(SimpleUser.Field.roleId).displayName(UserI18nEnum.FORM_ROLE) .fieldIndex(3).build()); if (user.getUsername() == null) { mainSection.fields(new TextDynaFieldBuilder().fieldName(User.Field.password).displayName (ShellI18nEnum.FORM_PASSWORD).contextHelp(ShellI18nEnum.FORM_PASSWORD_HELP).fieldIndex(4).build()); } defaultForm.sections(mainSection); return new DefaultDynaFormLayout(defaultForm); } } private class BasicEditFormFieldFactory extends AbstractBeanFieldGroupEditFieldFactory<SimpleUser> { private static final long serialVersionUID = 1L; BasicEditFormFieldFactory(GenericBeanForm<SimpleUser> form) { super(form); } @Override protected HasValue<?> onCreateField(Object propertyId) { if (SimpleUser.Field.roleId.equalTo(propertyId)) { return new RoleSelectionField(); } else if (User.Field.username.equalTo(propertyId) || User.Field.firstname.equalTo(propertyId) || User.Field.lastname.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH).withRequiredIndicatorVisible(true); } else if (User.Field.password.equalTo(propertyId)) { PasswordField field = new PasswordField(); field.setWidth(WebThemes.FORM_CONTROL_WIDTH); return field; } return null; } } private class AdvancedFormLayoutFactory extends AbstractFormLayoutFactory { private GridFormLayoutHelper basicInformationLayout; private GridFormLayoutHelper advancedInformationLayout; private GridFormLayoutHelper contactInformationLayout; private RolePermissionContainer rolePermissionLayout; @Override public AbstractComponent getLayout() { String title = (user.getUsername() == null) ? UserUIContext.getMessage(UserI18nEnum.NEW) : user.getDisplayName(); AddViewLayout formAddLayout = new AddViewLayout(title, VaadinIcons.USER); formAddLayout.addHeaderRight(generateEditFormControls(editUserForm, true, false, true)); FormContainer formContainer = new FormContainer(); basicInformationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN); formContainer.addSection(UserUIContext.getMessage(UserI18nEnum.SECTION_BASIC_INFORMATION), basicInformationLayout.getLayout()); contactInformationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN); formContainer.addSection(UserUIContext.getMessage(UserI18nEnum.SECTION_CONTACT_INFORMATION), contactInformationLayout.getLayout()); advancedInformationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN); formContainer.addSection(UserUIContext.getMessage(UserI18nEnum.SECTION_ADVANCED_INFORMATION), advancedInformationLayout.getLayout()); formAddLayout.addBody(formContainer); rolePermissionLayout = new RolePermissionContainer(); formAddLayout.addBottom(rolePermissionLayout); return formAddLayout; } void displayRolePermission(SimpleRole role) { rolePermissionLayout.displayRolePermission(role); } @Override protected HasValue<?> onAttachField(Object propertyId, HasValue<?> field) { if (propertyId.equals("firstname")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_FIRST_NAME), 0, 0); } else if (propertyId.equals("lastname")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_LAST_NAME), 0, 1); } else if (propertyId.equals("nickname")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_NICK_NAME), 1, 0); } else if (propertyId.equals("birthday")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 1, 1); } else if (propertyId.equals("username")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2); } else if (SimpleUser.Field.roleId.equalTo(propertyId)) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_ROLE), 1, 2); } else if (propertyId.equals("timezone")) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 3); } else if (User.Field.password.equalTo(propertyId) && (user.getUsername() == null)) { return basicInformationLayout.addComponent(field, UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD), UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD_HELP), 1, 3); } else if (propertyId.equals("company")) { return advancedInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 0); } else if (propertyId.equals("country")) { return advancedInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 1, 2); } else if (propertyId.equals("website")) { return advancedInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_WEBSITE), 1, 0); } else if (propertyId.equals("workphone")) { return contactInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_WORK_PHONE), 0, 0); } else if (propertyId.equals("homephone")) { return contactInformationLayout.addComponent(field, UserUIContext.getMessage(UserI18nEnum.FORM_HOME_PHONE), 0, 1); } else if (propertyId.equals("facebookaccount")) { return contactInformationLayout.addComponent(field, "Facebook", 1, 0); } else if (propertyId.equals("twitteraccount")) { return contactInformationLayout.addComponent(field, "Twitter", 1, 1); } else if (propertyId.equals("skypecontact")) { return contactInformationLayout.addComponent(field, "Skype", 0, 2); } return null; } } private class AdvancedEditFormFieldFactory extends AbstractBeanFieldGroupEditFieldFactory<SimpleUser> { private static final long serialVersionUID = 1L; AdvancedEditFormFieldFactory(GenericBeanForm<SimpleUser> form) { super(form); } @Override protected HasValue<?> onCreateField(Object propertyId) { if (SimpleUser.Field.roleId.equalTo(propertyId)) { return new RoleSelectionField(); } else if (User.Field.username.equalTo(propertyId) || User.Field.firstname.equalTo(propertyId) || User.Field.lastname.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH).withRequiredIndicatorVisible(true); } else if (User.Field.nickname.equalTo(propertyId) || User.Field.website.equalTo(propertyId) || User.Field.homephone.equalTo(propertyId) || User.Field.workphone.equalTo(propertyId) || User.Field.facebookaccount.equalTo(propertyId) || User.Field.twitteraccount.equalTo(propertyId) || User.Field.skypecontact.equalTo(propertyId) || User.Field.company.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if (User.Field.birthday.equalTo(propertyId)) { return new DateField(); } else if (propertyId.equals("timezone")) { return new TimeZoneSelectionField(false); } else if (propertyId.equals("country")) { CountryComboBox cboCountry = new CountryComboBox(); cboCountry.addValueChangeListener(valueChangeEvent -> user.setCountry((String) cboCountry.getValue())); return cboCountry; } else if (User.Field.password.equalTo(propertyId)) { PasswordField field = new PasswordField(); field.setWidth(WebThemes.FORM_CONTROL_WIDTH); return field; } return null; } } } private class RoleSelectionField extends CustomField<Integer> { private static final long serialVersionUID = 1L; private RoleComboBox roleBox; RoleSelectionField() { roleBox = new RoleComboBox(); roleBox.addValueChangeListener(valueChangeEvent -> { SimpleRole role = roleBox.getValue(); displayRolePermission(role); }); SimpleRole role = roleBox.getValue(); displayRolePermission(role); } @Override protected Component initContent() { return roleBox; } @Override protected void doSetValue(Integer roleId) { if (roleId != null) { roleBox.selectRoleById(roleId); } } @Override public Integer getValue() { SimpleRole role = roleBox.getValue(); return (role != null) ? role.getId() : null; } } }
17,154
0.651023
0.64461
337
49.902077
37.636074
152
false
false
0
0
0
0
0
0
0.721068
false
false
12
4b31b2be2afc393432f00c7bf43fddd08b1b633d
32,057,635,959,938
dae42883468254ef0210c36ccf881e18cf93d16e
/01_java_basic/02.class_season2/OverridingDemo.java
27aaa5e472d6cf97157a391dac9f1dbcfc914735
[]
no_license
sdu6342/java-practice
https://github.com/sdu6342/java-practice
5151f27c28ba691d4eb414dfe15d205b17ab723f
b132ecce47120dfe67276b96e2e90fea2f80f030
refs/heads/master
2017-12-08T07:11:32.761000
2017-01-23T08:17:29
2017-01-23T08:17:29
79,426,706
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* date: 2017.01.23 title: ์˜ค๋ฒ„๋ผ์ด๋”ฉ content: ์ƒ์†ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ถ€๋ชจํด๋ž˜์Šค์˜ ๋ฉ”์†Œ๋“œ๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ด๋ฅผ ์˜ค๋ฒ„๋ผ์ด๋”ฉ์ด๋ผ ํ•œ๋‹ค. ์˜ค๋ฒ„๋ผ์ด๋”ฉ์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ฉ”์†Œ๋“œ์˜ ์ด๋ฆ„์ด ๊ฐ™์•„์•ผํ•˜๊ณ , ๋ฉ”์†Œ๋“œ์˜ ๋งค๊ฐœ๋ณ€์ˆ˜ ๋ฐ์ดํ„ฐ ํƒ€์ž…๊ณผ ์ˆœ์„œ๊ฐ€ ๊ฐ™๊ณ , ๋ฉ”์†Œ๋“œ์˜ ๋ฆฌํ„ด๊ฐ’์ด ๊ฐ™์•„์•ผ ํ•œ๋‹ค. = ๋ฉ”์†Œ๋“œ์˜ ์„œ๋ช…์ด ๊ฐ™์•„์•ผ ํ•œ๋‹ค. */ class Calcurator{ int left, right; public Calcurator(int left, int right){ this.left = left; this.right = right; } public void sum(){ System.out.println(left + right); } } class Calcurator2 extends Calcurator { public Calcurator2(int left, int right){ super(left, right); } public void sum(){ System.out.println("๋‘ ์ˆ˜์˜ ํ•ฉ์€ : " + (left + right)); //์ž์‹ํด๋ž˜์Šค๋Š” ์˜ค๋ฒ„๋ผ์ด๋”ฉ์„ ํ†ตํ•ด ๊ฐ™์€ ์ด๋ฆ„์ด์ง€๋งŒ ๋‹ค๋ฅธ๊ธฐ๋Šฅ์„ ๊ฐ–๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค. } } public class OverridingDemo{ public static void main(String args[]){ Calcurator c2 = new Calcurator(50,20); c2.sum(); Calcurator2 c1 = new Calcurator2(50,20); c1.sum(); } }
UTF-8
Java
1,148
java
OverridingDemo.java
Java
[]
null
[]
/* date: 2017.01.23 title: ์˜ค๋ฒ„๋ผ์ด๋”ฉ content: ์ƒ์†ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ถ€๋ชจํด๋ž˜์Šค์˜ ๋ฉ”์†Œ๋“œ๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ด๋ฅผ ์˜ค๋ฒ„๋ผ์ด๋”ฉ์ด๋ผ ํ•œ๋‹ค. ์˜ค๋ฒ„๋ผ์ด๋”ฉ์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ฉ”์†Œ๋“œ์˜ ์ด๋ฆ„์ด ๊ฐ™์•„์•ผํ•˜๊ณ , ๋ฉ”์†Œ๋“œ์˜ ๋งค๊ฐœ๋ณ€์ˆ˜ ๋ฐ์ดํ„ฐ ํƒ€์ž…๊ณผ ์ˆœ์„œ๊ฐ€ ๊ฐ™๊ณ , ๋ฉ”์†Œ๋“œ์˜ ๋ฆฌํ„ด๊ฐ’์ด ๊ฐ™์•„์•ผ ํ•œ๋‹ค. = ๋ฉ”์†Œ๋“œ์˜ ์„œ๋ช…์ด ๊ฐ™์•„์•ผ ํ•œ๋‹ค. */ class Calcurator{ int left, right; public Calcurator(int left, int right){ this.left = left; this.right = right; } public void sum(){ System.out.println(left + right); } } class Calcurator2 extends Calcurator { public Calcurator2(int left, int right){ super(left, right); } public void sum(){ System.out.println("๋‘ ์ˆ˜์˜ ํ•ฉ์€ : " + (left + right)); //์ž์‹ํด๋ž˜์Šค๋Š” ์˜ค๋ฒ„๋ผ์ด๋”ฉ์„ ํ†ตํ•ด ๊ฐ™์€ ์ด๋ฆ„์ด์ง€๋งŒ ๋‹ค๋ฅธ๊ธฐ๋Šฅ์„ ๊ฐ–๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค. } } public class OverridingDemo{ public static void main(String args[]){ Calcurator c2 = new Calcurator(50,20); c2.sum(); Calcurator2 c1 = new Calcurator2(50,20); c1.sum(); } }
1,148
0.637116
0.608747
41
19.634146
19.469496
65
false
false
0
0
0
0
0
0
0.463415
false
false
12
1b24abc86174ad320107557e4132e6a5a9d1cce1
18,837,726,627,116
1c044d4f2276b4746da3d33fce7e0563ab826028
/app/src/main/java/ie/wit/darren/actio/EventMapActivity.java
d9787f867a9ed34f951bd4ec2c2c3e7f8e2060d9
[]
no_license
dLeniston/actio-android
https://github.com/dLeniston/actio-android
568f030bc1da3a37ccabae2dbae18dfc33fe5d26
523e88d9c73a268dded6f0337b82ec3bf910d4fe
refs/heads/master
2021-01-24T02:29:42.988000
2018-04-22T21:43:36
2018-04-22T21:43:36
122,847,221
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ie.wit.darren.actio; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import java.util.ArrayList; import ie.wit.darren.actio.modules.FetchUrl; /** * Created by Dazza on 27/02/2018. */ public class EventMapActivity extends AppCompatActivity implements OnMapReadyCallback,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { //Vars private static final String TAG = "EventMap"; private static final String FINE_LOCATION = android.Manifest.permission.ACCESS_FINE_LOCATION; private static final String COURSE_LOCATION = android.Manifest.permission.ACCESS_COARSE_LOCATION; private static final int LOCATION_PERMISSION_REQUEST_CODE = 1234; private Boolean mLocationPermissionsGranted = true; public static GoogleMap eventMap; double lat = 0.0; double lng = 0.0; private double totalMeters = 0; private String event; private LatLng origin; private LatLng destination; //private FetchUrl fetchUrl = new FetchUrl(EventMapActivity.this); //Service vars ArrayList<LatLng> MarkerPoints; private GoogleApiClient mGoogleApiClient; private Location mLastLocation; Marker mCurrLocationMarker; LatLng latLng; private LocationRequest mLocationRequest; MarkerOptions markerOptionsDest = new MarkerOptions(); MarkerOptions markerOptionsOrigin = new MarkerOptions(); //Widgets private TextView distanceLeft; @Override public void onMapReady(GoogleMap googleMap) { eventMap = googleMap; //Initialize Google Play Services if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { buildGoogleApiClient(); eventMap.setMyLocationEnabled(true); } } else { buildGoogleApiClient(); eventMap.setMyLocationEnabled(true); } } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_screen); Toolbar toolbar = (Toolbar) findViewById(R.id.map_toolbar); distanceLeft = (TextView) findViewById(R.id.distance_left); setSupportActionBar(toolbar); getSupportActionBar().setTitle("Route Map"); Intent intent = getIntent(); event = intent.getStringExtra("event"); String address = intent.getStringExtra("address"); TextView routeDetails = (TextView) findViewById(R.id.route_details); String details = "Route to: " + event + "\n" + "at: " + address; routeDetails.setText(details); String sLat = intent.getStringExtra("lat"); String sLon = intent.getStringExtra("lon"); lat = Double.parseDouble(sLat); lng = Double.parseDouble(sLon); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getLocationPermission(); } // Initializing MarkerPoints = new ArrayList<>(); // Obtain the SupportMapFragment and get notified when the map is ready to be used. initMap(); } private void initMap(){ Log.d(TAG, "initMap: initializing map"); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.event_map); mapFragment.getMapAsync(EventMapActivity.this); } private void getLocationPermission(){ Log.d(TAG, "getLocationPermission: getting location permissions"); String[] permissions = {android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_COARSE_LOCATION}; if(ContextCompat.checkSelfPermission(this.getApplicationContext(), FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){ if(ContextCompat.checkSelfPermission(this.getApplicationContext(), COURSE_LOCATION) == PackageManager.PERMISSION_GRANTED){ mLocationPermissionsGranted = true; initMap(); }else{ ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE); } }else{ ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { Log.d(TAG, "onRequestPermissionsResult: called."); mLocationPermissionsGranted = false; switch(requestCode){ case LOCATION_PERMISSION_REQUEST_CODE:{ if(grantResults.length > 0){ for(int i = 0; i < grantResults.length; i++){ if(grantResults[i] != PackageManager.PERMISSION_GRANTED){ mLocationPermissionsGranted = false; Log.d(TAG, "onRequestPermissionsResult: permission failed"); return; } } Log.d(TAG, "onRequestPermissionsResult: permission granted"); mLocationPermissionsGranted = true; //initialize our map initMap(); } } } } private String getUrl(LatLng origin, LatLng dest) { // Origin of route String str_origin = "origin=" + origin.latitude + "," + origin.longitude; // Destination of route String str_dest = "destination=" + dest.latitude + "," + dest.longitude; // Sensor enabled String sensor = "sensor=false"; // Building the parameters to the web service String parameters = str_origin + "&" + str_dest + "&" + sensor; // Output format String output = "json"; // Building the url to the web service String url = "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters; return url; } protected synchronized void buildGoogleApiClient() { mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); mGoogleApiClient.connect(); } @Override public void onConnected(Bundle bundle) { mLocationRequest = LocationRequest.create(); mLocationRequest.setInterval(5000); mLocationRequest.setFastestInterval(1000); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); } } @Override public void onConnectionSuspended(int i) { } @Override public void onLocationChanged(Location location) { //Place current location marker mLastLocation = location; if (mCurrLocationMarker != null) { mCurrLocationMarker.remove(); } latLng = new LatLng(location.getLatitude(), location.getLongitude()); moveCamera(eventMap, latLng, 15f); //Get origin and destination origin = latLng; destination = new LatLng(lat, lng); float distance = getDistance(location.getLatitude(), location.getLongitude(), lat, lng); distanceLeft.setText(String.format("%.2f", (distance / 1000)) + "Km"); markerSetup(origin, destination); // Checks, whether start and end locations are captured LatLng o = MarkerPoints.get(0); LatLng d = MarkerPoints.get(1); getDirections(o, d); } private void markerSetup(LatLng o, LatLng d){ //Add new marker to the Map MarkerPoints.clear(); MarkerPoints.add(o); MarkerPoints.add(d); markerOptionsDest.position(d).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); markerOptionsDest.title(event + " - Start"); eventMap.addMarker(markerOptionsDest); } private void getDirections(LatLng o, LatLng d){ // Start downloading json data from Google Directions API String url = getUrl(o, d); FetchUrl fetchUrl = new FetchUrl(getApplicationContext()); fetchUrl.execute(url); } private void moveCamera(GoogleMap map, LatLng latLng, float zoom){ map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom)); } private float getDistance(double lat1,double lon1,double lat2,double lon2) { float[] distance = new float[2]; Location.distanceBetween( lat1, lon1, lat2, lon2, distance); return distance[0]; } @Override public void onConnectionFailed(ConnectionResult connectionResult){ Toast.makeText(getApplicationContext(), "You can't make map requests", Toast.LENGTH_SHORT).show(); } }
UTF-8
Java
10,692
java
EventMapActivity.java
Java
[ { "context": ".darren.actio.modules.FetchUrl;\n\n/**\n * Created by Dazza on 27/02/2018.\n */\n\npublic class EventMapActivity", "end": 1361, "score": 0.999286413192749, "start": 1356, "tag": "USERNAME", "value": "Dazza" } ]
null
[]
package ie.wit.darren.actio; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import java.util.ArrayList; import ie.wit.darren.actio.modules.FetchUrl; /** * Created by Dazza on 27/02/2018. */ public class EventMapActivity extends AppCompatActivity implements OnMapReadyCallback,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { //Vars private static final String TAG = "EventMap"; private static final String FINE_LOCATION = android.Manifest.permission.ACCESS_FINE_LOCATION; private static final String COURSE_LOCATION = android.Manifest.permission.ACCESS_COARSE_LOCATION; private static final int LOCATION_PERMISSION_REQUEST_CODE = 1234; private Boolean mLocationPermissionsGranted = true; public static GoogleMap eventMap; double lat = 0.0; double lng = 0.0; private double totalMeters = 0; private String event; private LatLng origin; private LatLng destination; //private FetchUrl fetchUrl = new FetchUrl(EventMapActivity.this); //Service vars ArrayList<LatLng> MarkerPoints; private GoogleApiClient mGoogleApiClient; private Location mLastLocation; Marker mCurrLocationMarker; LatLng latLng; private LocationRequest mLocationRequest; MarkerOptions markerOptionsDest = new MarkerOptions(); MarkerOptions markerOptionsOrigin = new MarkerOptions(); //Widgets private TextView distanceLeft; @Override public void onMapReady(GoogleMap googleMap) { eventMap = googleMap; //Initialize Google Play Services if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { buildGoogleApiClient(); eventMap.setMyLocationEnabled(true); } } else { buildGoogleApiClient(); eventMap.setMyLocationEnabled(true); } } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_screen); Toolbar toolbar = (Toolbar) findViewById(R.id.map_toolbar); distanceLeft = (TextView) findViewById(R.id.distance_left); setSupportActionBar(toolbar); getSupportActionBar().setTitle("Route Map"); Intent intent = getIntent(); event = intent.getStringExtra("event"); String address = intent.getStringExtra("address"); TextView routeDetails = (TextView) findViewById(R.id.route_details); String details = "Route to: " + event + "\n" + "at: " + address; routeDetails.setText(details); String sLat = intent.getStringExtra("lat"); String sLon = intent.getStringExtra("lon"); lat = Double.parseDouble(sLat); lng = Double.parseDouble(sLon); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getLocationPermission(); } // Initializing MarkerPoints = new ArrayList<>(); // Obtain the SupportMapFragment and get notified when the map is ready to be used. initMap(); } private void initMap(){ Log.d(TAG, "initMap: initializing map"); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.event_map); mapFragment.getMapAsync(EventMapActivity.this); } private void getLocationPermission(){ Log.d(TAG, "getLocationPermission: getting location permissions"); String[] permissions = {android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_COARSE_LOCATION}; if(ContextCompat.checkSelfPermission(this.getApplicationContext(), FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){ if(ContextCompat.checkSelfPermission(this.getApplicationContext(), COURSE_LOCATION) == PackageManager.PERMISSION_GRANTED){ mLocationPermissionsGranted = true; initMap(); }else{ ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE); } }else{ ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { Log.d(TAG, "onRequestPermissionsResult: called."); mLocationPermissionsGranted = false; switch(requestCode){ case LOCATION_PERMISSION_REQUEST_CODE:{ if(grantResults.length > 0){ for(int i = 0; i < grantResults.length; i++){ if(grantResults[i] != PackageManager.PERMISSION_GRANTED){ mLocationPermissionsGranted = false; Log.d(TAG, "onRequestPermissionsResult: permission failed"); return; } } Log.d(TAG, "onRequestPermissionsResult: permission granted"); mLocationPermissionsGranted = true; //initialize our map initMap(); } } } } private String getUrl(LatLng origin, LatLng dest) { // Origin of route String str_origin = "origin=" + origin.latitude + "," + origin.longitude; // Destination of route String str_dest = "destination=" + dest.latitude + "," + dest.longitude; // Sensor enabled String sensor = "sensor=false"; // Building the parameters to the web service String parameters = str_origin + "&" + str_dest + "&" + sensor; // Output format String output = "json"; // Building the url to the web service String url = "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters; return url; } protected synchronized void buildGoogleApiClient() { mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); mGoogleApiClient.connect(); } @Override public void onConnected(Bundle bundle) { mLocationRequest = LocationRequest.create(); mLocationRequest.setInterval(5000); mLocationRequest.setFastestInterval(1000); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); } } @Override public void onConnectionSuspended(int i) { } @Override public void onLocationChanged(Location location) { //Place current location marker mLastLocation = location; if (mCurrLocationMarker != null) { mCurrLocationMarker.remove(); } latLng = new LatLng(location.getLatitude(), location.getLongitude()); moveCamera(eventMap, latLng, 15f); //Get origin and destination origin = latLng; destination = new LatLng(lat, lng); float distance = getDistance(location.getLatitude(), location.getLongitude(), lat, lng); distanceLeft.setText(String.format("%.2f", (distance / 1000)) + "Km"); markerSetup(origin, destination); // Checks, whether start and end locations are captured LatLng o = MarkerPoints.get(0); LatLng d = MarkerPoints.get(1); getDirections(o, d); } private void markerSetup(LatLng o, LatLng d){ //Add new marker to the Map MarkerPoints.clear(); MarkerPoints.add(o); MarkerPoints.add(d); markerOptionsDest.position(d).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); markerOptionsDest.title(event + " - Start"); eventMap.addMarker(markerOptionsDest); } private void getDirections(LatLng o, LatLng d){ // Start downloading json data from Google Directions API String url = getUrl(o, d); FetchUrl fetchUrl = new FetchUrl(getApplicationContext()); fetchUrl.execute(url); } private void moveCamera(GoogleMap map, LatLng latLng, float zoom){ map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom)); } private float getDistance(double lat1,double lon1,double lat2,double lon2) { float[] distance = new float[2]; Location.distanceBetween( lat1, lon1, lat2, lon2, distance); return distance[0]; } @Override public void onConnectionFailed(ConnectionResult connectionResult){ Toast.makeText(getApplicationContext(), "You can't make map requests", Toast.LENGTH_SHORT).show(); } }
10,692
0.660213
0.655537
278
37.456833
27.699894
123
false
false
0
0
0
0
0
0
0.669065
false
false
12
2ee2b789d08777c8f9ff903d49cb410e94f16559
1,846,835,944,743
08dd51bf1759c5353752b51d1670e810a1a50cf2
/src/MinHeap.java
a7d768a987362ca5255024e957eb010ecff19f9e
[]
no_license
navspeak/ds
https://github.com/navspeak/ds
431f2ec7898e495da75a916fbac61493db2554fd
e22f0bfacf3377a3daa05a7356f1e4ddbed0218c
refs/heads/master
2020-12-31T07:11:42.139000
2017-08-02T11:24:08
2017-08-02T11:24:08
80,598,553
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class MinHeap<T extends Comparable> extends Heap<T> { public MinHeap(Class<T> clazz) { super(clazz); } public MinHeap(Class<T> clazz, int size ) { super(clazz, size); } // 10 // 15 20 // 17 8 <- // // 10, 15, 20, 17, 8 <- (we add 8 and sift up) @Override protected void siftup() { // Till there is a parent, and // Till till it is out of order i.e. parentIndex is greater than child int index = getCount() - 1; while(hasParent(index) && elements[getParentIndex(index)].compareTo(elements[index]) > 0 ){ swap(index, getParentIndex(index)); index = getParentIndex(index); } } // 10 (17)<- we remove this // 15 20 // 17 <- // // 10, 15, 20, 17 @Override protected void siftdown() { int index = 0; // Till it has children, we just need to check the left children while(hasLeftChild(index)){ // in array impl we will always have left and then right int smallerChildIndex = getLeftChildIndex(index); // let's assume smaller child is left if (elements[smallerChildIndex].compareTo(elements[getRightChildIndex(index)]) > 0){ smallerChildIndex = getRightChildIndex(index); } if (elements[index].compareTo(elements[smallerChildIndex]) < 0) // if element at index is smaller than children, we are done break; else { swap(index, smallerChildIndex); } index = smallerChildIndex; } } @Override public T getMin() throws Heap.HeapEmptyException { return peek(); } @Override public T getMax() throws Heap.HeapEmptyException { int firstLeafIndex = getFirstLeafIndex(); T max = elements[firstLeafIndex]; for (int i = firstLeafIndex; i < getCount(); i++){ if (max.compareTo(elements[i]) < 0) max = elements[i]; } return max; } }
UTF-8
Java
1,829
java
MinHeap.java
Java
[]
null
[]
public class MinHeap<T extends Comparable> extends Heap<T> { public MinHeap(Class<T> clazz) { super(clazz); } public MinHeap(Class<T> clazz, int size ) { super(clazz, size); } // 10 // 15 20 // 17 8 <- // // 10, 15, 20, 17, 8 <- (we add 8 and sift up) @Override protected void siftup() { // Till there is a parent, and // Till till it is out of order i.e. parentIndex is greater than child int index = getCount() - 1; while(hasParent(index) && elements[getParentIndex(index)].compareTo(elements[index]) > 0 ){ swap(index, getParentIndex(index)); index = getParentIndex(index); } } // 10 (17)<- we remove this // 15 20 // 17 <- // // 10, 15, 20, 17 @Override protected void siftdown() { int index = 0; // Till it has children, we just need to check the left children while(hasLeftChild(index)){ // in array impl we will always have left and then right int smallerChildIndex = getLeftChildIndex(index); // let's assume smaller child is left if (elements[smallerChildIndex].compareTo(elements[getRightChildIndex(index)]) > 0){ smallerChildIndex = getRightChildIndex(index); } if (elements[index].compareTo(elements[smallerChildIndex]) < 0) // if element at index is smaller than children, we are done break; else { swap(index, smallerChildIndex); } index = smallerChildIndex; } } @Override public T getMin() throws Heap.HeapEmptyException { return peek(); } @Override public T getMax() throws Heap.HeapEmptyException { int firstLeafIndex = getFirstLeafIndex(); T max = elements[firstLeafIndex]; for (int i = firstLeafIndex; i < getCount(); i++){ if (max.compareTo(elements[i]) < 0) max = elements[i]; } return max; } }
1,829
0.632039
0.608529
71
24.746479
27.383411
127
false
false
0
0
0
0
0
0
2
false
false
12
6357d3478b6044b137e84c98474a66422ca43ac6
26,723,286,531,688
00b630046f1db8dfbe18891e926df40812e4a7a2
/app/src/main/java/com/wanjian/demo/App.java
7dbd243c74be26646b7b13e0fdaa1f9276c1bcfe
[]
no_license
android-notes/watcher
https://github.com/android-notes/watcher
31909487fa72f66e36637ca6ccd1e08a931cf430
2b52d7283f770bd00ee794a9f91cf1576ff0a1f4
refs/heads/master
2019-04-07T20:39:20.256000
2017-04-21T13:48:13
2017-04-21T13:48:13
87,143,621
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wanjian.demo; import android.app.Application; import com.wanjian.watcher.Watcher; /** * Created by wanjian on 2017/4/4. */ public class App extends Application { @Override public void onCreate() { super.onCreate(); Watcher.install(this); } }
UTF-8
Java
290
java
App.java
Java
[ { "context": "rt com.wanjian.watcher.Watcher;\n\n/**\n * Created by wanjian on 2017/4/4.\n */\n\npublic class App extends Applic", "end": 122, "score": 0.9994785785675049, "start": 115, "tag": "USERNAME", "value": "wanjian" } ]
null
[]
package com.wanjian.demo; import android.app.Application; import com.wanjian.watcher.Watcher; /** * Created by wanjian on 2017/4/4. */ public class App extends Application { @Override public void onCreate() { super.onCreate(); Watcher.install(this); } }
290
0.658621
0.637931
19
14.263158
14.631768
38
false
false
0
0
0
0
0
0
0.263158
false
false
12
c910a43be0f263154ca07cffe1bcd51f54d76ab8
4,672,924,440,672
1b193782dcdb584f8e9bc8d7e73e662970ade2d4
/src/com/travel/action/DeptAction.java
da58999b5f83558b6f0adcbc2de9a74f901be67f
[]
no_license
tossgoon/travel
https://github.com/tossgoon/travel
a09f5e56640bffd33e987d7d772553685be73361
a488fac23ca3dca38df09b6fdaefeef9bddf74a5
refs/heads/master
2021-01-01T06:52:10.201000
2017-11-11T13:44:16
2017-11-11T13:44:16
97,357,009
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.travel.action; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.struts2.ServletActionContext; import org.apache.struts2.json.annotations.JSON; import com.base.MD5Util; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.page.SplitPage; import com.travel.pojo.Chicksurvey; import com.travel.pojo.Department; import com.travel.pojo.Oa; import com.travel.pojo.Oafile; import com.travel.pojo.Oareceiver; import com.travel.pojo.Portal; import com.travel.pojo.User; import com.travel.service.DeptService; import com.travel.service.OaFileService; import com.travel.service.OaReceiverService; import com.travel.service.OaService; import com.travel.service.UserService; public class DeptAction extends ActionSupport { /** * */ private static final long serialVersionUID = 2871113028472366475L; /** * */ private Department dept = new Department(); private DeptService<Department> deptService; private List<Department> deptlist; private String errormsg; public DeptAction() { } @JSON(serialize = false) protected String getParam(String key) { return ServletActionContext.getRequest().getParameter(key); } public Department getDept() { return dept; } public void setDept(Department dept) { this.dept = dept; } @JSON(serialize = false) public DeptService<Department> getDeptService() { return deptService; } public void setDeptService(DeptService<Department> deptService) { this.deptService = deptService; } public List<Department> getDeptlist() { return deptlist; } public void setDeptlist(List<Department> deptlist) { this.deptlist = deptlist; } public String getErrormsg() { return errormsg; } public void setErrormsg(String errormsg) { this.errormsg = errormsg; } public String add() { String result = ""; try { deptService.addDept(this.dept); // throw new RuntimeException(""); setErrormsg("0"); result = SUCCESS; } catch (Exception e) { // TODO: handle exception e.printStackTrace(); setErrormsg("ไฟๅญ˜ๅ‡บ้”™ใ€‚" + e.getMessage()); result = ERROR; } return result; } public String update() { try { // String param = getParam("param"); this.deptService.updateDept(dept); setErrormsg("0"); return SUCCESS; } catch (Exception e) { // TODO: handle exception setErrormsg("ๆ›ดๆ–ฐๅ‡บ้”™ใ€‚" + e.getMessage()); return ERROR; } // System.out.println(this); } public String save() { if (dept.getId() == null) { return add(); } else { return update(); } } public String delete() { try { Integer param = Integer.parseInt(getParam("id")); deptService.deleteDept(param, Department.class); setErrormsg("0"); } catch (Exception e) { e.printStackTrace(); setErrormsg("ๅˆ ้™คๅ‡บ้”™ใ€‚" + e.getMessage()); return ERROR; } return SUCCESS; } public String query() { if (getParam("id") != null) { Integer id = Integer.parseInt(getParam("id")); dept = deptService.getDept(Department.class, id); } return SUCCESS; } public String querylist(){ try { this.deptlist=this.deptService.getDeptList(Department.class); setErrormsg("0"); } catch (Exception e) { e.printStackTrace(); setErrormsg("ๅ‡บ้”™ใ€‚" + e.getMessage()); return ERROR; } return SUCCESS; } }
GB18030
Java
3,557
java
DeptAction.java
Java
[]
null
[]
package com.travel.action; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.struts2.ServletActionContext; import org.apache.struts2.json.annotations.JSON; import com.base.MD5Util; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.page.SplitPage; import com.travel.pojo.Chicksurvey; import com.travel.pojo.Department; import com.travel.pojo.Oa; import com.travel.pojo.Oafile; import com.travel.pojo.Oareceiver; import com.travel.pojo.Portal; import com.travel.pojo.User; import com.travel.service.DeptService; import com.travel.service.OaFileService; import com.travel.service.OaReceiverService; import com.travel.service.OaService; import com.travel.service.UserService; public class DeptAction extends ActionSupport { /** * */ private static final long serialVersionUID = 2871113028472366475L; /** * */ private Department dept = new Department(); private DeptService<Department> deptService; private List<Department> deptlist; private String errormsg; public DeptAction() { } @JSON(serialize = false) protected String getParam(String key) { return ServletActionContext.getRequest().getParameter(key); } public Department getDept() { return dept; } public void setDept(Department dept) { this.dept = dept; } @JSON(serialize = false) public DeptService<Department> getDeptService() { return deptService; } public void setDeptService(DeptService<Department> deptService) { this.deptService = deptService; } public List<Department> getDeptlist() { return deptlist; } public void setDeptlist(List<Department> deptlist) { this.deptlist = deptlist; } public String getErrormsg() { return errormsg; } public void setErrormsg(String errormsg) { this.errormsg = errormsg; } public String add() { String result = ""; try { deptService.addDept(this.dept); // throw new RuntimeException(""); setErrormsg("0"); result = SUCCESS; } catch (Exception e) { // TODO: handle exception e.printStackTrace(); setErrormsg("ไฟๅญ˜ๅ‡บ้”™ใ€‚" + e.getMessage()); result = ERROR; } return result; } public String update() { try { // String param = getParam("param"); this.deptService.updateDept(dept); setErrormsg("0"); return SUCCESS; } catch (Exception e) { // TODO: handle exception setErrormsg("ๆ›ดๆ–ฐๅ‡บ้”™ใ€‚" + e.getMessage()); return ERROR; } // System.out.println(this); } public String save() { if (dept.getId() == null) { return add(); } else { return update(); } } public String delete() { try { Integer param = Integer.parseInt(getParam("id")); deptService.deleteDept(param, Department.class); setErrormsg("0"); } catch (Exception e) { e.printStackTrace(); setErrormsg("ๅˆ ้™คๅ‡บ้”™ใ€‚" + e.getMessage()); return ERROR; } return SUCCESS; } public String query() { if (getParam("id") != null) { Integer id = Integer.parseInt(getParam("id")); dept = deptService.getDept(Department.class, id); } return SUCCESS; } public String querylist(){ try { this.deptlist=this.deptService.getDeptList(Department.class); setErrormsg("0"); } catch (Exception e) { e.printStackTrace(); setErrormsg("ๅ‡บ้”™ใ€‚" + e.getMessage()); return ERROR; } return SUCCESS; } }
3,557
0.675376
0.667424
154
20.876623
17.15526
67
false
false
0
0
0
0
0
0
1.792208
false
false
12
72ec3e37e76122316c0430290636caa377e778a9
10,239,202,059,150
3824931e21bde815224b8051436a4fd8e2cd4e40
/src/main/java/com/eshop/controllers/CategoryController.java
340d20f303b8b31bbe54b24572790326b2b45db4
[]
no_license
eshop-bootcamp/eshop-core
https://github.com/eshop-bootcamp/eshop-core
b9f5e7f76fdf9af5fc0159d7e793937b567bee24
38ace97cfc30912a276c407d4cb2334289fd4272
refs/heads/master
2020-06-10T03:21:58.202000
2016-12-15T11:55:21
2016-12-15T11:55:30
76,100,805
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eshop.controllers; import com.eshop.model.Category; import com.eshop.model.Item; import com.eshop.services.CategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/categories") public class CategoryController { @Autowired private CategoryService categoryService; @RequestMapping(value = "", method = RequestMethod.GET) public List<Category> getAllCategories() { return categoryService.getAllCategories(); } @RequestMapping(value = "/{categoryId}/items", method = RequestMethod.GET) public List<Item> getAllItemsByCategory(@PathVariable("categoryId") Long categoryId) { return categoryService.getItemsByCategoryId(categoryId); } }
UTF-8
Java
828
java
CategoryController.java
Java
[]
null
[]
package com.eshop.controllers; import com.eshop.model.Category; import com.eshop.model.Item; import com.eshop.services.CategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/categories") public class CategoryController { @Autowired private CategoryService categoryService; @RequestMapping(value = "", method = RequestMethod.GET) public List<Category> getAllCategories() { return categoryService.getAllCategories(); } @RequestMapping(value = "/{categoryId}/items", method = RequestMethod.GET) public List<Item> getAllItemsByCategory(@PathVariable("categoryId") Long categoryId) { return categoryService.getItemsByCategoryId(categoryId); } }
828
0.76087
0.76087
29
27.551723
26.235783
90
false
false
0
0
0
0
0
0
0.413793
false
false
12
de0efd36e07124a720d965aaa914beb9787e8883
5,866,925,349,350
7f7019bdbc662e51f3ecdbb74bde529b4375a14d
/tests/src/de/pifpafpuf/contdis/BasicTests.java
033a5870199ee5cc361a51c29892895453fa1038
[ "Apache-2.0" ]
permissive
HaraldKi/contdis
https://github.com/HaraldKi/contdis
28e5306c5ee17debd0af84512d2a39f99d804492
dc374dec57ca80f8c31d7b1637620dd22dce7f6c
refs/heads/master
2020-12-05T05:41:35.297000
2016-09-15T05:54:49
2016-09-15T05:54:49
67,421,071
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.pifpafpuf.contdis; import org.junit.Test; public class BasicTests { @Test(timeout=2000) public void serverStartStopTest() throws Exception { Server s = Server.create(31125, 1); Thread.sleep(900); s.shutdown(); } }
UTF-8
Java
247
java
BasicTests.java
Java
[]
null
[]
package de.pifpafpuf.contdis; import org.junit.Test; public class BasicTests { @Test(timeout=2000) public void serverStartStopTest() throws Exception { Server s = Server.create(31125, 1); Thread.sleep(900); s.shutdown(); } }
247
0.692308
0.639676
14
16.642857
16.329672
54
false
false
0
0
0
0
0
0
0.428571
false
false
12
8e97a51a3368e814465766bce2dec48b750730cc
8,134,668,080,286
c009d2527bff210ca36e492c9f97db2fd50770ed
/swallow-test/src/main/java/com/dianping/swallow/test/cat/CatTest.java
71c764af7d81679691dac2aff90ca476e2817d34
[]
no_license
zjpjohn/dianping-swallow
https://github.com/zjpjohn/dianping-swallow
dd04670bff0e1cb3f942dae64047a8898cd00cf8
5865dbd058b3fb49e8cf6725488804e5099b19f1
refs/heads/master
2021-01-22T08:53:10.282000
2016-05-23T09:09:53
2016-05-23T09:09:53
66,056,694
1
0
null
true
2016-08-19T05:58:22
2016-08-19T05:58:22
2016-05-27T03:34:47
2016-05-27T03:34:42
50,454
0
0
0
null
null
null
package com.dianping.swallow.test.cat; import java.util.Date; import java.util.concurrent.TimeUnit; import org.junit.Test; import com.dianping.cat.Cat; import com.dianping.cat.message.Transaction; import com.dianping.swallow.common.internal.exception.SwallowAlertException; import com.dianping.swallow.test.AbstractUnitTest; /** * @author mengwenchao * * 2015ๅนด3ๆœˆ20ๆ—ฅ ไธ‹ๅˆ3:45:01 */ public class CatTest extends AbstractUnitTest{ @Test public void testArray(){ Long []data = new Long[5]; for(Long i : data){ System.out.println(i); } } @Test public void testTransaction(){ for(int i=0;i<100;i++){ Transaction t = Cat.newTransaction("test", "test"); try{ if((i&1) == 0){ t.setStatus(Transaction.SUCCESS); }else{ t.setStatus(new Exception("man made exception!!")); } }finally{ t.complete(); } sleep(1); } } @Test public void testGetTime(){ long date = 6130108015858157738L; System.out.println(new Date((date >> 32) *1000)); } @Test public void testException() throws InterruptedException{ for(int i=0; i < 5;i++){ logger.error("message", new SwallowAlertException("exception message")); TimeUnit.SECONDS.sleep(1); } } }
UTF-8
Java
1,237
java
CatTest.java
Java
[ { "context": "ing.swallow.test.AbstractUnitTest;\n\n/**\n * @author mengwenchao\n *\n * 2015ๅนด3ๆœˆ20ๆ—ฅ ไธ‹ๅˆ3:45:01\n */\npublic class CatTe", "end": 355, "score": 0.999070405960083, "start": 344, "tag": "USERNAME", "value": "mengwenchao" } ]
null
[]
package com.dianping.swallow.test.cat; import java.util.Date; import java.util.concurrent.TimeUnit; import org.junit.Test; import com.dianping.cat.Cat; import com.dianping.cat.message.Transaction; import com.dianping.swallow.common.internal.exception.SwallowAlertException; import com.dianping.swallow.test.AbstractUnitTest; /** * @author mengwenchao * * 2015ๅนด3ๆœˆ20ๆ—ฅ ไธ‹ๅˆ3:45:01 */ public class CatTest extends AbstractUnitTest{ @Test public void testArray(){ Long []data = new Long[5]; for(Long i : data){ System.out.println(i); } } @Test public void testTransaction(){ for(int i=0;i<100;i++){ Transaction t = Cat.newTransaction("test", "test"); try{ if((i&1) == 0){ t.setStatus(Transaction.SUCCESS); }else{ t.setStatus(new Exception("man made exception!!")); } }finally{ t.complete(); } sleep(1); } } @Test public void testGetTime(){ long date = 6130108015858157738L; System.out.println(new Date((date >> 32) *1000)); } @Test public void testException() throws InterruptedException{ for(int i=0; i < 5;i++){ logger.error("message", new SwallowAlertException("exception message")); TimeUnit.SECONDS.sleep(1); } } }
1,237
0.671557
0.632437
64
18.171875
19.624247
76
false
false
0
0
0
0
0
0
1.890625
false
false
12
791c0e2a0b64203488956eb0d73c41675d5dcdae
240,518,189,578
97f34059353000a7358e3e8c9d4d7d4ccea614d7
/mobile-android-gradle2/LaunchActivity/src/main/java/org/exoplatform/model/SocialCommentInfo.java
aee38da0908b496f732634a7f3525d6c819fd072
[]
no_license
phamtuanchip/first-class
https://github.com/phamtuanchip/first-class
3e27b3c5daf397ddba3015a52dfe6347967c2dcd
82cb9dc0b1111bace94fa091f743808c48f740e6
refs/heads/master
2020-03-28T05:26:36.121000
2017-02-09T07:38:12
2017-02-09T07:38:12
7,457,892
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.exoplatform.model; public class SocialCommentInfo { private String commentImageUrl; private String commentId; private String commentName; private String commentTitle; private long postedTime; public SocialCommentInfo() { } public void setImageUrl(String url) { commentImageUrl = url; } public String getImageUrl() { return commentImageUrl; } public void setCommentId(String id) { commentId = id; } public String getCommentId() { return commentId; } public void setCommentName(String name) { commentName = name; } public String getCommentName() { return commentName; } public void setCommentTitle(String title) { commentTitle = title; } public String getCommentTitle() { return commentTitle; } public void setPostedTime(long time) { postedTime = time; } public long getPostedTime() { return postedTime; } }
UTF-8
Java
933
java
SocialCommentInfo.java
Java
[]
null
[]
package org.exoplatform.model; public class SocialCommentInfo { private String commentImageUrl; private String commentId; private String commentName; private String commentTitle; private long postedTime; public SocialCommentInfo() { } public void setImageUrl(String url) { commentImageUrl = url; } public String getImageUrl() { return commentImageUrl; } public void setCommentId(String id) { commentId = id; } public String getCommentId() { return commentId; } public void setCommentName(String name) { commentName = name; } public String getCommentName() { return commentName; } public void setCommentTitle(String title) { commentTitle = title; } public String getCommentTitle() { return commentTitle; } public void setPostedTime(long time) { postedTime = time; } public long getPostedTime() { return postedTime; } }
933
0.689175
0.689175
59
14.81356
15.180802
45
false
false
0
0
0
0
0
0
0.271186
false
false
12
b384de1f41cdeb8839f6aa08bde538e7c636ef12
16,088,947,517,738
401f13e50d46627d0d0625aa44ff2827eef9495d
/eclipse/plugins/org.switchyard.tools.models.switchyard1_0/src/org/switchyard/tools/models/switchyard1_0/camel/CamelNettyTcpBindingType.java
dff65baab06db75a1835bbfec62bcb847d3de790
[]
no_license
punkhorn/tools
https://github.com/punkhorn/tools
6f646da3e39dcf9383ca6c6aed7bfee07cfddbe8
32acd56bf2d536e1dcdfe9bcd0c3379d7c982c96
refs/heads/master
2021-01-16T17:50:50.458000
2012-09-25T22:11:00
2012-09-26T03:06:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * <copyright> * </copyright> * * $Id$ */ package org.switchyard.tools.models.switchyard1_0.camel; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Netty Tcp Binding Type</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTextline <em>Textline</em>}</li> * <li>{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTcpNoDelay <em>Tcp No Delay</em>}</li> * <li>{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#isKeepAlive <em>Keep Alive</em>}</li> * </ul> * </p> * * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType() * @model extendedMetaData="name='CamelNettyTcpBindingType' kind='elementOnly'" * @generated */ public interface CamelNettyTcpBindingType extends CamelNettyBindingType { /** * Returns the value of the '<em><b>Textline</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Textline</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Textline</em>' attribute. * @see #setTextline(Boolean) * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType_Textline() * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject" * extendedMetaData="kind='element' name='textline' namespace='##targetNamespace'" * @generated */ Boolean getTextline(); /** * Sets the value of the '{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTextline <em>Textline</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Textline</em>' attribute. * @see #getTextline() * @generated */ void setTextline(Boolean value); /** * Returns the value of the '<em><b>Tcp No Delay</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Tcp No Delay</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Tcp No Delay</em>' attribute. * @see #setTcpNoDelay(Boolean) * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType_TcpNoDelay() * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject" * extendedMetaData="kind='element' name='tcpNoDelay' namespace='##targetNamespace'" * @generated */ Boolean getTcpNoDelay(); /** * Sets the value of the '{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTcpNoDelay <em>Tcp No Delay</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Tcp No Delay</em>' attribute. * @see #getTcpNoDelay() * @generated */ void setTcpNoDelay(Boolean value); /** * Returns the value of the '<em><b>Keep Alive</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Keep Alive</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Keep Alive</em>' attribute. * @see #setKeepAlive(boolean) * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType_KeepAlive() * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean" * extendedMetaData="kind='element' name='keepAlive' namespace='##targetNamespace'" * @generated */ boolean isKeepAlive(); /** * Sets the value of the '{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#isKeepAlive <em>Keep Alive</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Keep Alive</em>' attribute. * @see #isKeepAlive() * @generated */ void setKeepAlive(boolean value); } // CamelNettyTcpBindingType
UTF-8
Java
4,364
java
CamelNettyTcpBindingType.java
Java
[]
null
[]
/** * <copyright> * </copyright> * * $Id$ */ package org.switchyard.tools.models.switchyard1_0.camel; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Netty Tcp Binding Type</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTextline <em>Textline</em>}</li> * <li>{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTcpNoDelay <em>Tcp No Delay</em>}</li> * <li>{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#isKeepAlive <em>Keep Alive</em>}</li> * </ul> * </p> * * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType() * @model extendedMetaData="name='CamelNettyTcpBindingType' kind='elementOnly'" * @generated */ public interface CamelNettyTcpBindingType extends CamelNettyBindingType { /** * Returns the value of the '<em><b>Textline</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Textline</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Textline</em>' attribute. * @see #setTextline(Boolean) * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType_Textline() * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject" * extendedMetaData="kind='element' name='textline' namespace='##targetNamespace'" * @generated */ Boolean getTextline(); /** * Sets the value of the '{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTextline <em>Textline</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Textline</em>' attribute. * @see #getTextline() * @generated */ void setTextline(Boolean value); /** * Returns the value of the '<em><b>Tcp No Delay</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Tcp No Delay</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Tcp No Delay</em>' attribute. * @see #setTcpNoDelay(Boolean) * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType_TcpNoDelay() * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject" * extendedMetaData="kind='element' name='tcpNoDelay' namespace='##targetNamespace'" * @generated */ Boolean getTcpNoDelay(); /** * Sets the value of the '{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#getTcpNoDelay <em>Tcp No Delay</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Tcp No Delay</em>' attribute. * @see #getTcpNoDelay() * @generated */ void setTcpNoDelay(Boolean value); /** * Returns the value of the '<em><b>Keep Alive</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Keep Alive</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Keep Alive</em>' attribute. * @see #setKeepAlive(boolean) * @see org.switchyard.tools.models.switchyard1_0.camel.CamelPackage#getCamelNettyTcpBindingType_KeepAlive() * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean" * extendedMetaData="kind='element' name='keepAlive' namespace='##targetNamespace'" * @generated */ boolean isKeepAlive(); /** * Sets the value of the '{@link org.switchyard.tools.models.switchyard1_0.camel.CamelNettyTcpBindingType#isKeepAlive <em>Keep Alive</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Keep Alive</em>' attribute. * @see #isKeepAlive() * @generated */ void setKeepAlive(boolean value); } // CamelNettyTcpBindingType
4,364
0.642988
0.637947
110
38.672726
38.530533
158
false
false
0
0
0
0
0
0
0.090909
false
false
12
19a2a76f22441b2f540341480f6ccef6363a9113
16,973,710,778,047
80fd8818b0b4e006de77663d22a07d461c7e6021
/tree/LowestCommonAncestorofaBinaryTree.java
756d99e5888fe40842cc73d8b12ede1082980716
[]
no_license
harrykjg/leetcode
https://github.com/harrykjg/leetcode
61d38e4123ef50c7f84885b9f0b8225a1fa01390
c773b7dc2408e54165c4e07f2a589da06a198104
refs/heads/master
2021-11-07T20:56:51.347000
2021-10-22T23:56:47
2021-10-22T23:56:47
87,669,706
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package tree; /** * Created by yufengzhu on 7/23/18. */ public class LowestCommonAncestorofaBinaryTree { //่ฎฐๅพ— public TreeNode lowestCommonAncestor(TreeNode root, TreeNode A, TreeNode B) { if(root==null){ return null; } if(root==A||root==B){ return root; } TreeNode left=lowestCommonAncestor(root.left,A,B); TreeNode right=lowestCommonAncestor(root.right,A,B); if(left!=null&&right!=null){ return root; } return left==null?right:left; } //04/15/2020,ๅ†™็š„ไธๅฅฝ๏ผŒ่ฆ็ปƒ //https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/discuss/64954/My-Java-Solution ่ฟ™ไธช็”จๅˆฐไบ†bst็š„ๆ€ง่ดจ public TreeNode lowestCommonAncestor2(TreeNode root, TreeNode A, TreeNode B) { if (root==null){ return null; } if(root==A||root==B){//่ฟ™ๆ˜ฏ้”™็š„๏ผŒ็œ‹ๅˆซไบบ็š„็ญ”ๆกˆ return root; } TreeNode left=lowestCommonAncestor(root.left,A,B); TreeNode right=lowestCommonAncestor(root.right,A,B); if(left!=null&&right!=null){ return root; } if(left!=null){ return left; } return right; } //6/1/2021,BalancedBinaryTreeๅฏๅ‘๏ผŒ่ฟ™ๆ ทๆ˜ฏn2ๅคๆ‚ๅบฆ๏ผŒๆ˜ฏtop down๏ผŒไธ‹้ขๅ†™bottom up็š„ public TreeNode lowestCommonAncestor3(TreeNode root, TreeNode A, TreeNode B) { if(root==null){ return root; } if(root.val==A.val||root.val==B.val){ return root; } if(exist(root.left,A)&&exist(root.right,B)){ return root; } if(exist(root.right,A)&&exist(root.left,B)){ return root; } TreeNode n1=lowestCommonAncestor3(root.left,A,B); if(n1!=null){ return n1; } return lowestCommonAncestor3(root.right,A,B); } boolean exist(TreeNode root, TreeNode target){ if(root==null){ return false; } if(root.val==target.val){ return true; } if(root.val>target.val){ return exist(root.left,target); } return exist(root.right,target); } //ไธ‹้ขๅ†™bottom up็š„็š„๏ผŒๆณจๆ„ไป–็š„dfs้ƒจๅˆ†ๆ˜ฏๆ”พๅœจไธญ้—ด่ฎก็ฎ—ๅ‡บleft/right็š„ๆ—ถๅ€™่ฟ›่กŒ็š„๏ผŒ็„ถๅŽไธไผšๅ†้€’ๅฝ’่ฐƒ็”จlowestCommonAncestor4็š„๏ผŒBalancedBinaryTreeไนŸๆ˜ฏ่ฟ™ๆ ท๏ผŒๅณ็ป“ๅฐพreturn้‚ฃ้‡Œไธไผšๅ†้€’ๅฝ’ไบ† public TreeNode lowestCommonAncestor4(TreeNode root, TreeNode A, TreeNode B) { if(root==null){ return root; } if(root==A||root==B){ return root; } TreeNode left=lowestCommonAncestor4(root.left,A,B); TreeNode right=lowestCommonAncestor4(root.right,A,B); if(left!=null&&right!=null){ return root; } if(left!=null){ return left; } return right; } //7/16/2021ใ€‚่ฟ™ๆ ทๅ†™ๆ‰ๆ˜ฏๅˆฉ็”จไบ†bst็š„ๆ€ง่ดจ๏ผŒ้ข˜็›ฎ่ฏดไบ†่‚ฏๅฎšๆœ‰็ญ”ๆกˆใ€‚ๆ”นไบ†ไธ€ๆฌก่ฟ‡ไบ†ใ€‚ไปฅๅ‰ไธŠ้ขๅ†™็š„ๅบ”่ฏฅๆ˜ฏ้€‚็”จไบŽๆ™ฎ้€šไบŒๅ‰ๆ ‘็š„่งฃๆณ• public TreeNode lowestCommonAncestor5(TreeNode root, TreeNode A, TreeNode B) { if (root==null){ return null; } if (root.val==A.val||root.val==B.val){ return root; } if (root.val>A.val&&root.val<B.val){ return root; } if (root.val>B.val&&root.val<A.val){//ๅผ€ๅง‹ๆผไบ†่€ƒ่™‘A B่ฐๅคง่ฐๅฐ็š„ๆƒ…ๅ†ต return root; } if (root.val>A.val&&root.val>B.val){ return lowestCommonAncestor5(root.left,A,B); }else{ return lowestCommonAncestor5(root.right,A,B); } } }
UTF-8
Java
3,765
java
LowestCommonAncestorofaBinaryTree.java
Java
[ { "context": "package tree;\n\n/**\n * Created by yufengzhu on 7/23/18.\n */\npublic class LowestCommonAncestor", "end": 42, "score": 0.8506988286972046, "start": 33, "tag": "USERNAME", "value": "yufengzhu" } ]
null
[]
package tree; /** * Created by yufengzhu on 7/23/18. */ public class LowestCommonAncestorofaBinaryTree { //่ฎฐๅพ— public TreeNode lowestCommonAncestor(TreeNode root, TreeNode A, TreeNode B) { if(root==null){ return null; } if(root==A||root==B){ return root; } TreeNode left=lowestCommonAncestor(root.left,A,B); TreeNode right=lowestCommonAncestor(root.right,A,B); if(left!=null&&right!=null){ return root; } return left==null?right:left; } //04/15/2020,ๅ†™็š„ไธๅฅฝ๏ผŒ่ฆ็ปƒ //https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/discuss/64954/My-Java-Solution ่ฟ™ไธช็”จๅˆฐไบ†bst็š„ๆ€ง่ดจ public TreeNode lowestCommonAncestor2(TreeNode root, TreeNode A, TreeNode B) { if (root==null){ return null; } if(root==A||root==B){//่ฟ™ๆ˜ฏ้”™็š„๏ผŒ็œ‹ๅˆซไบบ็š„็ญ”ๆกˆ return root; } TreeNode left=lowestCommonAncestor(root.left,A,B); TreeNode right=lowestCommonAncestor(root.right,A,B); if(left!=null&&right!=null){ return root; } if(left!=null){ return left; } return right; } //6/1/2021,BalancedBinaryTreeๅฏๅ‘๏ผŒ่ฟ™ๆ ทๆ˜ฏn2ๅคๆ‚ๅบฆ๏ผŒๆ˜ฏtop down๏ผŒไธ‹้ขๅ†™bottom up็š„ public TreeNode lowestCommonAncestor3(TreeNode root, TreeNode A, TreeNode B) { if(root==null){ return root; } if(root.val==A.val||root.val==B.val){ return root; } if(exist(root.left,A)&&exist(root.right,B)){ return root; } if(exist(root.right,A)&&exist(root.left,B)){ return root; } TreeNode n1=lowestCommonAncestor3(root.left,A,B); if(n1!=null){ return n1; } return lowestCommonAncestor3(root.right,A,B); } boolean exist(TreeNode root, TreeNode target){ if(root==null){ return false; } if(root.val==target.val){ return true; } if(root.val>target.val){ return exist(root.left,target); } return exist(root.right,target); } //ไธ‹้ขๅ†™bottom up็š„็š„๏ผŒๆณจๆ„ไป–็š„dfs้ƒจๅˆ†ๆ˜ฏๆ”พๅœจไธญ้—ด่ฎก็ฎ—ๅ‡บleft/right็š„ๆ—ถๅ€™่ฟ›่กŒ็š„๏ผŒ็„ถๅŽไธไผšๅ†้€’ๅฝ’่ฐƒ็”จlowestCommonAncestor4็š„๏ผŒBalancedBinaryTreeไนŸๆ˜ฏ่ฟ™ๆ ท๏ผŒๅณ็ป“ๅฐพreturn้‚ฃ้‡Œไธไผšๅ†้€’ๅฝ’ไบ† public TreeNode lowestCommonAncestor4(TreeNode root, TreeNode A, TreeNode B) { if(root==null){ return root; } if(root==A||root==B){ return root; } TreeNode left=lowestCommonAncestor4(root.left,A,B); TreeNode right=lowestCommonAncestor4(root.right,A,B); if(left!=null&&right!=null){ return root; } if(left!=null){ return left; } return right; } //7/16/2021ใ€‚่ฟ™ๆ ทๅ†™ๆ‰ๆ˜ฏๅˆฉ็”จไบ†bst็š„ๆ€ง่ดจ๏ผŒ้ข˜็›ฎ่ฏดไบ†่‚ฏๅฎšๆœ‰็ญ”ๆกˆใ€‚ๆ”นไบ†ไธ€ๆฌก่ฟ‡ไบ†ใ€‚ไปฅๅ‰ไธŠ้ขๅ†™็š„ๅบ”่ฏฅๆ˜ฏ้€‚็”จไบŽๆ™ฎ้€šไบŒๅ‰ๆ ‘็š„่งฃๆณ• public TreeNode lowestCommonAncestor5(TreeNode root, TreeNode A, TreeNode B) { if (root==null){ return null; } if (root.val==A.val||root.val==B.val){ return root; } if (root.val>A.val&&root.val<B.val){ return root; } if (root.val>B.val&&root.val<A.val){//ๅผ€ๅง‹ๆผไบ†่€ƒ่™‘A B่ฐๅคง่ฐๅฐ็š„ๆƒ…ๅ†ต return root; } if (root.val>A.val&&root.val>B.val){ return lowestCommonAncestor5(root.left,A,B); }else{ return lowestCommonAncestor5(root.right,A,B); } } }
3,765
0.563462
0.550102
116
28.681034
24.633381
125
false
false
0
0
0
0
0
0
0.75
false
false
12
d0c3648ba672c40f273a9440b997fcd56d0c3de2
14,130,442,431,173
c1e81f96632a6e966e4a9ad55d906c982bf50afd
/RecyclerDemoRepeat/app/src/main/java/xyz/gitsieg/recyclerdemorepeat/Kommune.java
ae952309a3bb0a53285e2e01c0fce0d3c7b38fba
[]
no_license
gitsieg/androidstudioprojects
https://github.com/gitsieg/androidstudioprojects
f1492b39f9b703087a481737127cf2b47dc03f01
893fd1629ebd1eaff16b37db98fff0f38e6c07fc
refs/heads/master
2021-04-30T05:39:16.758000
2018-02-13T18:53:23
2018-02-13T18:53:23
121,421,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package xyz.gitsieg.recyclerdemorepeat; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; /** * Created by gitsieg on 07.02.18. */ public class Kommune { int kommunenr, befolkning; double areal; String kommuneNavn, fylke, ordforer; public Kommune(int kommunenr, int befolkning, double areal, String kommuneNavn, String fylke, String ordforer) { this.kommunenr = kommunenr; this.befolkning = befolkning; this.areal = areal; this.kommuneNavn = kommuneNavn; this.fylke = fylke; this.ordforer = ordforer; } public Kommune(JSONObject jsonKommune) { this.kommunenr = jsonKommune.optInt("Kommunenr", -1); this.befolkning = jsonKommune.optInt("Folketall", -1); this.areal = jsonKommune.optDouble("Areal", -1); this.kommuneNavn = jsonKommune.optString("Kommunenavn", "Ukjent"); this.fylke = jsonKommune.optString("Fylke", "Ukjent"); this.ordforer = jsonKommune.optString("Ordfรธrer", "Ukjent"); } protected static ArrayList<Kommune> createKommuneData(String jsonKommuner) throws JSONException { ArrayList<Kommune> kommuneliste = new ArrayList<>(); JSONObject obj = new JSONObject(jsonKommuner); JSONArray jsonKommuneArray = obj.getJSONArray("kommuner"); for (int i = 0; i < jsonKommuneArray.length(); i++) { JSONObject jsonKommune = jsonKommuneArray.getJSONObject(i); Kommune kommune = new Kommune(jsonKommune); kommuneliste.add(kommune); } return kommuneliste; } }
UTF-8
Java
1,648
java
Kommune.java
Java
[ { "context": "t;\n\nimport java.util.ArrayList;\n\n/**\n * Created by gitsieg on 07.02.18.\n */\n\npublic class Kommune {\n int ", "end": 182, "score": 0.9996716976165771, "start": 175, "tag": "USERNAME", "value": "gitsieg" } ]
null
[]
package xyz.gitsieg.recyclerdemorepeat; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; /** * Created by gitsieg on 07.02.18. */ public class Kommune { int kommunenr, befolkning; double areal; String kommuneNavn, fylke, ordforer; public Kommune(int kommunenr, int befolkning, double areal, String kommuneNavn, String fylke, String ordforer) { this.kommunenr = kommunenr; this.befolkning = befolkning; this.areal = areal; this.kommuneNavn = kommuneNavn; this.fylke = fylke; this.ordforer = ordforer; } public Kommune(JSONObject jsonKommune) { this.kommunenr = jsonKommune.optInt("Kommunenr", -1); this.befolkning = jsonKommune.optInt("Folketall", -1); this.areal = jsonKommune.optDouble("Areal", -1); this.kommuneNavn = jsonKommune.optString("Kommunenavn", "Ukjent"); this.fylke = jsonKommune.optString("Fylke", "Ukjent"); this.ordforer = jsonKommune.optString("Ordfรธrer", "Ukjent"); } protected static ArrayList<Kommune> createKommuneData(String jsonKommuner) throws JSONException { ArrayList<Kommune> kommuneliste = new ArrayList<>(); JSONObject obj = new JSONObject(jsonKommuner); JSONArray jsonKommuneArray = obj.getJSONArray("kommuner"); for (int i = 0; i < jsonKommuneArray.length(); i++) { JSONObject jsonKommune = jsonKommuneArray.getJSONObject(i); Kommune kommune = new Kommune(jsonKommune); kommuneliste.add(kommune); } return kommuneliste; } }
1,648
0.669095
0.663024
49
32.612244
28.151062
116
false
false
0
0
0
0
0
0
0.877551
false
false
12
f8649ad6797861f28aa0092487792b1fb0a4c5c7
4,887,672,810,949
1410ed59beeb2436ddc263e1d7b486342174772b
/src/main/java/at/w0mb/jQuery/fileUpload/AbstractFileupload.java
0b7aac666fa1ba5a6a534d344bb832c69dcbfd1d
[]
no_license
bonsagg/yabby
https://github.com/bonsagg/yabby
8a14e50013e0899490cd0c5162526646c128d86e
f08a118c756318e2d73eb0b9d365354e1ce882b1
refs/heads/master
2016-09-05T17:02:58.655000
2012-07-06T08:24:09
2012-07-06T08:24:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.w0mb.jQuery.fileUpload; import java.io.IOException; import java.net.URISyntaxException; import java.util.List; import java.util.UUID; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import at.w0mb.jQuery.fileUpload.domain.iFile; import at.w0mb.jQuery.fileUpload.domain.iFileMeta; import com.google.common.collect.Lists; public abstract class AbstractFileupload implements FileUpload { @Override @DELETE @Path("/{uuid}") public Response delete(@Context HttpServletRequest req, @PathParam("uuid") String uuid) { Status status; if (remove(uuid)) { status = Status.OK; } else { status = Status.NOT_FOUND; } return Response.status(status).build(); } @Override @GET public Response get(@Context HttpServletRequest req) { GenericEntity<List<iFileMeta>> entity = new GenericEntity<List<iFileMeta>>(getFileMetas()) {}; return Response.ok(entity).build(); } protected abstract String getCallbackUrl(); @Override @GET @Path("/url") public Response getCallbackUrl(@Context HttpServletRequest req) { // return Response.ok(new FileUrl(getCallbackUrl())).build(); return Response.ok().build(); } protected abstract iFile getFileByUuid(String uuid); protected abstract List<iFileMeta> getFileMetas(); public String getFileUrl(String randomUUIDString) { return getCallbackUrl() + "/"+ randomUUIDString; } @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void post(@Context HttpServletRequest req, @Context HttpServletResponse res) throws IOException, URISyntaxException, ServletException, FileUploadException { UUID uuid = UUID.randomUUID(); String randomUUIDString = uuid.toString(); FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List<?> items = upload.parseRequest(req); // Process the uploaded items for (Object item1 : items) { FileItem item = (FileItem) item1; iFileMeta meta = createFileMeta(item.getName(), item.getSize(), getFileUrl(randomUUIDString), item.getContentType()); iFile file = createFile(item.get(), randomUUIDString, meta); save(file); } res.sendRedirect(getCallbackUrl() + "/" + randomUUIDString + "/meta"); } protected abstract iFileMeta createFileMeta(String name, long size, String url, String contentType); protected abstract iFile createFile(byte[] data, String uuid, iFileMeta meta); @Override @GET @Path("/{uuid}/meta") public Response redirect(@Context HttpServletRequest req, @PathParam("uuid") String uuid) throws IOException { iFile file = getFileByUuid(uuid); if (file != null) { iFileMeta meta = file.getMeta(); List<iFileMeta> metas = Lists.newArrayList(meta); GenericEntity<List<iFileMeta>> entity = new GenericEntity<List<iFileMeta>>(metas) { }; return Response.ok(entity).build(); } else { return Response.status(Status.NOT_FOUND).build(); } } protected abstract boolean remove(String uuid); protected abstract void save(iFile file); @Override @GET @Path("/{uuid}") public Response serve(@PathParam("uuid") String uuid, @Context HttpServletResponse response) throws IOException { iFile file = getFileByUuid(uuid); return Response.ok(file.getData(), file.getMeta().getContentType()).header("Content-Disposition", "attachment; filename=" + file.getMeta().getName()).build(); } }
UTF-8
Java
4,201
java
AbstractFileupload.java
Java
[]
null
[]
package at.w0mb.jQuery.fileUpload; import java.io.IOException; import java.net.URISyntaxException; import java.util.List; import java.util.UUID; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import at.w0mb.jQuery.fileUpload.domain.iFile; import at.w0mb.jQuery.fileUpload.domain.iFileMeta; import com.google.common.collect.Lists; public abstract class AbstractFileupload implements FileUpload { @Override @DELETE @Path("/{uuid}") public Response delete(@Context HttpServletRequest req, @PathParam("uuid") String uuid) { Status status; if (remove(uuid)) { status = Status.OK; } else { status = Status.NOT_FOUND; } return Response.status(status).build(); } @Override @GET public Response get(@Context HttpServletRequest req) { GenericEntity<List<iFileMeta>> entity = new GenericEntity<List<iFileMeta>>(getFileMetas()) {}; return Response.ok(entity).build(); } protected abstract String getCallbackUrl(); @Override @GET @Path("/url") public Response getCallbackUrl(@Context HttpServletRequest req) { // return Response.ok(new FileUrl(getCallbackUrl())).build(); return Response.ok().build(); } protected abstract iFile getFileByUuid(String uuid); protected abstract List<iFileMeta> getFileMetas(); public String getFileUrl(String randomUUIDString) { return getCallbackUrl() + "/"+ randomUUIDString; } @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void post(@Context HttpServletRequest req, @Context HttpServletResponse res) throws IOException, URISyntaxException, ServletException, FileUploadException { UUID uuid = UUID.randomUUID(); String randomUUIDString = uuid.toString(); FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List<?> items = upload.parseRequest(req); // Process the uploaded items for (Object item1 : items) { FileItem item = (FileItem) item1; iFileMeta meta = createFileMeta(item.getName(), item.getSize(), getFileUrl(randomUUIDString), item.getContentType()); iFile file = createFile(item.get(), randomUUIDString, meta); save(file); } res.sendRedirect(getCallbackUrl() + "/" + randomUUIDString + "/meta"); } protected abstract iFileMeta createFileMeta(String name, long size, String url, String contentType); protected abstract iFile createFile(byte[] data, String uuid, iFileMeta meta); @Override @GET @Path("/{uuid}/meta") public Response redirect(@Context HttpServletRequest req, @PathParam("uuid") String uuid) throws IOException { iFile file = getFileByUuid(uuid); if (file != null) { iFileMeta meta = file.getMeta(); List<iFileMeta> metas = Lists.newArrayList(meta); GenericEntity<List<iFileMeta>> entity = new GenericEntity<List<iFileMeta>>(metas) { }; return Response.ok(entity).build(); } else { return Response.status(Status.NOT_FOUND).build(); } } protected abstract boolean remove(String uuid); protected abstract void save(iFile file); @Override @GET @Path("/{uuid}") public Response serve(@PathParam("uuid") String uuid, @Context HttpServletResponse response) throws IOException { iFile file = getFileByUuid(uuid); return Response.ok(file.getData(), file.getMeta().getContentType()).header("Content-Disposition", "attachment; filename=" + file.getMeta().getName()).build(); } }
4,201
0.729588
0.728398
135
30.125925
31.995701
167
false
false
0
0
0
0
0
0
0.874074
false
false
12
9eb377e5978a1791b22f134ee3824fa6b240ff5e
15,805,479,675,947
002840225bff1584464e81e114c754dd5e7c25b7
/TSQTester2.java
68943209169d3296b5e9f42996cc6a0053de9959
[]
no_license
IQ01660/datastructures
https://github.com/IQ01660/datastructures
684d55ac566a49e023899dcb09a7e7fe5de7791a
655cbddc4f46f2c51ee4c67a48da4055229f7dd7
refs/heads/master
2022-10-16T05:29:03.280000
2020-06-15T12:20:28
2020-06-15T12:20:28
272,420,641
0
0
null
true
2020-06-15T11:29:04
2020-06-15T11:29:03
2020-06-15T11:26:50
2020-06-15T11:26:47
0
0
0
0
null
false
false
public class TSQTester2{ public static void main(String[] args) { TwoStackQueue<String> testQueue = new TwoStackQueue<String>(); testQueue.enqueue("Roses"); System.out.println(testQueue.dequeue()); testQueue.enqueue("Peonies"); testQueue.enqueue("Daisies"); testQueue.enqueue("Chrysanthemums"); testQueue.enqueue("Dandelions"); while(!testQueue.isEmpty()) { System.out.println(testQueue.dequeue()); } System.out.println(testQueue.size()); System.out.println(testQueue.dequeue()); testQueue.enqueue("Sunflowers"); System.out.println(testQueue.dequeue()); } }
UTF-8
Java
685
java
TSQTester2.java
Java
[ { "context": "StackQueue<String>();\n\n testQueue.enqueue(\"Roses\");\n System.out.println(testQueue.dequeue()", "end": 176, "score": 0.9998180866241455, "start": 171, "tag": "NAME", "value": "Roses" }, { "context": "(testQueue.dequeue());\n testQueue.enqueue(\"Peonies\");\n testQueue.enqueue(\"Daisies\");\n ", "end": 263, "score": 0.9998165965080261, "start": 256, "tag": "NAME", "value": "Peonies" }, { "context": "ue.enqueue(\"Peonies\");\n testQueue.enqueue(\"Daisies\");\n testQueue.enqueue(\"Chrysanthemums\");\n ", "end": 301, "score": 0.9998319745063782, "start": 294, "tag": "NAME", "value": "Daisies" }, { "context": "ue.enqueue(\"Daisies\");\n testQueue.enqueue(\"Chrysanthemums\");\n testQueue.enqueue(\"Dandelions\");\n ", "end": 346, "score": 0.9998242855072021, "start": 332, "tag": "NAME", "value": "Chrysanthemums" }, { "context": "eue(\"Chrysanthemums\");\n testQueue.enqueue(\"Dandelions\");\n while(!testQueue.isEmpty()) {\n ", "end": 387, "score": 0.9998213648796082, "start": 377, "tag": "NAME", "value": "Dandelions" }, { "context": "(testQueue.dequeue());\n testQueue.enqueue(\"Sunflowers\");\n System.out.println(testQueue.dequeue()", "end": 624, "score": 0.9997642636299133, "start": 614, "tag": "NAME", "value": "Sunflowers" } ]
null
[]
public class TSQTester2{ public static void main(String[] args) { TwoStackQueue<String> testQueue = new TwoStackQueue<String>(); testQueue.enqueue("Roses"); System.out.println(testQueue.dequeue()); testQueue.enqueue("Peonies"); testQueue.enqueue("Daisies"); testQueue.enqueue("Chrysanthemums"); testQueue.enqueue("Dandelions"); while(!testQueue.isEmpty()) { System.out.println(testQueue.dequeue()); } System.out.println(testQueue.size()); System.out.println(testQueue.dequeue()); testQueue.enqueue("Sunflowers"); System.out.println(testQueue.dequeue()); } }
685
0.624817
0.623358
22
30.181818
20.875467
70
false
false
0
0
0
0
0
0
0.545455
false
false
12
d354013a0f8b405caf0f31f21ecade139010754a
1,254,130,482,723
fa15e6a976c752336dfb5951146a30e81322f342
/src/main/java/shop/warscat/sell/controller/BuyerProductController.java
c4536e986a150afbfb15720acb4a28779598d302
[]
no_license
WarsFeng/SpringBoog_Sell
https://github.com/WarsFeng/SpringBoog_Sell
05271ba69456e407e75129d49410ec3f473f5d08
cb47e96f3c3ff70b4529f1028bf85faf3edf0355
refs/heads/master
2021-09-10T18:52:58.167000
2018-03-31T04:09:55
2018-03-31T04:09:55
126,122,033
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package shop.warscat.sell.controller; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import shop.warscat.sell.vo.CategoryVO; import shop.warscat.sell.vo.ProductVO; import shop.warscat.sell.vo.ResultVO; import shop.warscat.sell.model.ProductCategory; import shop.warscat.sell.model.ProductInfo; import shop.warscat.sell.service.ProductCategoryService; import shop.warscat.sell.service.ProductInfoService; import shop.warscat.sell.utils.ResultVOUtils; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * Created with IntelliJ IDEA. * Description: ่ดญไนฐๅ•†ๅ“ * User: wars * Date: 2018-03-21 * Time: 01:18 */ @RestController @RequestMapping("/buyer/product") public class BuyerProductController { private final ProductInfoService productInfoService; private final ProductCategoryService productCategoryService; @Autowired public BuyerProductController(ProductInfoService productInfoService, ProductCategoryService productCategoryService) { this.productInfoService = productInfoService; this.productCategoryService = productCategoryService; } @RequestMapping("list") public ResultVO List() { //่Žทๅพ—ๆ‰€ๆœ‰ไธŠๆžถๅ•†ๅ“ List<ProductInfo> productInfoList = productInfoService.findUpAll(); //่Žทๅพ—ๅ•†ๅ“็ฑป็›ฎ List<Integer> categoryTypeList; categoryTypeList = productInfoList.stream() .map(ProductInfo::getCategoryType) .collect(Collectors.toList()); List<ProductCategory> categoryList = productCategoryService.findByCategoryTypeIn(categoryTypeList); //ๅฐ่ฃ… List<CategoryVO> categoryVOList = new ArrayList<>(); //ๅฐ่ฃ…CatagoryVO for (ProductCategory aCategoryList : categoryList) { CategoryVO categoryVO = new CategoryVO(); categoryVO.setCategoryName(aCategoryList.getCategoryName()); categoryVO.setCategoryType(aCategoryList.getCategoryType()); ArrayList<ProductVO> productVOList = new ArrayList<>(); //ๅฐ่ฃ…ProductVO for (ProductInfo aProductInfoList : productInfoList) { if (aProductInfoList.getCategoryType().equals(aCategoryList.getCategoryType())) { ProductVO productVO = new ProductVO(); BeanUtils.copyProperties(aProductInfoList, productVO); productVOList.add(productVO); } } categoryVO.setProductVOList(productVOList); categoryVOList.add(categoryVO); } return ResultVOUtils.success(categoryVOList); } }
UTF-8
Java
2,828
java
BuyerProductController.java
Java
[ { "context": " with IntelliJ IDEA.\n * Description: ่ดญไนฐๅ•†ๅ“\n * User: wars\n * Date: 2018-03-21\n * Time: 01:18\n */\n@RestContr", "end": 795, "score": 0.999405026435852, "start": 791, "tag": "USERNAME", "value": "wars" } ]
null
[]
package shop.warscat.sell.controller; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import shop.warscat.sell.vo.CategoryVO; import shop.warscat.sell.vo.ProductVO; import shop.warscat.sell.vo.ResultVO; import shop.warscat.sell.model.ProductCategory; import shop.warscat.sell.model.ProductInfo; import shop.warscat.sell.service.ProductCategoryService; import shop.warscat.sell.service.ProductInfoService; import shop.warscat.sell.utils.ResultVOUtils; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * Created with IntelliJ IDEA. * Description: ่ดญไนฐๅ•†ๅ“ * User: wars * Date: 2018-03-21 * Time: 01:18 */ @RestController @RequestMapping("/buyer/product") public class BuyerProductController { private final ProductInfoService productInfoService; private final ProductCategoryService productCategoryService; @Autowired public BuyerProductController(ProductInfoService productInfoService, ProductCategoryService productCategoryService) { this.productInfoService = productInfoService; this.productCategoryService = productCategoryService; } @RequestMapping("list") public ResultVO List() { //่Žทๅพ—ๆ‰€ๆœ‰ไธŠๆžถๅ•†ๅ“ List<ProductInfo> productInfoList = productInfoService.findUpAll(); //่Žทๅพ—ๅ•†ๅ“็ฑป็›ฎ List<Integer> categoryTypeList; categoryTypeList = productInfoList.stream() .map(ProductInfo::getCategoryType) .collect(Collectors.toList()); List<ProductCategory> categoryList = productCategoryService.findByCategoryTypeIn(categoryTypeList); //ๅฐ่ฃ… List<CategoryVO> categoryVOList = new ArrayList<>(); //ๅฐ่ฃ…CatagoryVO for (ProductCategory aCategoryList : categoryList) { CategoryVO categoryVO = new CategoryVO(); categoryVO.setCategoryName(aCategoryList.getCategoryName()); categoryVO.setCategoryType(aCategoryList.getCategoryType()); ArrayList<ProductVO> productVOList = new ArrayList<>(); //ๅฐ่ฃ…ProductVO for (ProductInfo aProductInfoList : productInfoList) { if (aProductInfoList.getCategoryType().equals(aCategoryList.getCategoryType())) { ProductVO productVO = new ProductVO(); BeanUtils.copyProperties(aProductInfoList, productVO); productVOList.add(productVO); } } categoryVO.setProductVOList(productVOList); categoryVOList.add(categoryVO); } return ResultVOUtils.success(categoryVOList); } }
2,828
0.714388
0.710072
72
37.611111
26.931784
121
false
false
0
0
0
0
0
0
0.513889
false
false
12
a2f82ad5d9243f77acd7907d42d29c3dfc937486
1,254,130,481,775
12d54ff875a4bda1664332d7a296ba3cf9684b54
/app/src/main/java/com/example/administrator/fragmenttap/mitiupager/ImageFragment.java
5fbdb6348d8768bc05c2bb8a4f5e788b6e7f3b46
[]
no_license
HappyImp/FragmentTap
https://github.com/HappyImp/FragmentTap
2e71e4fdaab4c0c0b706954f06e4be0198e9a6ed
53a8359aa22a50acd9b34509a9a1ec8af864d70f
refs/heads/master
2020-02-26T13:06:37.454000
2016-06-28T02:27:52
2016-06-28T02:27:52
62,028,575
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.administrator.fragmenttap.mitiupager; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.example.administrator.fragmenttap.R; import com.example.administrator.fragmenttap.base.BaseFragment; import butterknife.Bind; import butterknife.ButterKnife; /** * Created by Zoi. * E-mail๏ผšKyluZoi@gmail.com * 2016/6/8 */ public class ImageFragment extends BaseFragment { @Bind(R.id.iv_photo) ImageView ivPhoto; private Bitmap bitmap; private String url=null; private String savePath=null; public static ImageFragment newInstance(String photoData) { return newInstance(photoData,""); } public static ImageFragment newInstance(String photoData,String filePath) { Bundle args = new Bundle(); ImageFragment fragment = new ImageFragment(); args.putString("photo",photoData); fragment.setArguments(args); return fragment; } @Override public int getLayoutId() { return R.layout.frag_image; } @Override protected void initView(View contentView) { ButterKnife.bind(this, contentView); if(getArguments()!=null) { url=getArguments().getString("photo"); } Glide.with(getContext()) .load(url) .into(ivPhoto); } @Override protected void initData() { } @Override public void doAfterReConnectNewWork() { } @Override public void onDestroyView() { ButterKnife.unbind(this); super.onDestroyView(); } }
UTF-8
Java
1,675
java
ImageFragment.java
Java
[ { "context": "import butterknife.ButterKnife;\n\n/**\n * Created by Zoi.\n * E-mail๏ผšKyluZoi@gmail.com\n * 2016/6/8\n */\npubl", "end": 402, "score": 0.7517346143722534, "start": 399, "tag": "USERNAME", "value": "Zoi" }, { "context": "fe.ButterKnife;\n\n/**\n * Created by Zoi.\n * E-mail๏ผšKyluZoi@gmail.com\n * 2016/6/8\n */\npublic class ImageFragment extend", "end": 431, "score": 0.9999226331710815, "start": 414, "tag": "EMAIL", "value": "KyluZoi@gmail.com" } ]
null
[]
package com.example.administrator.fragmenttap.mitiupager; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.example.administrator.fragmenttap.R; import com.example.administrator.fragmenttap.base.BaseFragment; import butterknife.Bind; import butterknife.ButterKnife; /** * Created by Zoi. * E-mail๏ผš<EMAIL> * 2016/6/8 */ public class ImageFragment extends BaseFragment { @Bind(R.id.iv_photo) ImageView ivPhoto; private Bitmap bitmap; private String url=null; private String savePath=null; public static ImageFragment newInstance(String photoData) { return newInstance(photoData,""); } public static ImageFragment newInstance(String photoData,String filePath) { Bundle args = new Bundle(); ImageFragment fragment = new ImageFragment(); args.putString("photo",photoData); fragment.setArguments(args); return fragment; } @Override public int getLayoutId() { return R.layout.frag_image; } @Override protected void initView(View contentView) { ButterKnife.bind(this, contentView); if(getArguments()!=null) { url=getArguments().getString("photo"); } Glide.with(getContext()) .load(url) .into(ivPhoto); } @Override protected void initData() { } @Override public void doAfterReConnectNewWork() { } @Override public void onDestroyView() { ButterKnife.unbind(this); super.onDestroyView(); } }
1,665
0.661686
0.658099
73
21.917809
19.032598
79
false
false
0
0
0
0
0
0
0.410959
false
false
12
ba302d74adfd259482a250f55f9a6e06d94f85cc
4,423,816,360,691
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_3f6024e93c2cb4c835fde994751a4a560c331ae3/FieldRenderer/2_3f6024e93c2cb4c835fde994751a4a560c331ae3_FieldRenderer_s.java
c8b81103d78d11b5a330cc40fa61e20108330296
[]
no_license
zhongxingyu/Seer
https://github.com/zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516000
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
false
2023-06-22T07:55:57
2020-04-28T11:07:49
2023-06-21T00:53:27
2023-06-22T07:55:57
2,849,868
2
2
0
null
false
false
package net.sf.qualitycheck.immutableobject.generator; import java.util.Locale; import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.sf.qualitycheck.Check; import net.sf.qualitycheck.immutableobject.domain.CollectionVariant; import net.sf.qualitycheck.immutableobject.domain.Field; import net.sf.qualitycheck.immutableobject.domain.ImmutableSettings; import net.sf.qualitycheck.immutableobject.domain.Type; import org.stringtemplate.v4.AttributeRenderer; final class FieldRenderer implements AttributeRenderer { public enum Option { COPY, COPY_FROM_INTERFACE, IMMUTABLE; @Nullable public static Option evaluate(@Nonnull final String option) { Check.notNull(option, "option"); return valueOf(option.trim().toUpperCase()); } } private static final String CHECK_NONNEGATIVE = "Check.notNegative(%s, \"%s\")"; private static final String CHECK_NONNULL = "Check.notNull(%s, \"%s\")"; @Nonnull public static final String determineGeneric(@Nonnull final Type type) { return type.getGenericDeclaration().isUndefined() ? "" : "<" + type.getGenericDeclaration().getDeclaration() + ">"; } @Nonnull static String surroundWithCheck(@Nonnull final Field field, @Nonnull final String referenceAccess) { Check.notEmpty(referenceAccess, "referenceAccess"); String result = referenceAccess; if (field.isNonnegative()) { result = String.format(CHECK_NONNEGATIVE, result, result); } else if (field.isNonnull()) { result = String.format(CHECK_NONNULL, result, result); } return result; } @Nonnull private final ImmutableSettings _settings; public FieldRenderer(@Nonnull final ImmutableSettings settings) { _settings = Check.notNull(settings, "settings"); } @Nonnull String copyCollection(@Nonnull final Field field, @Nonnull final String currentResult) { String result = currentResult; final CollectionVariant variant = CollectionVariant.evaluate(field.getType()); if (variant != null) { if (_settings.hasGuava()) { result = String.format(variant.getGuavaCopy(), result); } else { final String generic = determineGeneric(field.getType()); result = String.format(variant.getDefaultCopy(), generic, result); } } return result; } @Nonnull String makeCollectionImmutable(@Nonnull final Field field, @Nonnull final String currentResult) { String result = currentResult; final CollectionVariant variant = CollectionVariant.evaluate(field.getType()); if (variant != null) { if (_settings.hasGuava()) { result = String.format(variant.getGuavaImmutable(), result); } else { final String generic = determineGeneric(field.getType()); result = String.format(variant.getDefaultImmutable(), generic, result); } } return result; } @Nonnull @Override public String toString(final Object o, final String formatOption, final Locale locale) { // o will be instanceof CollectionVariant final Field field = (Field) o; String result = field.getName(); final Option option = formatOption != null ? Option.evaluate(formatOption) : null; if (Option.COPY_FROM_INTERFACE == option) { result = _settings.getInterfaceDeclaration().getType().getName().toLowerCase() + "." + field.getAccessorMethodName(); } if (_settings.hasQualityCheck()) { result = surroundWithCheck(field, result); } if (option == Option.IMMUTABLE) { result = makeCollectionImmutable(field, result); } else if (option == Option.COPY || option == Option.COPY_FROM_INTERFACE) { result = copyCollection(field, result); } return result; } }
UTF-8
Java
3,668
java
2_3f6024e93c2cb4c835fde994751a4a560c331ae3_FieldRenderer_s.java
Java
[]
null
[]
package net.sf.qualitycheck.immutableobject.generator; import java.util.Locale; import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.sf.qualitycheck.Check; import net.sf.qualitycheck.immutableobject.domain.CollectionVariant; import net.sf.qualitycheck.immutableobject.domain.Field; import net.sf.qualitycheck.immutableobject.domain.ImmutableSettings; import net.sf.qualitycheck.immutableobject.domain.Type; import org.stringtemplate.v4.AttributeRenderer; final class FieldRenderer implements AttributeRenderer { public enum Option { COPY, COPY_FROM_INTERFACE, IMMUTABLE; @Nullable public static Option evaluate(@Nonnull final String option) { Check.notNull(option, "option"); return valueOf(option.trim().toUpperCase()); } } private static final String CHECK_NONNEGATIVE = "Check.notNegative(%s, \"%s\")"; private static final String CHECK_NONNULL = "Check.notNull(%s, \"%s\")"; @Nonnull public static final String determineGeneric(@Nonnull final Type type) { return type.getGenericDeclaration().isUndefined() ? "" : "<" + type.getGenericDeclaration().getDeclaration() + ">"; } @Nonnull static String surroundWithCheck(@Nonnull final Field field, @Nonnull final String referenceAccess) { Check.notEmpty(referenceAccess, "referenceAccess"); String result = referenceAccess; if (field.isNonnegative()) { result = String.format(CHECK_NONNEGATIVE, result, result); } else if (field.isNonnull()) { result = String.format(CHECK_NONNULL, result, result); } return result; } @Nonnull private final ImmutableSettings _settings; public FieldRenderer(@Nonnull final ImmutableSettings settings) { _settings = Check.notNull(settings, "settings"); } @Nonnull String copyCollection(@Nonnull final Field field, @Nonnull final String currentResult) { String result = currentResult; final CollectionVariant variant = CollectionVariant.evaluate(field.getType()); if (variant != null) { if (_settings.hasGuava()) { result = String.format(variant.getGuavaCopy(), result); } else { final String generic = determineGeneric(field.getType()); result = String.format(variant.getDefaultCopy(), generic, result); } } return result; } @Nonnull String makeCollectionImmutable(@Nonnull final Field field, @Nonnull final String currentResult) { String result = currentResult; final CollectionVariant variant = CollectionVariant.evaluate(field.getType()); if (variant != null) { if (_settings.hasGuava()) { result = String.format(variant.getGuavaImmutable(), result); } else { final String generic = determineGeneric(field.getType()); result = String.format(variant.getDefaultImmutable(), generic, result); } } return result; } @Nonnull @Override public String toString(final Object o, final String formatOption, final Locale locale) { // o will be instanceof CollectionVariant final Field field = (Field) o; String result = field.getName(); final Option option = formatOption != null ? Option.evaluate(formatOption) : null; if (Option.COPY_FROM_INTERFACE == option) { result = _settings.getInterfaceDeclaration().getType().getName().toLowerCase() + "." + field.getAccessorMethodName(); } if (_settings.hasQualityCheck()) { result = surroundWithCheck(field, result); } if (option == Option.IMMUTABLE) { result = makeCollectionImmutable(field, result); } else if (option == Option.COPY || option == Option.COPY_FROM_INTERFACE) { result = copyCollection(field, result); } return result; } }
3,668
0.714013
0.71374
110
32.336365
30.78969
120
false
false
0
0
0
0
0
0
2.072727
false
false
12
73ddb999a4ed4d7264b2b89c45e5fbc411911108
10,179,072,535,975
4b93a2d0350b8fb673967ac84ca219a54c4d0648
/ims/framework/UIFactory.java
a0fa9c0ffdf45692747bf4d585db39982c968741
[]
no_license
LibreHIS/framework
https://github.com/LibreHIS/framework
f1b91f9a3d9bb35c13ffb2b1396ca546d8ef6ff1
8eda310fb9fc208fce53d9e7f2714fb4dcd8930a
refs/heads/master
2021-01-13T03:02:05.452000
2016-12-21T10:39:39
2016-12-21T10:39:39
77,041,739
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ims.framework; import java.io.Serializable; import ims.framework.controls.Timer; import ims.framework.enumerations.ControlAnchoring; import ims.framework.enumerations.ControlState; abstract public class UIFactory implements Serializable { private static final long serialVersionUID = 1L; abstract public UIEngine getUIEngine(); abstract public Form getForm(); abstract public Control getControl(Class controlClass, Object[] params); abstract public Control getControl(Class controlClass, Form parentForm, Object[] params); abstract public Menu createMenu(int id); abstract public Timer createTimer(int id, int interval, boolean enabled); abstract public MenuItem createMenuItem(int id, String text, boolean enabled, boolean visible, Integer imageID, boolean canEditData, boolean beginAGroup); abstract public CustomComponent getEmptyCustomComponent(); protected final void setContainerContext(Control parentControl, Container container, int id, int x, int y, int width, int height, ControlState viewMode, ControlState editMode, ControlAnchoring anchor, String caption, int groupID, boolean visible, boolean autoPostBack, boolean isInLayer, boolean layerHasTabs, boolean layerHasAutoPostBack, boolean collapsable) { container.setContext(parentControl, id, x, y, width, height, viewMode, editMode, anchor, caption, groupID, visible, autoPostBack, isInLayer, layerHasTabs, layerHasAutoPostBack, collapsable); } }
UTF-8
Java
1,438
java
UIFactory.java
Java
[]
null
[]
package ims.framework; import java.io.Serializable; import ims.framework.controls.Timer; import ims.framework.enumerations.ControlAnchoring; import ims.framework.enumerations.ControlState; abstract public class UIFactory implements Serializable { private static final long serialVersionUID = 1L; abstract public UIEngine getUIEngine(); abstract public Form getForm(); abstract public Control getControl(Class controlClass, Object[] params); abstract public Control getControl(Class controlClass, Form parentForm, Object[] params); abstract public Menu createMenu(int id); abstract public Timer createTimer(int id, int interval, boolean enabled); abstract public MenuItem createMenuItem(int id, String text, boolean enabled, boolean visible, Integer imageID, boolean canEditData, boolean beginAGroup); abstract public CustomComponent getEmptyCustomComponent(); protected final void setContainerContext(Control parentControl, Container container, int id, int x, int y, int width, int height, ControlState viewMode, ControlState editMode, ControlAnchoring anchor, String caption, int groupID, boolean visible, boolean autoPostBack, boolean isInLayer, boolean layerHasTabs, boolean layerHasAutoPostBack, boolean collapsable) { container.setContext(parentControl, id, x, y, width, height, viewMode, editMode, anchor, caption, groupID, visible, autoPostBack, isInLayer, layerHasTabs, layerHasAutoPostBack, collapsable); } }
1,438
0.817107
0.816412
24
58.958332
78.433876
361
false
false
0
0
0
0
0
0
3
false
false
12
7341413eba969c11e931de4f3946ab41aeb1bf8b
18,202,071,454,399
b1b93cd551af3e7c591b7e152da867e424cfa81d
/IMS-java-client/src/GUI/Fields/AIntegerField.java
8e8c4fe0a5949b6c399a820a16d592c5ea987f71
[ "MIT" ]
permissive
eliasdk/NutriServe
https://github.com/eliasdk/NutriServe
a93484e6a83e1236662bfefb2d34ed95affff868
ef126f83f881741bfc65f08b65094a1df8c472bf
refs/heads/master
2021-03-27T16:59:38.431000
2017-05-28T18:34:13
2017-05-28T18:34:13
91,822,877
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package GUI.Fields; import javax.swing.event.ChangeListener; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; public class AIntegerField extends Field { private TextField text; public AIntegerField(String label) { super(label); text = new TextField(); text.textProperty().addListener((observable, oldValue, newValue) -> { if (!newValue.matches("\\d*")) { text.setText(newValue.replaceAll("[^\\d]", "")); } }); } public void setFieldLocation(GridPane pane, int row) { pane.add(new Label(getLabel()), 0, row); pane.add(text, 1, row); } public Integer getInt() { return Integer.parseInt(text.getText()); } public void setInt(int integer) { this.text.setText(integer + ""); } @Override public void setEnable(boolean enable) { text.setDisable(!enable); } }
UTF-8
Java
924
java
AIntegerField.java
Java
[]
null
[]
package GUI.Fields; import javax.swing.event.ChangeListener; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; public class AIntegerField extends Field { private TextField text; public AIntegerField(String label) { super(label); text = new TextField(); text.textProperty().addListener((observable, oldValue, newValue) -> { if (!newValue.matches("\\d*")) { text.setText(newValue.replaceAll("[^\\d]", "")); } }); } public void setFieldLocation(GridPane pane, int row) { pane.add(new Label(getLabel()), 0, row); pane.add(text, 1, row); } public Integer getInt() { return Integer.parseInt(text.getText()); } public void setInt(int integer) { this.text.setText(integer + ""); } @Override public void setEnable(boolean enable) { text.setDisable(!enable); } }
924
0.651515
0.649351
40
21.1
19.668249
71
false
false
0
0
0
0
0
0
1.4
false
false
12
f1cc39b827229978e655d03a24b3472da164ec13
33,595,234,245,560
148ed3a8e062d74195f2c5bed2a1396204115b35
/jetty/extras/sslengine/src/main/java/org/mortbay/jetty/security/SslSelectChannelConnector.java
e0863a5ce4e9e21adf5c61696cf0e0006de43aea
[ "LicenseRef-scancode-other-permissive", "Apache-2.0", "LGPL-2.0-or-later", "CDDL-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
napcs/qedserver
https://github.com/napcs/qedserver
1cb3de8e3733acf0dd160fe4f9b11c630700aee7
ada3244f36db710ed66a8fd98169b7d440cfd8ab
refs/heads/master
2023-07-02T12:37:12.419000
2015-02-18T19:17:25
2015-02-18T19:17:25
1,683,704
33
5
MIT
false
2020-10-13T10:04:01
2011-04-30T04:15:53
2020-02-18T19:00:40
2020-10-13T10:03:59
22,022
40
7
6
Java
false
false
//======================================================================== //Copyright 2004-2008 Mort Bay Consulting Pty. Ltd. //------------------------------------------------------------------------ //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at //http://www.apache.org/licenses/LICENSE-2.0 //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. //======================================================================== package org.mortbay.jetty.security; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; import java.security.KeyStore; import java.security.SecureRandom; import java.security.Security; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import org.mortbay.io.Buffer; import org.mortbay.io.Connection; import org.mortbay.io.EndPoint; import org.mortbay.io.bio.SocketEndPoint; import org.mortbay.io.nio.DirectNIOBuffer; import org.mortbay.io.nio.IndirectNIOBuffer; import org.mortbay.io.nio.NIOBuffer; import org.mortbay.io.nio.SelectChannelEndPoint; import org.mortbay.io.nio.SelectorManager.SelectSet; import org.mortbay.jetty.HttpConnection; import org.mortbay.jetty.HttpParser; import org.mortbay.jetty.HttpSchemes; import org.mortbay.jetty.Request; import org.mortbay.jetty.nio.SelectChannelConnector; import org.mortbay.log.Log; import org.mortbay.resource.Resource; /* ------------------------------------------------------------ */ /** * SslSelectChannelConnector. * * @author Nik Gonzalez <ngonzalez@exist.com> * @author Greg Wilkins <gregw@mortbay.com> */ public class SslSelectChannelConnector extends SelectChannelConnector { /** * The name of the SSLSession attribute that will contain any cached * information. */ static final String CACHED_INFO_ATTR=CachedInfo.class.getName(); /** Default value for the keystore location path. */ public static final String DEFAULT_KEYSTORE=System.getProperty("user.home")+File.separator+".keystore"; /** String name of key password property. */ public static final String KEYPASSWORD_PROPERTY="jetty.ssl.keypassword"; /** String name of keystore password property. */ public static final String PASSWORD_PROPERTY="jetty.ssl.password"; /** Default value for the cipher Suites. */ private String _excludeCipherSuites[]=null; /** Default value for the keystore location path. */ private String _keystore=DEFAULT_KEYSTORE; private String _keystoreType="JKS"; // type of the key store /** Set to true if we require client certificate authentication. */ private boolean _needClientAuth=false; private boolean _wantClientAuth=false; private transient Password _password; private transient Password _keyPassword; private transient Password _trustPassword; private String _protocol="TLS"; private String _algorithm="SunX509"; // cert algorithm private String _provider; private String _secureRandomAlgorithm; // cert algorithm private String _sslKeyManagerFactoryAlgorithm=(Security.getProperty("ssl.KeyManagerFactory.algorithm")==null?"SunX509":Security .getProperty("ssl.KeyManagerFactory.algorithm")); // cert // algorithm private String _sslTrustManagerFactoryAlgorithm=(Security.getProperty("ssl.TrustManagerFactory.algorithm")==null?"SunX509":Security .getProperty("ssl.TrustManagerFactory.algorithm")); // cert // algorithm private String _truststore; private String _truststoreType="JKS"; // type of the key store private SSLContext _context; private int _packetBufferSize; private int _applicationBufferSize; private ConcurrentLinkedQueue<Buffer> _packetBuffers = new ConcurrentLinkedQueue<Buffer>(); private ConcurrentLinkedQueue<Buffer> _applicationBuffers = new ConcurrentLinkedQueue<Buffer>(); private boolean _allowRenegotiate=false; /* ------------------------------------------------------------ */ /* (non-Javadoc) * @see org.mortbay.jetty.AbstractBuffers#getBuffer(int) */ public Buffer getBuffer(int size) { Buffer buffer; if (size==_applicationBufferSize) { buffer = _applicationBuffers.poll(); if (buffer==null) buffer=new IndirectNIOBuffer(size); } else if (size==_packetBufferSize) { buffer = _packetBuffers.poll(); if (buffer==null) buffer=getUseDirectBuffers() ?(NIOBuffer)new DirectNIOBuffer(size) :(NIOBuffer)new IndirectNIOBuffer(size); } else buffer=super.getBuffer(size); return buffer; } /* ------------------------------------------------------------ */ /* (non-Javadoc) * @see org.mortbay.jetty.AbstractBuffers#returnBuffer(org.mortbay.io.Buffer) */ public void returnBuffer(Buffer buffer) { buffer.clear(); int size=buffer.capacity(); ByteBuffer bbuf = ((NIOBuffer)buffer).getByteBuffer(); bbuf.position(0); bbuf.limit(size); if (size==_applicationBufferSize) _applicationBuffers.add(buffer); else if (size==_packetBufferSize) _packetBuffers.add(buffer); else super.returnBuffer(buffer); } /** * Return the chain of X509 certificates used to negotiate the SSL Session. * <p> * Note: in order to do this we must convert a * javax.security.cert.X509Certificate[], as used by JSSE to a * java.security.cert.X509Certificate[],as required by the Servlet specs. * * @param sslSession * the javax.net.ssl.SSLSession to use as the source of the * cert chain. * @return the chain of java.security.cert.X509Certificates used to * negotiate the SSL connection. <br> * Will be null if the chain is missing or empty. */ private static X509Certificate[] getCertChain(SSLSession sslSession) { try { javax.security.cert.X509Certificate javaxCerts[]=sslSession.getPeerCertificateChain(); if (javaxCerts==null||javaxCerts.length==0) return null; int length=javaxCerts.length; X509Certificate[] javaCerts=new X509Certificate[length]; java.security.cert.CertificateFactory cf=java.security.cert.CertificateFactory.getInstance("X.509"); for (int i=0; i<length; i++) { byte bytes[]=javaxCerts[i].getEncoded(); ByteArrayInputStream stream=new ByteArrayInputStream(bytes); javaCerts[i]=(X509Certificate)cf.generateCertificate(stream); } return javaCerts; } catch (SSLPeerUnverifiedException e) { Log.ignore(e); return null; } catch (Exception e) { Log.warn(Log.EXCEPTION,e); return null; } } /* ------------------------------------------------------------ */ /** * Allow the Listener a chance to customise the request. before the server * does its stuff. <br> * This allows the required attributes to be set for SSL requests. <br> * The requirements of the Servlet specs are: * <ul> * <li> an attribute named "javax.servlet.request.cipher_suite" of type * String.</li> * <li> an attribute named "javax.servlet.request.key_size" of type Integer.</li> * <li> an attribute named "javax.servlet.request.X509Certificate" of type * java.security.cert.X509Certificate[]. This is an array of objects of type * X509Certificate, the order of this array is defined as being in ascending * order of trust. The first certificate in the chain is the one set by the * client, the next is the one used to authenticate the first, and so on. * </li> * </ul> * * @param endpoint * The Socket the request arrived on. This should be a * {@link SocketEndPoint} wrapping a {@link SSLSocket}. * @param request * HttpRequest to be customised. */ public void customize(EndPoint endpoint, Request request) throws IOException { super.customize(endpoint,request); request.setScheme(HttpSchemes.HTTPS); SslHttpChannelEndPoint sslHttpChannelEndpoint=(SslHttpChannelEndPoint)endpoint; SSLEngine sslEngine=sslHttpChannelEndpoint.getSSLEngine(); try { SSLSession sslSession=sslEngine.getSession(); String cipherSuite=sslSession.getCipherSuite(); Integer keySize; X509Certificate[] certs; CachedInfo cachedInfo=(CachedInfo)sslSession.getValue(CACHED_INFO_ATTR); if (cachedInfo!=null) { keySize=cachedInfo.getKeySize(); certs=cachedInfo.getCerts(); } else { keySize=new Integer(ServletSSL.deduceKeyLength(cipherSuite)); certs=getCertChain(sslSession); cachedInfo=new CachedInfo(keySize,certs); sslSession.putValue(CACHED_INFO_ATTR,cachedInfo); } if (certs!=null) request.setAttribute("javax.servlet.request.X509Certificate",certs); request.setAttribute("javax.servlet.request.cipher_suite",cipherSuite); request.setAttribute("javax.servlet.request.key_size",keySize); } catch (Exception e) { Log.warn(Log.EXCEPTION,e); } } /* ------------------------------------------------------------ */ public SslSelectChannelConnector() { // Buffer sizes should be from SSL session, but not known at this stage. // size should be 16k, but appears to need 16k+1 byte? Giving it 16k+2k // just // to be safe. TODO investigate } /* ------------------------------------------------------------ */ /** * @return True if SSL re-negotiation is allowed (default false) */ public boolean isAllowRenegotiate() { return _allowRenegotiate; } /* ------------------------------------------------------------ */ /** * Set if SSL re-negotiation is allowed. CVE-2009-3555 discovered * a vulnerability in SSL/TLS with re-negotiation. If your JVM * does not have CVE-2009-3555 fixed, then re-negotiation should * not be allowed. * @param allowRenegotiate true if re-negotiation is allowed (default false) */ public void setAllowRenegotiate(boolean allowRenegotiate) { _allowRenegotiate = allowRenegotiate; } /** * * @deprecated As of Java Servlet API 2.0, with no replacement. * */ public String[] getCipherSuites() { return getExcludeCipherSuites(); } public String[] getExcludeCipherSuites() { return _excludeCipherSuites; } /** * * @deprecated As of Java Servlet API 2.0, with no replacement. * * @author Tony Jiang */ public void setCipherSuites(String[] cipherSuites) { setExcludeCipherSuites(cipherSuites); } public void setExcludeCipherSuites(String[] cipherSuites) { this._excludeCipherSuites=cipherSuites; } /* ------------------------------------------------------------ */ public void setPassword(String password) { _password=Password.getPassword(PASSWORD_PROPERTY,password,null); } /* ------------------------------------------------------------ */ public void setTrustPassword(String password) { _trustPassword=Password.getPassword(PASSWORD_PROPERTY,password,null); } /* ------------------------------------------------------------ */ public void setKeyPassword(String password) { _keyPassword=Password.getPassword(KEYPASSWORD_PROPERTY,password,null); } /* ------------------------------------------------------------ */ public String getAlgorithm() { return (this._algorithm); } /* ------------------------------------------------------------ */ public void setAlgorithm(String algorithm) { this._algorithm=algorithm; } /* ------------------------------------------------------------ */ public String getProtocol() { return _protocol; } /* ------------------------------------------------------------ */ public void setProtocol(String protocol) { _protocol=protocol; } /* ------------------------------------------------------------ */ public void setKeystore(String keystore) { _keystore=keystore; } /* ------------------------------------------------------------ */ public String getKeystore() { return _keystore; } /* ------------------------------------------------------------ */ public String getKeystoreType() { return (_keystoreType); } /* ------------------------------------------------------------ */ public boolean getNeedClientAuth() { return _needClientAuth; } /* ------------------------------------------------------------ */ public boolean getWantClientAuth() { return _wantClientAuth; } /* ------------------------------------------------------------ */ /** * Set the value of the needClientAuth property * * @param needClientAuth * true iff we require client certificate authentication. */ public void setNeedClientAuth(boolean needClientAuth) { _needClientAuth=needClientAuth; } public void setWantClientAuth(boolean wantClientAuth) { _wantClientAuth=wantClientAuth; } /* ------------------------------------------------------------ */ public void setKeystoreType(String keystoreType) { _keystoreType=keystoreType; } /* ------------------------------------------------------------ */ public String getProvider() { return _provider; } public String getSecureRandomAlgorithm() { return (this._secureRandomAlgorithm); } /* ------------------------------------------------------------ */ public String getSslKeyManagerFactoryAlgorithm() { return (this._sslKeyManagerFactoryAlgorithm); } /* ------------------------------------------------------------ */ public String getSslTrustManagerFactoryAlgorithm() { return (this._sslTrustManagerFactoryAlgorithm); } /* ------------------------------------------------------------ */ public String getTruststore() { return _truststore; } /* ------------------------------------------------------------ */ public String getTruststoreType() { return _truststoreType; } /* ------------------------------------------------------------ */ public void setProvider(String _provider) { this._provider=_provider; } /* ------------------------------------------------------------ */ public void setSecureRandomAlgorithm(String algorithm) { this._secureRandomAlgorithm=algorithm; } /* ------------------------------------------------------------ */ public void setSslKeyManagerFactoryAlgorithm(String algorithm) { this._sslKeyManagerFactoryAlgorithm=algorithm; } /* ------------------------------------------------------------ */ public void setSslTrustManagerFactoryAlgorithm(String algorithm) { this._sslTrustManagerFactoryAlgorithm=algorithm; } public void setTruststore(String truststore) { _truststore=truststore; } public void setTruststoreType(String truststoreType) { _truststoreType=truststoreType; } /* ------------------------------------------------------------ */ /** * By default, we're confidential, given we speak SSL. But, if we've been * told about an confidential port, and said port is not our port, then * we're not. This allows separation of listeners providing INTEGRAL versus * CONFIDENTIAL constraints, such as one SSL listener configured to require * client certs providing CONFIDENTIAL, whereas another SSL listener not * requiring client certs providing mere INTEGRAL constraints. */ public boolean isConfidential(Request request) { final int confidentialPort=getConfidentialPort(); return confidentialPort==0||confidentialPort==request.getServerPort(); } /* ------------------------------------------------------------ */ /** * By default, we're integral, given we speak SSL. But, if we've been told * about an integral port, and said port is not our port, then we're not. * This allows separation of listeners providing INTEGRAL versus * CONFIDENTIAL constraints, such as one SSL listener configured to require * client certs providing CONFIDENTIAL, whereas another SSL listener not * requiring client certs providing mere INTEGRAL constraints. */ public boolean isIntegral(Request request) { final int integralPort=getIntegralPort(); return integralPort==0||integralPort==request.getServerPort(); } /* ------------------------------------------------------------------------------- */ protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { SslHttpChannelEndPoint endp = new SslHttpChannelEndPoint(this,channel,selectSet,key,createSSLEngine()); endp.setAllowRenegotiate(_allowRenegotiate); return endp; } /* ------------------------------------------------------------------------------- */ protected Connection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint) { HttpConnection connection=(HttpConnection)super.newConnection(channel,endpoint); ((HttpParser)connection.getParser()).setForceContentBuffer(true); return connection; } /* ------------------------------------------------------------ */ protected SSLEngine createSSLEngine() throws IOException { SSLEngine engine=null; try { engine=_context.createSSLEngine(); engine.setUseClientMode(false); if (_wantClientAuth) engine.setWantClientAuth(_wantClientAuth); if (_needClientAuth) engine.setNeedClientAuth(_needClientAuth); if (_excludeCipherSuites!=null&&_excludeCipherSuites.length>0) { List<String> excludedCSList=Arrays.asList(_excludeCipherSuites); String[] enabledCipherSuites=engine.getEnabledCipherSuites(); List<String> enabledCSList=new ArrayList<String>(Arrays.asList(enabledCipherSuites)); for (String cipherName : excludedCSList) { if (enabledCSList.contains(cipherName)) { enabledCSList.remove(cipherName); } } enabledCipherSuites=enabledCSList.toArray(new String[enabledCSList.size()]); engine.setEnabledCipherSuites(enabledCipherSuites); } } catch (Exception e) { Log.warn("Error creating sslEngine -- closing this connector",e); close(); throw new IllegalStateException(e); } return engine; } protected void doStart() throws Exception { _context=createSSLContext(); SSLEngine engine=_context.createSSLEngine(); SSLSession session=engine.getSession(); if (getHeaderBufferSize()<session.getApplicationBufferSize()) setHeaderBufferSize(session.getApplicationBufferSize()); if (getRequestBufferSize()<session.getApplicationBufferSize()) setRequestBufferSize(session.getApplicationBufferSize()); super.doStart(); } protected SSLContext createSSLContext() throws Exception { if (_truststore==null) { _truststore=_keystore; _truststoreType=_keystoreType; } InputStream keystoreInputStream = null; KeyManager[] keyManagers=null; KeyStore keyStore = null; try { if (_keystore!=null) { keystoreInputStream=Resource.newResource(_keystore).getInputStream(); keyStore = KeyStore.getInstance(_keystoreType); keyStore.load(keystoreInputStream,_password==null?null:_password.toString().toCharArray()); } } finally { if (keystoreInputStream != null) keystoreInputStream.close(); } KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance(_sslKeyManagerFactoryAlgorithm); keyManagerFactory.init(keyStore,_keyPassword==null?(_password==null?null:_password.toString().toCharArray()):_keyPassword.toString().toCharArray()); keyManagers=keyManagerFactory.getKeyManagers(); TrustManager[] trustManagers=null; InputStream truststoreInputStream = null; KeyStore trustStore = null; try { if (_truststore!=null) { truststoreInputStream = Resource.newResource(_truststore).getInputStream(); trustStore=KeyStore.getInstance(_truststoreType); trustStore.load(truststoreInputStream,_trustPassword==null?null:_trustPassword.toString().toCharArray()); } } finally { if (truststoreInputStream != null) truststoreInputStream.close(); } TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance(_sslTrustManagerFactoryAlgorithm); trustManagerFactory.init(trustStore); trustManagers=trustManagerFactory.getTrustManagers(); SecureRandom secureRandom=_secureRandomAlgorithm==null?null:SecureRandom.getInstance(_secureRandomAlgorithm); SSLContext context=_provider==null?SSLContext.getInstance(_protocol):SSLContext.getInstance(_protocol,_provider); context.init(keyManagers,trustManagers,secureRandom); return context; } /** * Simple bundle of information that is cached in the SSLSession. Stores the * effective keySize and the client certificate chain. */ private class CachedInfo { private X509Certificate[] _certs; private Integer _keySize; CachedInfo(Integer keySize, X509Certificate[] certs) { this._keySize=keySize; this._certs=certs; } X509Certificate[] getCerts() { return _certs; } Integer getKeySize() { return _keySize; } } }
UTF-8
Java
24,290
java
SslSelectChannelConnector.java
Java
[ { "context": "/\n/**\n * SslSelectChannelConnector.\n * \n * @author Nik Gonzalez <ngonzalez@exist.com>\n * @author Greg Wilkins <gr", "end": 2434, "score": 0.9998975396156311, "start": 2422, "tag": "NAME", "value": "Nik Gonzalez" }, { "context": "ectChannelConnector.\n * \n * @author Nik Gonzalez <ngonzalez@exist.com>\n * @author Greg Wilkins <gregw@mortbay.com>\n */\n", "end": 2455, "score": 0.9999339580535889, "start": 2436, "tag": "EMAIL", "value": "ngonzalez@exist.com" }, { "context": "thor Nik Gonzalez <ngonzalez@exist.com>\n * @author Greg Wilkins <gregw@mortbay.com>\n */\npublic class SslSelectCha", "end": 2480, "score": 0.9998924136161804, "start": 2468, "tag": "NAME", "value": "Greg Wilkins" }, { "context": "ez <ngonzalez@exist.com>\n * @author Greg Wilkins <gregw@mortbay.com>\n */\npublic class SslSelectChannelConnector exten", "end": 2499, "score": 0.9999364614486694, "start": 2482, "tag": "EMAIL", "value": "gregw@mortbay.com" }, { "context": "I 2.0, with no replacement.\n * \n * @author Tony Jiang\n */\n public void setCipherSuites(String[] ", "end": 12305, "score": 0.9995223879814148, "start": 12295, "tag": "NAME", "value": "Tony Jiang" } ]
null
[]
//======================================================================== //Copyright 2004-2008 Mort Bay Consulting Pty. Ltd. //------------------------------------------------------------------------ //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at //http://www.apache.org/licenses/LICENSE-2.0 //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. //======================================================================== package org.mortbay.jetty.security; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; import java.security.KeyStore; import java.security.SecureRandom; import java.security.Security; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import org.mortbay.io.Buffer; import org.mortbay.io.Connection; import org.mortbay.io.EndPoint; import org.mortbay.io.bio.SocketEndPoint; import org.mortbay.io.nio.DirectNIOBuffer; import org.mortbay.io.nio.IndirectNIOBuffer; import org.mortbay.io.nio.NIOBuffer; import org.mortbay.io.nio.SelectChannelEndPoint; import org.mortbay.io.nio.SelectorManager.SelectSet; import org.mortbay.jetty.HttpConnection; import org.mortbay.jetty.HttpParser; import org.mortbay.jetty.HttpSchemes; import org.mortbay.jetty.Request; import org.mortbay.jetty.nio.SelectChannelConnector; import org.mortbay.log.Log; import org.mortbay.resource.Resource; /* ------------------------------------------------------------ */ /** * SslSelectChannelConnector. * * @author <NAME> <<EMAIL>> * @author <NAME> <<EMAIL>> */ public class SslSelectChannelConnector extends SelectChannelConnector { /** * The name of the SSLSession attribute that will contain any cached * information. */ static final String CACHED_INFO_ATTR=CachedInfo.class.getName(); /** Default value for the keystore location path. */ public static final String DEFAULT_KEYSTORE=System.getProperty("user.home")+File.separator+".keystore"; /** String name of key password property. */ public static final String KEYPASSWORD_PROPERTY="jetty.ssl.keypassword"; /** String name of keystore password property. */ public static final String PASSWORD_PROPERTY="jetty.ssl.password"; /** Default value for the cipher Suites. */ private String _excludeCipherSuites[]=null; /** Default value for the keystore location path. */ private String _keystore=DEFAULT_KEYSTORE; private String _keystoreType="JKS"; // type of the key store /** Set to true if we require client certificate authentication. */ private boolean _needClientAuth=false; private boolean _wantClientAuth=false; private transient Password _password; private transient Password _keyPassword; private transient Password _trustPassword; private String _protocol="TLS"; private String _algorithm="SunX509"; // cert algorithm private String _provider; private String _secureRandomAlgorithm; // cert algorithm private String _sslKeyManagerFactoryAlgorithm=(Security.getProperty("ssl.KeyManagerFactory.algorithm")==null?"SunX509":Security .getProperty("ssl.KeyManagerFactory.algorithm")); // cert // algorithm private String _sslTrustManagerFactoryAlgorithm=(Security.getProperty("ssl.TrustManagerFactory.algorithm")==null?"SunX509":Security .getProperty("ssl.TrustManagerFactory.algorithm")); // cert // algorithm private String _truststore; private String _truststoreType="JKS"; // type of the key store private SSLContext _context; private int _packetBufferSize; private int _applicationBufferSize; private ConcurrentLinkedQueue<Buffer> _packetBuffers = new ConcurrentLinkedQueue<Buffer>(); private ConcurrentLinkedQueue<Buffer> _applicationBuffers = new ConcurrentLinkedQueue<Buffer>(); private boolean _allowRenegotiate=false; /* ------------------------------------------------------------ */ /* (non-Javadoc) * @see org.mortbay.jetty.AbstractBuffers#getBuffer(int) */ public Buffer getBuffer(int size) { Buffer buffer; if (size==_applicationBufferSize) { buffer = _applicationBuffers.poll(); if (buffer==null) buffer=new IndirectNIOBuffer(size); } else if (size==_packetBufferSize) { buffer = _packetBuffers.poll(); if (buffer==null) buffer=getUseDirectBuffers() ?(NIOBuffer)new DirectNIOBuffer(size) :(NIOBuffer)new IndirectNIOBuffer(size); } else buffer=super.getBuffer(size); return buffer; } /* ------------------------------------------------------------ */ /* (non-Javadoc) * @see org.mortbay.jetty.AbstractBuffers#returnBuffer(org.mortbay.io.Buffer) */ public void returnBuffer(Buffer buffer) { buffer.clear(); int size=buffer.capacity(); ByteBuffer bbuf = ((NIOBuffer)buffer).getByteBuffer(); bbuf.position(0); bbuf.limit(size); if (size==_applicationBufferSize) _applicationBuffers.add(buffer); else if (size==_packetBufferSize) _packetBuffers.add(buffer); else super.returnBuffer(buffer); } /** * Return the chain of X509 certificates used to negotiate the SSL Session. * <p> * Note: in order to do this we must convert a * javax.security.cert.X509Certificate[], as used by JSSE to a * java.security.cert.X509Certificate[],as required by the Servlet specs. * * @param sslSession * the javax.net.ssl.SSLSession to use as the source of the * cert chain. * @return the chain of java.security.cert.X509Certificates used to * negotiate the SSL connection. <br> * Will be null if the chain is missing or empty. */ private static X509Certificate[] getCertChain(SSLSession sslSession) { try { javax.security.cert.X509Certificate javaxCerts[]=sslSession.getPeerCertificateChain(); if (javaxCerts==null||javaxCerts.length==0) return null; int length=javaxCerts.length; X509Certificate[] javaCerts=new X509Certificate[length]; java.security.cert.CertificateFactory cf=java.security.cert.CertificateFactory.getInstance("X.509"); for (int i=0; i<length; i++) { byte bytes[]=javaxCerts[i].getEncoded(); ByteArrayInputStream stream=new ByteArrayInputStream(bytes); javaCerts[i]=(X509Certificate)cf.generateCertificate(stream); } return javaCerts; } catch (SSLPeerUnverifiedException e) { Log.ignore(e); return null; } catch (Exception e) { Log.warn(Log.EXCEPTION,e); return null; } } /* ------------------------------------------------------------ */ /** * Allow the Listener a chance to customise the request. before the server * does its stuff. <br> * This allows the required attributes to be set for SSL requests. <br> * The requirements of the Servlet specs are: * <ul> * <li> an attribute named "javax.servlet.request.cipher_suite" of type * String.</li> * <li> an attribute named "javax.servlet.request.key_size" of type Integer.</li> * <li> an attribute named "javax.servlet.request.X509Certificate" of type * java.security.cert.X509Certificate[]. This is an array of objects of type * X509Certificate, the order of this array is defined as being in ascending * order of trust. The first certificate in the chain is the one set by the * client, the next is the one used to authenticate the first, and so on. * </li> * </ul> * * @param endpoint * The Socket the request arrived on. This should be a * {@link SocketEndPoint} wrapping a {@link SSLSocket}. * @param request * HttpRequest to be customised. */ public void customize(EndPoint endpoint, Request request) throws IOException { super.customize(endpoint,request); request.setScheme(HttpSchemes.HTTPS); SslHttpChannelEndPoint sslHttpChannelEndpoint=(SslHttpChannelEndPoint)endpoint; SSLEngine sslEngine=sslHttpChannelEndpoint.getSSLEngine(); try { SSLSession sslSession=sslEngine.getSession(); String cipherSuite=sslSession.getCipherSuite(); Integer keySize; X509Certificate[] certs; CachedInfo cachedInfo=(CachedInfo)sslSession.getValue(CACHED_INFO_ATTR); if (cachedInfo!=null) { keySize=cachedInfo.getKeySize(); certs=cachedInfo.getCerts(); } else { keySize=new Integer(ServletSSL.deduceKeyLength(cipherSuite)); certs=getCertChain(sslSession); cachedInfo=new CachedInfo(keySize,certs); sslSession.putValue(CACHED_INFO_ATTR,cachedInfo); } if (certs!=null) request.setAttribute("javax.servlet.request.X509Certificate",certs); request.setAttribute("javax.servlet.request.cipher_suite",cipherSuite); request.setAttribute("javax.servlet.request.key_size",keySize); } catch (Exception e) { Log.warn(Log.EXCEPTION,e); } } /* ------------------------------------------------------------ */ public SslSelectChannelConnector() { // Buffer sizes should be from SSL session, but not known at this stage. // size should be 16k, but appears to need 16k+1 byte? Giving it 16k+2k // just // to be safe. TODO investigate } /* ------------------------------------------------------------ */ /** * @return True if SSL re-negotiation is allowed (default false) */ public boolean isAllowRenegotiate() { return _allowRenegotiate; } /* ------------------------------------------------------------ */ /** * Set if SSL re-negotiation is allowed. CVE-2009-3555 discovered * a vulnerability in SSL/TLS with re-negotiation. If your JVM * does not have CVE-2009-3555 fixed, then re-negotiation should * not be allowed. * @param allowRenegotiate true if re-negotiation is allowed (default false) */ public void setAllowRenegotiate(boolean allowRenegotiate) { _allowRenegotiate = allowRenegotiate; } /** * * @deprecated As of Java Servlet API 2.0, with no replacement. * */ public String[] getCipherSuites() { return getExcludeCipherSuites(); } public String[] getExcludeCipherSuites() { return _excludeCipherSuites; } /** * * @deprecated As of Java Servlet API 2.0, with no replacement. * * @author <NAME> */ public void setCipherSuites(String[] cipherSuites) { setExcludeCipherSuites(cipherSuites); } public void setExcludeCipherSuites(String[] cipherSuites) { this._excludeCipherSuites=cipherSuites; } /* ------------------------------------------------------------ */ public void setPassword(String password) { _password=Password.getPassword(PASSWORD_PROPERTY,password,null); } /* ------------------------------------------------------------ */ public void setTrustPassword(String password) { _trustPassword=Password.getPassword(PASSWORD_PROPERTY,password,null); } /* ------------------------------------------------------------ */ public void setKeyPassword(String password) { _keyPassword=Password.getPassword(KEYPASSWORD_PROPERTY,password,null); } /* ------------------------------------------------------------ */ public String getAlgorithm() { return (this._algorithm); } /* ------------------------------------------------------------ */ public void setAlgorithm(String algorithm) { this._algorithm=algorithm; } /* ------------------------------------------------------------ */ public String getProtocol() { return _protocol; } /* ------------------------------------------------------------ */ public void setProtocol(String protocol) { _protocol=protocol; } /* ------------------------------------------------------------ */ public void setKeystore(String keystore) { _keystore=keystore; } /* ------------------------------------------------------------ */ public String getKeystore() { return _keystore; } /* ------------------------------------------------------------ */ public String getKeystoreType() { return (_keystoreType); } /* ------------------------------------------------------------ */ public boolean getNeedClientAuth() { return _needClientAuth; } /* ------------------------------------------------------------ */ public boolean getWantClientAuth() { return _wantClientAuth; } /* ------------------------------------------------------------ */ /** * Set the value of the needClientAuth property * * @param needClientAuth * true iff we require client certificate authentication. */ public void setNeedClientAuth(boolean needClientAuth) { _needClientAuth=needClientAuth; } public void setWantClientAuth(boolean wantClientAuth) { _wantClientAuth=wantClientAuth; } /* ------------------------------------------------------------ */ public void setKeystoreType(String keystoreType) { _keystoreType=keystoreType; } /* ------------------------------------------------------------ */ public String getProvider() { return _provider; } public String getSecureRandomAlgorithm() { return (this._secureRandomAlgorithm); } /* ------------------------------------------------------------ */ public String getSslKeyManagerFactoryAlgorithm() { return (this._sslKeyManagerFactoryAlgorithm); } /* ------------------------------------------------------------ */ public String getSslTrustManagerFactoryAlgorithm() { return (this._sslTrustManagerFactoryAlgorithm); } /* ------------------------------------------------------------ */ public String getTruststore() { return _truststore; } /* ------------------------------------------------------------ */ public String getTruststoreType() { return _truststoreType; } /* ------------------------------------------------------------ */ public void setProvider(String _provider) { this._provider=_provider; } /* ------------------------------------------------------------ */ public void setSecureRandomAlgorithm(String algorithm) { this._secureRandomAlgorithm=algorithm; } /* ------------------------------------------------------------ */ public void setSslKeyManagerFactoryAlgorithm(String algorithm) { this._sslKeyManagerFactoryAlgorithm=algorithm; } /* ------------------------------------------------------------ */ public void setSslTrustManagerFactoryAlgorithm(String algorithm) { this._sslTrustManagerFactoryAlgorithm=algorithm; } public void setTruststore(String truststore) { _truststore=truststore; } public void setTruststoreType(String truststoreType) { _truststoreType=truststoreType; } /* ------------------------------------------------------------ */ /** * By default, we're confidential, given we speak SSL. But, if we've been * told about an confidential port, and said port is not our port, then * we're not. This allows separation of listeners providing INTEGRAL versus * CONFIDENTIAL constraints, such as one SSL listener configured to require * client certs providing CONFIDENTIAL, whereas another SSL listener not * requiring client certs providing mere INTEGRAL constraints. */ public boolean isConfidential(Request request) { final int confidentialPort=getConfidentialPort(); return confidentialPort==0||confidentialPort==request.getServerPort(); } /* ------------------------------------------------------------ */ /** * By default, we're integral, given we speak SSL. But, if we've been told * about an integral port, and said port is not our port, then we're not. * This allows separation of listeners providing INTEGRAL versus * CONFIDENTIAL constraints, such as one SSL listener configured to require * client certs providing CONFIDENTIAL, whereas another SSL listener not * requiring client certs providing mere INTEGRAL constraints. */ public boolean isIntegral(Request request) { final int integralPort=getIntegralPort(); return integralPort==0||integralPort==request.getServerPort(); } /* ------------------------------------------------------------------------------- */ protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { SslHttpChannelEndPoint endp = new SslHttpChannelEndPoint(this,channel,selectSet,key,createSSLEngine()); endp.setAllowRenegotiate(_allowRenegotiate); return endp; } /* ------------------------------------------------------------------------------- */ protected Connection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint) { HttpConnection connection=(HttpConnection)super.newConnection(channel,endpoint); ((HttpParser)connection.getParser()).setForceContentBuffer(true); return connection; } /* ------------------------------------------------------------ */ protected SSLEngine createSSLEngine() throws IOException { SSLEngine engine=null; try { engine=_context.createSSLEngine(); engine.setUseClientMode(false); if (_wantClientAuth) engine.setWantClientAuth(_wantClientAuth); if (_needClientAuth) engine.setNeedClientAuth(_needClientAuth); if (_excludeCipherSuites!=null&&_excludeCipherSuites.length>0) { List<String> excludedCSList=Arrays.asList(_excludeCipherSuites); String[] enabledCipherSuites=engine.getEnabledCipherSuites(); List<String> enabledCSList=new ArrayList<String>(Arrays.asList(enabledCipherSuites)); for (String cipherName : excludedCSList) { if (enabledCSList.contains(cipherName)) { enabledCSList.remove(cipherName); } } enabledCipherSuites=enabledCSList.toArray(new String[enabledCSList.size()]); engine.setEnabledCipherSuites(enabledCipherSuites); } } catch (Exception e) { Log.warn("Error creating sslEngine -- closing this connector",e); close(); throw new IllegalStateException(e); } return engine; } protected void doStart() throws Exception { _context=createSSLContext(); SSLEngine engine=_context.createSSLEngine(); SSLSession session=engine.getSession(); if (getHeaderBufferSize()<session.getApplicationBufferSize()) setHeaderBufferSize(session.getApplicationBufferSize()); if (getRequestBufferSize()<session.getApplicationBufferSize()) setRequestBufferSize(session.getApplicationBufferSize()); super.doStart(); } protected SSLContext createSSLContext() throws Exception { if (_truststore==null) { _truststore=_keystore; _truststoreType=_keystoreType; } InputStream keystoreInputStream = null; KeyManager[] keyManagers=null; KeyStore keyStore = null; try { if (_keystore!=null) { keystoreInputStream=Resource.newResource(_keystore).getInputStream(); keyStore = KeyStore.getInstance(_keystoreType); keyStore.load(keystoreInputStream,_password==null?null:_password.toString().toCharArray()); } } finally { if (keystoreInputStream != null) keystoreInputStream.close(); } KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance(_sslKeyManagerFactoryAlgorithm); keyManagerFactory.init(keyStore,_keyPassword==null?(_password==null?null:_password.toString().toCharArray()):_keyPassword.toString().toCharArray()); keyManagers=keyManagerFactory.getKeyManagers(); TrustManager[] trustManagers=null; InputStream truststoreInputStream = null; KeyStore trustStore = null; try { if (_truststore!=null) { truststoreInputStream = Resource.newResource(_truststore).getInputStream(); trustStore=KeyStore.getInstance(_truststoreType); trustStore.load(truststoreInputStream,_trustPassword==null?null:_trustPassword.toString().toCharArray()); } } finally { if (truststoreInputStream != null) truststoreInputStream.close(); } TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance(_sslTrustManagerFactoryAlgorithm); trustManagerFactory.init(trustStore); trustManagers=trustManagerFactory.getTrustManagers(); SecureRandom secureRandom=_secureRandomAlgorithm==null?null:SecureRandom.getInstance(_secureRandomAlgorithm); SSLContext context=_provider==null?SSLContext.getInstance(_protocol):SSLContext.getInstance(_protocol,_provider); context.init(keyManagers,trustManagers,secureRandom); return context; } /** * Simple bundle of information that is cached in the SSLSession. Stores the * effective keySize and the client certificate chain. */ private class CachedInfo { private X509Certificate[] _certs; private Integer _keySize; CachedInfo(Integer keySize, X509Certificate[] certs) { this._keySize=keySize; this._certs=certs; } X509Certificate[] getCerts() { return _certs; } Integer getKeySize() { return _keySize; } } }
24,252
0.574352
0.569741
695
33.949642
29.601168
156
false
false
0
0
0
0
86
0.006999
0.4
false
false
12
e4be23b3fd918fd75d5b4645822741376895efdf
738,734,435,539
564cb343841b08e17e1f93c04b43bb09c0cdc84f
/src/main/java/com/dkjk/search/service/ElasticSearchUtil.java
c9c98a4d66267fcf853c910087d399cea7d137a3
[]
no_license
hualess/daokou-search-api
https://github.com/hualess/daokou-search-api
28657b4a7dc68c1ffc6207d882512f0bf18cbfcf
abd8ea074e3a54c49f3f24e5595f9c26f681241f
refs/heads/master
2022-10-21T18:32:11.343000
2020-01-04T08:42:40
2020-01-04T08:42:40
231,496,513
0
0
null
false
2022-10-05T18:20:58
2020-01-03T02:28:03
2020-01-04T08:47:35
2022-10-05T18:20:58
138
0
0
3
Java
false
false
package com.dkjk.search.service; import lombok.extern.slf4j.Slf4j; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.xcontent.XContentType; import org.springframework.beans.factory.annotation.Autowired; /** * @author liubaohua * @date 2019-10-29 14:19 */ @Slf4j public class ElasticSearchUtil { @Autowired RestHighLevelClient highLevelClient; public void createIndex(String indexName, String settings, String mappings) { try{ CreateIndexRequest request = new CreateIndexRequest(indexName); buildSetting(request, settings); buildIndexMapping(request, mappings); highLevelClient.indices().create(request, RequestOptions.DEFAULT); log.info("็ดขๅผ•ๅˆ›ๅปบๆˆๅŠŸ"); }catch (Exception e){ log.error("็ดขๅผ•ๅˆ›ๅปบๅคฑ่ดฅ:{}", e); } } /** * ่ฎพ็ฝฎๅˆ†็‰‡ * @param request */ private void buildSetting(CreateIndexRequest request, String settings) { request.settings(settings, XContentType.JSON); } /** * ่ฎพ็ฝฎ็ดขๅผ•็š„mapping * @param request */ private void buildIndexMapping(CreateIndexRequest request, String mappings) { request.mapping(mappings, XContentType.JSON); } }
UTF-8
Java
1,410
java
ElasticSearchUtil.java
Java
[ { "context": "eans.factory.annotation.Autowired;\n\n/**\n * @author liubaohua\n * @date 2019-10-29 14:19\n */\n@Slf4j\npublic class", "end": 385, "score": 0.996738076210022, "start": 376, "tag": "USERNAME", "value": "liubaohua" } ]
null
[]
package com.dkjk.search.service; import lombok.extern.slf4j.Slf4j; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.xcontent.XContentType; import org.springframework.beans.factory.annotation.Autowired; /** * @author liubaohua * @date 2019-10-29 14:19 */ @Slf4j public class ElasticSearchUtil { @Autowired RestHighLevelClient highLevelClient; public void createIndex(String indexName, String settings, String mappings) { try{ CreateIndexRequest request = new CreateIndexRequest(indexName); buildSetting(request, settings); buildIndexMapping(request, mappings); highLevelClient.indices().create(request, RequestOptions.DEFAULT); log.info("็ดขๅผ•ๅˆ›ๅปบๆˆๅŠŸ"); }catch (Exception e){ log.error("็ดขๅผ•ๅˆ›ๅปบๅคฑ่ดฅ:{}", e); } } /** * ่ฎพ็ฝฎๅˆ†็‰‡ * @param request */ private void buildSetting(CreateIndexRequest request, String settings) { request.settings(settings, XContentType.JSON); } /** * ่ฎพ็ฝฎ็ดขๅผ•็š„mapping * @param request */ private void buildIndexMapping(CreateIndexRequest request, String mappings) { request.mapping(mappings, XContentType.JSON); } }
1,410
0.690058
0.679094
47
28.106382
25.895235
81
false
false
0
0
0
0
0
0
0.553191
false
false
12
3734463daf17878e91e51c579a54467e66b7045a
15,942,918,635,109
19162115253524af5187a380c37b20363e2ef357
/src/main/java/model/TAccesos.java
db3d1967ed6cd74aa44228b0b9e0561bfac94c44
[]
no_license
CarlesRa/PracticaHibernateMaven
https://github.com/CarlesRa/PracticaHibernateMaven
bd3e283ec21765ad1a22252a157218806262fa40
b9bea93f4b377163d9794470fdbdf6a1c36fdb12
refs/heads/master
2022-08-12T17:57:35.498000
2019-12-05T19:59:06
2019-12-05T19:59:06
225,593,693
0
0
null
false
2022-02-10T02:33:25
2019-12-03T10:33:52
2019-12-05T19:59:49
2022-02-10T02:33:23
71
0
0
1
Java
false
false
package model; // Generated 29 nov. 2019 17:36:32 by Hibernate Tools 5.2.12.Final /** * TAccesos generated by hbm2java */ public class TAccesos implements java.io.Serializable { private int codAcceso; private TEstaciones TEstaciones; private String descripcion; public TAccesos() { } public TAccesos(int codAcceso, TEstaciones TEstaciones, String descripcion) { this.codAcceso = codAcceso; this.TEstaciones = TEstaciones; this.descripcion = descripcion; } public int getCodAcceso() { return this.codAcceso; } public void setCodAcceso(int codAcceso) { this.codAcceso = codAcceso; } public TEstaciones getTEstaciones() { return this.TEstaciones; } public void setTEstaciones(TEstaciones TEstaciones) { this.TEstaciones = TEstaciones; } public String getDescripcion() { return this.descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } }
UTF-8
Java
929
java
TAccesos.java
Java
[]
null
[]
package model; // Generated 29 nov. 2019 17:36:32 by Hibernate Tools 5.2.12.Final /** * TAccesos generated by hbm2java */ public class TAccesos implements java.io.Serializable { private int codAcceso; private TEstaciones TEstaciones; private String descripcion; public TAccesos() { } public TAccesos(int codAcceso, TEstaciones TEstaciones, String descripcion) { this.codAcceso = codAcceso; this.TEstaciones = TEstaciones; this.descripcion = descripcion; } public int getCodAcceso() { return this.codAcceso; } public void setCodAcceso(int codAcceso) { this.codAcceso = codAcceso; } public TEstaciones getTEstaciones() { return this.TEstaciones; } public void setTEstaciones(TEstaciones TEstaciones) { this.TEstaciones = TEstaciones; } public String getDescripcion() { return this.descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } }
929
0.74704
0.728741
46
19.195652
20.332689
78
false
false
0
0
0
0
0
0
1.130435
false
false
12
f67b27c24e15e2c996daa12a2acbf759c65572b4
30,459,908,115,728
8ecf7607195a8f9c02cf87d9fd143d5c4149ce07
/src/net/threebit/jvr/test/dxTests.java
14f24954074858b91cb3f33b277e9a5f1367ad13
[ "Apache-2.0" ]
permissive
kevinodotnet/jvr
https://github.com/kevinodotnet/jvr
0a7e870350979b5a3955f3663dd7d33bee1711c7
bc24f47273811a133f8de5fb701f6ac07ba459f1
refs/heads/master
2021-01-10T21:32:58.412000
2013-11-05T02:27:20
2013-11-05T02:27:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.threebit.jvr.test; /* * $Id: dxTests.java,v 1.56 2005/01/26 01:34:05 kevino Exp $ * * Copyright (c) 2003,2004 Kevin O'Donnell * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ import java.io.*; import java.util.*; import java.util.logging.Logger; import junit.framework.*; import net.threebit.jvr.*; public class dxTests extends AbstractTest { public void testX() { System.exit(1); } public void test22_uio_1() throws Exception { int d = dx.open("dxxxB1C1",0); DV_TPT[] tpt = new DV_TPT[1]; tpt[0] = new DV_TPT(); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 50; tpt[0].tp_flags = dx.TF_MAXTIME; // Create a custom UserIO object that will delete read/write/seek calls to the RandomAccessFile class. final RandomAccessFile f = new RandomAccessFile("c:\\code\\oreivr\\dict\\eng\\misc\\maximumRecordingTimeExceeded.vox","rw"); UserIO uio = new UserIO(); uio.setHandler(new UserIOHandler(){ public byte[] read (UserIO io, int len) throws IOException { logger.info("len: " + len); byte[] ret = new byte[len]; int r = f.read(ret); if (r == -1) { return null; } byte[] ret2 = new byte[r]; for (int x = 0; x < r; x++) { ret2[x] = ret[x]; } return ret2; } public long seek (UserIO io, long offset, int whence) throws IOException { logger.info("offset: " + offset + " whence: " + jvr.symbolName("SEEK_",whence)); if (whence == dx.SEEK_SET) { f.seek(offset); } else if (whence == dx.SEEK_CUR) { f.seek( f.getFilePointer() + offset ); } else if (whence == dx.SEEK_END) { f.seek( f.length() + offset ); } else { logger.info("Unknown whence value: " + whence); return -1; } return f.getFilePointer(); } public int write (UserIO io, byte[] buffer) throws IOException { logger.info("buffer.length: " + buffer.length); f.write(buffer); return buffer.length; } }); logger.info("Recording..."); dx.rec( d,new DX_IOTT[]{uio},tpt,dx.RM_TONE|dx.EV_SYNC); logger.info("Playing..."); dx.play(d,new DX_IOTT[]{uio},null,dx.EV_SYNC); logger.info("Done..."); dx.close(d); } class HideThese extends AbstractTest { public void test21_initcallp() throws Exception { int d = dx.open("dxxxB1C1",0); dx.deltones(d); dx.chgdur(dx.TID_RNGBK1, 40, 10, 20, 5); dx.chgfreq(dx.TID_RNGBK1, 367,62,470,47); dx.chgrepcnt(dx.TID_RNGBK1, 2); dx.initcallp(d); dx.close(d); } // public void testX() { System.exit(1); } /* public void test20_dxxpb_native() throws Exception { logger.info("Allocating"); DX_XPB x = new DX_XPB(); logger.info("x: " + x); try { Thread.sleep(1000); } catch (Exception ignore) { } logger.info("NULLING"); x = null; System.gc(); try { Thread.sleep(1000); } catch (Exception ignore) { } logger.info("x: " + x); logger.info("DONE"); } */ public void test19_rec_play_async() throws Exception { logger.info("0"); final DX_XPB xpb = new DX_XPB(); logger.info("1"); xpb.wFileFormat = dx.FILE_FORMAT_WAVE; logger.info("2"); xpb.wDataFormat = dx.DATA_FORMAT_PCM; logger.info("3"); xpb.nSamplesPerSec = dx.DRT_11KHZ; logger.info("4"); xpb.wBitsPerSample = 8; logger.info("A"); final DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 10; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 1; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("B"); final String filename = "dxTests-test19_recplayasync.wav"; new File(filename).delete(); final DX_IOTT[] iottArray = DX_IOTT.newArray(1); final DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); logger.info("C"); final int dxDev = dx.open("dxxxB1C1",0); logger.info("dxDev: " + dxDev); dx.stopch(dxDev,dx.EV_SYNC); // int msDev = ms.open("msiB1C1",0); /* ms.setevtmsk(msDev,ms.DTG_SIGEVT,ms.MSMM_OFFHOOK|ms.MSMM_ONHOOK|ms.MSMM_HOOKFLASH,ms.DTA_SETMSK); dx.setevtmsk(dxDev,dx.DM_SILOF|dx.DM_SILON); dx.listen(dxDev,ms.getxmitslot(msDev)); ms.listen(msDev,dx.getxmitslot(dxDev)); */ JVRMetaEventListener mel = new JVRMetaEventListener() { public boolean handleEvent (MetaEvent e) throws JVRException { if (e.evtdev != dxDev) { return true; } if (e.evttype == dx.TDX_ERROR) { logger.info(""+sr.ATDV_LASTERR((int)e.evtdev)); logger.info(""+sr.ATDV_ERRMSGP((int)e.evtdev)); synchronized (this) { notifyAll(); } } if (e.evttype == dx.TDX_RECORD) { logger.info("Playback ASYNC style."); dx.clrdigbuf(dxDev); dx.fileclose(iott.io_fhandle); iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_RDONLY|dx.WIN32_O_BINARY,0); dx.playiottdata(dxDev,iottArray,tpt,xpb,dx.EV_ASYNC); // dx.playvox (dxDev, filename, null, null, dx.EV_SYNC); // dx.playwav(dxDev, filename, null, dx.EV_SYNC); // synchronized (this) { notifyAll(); } } if (e.evttype == dx.TDX_PLAY) { logger.info("Finished playing"); logger.info("TERMMSK: " + dx.ATDX_TERMMSK(dxDev)); synchronized (this) { notifyAll(); } } return true; } }; jvr.addEventListener(mel); logger.info("Recording ASYNC style."); dx.reciottdata(dxDev,iottArray,tpt,xpb,dx.EV_ASYNC|dx.RM_TONE); logger.info("recording started"); synchronized (mel) { mel.wait(); } logger.info("finished synchronization"); jvr.removeEventListener(mel); dx.fileclose(iott.io_fhandle); dx.close(dxDev); // ms.close(msDev); logger.info("TEST finished"); } public void testX() { System.exit(1); } public void test18_no_dial_cap() throws Exception { int dxDev = dx.open("dxxxB1C1",0); int msDev = ms.open("msiB1C1",0); ms.setevtmsk(msDev,ms.DTG_SIGEVT,ms.MSMM_OFFHOOK|ms.MSMM_ONHOOK|ms.MSMM_HOOKFLASH,ms.DTA_SETMSK); dx.setevtmsk(dxDev,dx.DM_SILOF|dx.DM_SILON); dx.listen(dxDev,ms.getxmitslot(msDev)); ms.listen(msDev,dx.getxmitslot(dxDev)); logger.info("Starting CAP using dx.dial"); DX_CAP cap = new DX_CAP(); cap.ca_nbrdna = 8; cap.ca_intflg = dx.DX_PAMDOPTEN; cap.ca_pamd_spdval = (byte) dx.PAMD_ACCU; cap.ca_hedge = 1; long cpterm = dx.dial(dxDev,"",cap,dx.EV_SYNC|dx.DX_CALLP); if (cpterm == dx.CR_CNCT) { // Since this is ISDN specific, we expect only one of // CON_PVD or CON_PAMD long cpConnType = dx.ATDX_CONNTYPE(dxDev); if (cpConnType == dx.CON_CAD) { logger.info("CON_CAD"); } else if (cpConnType == dx.CON_PVD) { logger.info("CON_PVD"); } else if (cpConnType == dx.CON_PAMD) { logger.info("CON_PAMD"); logger.info("SILON_SILOFF set"); dx.setevtmsk(dxDev,dx.DM_SILOF|dx.DM_SILON); try { Thread.sleep(30*1000); } catch (Exception ignore) { } } else if (cpConnType == dx.CON_LPC) { logger.info("CON_LPC"); } else { throw new RuntimeException("Not possible"); } } else if (cpterm == dx.CR_BUSY) { logger.info("CR_BUSY"); } else if (cpterm == dx.CR_CEPT) { logger.info("CR_CEPT"); } else if (cpterm == dx.CR_ERROR) { logger.info("CR_ERROR"); } else if (cpterm == dx.CR_FAXTONE) { logger.info("CR_FAXTONE"); } else if (cpterm == dx.CR_NOANS) { logger.info("CR_NOANS"); } else if (cpterm == dx.CR_NODIALTONE) { logger.info("CR_NODIALTONE"); } else if (cpterm == dx.CR_NORB) { logger.info("CR_NORB"); } else if (cpterm == dx.CR_STOPD) { logger.info("CR_STOPD"); } else { throw new RuntimeException("ERROR: this condition should never be true."); } dx.close(dxDev); ms.close(msDev); } public void test17_wtring_and_getdigits_again() throws Exception { int dev = dx.open("dxxxB1C1",0); dx.clrdigbuf(dev); for (int x = 0; x < 1; x++) { logger.info("sethook(ONHOOK)"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); logger.info("wtring()"); dx.wtring(dev, 1, dx.DX_OFFHOOK, -1); DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 10 * 10; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 5; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("getdig()"); logger.info(" got: " + dx.getdig(dev, tpt, null, dx.EV_SYNC)); logger.info("sethook(ONHOOK)"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); try { for (int i = 0; i < 15; i++) { logger.info("Sleeping " + (15-i)); Thread.sleep(1000); } } catch (Exception ignore) { } } dx.close(dev); } public void test16_wtring_and_getdigits() throws Exception { int dev = dx.open("dxxxB1C1",0); dx.clrdigbuf(dev); logger.info("setting hook state"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); logger.info("waiting for a ring"); dx.wtring(dev, 1, dx.DX_OFFHOOK, -1); DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 10 * 10; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 25; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("waiting for digits"); String phoneNumber = dx.getdig(dev, tpt, null, dx.EV_SYNC); logger.info("got: '"+phoneNumber+"'"); logger.info("hangup and close"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); dx.close(dev); } public void test15_fileopen_linux() throws Exception { if (! linux) { return; } int dxdev = dx.open("dxxxB1C1",0); int f = dx.fileopen( "/tmp/testfile.vox", dx.LINUX_O_CREAT, 777 ); dx.fileclose(f); dx.close(dxdev); } public void test14_wtcallid() throws Exception { int dxdev = dx.open("dxxxB1C1",0); try { logger.info("enabling callerid."); dx.setparm(dxdev,dx.DXCH_CALLID,dx.DX_CALLIDENABLE); logger.info("wtcallid()"); String callid = dx.wtcallid(dxdev,2,-1); logger.info("wtcallid() returned: '"+callid+"'"); } catch (JVRException e) { logger.throwing(getClass().getName(),"test14_wtcallid",e); } dx.close(dxdev); } public void test13_recwav() throws Exception { int dxdev = dx.open("dxxxB1C1",0); int msdev = ms.open("msiB1C1",0); ms.listen(msdev, dx.getxmitslot(dxdev)); dx.listen(dxdev, ms.getxmitslot(msdev)); String filename = "dxTests-test13_recwav.wav"; DX_XPB xpb = null; DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 50; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 1; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("recwav()"); dx.recwav(dxdev, filename, tpt, xpb, dx.RM_TONE|dx.EV_SYNC); tpt = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXDTMF; tpt[0].tp_length = 1; tpt[0].tp_flags = dx.TF_MAXDTMF; logger.info("playwav()"); dx.playwav(dxdev, filename, tpt, dx.EV_SYNC); dx.close(dxdev); ms.close(msdev); } public void test1_openclose() throws Exception { int dev = dx.open("dxxxB1C1",0); assertTrue(dev > 0); dx.close(dev); } /*public void test2_sethook_and_events() throws Exception { class Test2EventListener extends JVREventListener { public int times = 0; public boolean handleEvent (Event e) { // Remember how many times we've seen an event. times ++; return true; } } Test2EventListener el = new Test2EventListener(); jvr.addEventListener(el); int dev = dx.open("dxxxB1C1",0); dx.setevtmsk( dev, dx.DM_LCOFF| dx.DM_LCON| dx.DM_RINGS| dx.DM_RNGOFF| dx.DM_SILOF| dx.DM_SILON| dx.DM_WINK| dx.DM_LCREV ); assertTrue(dev > 0); for (int x = 0; x < 2; x++) { dx.sethook(dev,jvr.DX_ONHOOK,jvr.EV_ASYNC); Thread.sleep(100); } dx.close(dev); Thread.sleep(200); // Make sure that out custom event listener saw at least // two events go by. assertTrue(el.times >= 2); jvr.removeEventListener(el); }*/ public void test3_getxmitslot_listen() throws Exception { int d1 = dx.open("dxxxB1C1",0); int d2 = dx.open("dxxxB1C2",0); dx.unlisten(d1); dx.unlisten(d2); dx.listen(d1, dx.getxmitslot(d2)); dx.listen(d2, dx.getxmitslot(d1)); dx.close(d1); dx.close(d2); } /** * */ public void test4_listen_dial() throws Exception { logger.info("Listen to dialing on MSI port"); int dxdev = dx.open("dxxxB1C1",0); int msdev = ms.open("msiB1C1",0); ms.listen(msdev, dx.getxmitslot(dxdev)); dx.listen(dxdev, ms.getxmitslot(msdev)); for (int x = 3; x > 3; x--) { logger.info(" " + x + " more second(s)"); dx.dial(dxdev,"6135551212",null,dx.EV_SYNC); Thread.sleep(100); } dx.close(dxdev); ms.close(msdev); } /*public void test5_dial_digitevt() throws Exception { int d1 = dx.open("dxxxB1C1",0); int d2 = dx.open("dxxxB1C2",0); logger.info("Dialing on dxxxB1C1; should see DG_DIGIT event on dxxxB1C2"); dx.listen(d1, dx.getxmitslot(d2)); dx.listen(d2, dx.getxmitslot(d1)); dx.setevtmsk(d1, dx.DM_DIGITS); dx.setevtmsk(d2, dx.DM_DIGITS); JVREventListener el = new JVREventListener() { public boolean handleEvent (Event e) { return true; } }; jvr.addEventListener(el); for (int x = 0; x < 3; x++) { String dialstr = ""+x; logger.info("dialing: " + dialstr); dx.dial(d1,dialstr,null,dx.EV_SYNC); // Thread.sleep(1000) } jvr.removeEventListener(el); dx.close(d1); dx.close(d2); }*/ /* * public void test6_event_load() throws Exception { final int toSend = 3; final int[] eventCount = new int[24]; final int[] sentCount = new int[24]; final int[] dev = new int[24]; class TestEventListener extends JVREventListener { public boolean handleEvent (Event e) { // count up the number of events for each device. int offset = -1; for (int x = 0; x < 24; x++) { if (e.device == dev[x]) { offset = x; } } eventCount[offset]++; return true; } } ArrayList dialers = new ArrayList(); for (int x = 0; x < 24; x++) { int chan = ((x+1)%4)+1; int board = (x/4)+1; dev[x] = dx.open("dxxxB"+board+"C"+chan,0); dx.unlisten(dev[x]); } // Make the last 12 listen to the first twelve. for (int x = 0; x < 12; x++) { dx.listen(dev[x+12], dx.getxmitslot(dev[x])); dx.setevtmsk(dev[x+12], dx.DM_DIGITS); } TestEventListener el = new TestEventListener(); jvr.addEventListener(el); int threadCount = 0; // Create 12 thread to dial on the first 12. for (int x = 0; x < 12; x++) { final int mydev = dev[x]; final int offset = x; Thread dialer = new Thread() { public void run() { java.util.Random r = new Random(); try { for (int y = 0; y < toSend; y++) { dx.dial(mydev,""+y,null,dx.EV_SYNC); sentCount[offset]++; try { Thread.sleep(400 + r.nextInt(200)); } catch (Exception ignore) { } } } catch (JVRException e) { logger.throwing(getClass().getName(),"run",e); } } }; threadCount ++; dialer.start(); dialers.add(dialer); } for (Iterator i = dialers.iterator(); i.hasNext(); ) { logger.info("waiting for dialers to finish: " + threadCount); Thread t = (Thread) i.next(); t.join(); threadCount--; } Thread.sleep(1000); jvr.removeEventListener(el); for (int x = 0; x < 12; x++) { dx.close(dev[x]); try { assertTrue(eventCount[x] == 0); assertTrue(sentCount[x] == toSend); } catch (AssertionFailedError e) { logger.info("offset: " + x + " count: " + eventCount[x] + " sent: " + sentCount[x]); throw e; } } for (int x = 12; x < 24; x++) { dx.close(dev[x]); try { assertTrue(eventCount[x] == toSend); assertTrue(sentCount[x] == 0); } catch (AssertionFailedError e) { logger.info("offset: " + x + " count: " + eventCount[x] + " sent: " + sentCount[x]); throw e; } } } */ public void test7_tones() throws Exception { int dev = dx.open("dxxxB1C1",0); int msi = ms.open("msiB1C1",0); dx.unlisten(dev); ms.listen(msi,dx.getxmitslot(dev)); ms.close(msi); TN_GENCAD tngencad = new TN_GENCAD(); tngencad.cycles = 1; tngencad.numsegs = 1; tngencad.tone[0] = dx.bldtngen(440,480,-19,-19,200); // dialtone. tngencad.offtime[0] = 400; // 4 seconds. DV_TPT tpt[] = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 200; // 20 seconds (3 rings) tpt[0].tp_flags = dx.TF_MAXTIME; logger.info("Playing regular ring back cadence (4 seconds of silence)"); dx.playtoneEx(dev,tngencad,tpt,dx.EV_SYNC); logger.info("Playing dial tone for 2 seconds"); tpt[0].tp_length = 20; TN_GEN tngen = dx.bldtngen(350,440,-20,-20,-1); dx.playtone(dev,tngen,tpt,dx.EV_SYNC); dx.close(dev); } /*public void test8_getdig() throws Exception { DV_DIGIT digit = new DV_DIGIT(); final int dx1 = dx.open("dxxxB1C1",0); final int dx2 = dx.open("dxxxB1C2",0); dx.listen(dx1,dx.getxmitslot(dx2)); dx.listen(dx2,dx.getxmitslot(dx1)); dx.stopch(dx1,dx.EV_SYNC); dx.stopch(dx2,dx.EV_SYNC); dx.setevtmsk(dx1, dx.DM_DIGOFF); dx.setevtmsk(dx2, dx.DM_DIGOFF); final DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXDTMF; tpt[0].tp_length = 1; tpt[0].tp_flags = dx.TF_MAXDTMF; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_IDDTIME; tpt[1].tp_length = 100; tpt[1].tp_flags = dx.TF_MAXSIL; class TestEventListener extends JVREventListener { int dials = 0; public DV_DIGIT asyncBuf = null; public boolean handleEvent (Event e) throws JVRException { if (e.type == dx.TDX_DIAL && e.device == dx1) { // previous dialing I/O finished; Wait three seconds then // kick off another one. We need to delay so that the // GETDIG DV_TPT specs allow getdig() to finish. // Do the waiting in a thread so that the event handler is // not blocked. String dialStr = ""+dials++; logger.info("ASYNC dial '"+dialStr+"' start"); dx.dial(dx1,dialStr,null,dx.EV_ASYNC); } else if (e.type == dx.TDX_GETDIG && e.device == dx2) { // Since we only get events on ASYNC, report on the last sync operation. logger.info("TDX_GETDIG/ASYNC (digits: '"+asyncBuf+"')"); Thread syncWorker = new Thread() { public void run() { try { // SYNC varient 1. logger.info("getdig(SYNC)"); String s = dx.getdig(dx2, tpt, null, dx.EV_SYNC); logger.info(" (s: '"+s+"')"); // SYNC varient 2. logger.info("getdig(SYNC)"); DV_DIGIT digBuf = new DV_DIGIT(); s = dx.getdig(dx2, tpt, digBuf, dx.EV_SYNC); logger.info(" (digits: '"+digBuf+"' s: '"+s+"')"); // And, finally, kick out another ASYNC request to repeat the cycle of life. logger.info("getdig(ASYNC)"); asyncBuf = new DV_DIGIT(); dx.getdig(dx2, tpt, asyncBuf, dx.EV_ASYNC); } catch (Exception e) { logger.throwing(getClass().getName(),"run",e); } } }; syncWorker.start(); } else { logger.info("UNHANDLED EVENT !!!!!"); } return true; } } TestEventListener el = new TestEventListener(); jvr.addEventListener(el); // Kick off the ASYNC operations el.asyncBuf = new DV_DIGIT(); logger.info("//////////////////////////////////////////////////////////"); logger.info("ASYNC getdig start"); dx.getdig(dx2, tpt, el.asyncBuf, dx.EV_ASYNC); logger.info("ASYNC dial '0' start"); dx.dial(dx1,"0",null,dx.EV_ASYNC); while (el.dials < 3) { try { Thread.sleep(1000); } catch (Exception ignore) { } } jvr.removeEventListener(el); dx.stopch(dx1,dx.EV_SYNC); dx.stopch(dx2,dx.EV_SYNC); dx.close(dx1); dx.close(dx2); logger.info("//////////////////////////////////////////////////////////"); }*/ public void test9_recplay() throws Exception { DX_XPB xpb = null; DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 50; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 1; tpt[1].tp_flags = dx.TF_MAXDTMF; int dxDev = dx.open("dxxxB1C1",0); int msDev = ms.open("msiB1C1",0); dx.listen(dxDev, ms.getxmitslot(msDev)); ms.listen(msDev, dx.getxmitslot(dxDev)); String rec1 = "test9_recf-1.vox"; logger.info("recf() " + rec1); dx.recf(dxDev, rec1, tpt, dx.RM_TONE|dx.EV_SYNC); logger.info("playvox() " + rec1); dx.playvox (dxDev, rec1, null, null, dx.EV_SYNC); ms.close(msDev); dx.close(dxDev); } /*public void test10_rec_iott() throws Exception { if (win32) { final int dxDev = dx.open("dxxxB1C1",0); int msDev = ms.open("msiB1C1",0); dx.listen(dxDev, ms.getxmitslot(msDev)); ms.listen(msDev, dx.getxmitslot(dxDev)); final DV_TPT tpt[] = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 20; tpt[0].tp_flags = dx.TF_MAXTIME; // // EV_SYNC // final String filename = "test.vox"; { new File(filename).delete(); DX_IOTT[] iottArray = DX_IOTT.newArray(1); DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); iott.io_length = -1; logger.info("dx.rec()"); dx.rec(dxDev,iottArray,tpt,dx.RM_TONE|dx.EV_SYNC); dx.fileclose(iott.io_fhandle); logger.info("dx.playvox()"); dx.playvox (dxDev, filename, null, null, dx.EV_SYNC); } // // EV_ASYNC // // The DX_IOTT object needs to remain in-scope for the entire duration of the asynchronous call to dx_rec() new File(filename).delete(); final DX_IOTT[] iottArray = DX_IOTT.newArray(1); final DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); iott.io_length = -1; class TEL extends JVREventListener { public boolean handleEvent (Event e) throws JVRException { if (e.type == dx.TDX_DIAL) { // start ASYNC recording logger.info("dx.rec() EV_ASYNC"); dx.rec(dxDev,iottArray,tpt,dx.RM_TONE|dx.EV_ASYNC); } if (e.type == dx.TDX_RECORD) { // play back recorded file dx.fileclose(iott.io_fhandle); // done synchronized (this) { notifyAll(); } } if (e.type == dx.TDX_PLAY) { } return true; } } TEL el = new TEL(); jvr.addEventListener(el); dx.dial(dxDev,"1",null,dx.EV_ASYNC); // to kick the context into the event handler. synchronized (el) { el.wait(); } jvr.removeEventListener(el); logger.info("dx.playvox() EV_SYNC"); dx.playvox (dxDev, filename, null, null, dx.EV_SYNC); // // EV_ASYNC // dx.close(dxDev); ms.close(msDev); } if (linux) { throw new Exception("TODO: write a DX_IOTT and dx_recf() test for LINUX"); } }*/ public void test11_wtring() throws Exception { int dxdev = dx.open("dxxxB1C1",0); final int msdev = ms.open("msiB1C1",0); dx.listen(dxdev, ms.getxmitslot(msdev)); ms.listen(msdev, dx.getxmitslot(dxdev)); ms.stopfn(msdev,ms.MTF_RING); dx.stopch(dxdev,dx.EV_SYNC); Thread ringer = new Thread() { public void run() { try { sleep(1000); logger.info("generating RING"); ms.genring(msdev,2,ms.EV_SYNC); } catch (Exception ignore) { } } }; ringer.start(); logger.info("waiting for ring"); try { dx.wtring(dxdev, 2, dx.DX_ONHOOK, 10); assertTrue(false); } catch (DialogicException e) { // TODO: assert that the exception is an I/O timeout exception. // logger.throwing(getClass().getName(),"test11_wtring",e); } dx.close(dxdev); ms.close(msdev); } /*public void test12_mreciottdata() throws Exception { if (!win32) { return; } // win32 only test. final int dx1 = dx.open("dxxxB1C1",0); final int dx2 = dx.open("dxxxB1C2",0); final int dx3 = dx.open("dxxxB1C3",0); int msi = ms.open("msiB1C1",0); ms.unlisten(msi); dx.stopch(dx1,dx.EV_SYNC); dx.stopch(dx2,dx.EV_SYNC); dx.stopch(dx3,dx.EV_SYNC); // Use dx1 and dx2 to create "noise" suitable for recording. // This event listener will guarantee that noise keeps happening // until the event listener is removed. class TEL extends JVREventListener { public boolean handleEvent (Event e) throws JVRException { if (e.device == dx1 || e.device == dx2) { String dial = "1"; if (e.device == dx2) { dial = "2"; } dx.dial(e.device,dial,null,dx.EV_ASYNC); } return true; } } TEL tel = new TEL(); jvr.addEventListener(tel); logger.info("Kicking out the events! Why are the events not showing up?"); ms.listen(msi,dx.getxmitslot(dx1)); dx.dial(dx1,"0",null,dx.EV_ASYNC); dx.dial(dx2,"0",null,dx.EV_ASYNC); // Prepare timeslot info for the two slots we will record. SC_TSINFO tsinfo = new SC_TSINFO(); tsinfo.add( dx.getxmitslot(dx1).ts() ); tsinfo.add( dx.getxmitslot(dx2).ts() ); logger.info("" + tsinfo); DX_IOTT[] iottArray = DX_IOTT.newArray(1); DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen("mreciottdata_test.vox",dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); iott.io_length = -1; DV_TPT tpt[] = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 30; tpt[0].tp_flags = dx.TF_MAXTIME; DX_XPB xpb = new DX_XPB(); xpb.wFileFormat = dx.FILE_FORMAT_VOX; xpb.wDataFormat = dx.DATA_FORMAT_DIALOGIC_ADPCM; xpb.nSamplesPerSec = dx.DRT_8KHZ; xpb.wBitsPerSample = 4; logger.info("iott : " + DX_IOTT.toString(iottArray)); logger.info("tpt : " + DV_TPT.toString(tpt)); logger.info("xpb : " + xpb); logger.info("tsinfo: " + tsinfo); dx.mreciottdata(dx3,iottArray,tpt,xpb,0,tsinfo); dx.fileclose(iott.io_fhandle); dx.unlisten(dx3); ms.listen(msi,dx.getxmitslot(dx3)); logger.info("done; playback the file"); dx.playvox(dx3,"mreciottdata_test.vox",null,null,dx.EV_SYNC); jvr.removeEventListener(tel); dx.close(dx1); dx.close(dx2); dx.close(dx3); ms.close(msi); }*/ } // class HideThese }
UTF-8
Java
27,968
java
dxTests.java
Java
[ { "context": "34:05 kevino Exp $\r\n *\r\n * Copyright (c) 2003,2004 Kevin O'Donnell\r\n * \r\n * This library is free software; you can r", "end": 146, "score": 0.9997599720954895, "start": 131, "tag": "NAME", "value": "Kevin O'Donnell" } ]
null
[]
package net.threebit.jvr.test; /* * $Id: dxTests.java,v 1.56 2005/01/26 01:34:05 kevino Exp $ * * Copyright (c) 2003,2004 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ import java.io.*; import java.util.*; import java.util.logging.Logger; import junit.framework.*; import net.threebit.jvr.*; public class dxTests extends AbstractTest { public void testX() { System.exit(1); } public void test22_uio_1() throws Exception { int d = dx.open("dxxxB1C1",0); DV_TPT[] tpt = new DV_TPT[1]; tpt[0] = new DV_TPT(); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 50; tpt[0].tp_flags = dx.TF_MAXTIME; // Create a custom UserIO object that will delete read/write/seek calls to the RandomAccessFile class. final RandomAccessFile f = new RandomAccessFile("c:\\code\\oreivr\\dict\\eng\\misc\\maximumRecordingTimeExceeded.vox","rw"); UserIO uio = new UserIO(); uio.setHandler(new UserIOHandler(){ public byte[] read (UserIO io, int len) throws IOException { logger.info("len: " + len); byte[] ret = new byte[len]; int r = f.read(ret); if (r == -1) { return null; } byte[] ret2 = new byte[r]; for (int x = 0; x < r; x++) { ret2[x] = ret[x]; } return ret2; } public long seek (UserIO io, long offset, int whence) throws IOException { logger.info("offset: " + offset + " whence: " + jvr.symbolName("SEEK_",whence)); if (whence == dx.SEEK_SET) { f.seek(offset); } else if (whence == dx.SEEK_CUR) { f.seek( f.getFilePointer() + offset ); } else if (whence == dx.SEEK_END) { f.seek( f.length() + offset ); } else { logger.info("Unknown whence value: " + whence); return -1; } return f.getFilePointer(); } public int write (UserIO io, byte[] buffer) throws IOException { logger.info("buffer.length: " + buffer.length); f.write(buffer); return buffer.length; } }); logger.info("Recording..."); dx.rec( d,new DX_IOTT[]{uio},tpt,dx.RM_TONE|dx.EV_SYNC); logger.info("Playing..."); dx.play(d,new DX_IOTT[]{uio},null,dx.EV_SYNC); logger.info("Done..."); dx.close(d); } class HideThese extends AbstractTest { public void test21_initcallp() throws Exception { int d = dx.open("dxxxB1C1",0); dx.deltones(d); dx.chgdur(dx.TID_RNGBK1, 40, 10, 20, 5); dx.chgfreq(dx.TID_RNGBK1, 367,62,470,47); dx.chgrepcnt(dx.TID_RNGBK1, 2); dx.initcallp(d); dx.close(d); } // public void testX() { System.exit(1); } /* public void test20_dxxpb_native() throws Exception { logger.info("Allocating"); DX_XPB x = new DX_XPB(); logger.info("x: " + x); try { Thread.sleep(1000); } catch (Exception ignore) { } logger.info("NULLING"); x = null; System.gc(); try { Thread.sleep(1000); } catch (Exception ignore) { } logger.info("x: " + x); logger.info("DONE"); } */ public void test19_rec_play_async() throws Exception { logger.info("0"); final DX_XPB xpb = new DX_XPB(); logger.info("1"); xpb.wFileFormat = dx.FILE_FORMAT_WAVE; logger.info("2"); xpb.wDataFormat = dx.DATA_FORMAT_PCM; logger.info("3"); xpb.nSamplesPerSec = dx.DRT_11KHZ; logger.info("4"); xpb.wBitsPerSample = 8; logger.info("A"); final DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 10; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 1; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("B"); final String filename = "dxTests-test19_recplayasync.wav"; new File(filename).delete(); final DX_IOTT[] iottArray = DX_IOTT.newArray(1); final DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); logger.info("C"); final int dxDev = dx.open("dxxxB1C1",0); logger.info("dxDev: " + dxDev); dx.stopch(dxDev,dx.EV_SYNC); // int msDev = ms.open("msiB1C1",0); /* ms.setevtmsk(msDev,ms.DTG_SIGEVT,ms.MSMM_OFFHOOK|ms.MSMM_ONHOOK|ms.MSMM_HOOKFLASH,ms.DTA_SETMSK); dx.setevtmsk(dxDev,dx.DM_SILOF|dx.DM_SILON); dx.listen(dxDev,ms.getxmitslot(msDev)); ms.listen(msDev,dx.getxmitslot(dxDev)); */ JVRMetaEventListener mel = new JVRMetaEventListener() { public boolean handleEvent (MetaEvent e) throws JVRException { if (e.evtdev != dxDev) { return true; } if (e.evttype == dx.TDX_ERROR) { logger.info(""+sr.ATDV_LASTERR((int)e.evtdev)); logger.info(""+sr.ATDV_ERRMSGP((int)e.evtdev)); synchronized (this) { notifyAll(); } } if (e.evttype == dx.TDX_RECORD) { logger.info("Playback ASYNC style."); dx.clrdigbuf(dxDev); dx.fileclose(iott.io_fhandle); iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_RDONLY|dx.WIN32_O_BINARY,0); dx.playiottdata(dxDev,iottArray,tpt,xpb,dx.EV_ASYNC); // dx.playvox (dxDev, filename, null, null, dx.EV_SYNC); // dx.playwav(dxDev, filename, null, dx.EV_SYNC); // synchronized (this) { notifyAll(); } } if (e.evttype == dx.TDX_PLAY) { logger.info("Finished playing"); logger.info("TERMMSK: " + dx.ATDX_TERMMSK(dxDev)); synchronized (this) { notifyAll(); } } return true; } }; jvr.addEventListener(mel); logger.info("Recording ASYNC style."); dx.reciottdata(dxDev,iottArray,tpt,xpb,dx.EV_ASYNC|dx.RM_TONE); logger.info("recording started"); synchronized (mel) { mel.wait(); } logger.info("finished synchronization"); jvr.removeEventListener(mel); dx.fileclose(iott.io_fhandle); dx.close(dxDev); // ms.close(msDev); logger.info("TEST finished"); } public void testX() { System.exit(1); } public void test18_no_dial_cap() throws Exception { int dxDev = dx.open("dxxxB1C1",0); int msDev = ms.open("msiB1C1",0); ms.setevtmsk(msDev,ms.DTG_SIGEVT,ms.MSMM_OFFHOOK|ms.MSMM_ONHOOK|ms.MSMM_HOOKFLASH,ms.DTA_SETMSK); dx.setevtmsk(dxDev,dx.DM_SILOF|dx.DM_SILON); dx.listen(dxDev,ms.getxmitslot(msDev)); ms.listen(msDev,dx.getxmitslot(dxDev)); logger.info("Starting CAP using dx.dial"); DX_CAP cap = new DX_CAP(); cap.ca_nbrdna = 8; cap.ca_intflg = dx.DX_PAMDOPTEN; cap.ca_pamd_spdval = (byte) dx.PAMD_ACCU; cap.ca_hedge = 1; long cpterm = dx.dial(dxDev,"",cap,dx.EV_SYNC|dx.DX_CALLP); if (cpterm == dx.CR_CNCT) { // Since this is ISDN specific, we expect only one of // CON_PVD or CON_PAMD long cpConnType = dx.ATDX_CONNTYPE(dxDev); if (cpConnType == dx.CON_CAD) { logger.info("CON_CAD"); } else if (cpConnType == dx.CON_PVD) { logger.info("CON_PVD"); } else if (cpConnType == dx.CON_PAMD) { logger.info("CON_PAMD"); logger.info("SILON_SILOFF set"); dx.setevtmsk(dxDev,dx.DM_SILOF|dx.DM_SILON); try { Thread.sleep(30*1000); } catch (Exception ignore) { } } else if (cpConnType == dx.CON_LPC) { logger.info("CON_LPC"); } else { throw new RuntimeException("Not possible"); } } else if (cpterm == dx.CR_BUSY) { logger.info("CR_BUSY"); } else if (cpterm == dx.CR_CEPT) { logger.info("CR_CEPT"); } else if (cpterm == dx.CR_ERROR) { logger.info("CR_ERROR"); } else if (cpterm == dx.CR_FAXTONE) { logger.info("CR_FAXTONE"); } else if (cpterm == dx.CR_NOANS) { logger.info("CR_NOANS"); } else if (cpterm == dx.CR_NODIALTONE) { logger.info("CR_NODIALTONE"); } else if (cpterm == dx.CR_NORB) { logger.info("CR_NORB"); } else if (cpterm == dx.CR_STOPD) { logger.info("CR_STOPD"); } else { throw new RuntimeException("ERROR: this condition should never be true."); } dx.close(dxDev); ms.close(msDev); } public void test17_wtring_and_getdigits_again() throws Exception { int dev = dx.open("dxxxB1C1",0); dx.clrdigbuf(dev); for (int x = 0; x < 1; x++) { logger.info("sethook(ONHOOK)"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); logger.info("wtring()"); dx.wtring(dev, 1, dx.DX_OFFHOOK, -1); DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 10 * 10; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 5; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("getdig()"); logger.info(" got: " + dx.getdig(dev, tpt, null, dx.EV_SYNC)); logger.info("sethook(ONHOOK)"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); try { for (int i = 0; i < 15; i++) { logger.info("Sleeping " + (15-i)); Thread.sleep(1000); } } catch (Exception ignore) { } } dx.close(dev); } public void test16_wtring_and_getdigits() throws Exception { int dev = dx.open("dxxxB1C1",0); dx.clrdigbuf(dev); logger.info("setting hook state"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); logger.info("waiting for a ring"); dx.wtring(dev, 1, dx.DX_OFFHOOK, -1); DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 10 * 10; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 25; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("waiting for digits"); String phoneNumber = dx.getdig(dev, tpt, null, dx.EV_SYNC); logger.info("got: '"+phoneNumber+"'"); logger.info("hangup and close"); dx.sethook(dev,dx.DX_ONHOOK,dx.EV_SYNC); dx.close(dev); } public void test15_fileopen_linux() throws Exception { if (! linux) { return; } int dxdev = dx.open("dxxxB1C1",0); int f = dx.fileopen( "/tmp/testfile.vox", dx.LINUX_O_CREAT, 777 ); dx.fileclose(f); dx.close(dxdev); } public void test14_wtcallid() throws Exception { int dxdev = dx.open("dxxxB1C1",0); try { logger.info("enabling callerid."); dx.setparm(dxdev,dx.DXCH_CALLID,dx.DX_CALLIDENABLE); logger.info("wtcallid()"); String callid = dx.wtcallid(dxdev,2,-1); logger.info("wtcallid() returned: '"+callid+"'"); } catch (JVRException e) { logger.throwing(getClass().getName(),"test14_wtcallid",e); } dx.close(dxdev); } public void test13_recwav() throws Exception { int dxdev = dx.open("dxxxB1C1",0); int msdev = ms.open("msiB1C1",0); ms.listen(msdev, dx.getxmitslot(dxdev)); dx.listen(dxdev, ms.getxmitslot(msdev)); String filename = "dxTests-test13_recwav.wav"; DX_XPB xpb = null; DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 50; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 1; tpt[1].tp_flags = dx.TF_MAXDTMF; logger.info("recwav()"); dx.recwav(dxdev, filename, tpt, xpb, dx.RM_TONE|dx.EV_SYNC); tpt = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXDTMF; tpt[0].tp_length = 1; tpt[0].tp_flags = dx.TF_MAXDTMF; logger.info("playwav()"); dx.playwav(dxdev, filename, tpt, dx.EV_SYNC); dx.close(dxdev); ms.close(msdev); } public void test1_openclose() throws Exception { int dev = dx.open("dxxxB1C1",0); assertTrue(dev > 0); dx.close(dev); } /*public void test2_sethook_and_events() throws Exception { class Test2EventListener extends JVREventListener { public int times = 0; public boolean handleEvent (Event e) { // Remember how many times we've seen an event. times ++; return true; } } Test2EventListener el = new Test2EventListener(); jvr.addEventListener(el); int dev = dx.open("dxxxB1C1",0); dx.setevtmsk( dev, dx.DM_LCOFF| dx.DM_LCON| dx.DM_RINGS| dx.DM_RNGOFF| dx.DM_SILOF| dx.DM_SILON| dx.DM_WINK| dx.DM_LCREV ); assertTrue(dev > 0); for (int x = 0; x < 2; x++) { dx.sethook(dev,jvr.DX_ONHOOK,jvr.EV_ASYNC); Thread.sleep(100); } dx.close(dev); Thread.sleep(200); // Make sure that out custom event listener saw at least // two events go by. assertTrue(el.times >= 2); jvr.removeEventListener(el); }*/ public void test3_getxmitslot_listen() throws Exception { int d1 = dx.open("dxxxB1C1",0); int d2 = dx.open("dxxxB1C2",0); dx.unlisten(d1); dx.unlisten(d2); dx.listen(d1, dx.getxmitslot(d2)); dx.listen(d2, dx.getxmitslot(d1)); dx.close(d1); dx.close(d2); } /** * */ public void test4_listen_dial() throws Exception { logger.info("Listen to dialing on MSI port"); int dxdev = dx.open("dxxxB1C1",0); int msdev = ms.open("msiB1C1",0); ms.listen(msdev, dx.getxmitslot(dxdev)); dx.listen(dxdev, ms.getxmitslot(msdev)); for (int x = 3; x > 3; x--) { logger.info(" " + x + " more second(s)"); dx.dial(dxdev,"6135551212",null,dx.EV_SYNC); Thread.sleep(100); } dx.close(dxdev); ms.close(msdev); } /*public void test5_dial_digitevt() throws Exception { int d1 = dx.open("dxxxB1C1",0); int d2 = dx.open("dxxxB1C2",0); logger.info("Dialing on dxxxB1C1; should see DG_DIGIT event on dxxxB1C2"); dx.listen(d1, dx.getxmitslot(d2)); dx.listen(d2, dx.getxmitslot(d1)); dx.setevtmsk(d1, dx.DM_DIGITS); dx.setevtmsk(d2, dx.DM_DIGITS); JVREventListener el = new JVREventListener() { public boolean handleEvent (Event e) { return true; } }; jvr.addEventListener(el); for (int x = 0; x < 3; x++) { String dialstr = ""+x; logger.info("dialing: " + dialstr); dx.dial(d1,dialstr,null,dx.EV_SYNC); // Thread.sleep(1000) } jvr.removeEventListener(el); dx.close(d1); dx.close(d2); }*/ /* * public void test6_event_load() throws Exception { final int toSend = 3; final int[] eventCount = new int[24]; final int[] sentCount = new int[24]; final int[] dev = new int[24]; class TestEventListener extends JVREventListener { public boolean handleEvent (Event e) { // count up the number of events for each device. int offset = -1; for (int x = 0; x < 24; x++) { if (e.device == dev[x]) { offset = x; } } eventCount[offset]++; return true; } } ArrayList dialers = new ArrayList(); for (int x = 0; x < 24; x++) { int chan = ((x+1)%4)+1; int board = (x/4)+1; dev[x] = dx.open("dxxxB"+board+"C"+chan,0); dx.unlisten(dev[x]); } // Make the last 12 listen to the first twelve. for (int x = 0; x < 12; x++) { dx.listen(dev[x+12], dx.getxmitslot(dev[x])); dx.setevtmsk(dev[x+12], dx.DM_DIGITS); } TestEventListener el = new TestEventListener(); jvr.addEventListener(el); int threadCount = 0; // Create 12 thread to dial on the first 12. for (int x = 0; x < 12; x++) { final int mydev = dev[x]; final int offset = x; Thread dialer = new Thread() { public void run() { java.util.Random r = new Random(); try { for (int y = 0; y < toSend; y++) { dx.dial(mydev,""+y,null,dx.EV_SYNC); sentCount[offset]++; try { Thread.sleep(400 + r.nextInt(200)); } catch (Exception ignore) { } } } catch (JVRException e) { logger.throwing(getClass().getName(),"run",e); } } }; threadCount ++; dialer.start(); dialers.add(dialer); } for (Iterator i = dialers.iterator(); i.hasNext(); ) { logger.info("waiting for dialers to finish: " + threadCount); Thread t = (Thread) i.next(); t.join(); threadCount--; } Thread.sleep(1000); jvr.removeEventListener(el); for (int x = 0; x < 12; x++) { dx.close(dev[x]); try { assertTrue(eventCount[x] == 0); assertTrue(sentCount[x] == toSend); } catch (AssertionFailedError e) { logger.info("offset: " + x + " count: " + eventCount[x] + " sent: " + sentCount[x]); throw e; } } for (int x = 12; x < 24; x++) { dx.close(dev[x]); try { assertTrue(eventCount[x] == toSend); assertTrue(sentCount[x] == 0); } catch (AssertionFailedError e) { logger.info("offset: " + x + " count: " + eventCount[x] + " sent: " + sentCount[x]); throw e; } } } */ public void test7_tones() throws Exception { int dev = dx.open("dxxxB1C1",0); int msi = ms.open("msiB1C1",0); dx.unlisten(dev); ms.listen(msi,dx.getxmitslot(dev)); ms.close(msi); TN_GENCAD tngencad = new TN_GENCAD(); tngencad.cycles = 1; tngencad.numsegs = 1; tngencad.tone[0] = dx.bldtngen(440,480,-19,-19,200); // dialtone. tngencad.offtime[0] = 400; // 4 seconds. DV_TPT tpt[] = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 200; // 20 seconds (3 rings) tpt[0].tp_flags = dx.TF_MAXTIME; logger.info("Playing regular ring back cadence (4 seconds of silence)"); dx.playtoneEx(dev,tngencad,tpt,dx.EV_SYNC); logger.info("Playing dial tone for 2 seconds"); tpt[0].tp_length = 20; TN_GEN tngen = dx.bldtngen(350,440,-20,-20,-1); dx.playtone(dev,tngen,tpt,dx.EV_SYNC); dx.close(dev); } /*public void test8_getdig() throws Exception { DV_DIGIT digit = new DV_DIGIT(); final int dx1 = dx.open("dxxxB1C1",0); final int dx2 = dx.open("dxxxB1C2",0); dx.listen(dx1,dx.getxmitslot(dx2)); dx.listen(dx2,dx.getxmitslot(dx1)); dx.stopch(dx1,dx.EV_SYNC); dx.stopch(dx2,dx.EV_SYNC); dx.setevtmsk(dx1, dx.DM_DIGOFF); dx.setevtmsk(dx2, dx.DM_DIGOFF); final DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXDTMF; tpt[0].tp_length = 1; tpt[0].tp_flags = dx.TF_MAXDTMF; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_IDDTIME; tpt[1].tp_length = 100; tpt[1].tp_flags = dx.TF_MAXSIL; class TestEventListener extends JVREventListener { int dials = 0; public DV_DIGIT asyncBuf = null; public boolean handleEvent (Event e) throws JVRException { if (e.type == dx.TDX_DIAL && e.device == dx1) { // previous dialing I/O finished; Wait three seconds then // kick off another one. We need to delay so that the // GETDIG DV_TPT specs allow getdig() to finish. // Do the waiting in a thread so that the event handler is // not blocked. String dialStr = ""+dials++; logger.info("ASYNC dial '"+dialStr+"' start"); dx.dial(dx1,dialStr,null,dx.EV_ASYNC); } else if (e.type == dx.TDX_GETDIG && e.device == dx2) { // Since we only get events on ASYNC, report on the last sync operation. logger.info("TDX_GETDIG/ASYNC (digits: '"+asyncBuf+"')"); Thread syncWorker = new Thread() { public void run() { try { // SYNC varient 1. logger.info("getdig(SYNC)"); String s = dx.getdig(dx2, tpt, null, dx.EV_SYNC); logger.info(" (s: '"+s+"')"); // SYNC varient 2. logger.info("getdig(SYNC)"); DV_DIGIT digBuf = new DV_DIGIT(); s = dx.getdig(dx2, tpt, digBuf, dx.EV_SYNC); logger.info(" (digits: '"+digBuf+"' s: '"+s+"')"); // And, finally, kick out another ASYNC request to repeat the cycle of life. logger.info("getdig(ASYNC)"); asyncBuf = new DV_DIGIT(); dx.getdig(dx2, tpt, asyncBuf, dx.EV_ASYNC); } catch (Exception e) { logger.throwing(getClass().getName(),"run",e); } } }; syncWorker.start(); } else { logger.info("UNHANDLED EVENT !!!!!"); } return true; } } TestEventListener el = new TestEventListener(); jvr.addEventListener(el); // Kick off the ASYNC operations el.asyncBuf = new DV_DIGIT(); logger.info("//////////////////////////////////////////////////////////"); logger.info("ASYNC getdig start"); dx.getdig(dx2, tpt, el.asyncBuf, dx.EV_ASYNC); logger.info("ASYNC dial '0' start"); dx.dial(dx1,"0",null,dx.EV_ASYNC); while (el.dials < 3) { try { Thread.sleep(1000); } catch (Exception ignore) { } } jvr.removeEventListener(el); dx.stopch(dx1,dx.EV_SYNC); dx.stopch(dx2,dx.EV_SYNC); dx.close(dx1); dx.close(dx2); logger.info("//////////////////////////////////////////////////////////"); }*/ public void test9_recplay() throws Exception { DX_XPB xpb = null; DV_TPT tpt[] = DV_TPT.newArray(2); tpt[0].tp_type = dx.IO_CONT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 50; tpt[0].tp_flags = dx.TF_MAXTIME; tpt[1].tp_type = dx.IO_EOT; tpt[1].tp_termno = dx.DX_MAXDTMF; tpt[1].tp_length = 1; tpt[1].tp_flags = dx.TF_MAXDTMF; int dxDev = dx.open("dxxxB1C1",0); int msDev = ms.open("msiB1C1",0); dx.listen(dxDev, ms.getxmitslot(msDev)); ms.listen(msDev, dx.getxmitslot(dxDev)); String rec1 = "test9_recf-1.vox"; logger.info("recf() " + rec1); dx.recf(dxDev, rec1, tpt, dx.RM_TONE|dx.EV_SYNC); logger.info("playvox() " + rec1); dx.playvox (dxDev, rec1, null, null, dx.EV_SYNC); ms.close(msDev); dx.close(dxDev); } /*public void test10_rec_iott() throws Exception { if (win32) { final int dxDev = dx.open("dxxxB1C1",0); int msDev = ms.open("msiB1C1",0); dx.listen(dxDev, ms.getxmitslot(msDev)); ms.listen(msDev, dx.getxmitslot(dxDev)); final DV_TPT tpt[] = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 20; tpt[0].tp_flags = dx.TF_MAXTIME; // // EV_SYNC // final String filename = "test.vox"; { new File(filename).delete(); DX_IOTT[] iottArray = DX_IOTT.newArray(1); DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); iott.io_length = -1; logger.info("dx.rec()"); dx.rec(dxDev,iottArray,tpt,dx.RM_TONE|dx.EV_SYNC); dx.fileclose(iott.io_fhandle); logger.info("dx.playvox()"); dx.playvox (dxDev, filename, null, null, dx.EV_SYNC); } // // EV_ASYNC // // The DX_IOTT object needs to remain in-scope for the entire duration of the asynchronous call to dx_rec() new File(filename).delete(); final DX_IOTT[] iottArray = DX_IOTT.newArray(1); final DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen(filename,dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); iott.io_length = -1; class TEL extends JVREventListener { public boolean handleEvent (Event e) throws JVRException { if (e.type == dx.TDX_DIAL) { // start ASYNC recording logger.info("dx.rec() EV_ASYNC"); dx.rec(dxDev,iottArray,tpt,dx.RM_TONE|dx.EV_ASYNC); } if (e.type == dx.TDX_RECORD) { // play back recorded file dx.fileclose(iott.io_fhandle); // done synchronized (this) { notifyAll(); } } if (e.type == dx.TDX_PLAY) { } return true; } } TEL el = new TEL(); jvr.addEventListener(el); dx.dial(dxDev,"1",null,dx.EV_ASYNC); // to kick the context into the event handler. synchronized (el) { el.wait(); } jvr.removeEventListener(el); logger.info("dx.playvox() EV_SYNC"); dx.playvox (dxDev, filename, null, null, dx.EV_SYNC); // // EV_ASYNC // dx.close(dxDev); ms.close(msDev); } if (linux) { throw new Exception("TODO: write a DX_IOTT and dx_recf() test for LINUX"); } }*/ public void test11_wtring() throws Exception { int dxdev = dx.open("dxxxB1C1",0); final int msdev = ms.open("msiB1C1",0); dx.listen(dxdev, ms.getxmitslot(msdev)); ms.listen(msdev, dx.getxmitslot(dxdev)); ms.stopfn(msdev,ms.MTF_RING); dx.stopch(dxdev,dx.EV_SYNC); Thread ringer = new Thread() { public void run() { try { sleep(1000); logger.info("generating RING"); ms.genring(msdev,2,ms.EV_SYNC); } catch (Exception ignore) { } } }; ringer.start(); logger.info("waiting for ring"); try { dx.wtring(dxdev, 2, dx.DX_ONHOOK, 10); assertTrue(false); } catch (DialogicException e) { // TODO: assert that the exception is an I/O timeout exception. // logger.throwing(getClass().getName(),"test11_wtring",e); } dx.close(dxdev); ms.close(msdev); } /*public void test12_mreciottdata() throws Exception { if (!win32) { return; } // win32 only test. final int dx1 = dx.open("dxxxB1C1",0); final int dx2 = dx.open("dxxxB1C2",0); final int dx3 = dx.open("dxxxB1C3",0); int msi = ms.open("msiB1C1",0); ms.unlisten(msi); dx.stopch(dx1,dx.EV_SYNC); dx.stopch(dx2,dx.EV_SYNC); dx.stopch(dx3,dx.EV_SYNC); // Use dx1 and dx2 to create "noise" suitable for recording. // This event listener will guarantee that noise keeps happening // until the event listener is removed. class TEL extends JVREventListener { public boolean handleEvent (Event e) throws JVRException { if (e.device == dx1 || e.device == dx2) { String dial = "1"; if (e.device == dx2) { dial = "2"; } dx.dial(e.device,dial,null,dx.EV_ASYNC); } return true; } } TEL tel = new TEL(); jvr.addEventListener(tel); logger.info("Kicking out the events! Why are the events not showing up?"); ms.listen(msi,dx.getxmitslot(dx1)); dx.dial(dx1,"0",null,dx.EV_ASYNC); dx.dial(dx2,"0",null,dx.EV_ASYNC); // Prepare timeslot info for the two slots we will record. SC_TSINFO tsinfo = new SC_TSINFO(); tsinfo.add( dx.getxmitslot(dx1).ts() ); tsinfo.add( dx.getxmitslot(dx2).ts() ); logger.info("" + tsinfo); DX_IOTT[] iottArray = DX_IOTT.newArray(1); DX_IOTT iott = iottArray[0]; iott.io_type = dx.IO_DEV; iott.io_fhandle = dx.fileopen("mreciottdata_test.vox",dx.WIN32_O_CREAT|dx.WIN32_O_RDWR|dx.WIN32_O_BINARY,dx.WIN32_S_IREAD|dx.WIN32_S_IWRITE); iott.io_length = -1; DV_TPT tpt[] = DV_TPT.newArray(1); tpt[0].tp_type = dx.IO_EOT; tpt[0].tp_termno = dx.DX_MAXTIME; tpt[0].tp_length = 30; tpt[0].tp_flags = dx.TF_MAXTIME; DX_XPB xpb = new DX_XPB(); xpb.wFileFormat = dx.FILE_FORMAT_VOX; xpb.wDataFormat = dx.DATA_FORMAT_DIALOGIC_ADPCM; xpb.nSamplesPerSec = dx.DRT_8KHZ; xpb.wBitsPerSample = 4; logger.info("iott : " + DX_IOTT.toString(iottArray)); logger.info("tpt : " + DV_TPT.toString(tpt)); logger.info("xpb : " + xpb); logger.info("tsinfo: " + tsinfo); dx.mreciottdata(dx3,iottArray,tpt,xpb,0,tsinfo); dx.fileclose(iott.io_fhandle); dx.unlisten(dx3); ms.listen(msi,dx.getxmitslot(dx3)); logger.info("done; playback the file"); dx.playvox(dx3,"mreciottdata_test.vox",null,null,dx.EV_SYNC); jvr.removeEventListener(tel); dx.close(dx1); dx.close(dx2); dx.close(dx3); ms.close(msi); }*/ } // class HideThese }
27,959
0.60605
0.581987
895
29.249163
21.656626
143
false
false
0
0
0
0
0
0
3.395531
false
false
12
6b2c072078ec14d6c6c829fc6874973bc23ca4fa
21,895,743,325,271
39277c68e0f0b31cef716a1a99e111cae84e08df
/java8features/src/java8features/patient.java
877febbe4473837ccd41d8d72e88aa991e116bb9
[]
no_license
karun54/java8features
https://github.com/karun54/java8features
5d5b3ea62ae97505b19692b34965b46f0c82b18d
944061a0d2eec6a8286a0b9bb59aaf0ee68f27c2
refs/heads/master
2023-04-24T04:36:20.796000
2021-05-10T02:28:14
2021-05-10T02:28:14
365,895,949
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package java8features; public class patient implements Comparable<patient> { int id; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } String name; int age; public patient(int id,String name,int age) { this.id=id; this.name=name; this.age=age; } public int compareTo(patient p1) { // TODO Auto-generated method stub if(age==p1.age) return 0; else if(age>p1.age) return 1; else return -1; } }
UTF-8
Java
664
java
patient.java
Java
[]
null
[]
package java8features; public class patient implements Comparable<patient> { int id; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } String name; int age; public patient(int id,String name,int age) { this.id=id; this.name=name; this.age=age; } public int compareTo(patient p1) { // TODO Auto-generated method stub if(age==p1.age) return 0; else if(age>p1.age) return 1; else return -1; } }
664
0.643072
0.63253
40
14.6
12.579349
53
false
false
0
0
0
0
0
0
0.925
false
false
12
f1f86645202661c9ea1387db889217cea9c94ec7
9,268,539,450,308
f8b95b4dd190a74a79d8f44ba865bc638fb31328
/com.google.dart.engine/src/com/google/dart/engine/utilities/general/CharOperation.java
4873e48f81aa4e782a53551dc33f2df862e2e7c2
[]
no_license
unreal0/java2dart
https://github.com/unreal0/java2dart
cdd790fc47ba6d9bd617bdd036fd7b7661249099
2bd245db46a7090e9298de28f5fd25bac4744957
refs/heads/master
2020-04-03T06:52:30.070000
2018-10-28T15:55:46
2018-10-28T15:55:46
155,086,502
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2013, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.google.dart.engine.utilities.general; /** * @coverage dart.engine.utilities */ public class CharOperation { /** * Return true if the pattern matches the given name using CamelCase rules, or false otherwise. * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently * case sensitive. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * Using this method allows matching names to have more parts than the specified pattern (see * {@link #camelCaseMatch(char[], char[], boolean)}).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap', 'HatMapper' <b>and * also</b> 'HashMapEntry'. * <p> * * <pre> * Examples:<ol> * <li> pattern = "NPE".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NPE".toCharArray() * name = "NoPermissionException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NoPermissionException".toCharArray() * result => false</li> * <li> pattern = "npe".toCharArray() * name = "NullPointerException".toCharArray() * result => false</li> * <li> pattern = "IPL3".toCharArray() * name = "IPerspectiveListener3".toCharArray() * result => true</li> * <li> pattern = "HM".toCharArray() * name = "HashMapEntry".toCharArray() * result => true</li> * </ol></pre> * * @param pattern the given pattern * @param name the given name * @return true if the pattern matches the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, char[] name) { // null pattern is equivalent to '*' if (pattern == null) { return true; } // null name cannot match if (name == null) { return false; } return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, false); } /** * Return true if the pattern matches the given name using CamelCase rules, or false otherwise. * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently * case sensitive. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * CamelCase can be restricted to match only the same count of parts. When this restriction is * specified the given pattern and the given name must have <b>exactly</b> the same number of * parts (i.e. the same number of uppercase characters).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap' and 'HatMapper' <b>but * not</b> 'HashMapEntry'. * <p> * * <pre> * Examples:<ol> * <li> pattern = "NPE".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NPE".toCharArray() * name = "NoPermissionException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NoPermissionException".toCharArray() * result => false</li> * <li> pattern = "npe".toCharArray() * name = "NullPointerException".toCharArray() * result => false</li> * <li> pattern = "IPL3".toCharArray() * name = "IPerspectiveListener3".toCharArray() * result => true</li> * <li> pattern = "HM".toCharArray() * name = "HashMapEntry".toCharArray() * result => (samePartCount == false)</li> * </ol></pre> * * @param pattern the given pattern * @param name the given name * @param samePartCount flag telling whether the pattern and the name should have the same count * of parts or not.<br> * &nbsp;&nbsp;For example: * <ul> * <li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not * 'HashMapEntry'</li> <li>'HMap' type string pattern will still match previous 'HashMap' * and 'HtmlMapper' types, but not 'HighMagnitude'</li> * </ul> * @return true if the pattern matches the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean samePartCount) { // null pattern is equivalent to '*' if (pattern == null) { return true; } // null name cannot match if (name == null) { return false; } return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, samePartCount); } /** * Return true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and * is inherently case sensitive. Can match only subset of name/pattern, considering end positions * as non-inclusive. The sub-pattern is defined by the patternStart and patternEnd positions. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * Using this method allows matching names to have more parts than the specified pattern (see * {@link #camelCaseMatch(char[], int, int, char[], int, int, boolean)}).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap', 'HatMapper' <b>and * also</b> 'HashMapEntry'. * <p> * Examples: * <ol> * <li>pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = * "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true</li> * <li>pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = * "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => true</li> * <li>pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = * "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true</li> * <li>pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = * "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => false</li> * <li>pattern = "npe".toCharArray() patternStart = 0 patternEnd = 3 name = * "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => false</li> * <li>pattern = "IPL3".toCharArray() patternStart = 0 patternEnd = 4 name = * "IPerspectiveListener3".toCharArray() nameStart = 0 nameEnd = 21 result => true</li> * <li>pattern = "HM".toCharArray() patternStart = 0 patternEnd = 2 name = * "HashMapEntry".toCharArray() nameStart = 0 nameEnd = 12 result => true</li> * </ol> * * @param pattern the given pattern * @param patternStart the start index of the pattern, inclusive * @param patternEnd the end index of the pattern, exclusive * @param name the given name * @param nameStart the start index of the name, inclusive * @param nameEnd the end index of the name, exclusive * @return true if a sub-pattern matches the sub-part of the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) { return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, false); } /** * Return true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and * is inherently case sensitive. Can match only subset of name/pattern, considering end positions * as non-inclusive. The sub-pattern is defined by the patternStart and patternEnd positions. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * CamelCase can be restricted to match only the same count of parts. When this restriction is * specified the given pattern and the given name must have <b>exactly</b> the same number of * parts (i.e. the same number of uppercase characters).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap' and 'HatMapper' <b>but * not</b> 'HashMapEntry'. * <p> * * <pre> * Examples: * <ol> * <li> pattern = "NPE".toCharArray() * patternStart = 0 * patternEnd = 3 * name = "NullPointerException".toCharArray() * nameStart = 0 * nameEnd = 20 * result => true</li> * <li> pattern = "NPE".toCharArray() * patternStart = 0 * patternEnd = 3 * name = "NoPermissionException".toCharArray() * nameStart = 0 * nameEnd = 21 * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * patternStart = 0 * patternEnd = 6 * name = "NullPointerException".toCharArray() * nameStart = 0 * nameEnd = 20 * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * patternStart = 0 * patternEnd = 6 * name = "NoPermissionException".toCharArray() * nameStart = 0 * nameEnd = 21 * result => false</li> * <li> pattern = "npe".toCharArray() * patternStart = 0 * patternEnd = 3 * name = "NullPointerException".toCharArray() * nameStart = 0 * nameEnd = 20 * result => false</li> * <li> pattern = "IPL3".toCharArray() * patternStart = 0 * patternEnd = 4 * name = "IPerspectiveListener3".toCharArray() * nameStart = 0 * nameEnd = 21 * result => true</li> * <li> pattern = "HM".toCharArray() * patternStart = 0 * patternEnd = 2 * name = "HashMapEntry".toCharArray() * nameStart = 0 * nameEnd = 12 * result => (samePartCount == false)</li> * </ol> * </pre> * * @param pattern the given pattern * @param patternStart the start index of the pattern, inclusive * @param patternEnd the end index of the pattern, exclusive * @param name the given name * @param nameStart the start index of the name, inclusive * @param nameEnd the end index of the name, exclusive * @param samePartCount flag telling whether the pattern and the name should have the same count * of parts or not.<br> * &nbsp;&nbsp;For example: * <ul> * <li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not * 'HashMapEntry'</li> <li>'HMap' type string pattern will still match previous 'HashMap' * and 'HtmlMapper' types, but not 'HighMagnitude'</li> * </ul> * @return true if a sub-pattern matches the sub-part of the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount) { // null name cannot match if (name == null) { return false; } // null pattern is equivalent to '*' if (pattern == null) { return true; } if (patternEnd < 0) { patternEnd = pattern.length; } if (nameEnd < 0) { nameEnd = name.length; } if (patternEnd <= patternStart) { return nameEnd <= nameStart; } if (nameEnd <= nameStart) { return false; } // check first pattern char if (name[nameStart] != pattern[patternStart]) { // first char must strictly match (upper/lower) return false; } char patternChar, nameChar; int iPattern = patternStart; int iName = nameStart; // Main loop is on pattern characters while (true) { iPattern++; iName++; if (iPattern == patternEnd) { // we have exhausted pattern... // it's a match if the name can have additional parts (i.e. uppercase // characters) or is also exhausted if (!samePartCount || iName == nameEnd) { return true; } // otherwise it's a match only if the name has no more uppercase characters while (true) { if (iName == nameEnd) { // we have exhausted the name, so it's a match return true; } nameChar = name[iName]; // test if the name character is uppercase if (!Character.isJavaIdentifierPart(nameChar) || Character.isUpperCase(nameChar)) { return false; } iName++; } } if (iName == nameEnd) { // We have exhausted the name (and not the pattern), so it's not a match return false; } // For as long as we're exactly matching, bring it on (even if it's a lower case character) if ((patternChar = pattern[iPattern]) == name[iName]) { continue; } // If characters are not equals, then it's not a match if patternChar is lowercase if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) { return false; } // patternChar is uppercase, so let's find the next uppercase in name while (true) { if (iName == nameEnd) { // We have exhausted name (and not pattern), so it's not a match return false; } nameChar = name[iName]; if (Character.isJavaIdentifierPart(nameChar) && !Character.isUpperCase(nameChar) && !Character.isDigit(nameChar)) { iName++; } else if (Character.isDigit(nameChar)) { if (patternChar == nameChar) { break; } iName++; } else if (patternChar != nameChar) { return false; } else { break; } } // At this point, either name has been exhausted, or it is at an uppercase // letter. // Since pattern is also at an uppercase letter } } /** * Return true if the pattern matches the given name, false otherwise. This char[] pattern * matching accepts wild-cards '*' and '?'. When not case sensitive, the pattern is assumed to * already be lowercased, the name will be lowercased character per character as comparing. If * name is null, the answer is false. If pattern is null, the answer is true if name is not null. <br> * <br> * For example: * <ol> * <li> * * <pre> * pattern = { '?', 'b', '*' } * name = { 'a', 'b', 'c' , 'd' } * isCaseSensitive = true * result => true * </pre> * </li> * <li> * * <pre> * pattern = { '?', 'b', '?' } * name = { 'a', 'b', 'c' , 'd' } * isCaseSensitive = true * result => false * </pre> * </li> * <li> * * <pre> * pattern = { 'b', '*' } * name = { 'a', 'b', 'c' , 'd' } * isCaseSensitive = true * result => false * </pre> * </li> * </ol> * * @param pattern the given pattern * @param name the given name * @param isCaseSensitive flag to know whether or not the matching should be case sensitive * @return true if the pattern matches the given name, false otherwise */ public static final boolean match(char[] pattern, char[] name, boolean isCaseSensitive) { if (name == null) { return false; // null name cannot match } if (pattern == null) { return true; // null pattern is equivalent to '*' } return match(pattern, 0, pattern.length, name, 0, name.length, isCaseSensitive); } /** * Return true if a sub-pattern matches the subpart of the given name, false otherwise. char[] * pattern matching, accepting wild-cards '*' and '?'. Can match only subset of name/pattern. end * positions are non-inclusive. The subpattern is defined by the patternStart and pattternEnd * positions. When not case sensitive, the pattern is assumed to already be lowercased, the name * will be lowercased character per character as comparing. <br> * <br> * For example: * <ol> * <li> * * <pre> * pattern = { '?', 'b', '*' } * patternStart = 1 * patternEnd = 3 * name = { 'a', 'b', 'c' , 'd' } * nameStart = 1 * nameEnd = 4 * isCaseSensitive = true * result => true * </pre> * </li> * <li> * * <pre> * pattern = { '?', 'b', '*' } * patternStart = 1 * patternEnd = 2 * name = { 'a', 'b', 'c' , 'd' } * nameStart = 1 * nameEnd = 2 * isCaseSensitive = true * result => false * </pre> * </li> * </ol> * * @param pattern the given pattern * @param patternStart the given pattern start * @param patternEnd the given pattern end * @param name the given name * @param nameStart the given name start * @param nameEnd the given name end * @param isCaseSensitive flag to know if the matching should be case sensitive * @return true if a sub-pattern matches the subpart of the given name, false otherwise */ public static final boolean match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive) { if (name == null) { return false; // null name cannot match } if (pattern == null) { return true; // null pattern is equivalent to '*' } int iPattern = patternStart; int iName = nameStart; if (patternEnd < 0) { patternEnd = pattern.length; } if (nameEnd < 0) { nameEnd = name.length; } /* check first segment */ char patternChar = 0; while ((iPattern < patternEnd) && (patternChar = pattern[iPattern]) != '*') { if (iName == nameEnd) { return false; } if (patternChar != (isCaseSensitive ? name[iName] : toLowerCase(name[iName])) && patternChar != '?') { return false; } iName++; iPattern++; } /* check sequence of star+segment */ int segmentStart; if (patternChar == '*') { segmentStart = ++iPattern; // skip star } else { segmentStart = 0; // force iName check } int prefixStart = iName; checkSegment : while (iName < nameEnd) { if (iPattern == patternEnd) { iPattern = segmentStart; // mismatch - restart current segment iName = ++prefixStart; continue checkSegment; } /* segment is ending */ if ((patternChar = pattern[iPattern]) == '*') { segmentStart = ++iPattern; // skip start if (segmentStart == patternEnd) { return true; } prefixStart = iName; continue checkSegment; } /* check current name character */ if ((isCaseSensitive ? name[iName] : toLowerCase(name[iName])) != patternChar && patternChar != '?') { iPattern = segmentStart; // mismatch - restart current segment iName = ++prefixStart; continue checkSegment; } iName++; iPattern++; } return (segmentStart == patternEnd) || (iName == nameEnd && iPattern == patternEnd) || (iPattern == patternEnd - 1 && pattern[iPattern] == '*'); } private static char toLowerCase(char c) { return Character.toLowerCase(c); } }
UTF-8
Java
24,530
java
CharOperation.java
Java
[]
null
[]
/* * Copyright (c) 2013, the Dart project authors. * * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.google.dart.engine.utilities.general; /** * @coverage dart.engine.utilities */ public class CharOperation { /** * Return true if the pattern matches the given name using CamelCase rules, or false otherwise. * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently * case sensitive. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * Using this method allows matching names to have more parts than the specified pattern (see * {@link #camelCaseMatch(char[], char[], boolean)}).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap', 'HatMapper' <b>and * also</b> 'HashMapEntry'. * <p> * * <pre> * Examples:<ol> * <li> pattern = "NPE".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NPE".toCharArray() * name = "NoPermissionException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NoPermissionException".toCharArray() * result => false</li> * <li> pattern = "npe".toCharArray() * name = "NullPointerException".toCharArray() * result => false</li> * <li> pattern = "IPL3".toCharArray() * name = "IPerspectiveListener3".toCharArray() * result => true</li> * <li> pattern = "HM".toCharArray() * name = "HashMapEntry".toCharArray() * result => true</li> * </ol></pre> * * @param pattern the given pattern * @param name the given name * @return true if the pattern matches the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, char[] name) { // null pattern is equivalent to '*' if (pattern == null) { return true; } // null name cannot match if (name == null) { return false; } return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, false); } /** * Return true if the pattern matches the given name using CamelCase rules, or false otherwise. * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently * case sensitive. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * CamelCase can be restricted to match only the same count of parts. When this restriction is * specified the given pattern and the given name must have <b>exactly</b> the same number of * parts (i.e. the same number of uppercase characters).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap' and 'HatMapper' <b>but * not</b> 'HashMapEntry'. * <p> * * <pre> * Examples:<ol> * <li> pattern = "NPE".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NPE".toCharArray() * name = "NoPermissionException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NullPointerException".toCharArray() * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * name = "NoPermissionException".toCharArray() * result => false</li> * <li> pattern = "npe".toCharArray() * name = "NullPointerException".toCharArray() * result => false</li> * <li> pattern = "IPL3".toCharArray() * name = "IPerspectiveListener3".toCharArray() * result => true</li> * <li> pattern = "HM".toCharArray() * name = "HashMapEntry".toCharArray() * result => (samePartCount == false)</li> * </ol></pre> * * @param pattern the given pattern * @param name the given name * @param samePartCount flag telling whether the pattern and the name should have the same count * of parts or not.<br> * &nbsp;&nbsp;For example: * <ul> * <li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not * 'HashMapEntry'</li> <li>'HMap' type string pattern will still match previous 'HashMap' * and 'HtmlMapper' types, but not 'HighMagnitude'</li> * </ul> * @return true if the pattern matches the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean samePartCount) { // null pattern is equivalent to '*' if (pattern == null) { return true; } // null name cannot match if (name == null) { return false; } return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, samePartCount); } /** * Return true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and * is inherently case sensitive. Can match only subset of name/pattern, considering end positions * as non-inclusive. The sub-pattern is defined by the patternStart and patternEnd positions. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * Using this method allows matching names to have more parts than the specified pattern (see * {@link #camelCaseMatch(char[], int, int, char[], int, int, boolean)}).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap', 'HatMapper' <b>and * also</b> 'HashMapEntry'. * <p> * Examples: * <ol> * <li>pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = * "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true</li> * <li>pattern = "NPE".toCharArray() patternStart = 0 patternEnd = 3 name = * "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => true</li> * <li>pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = * "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => true</li> * <li>pattern = "NuPoEx".toCharArray() patternStart = 0 patternEnd = 6 name = * "NoPermissionException".toCharArray() nameStart = 0 nameEnd = 21 result => false</li> * <li>pattern = "npe".toCharArray() patternStart = 0 patternEnd = 3 name = * "NullPointerException".toCharArray() nameStart = 0 nameEnd = 20 result => false</li> * <li>pattern = "IPL3".toCharArray() patternStart = 0 patternEnd = 4 name = * "IPerspectiveListener3".toCharArray() nameStart = 0 nameEnd = 21 result => true</li> * <li>pattern = "HM".toCharArray() patternStart = 0 patternEnd = 2 name = * "HashMapEntry".toCharArray() nameStart = 0 nameEnd = 12 result => true</li> * </ol> * * @param pattern the given pattern * @param patternStart the start index of the pattern, inclusive * @param patternEnd the end index of the pattern, exclusive * @param name the given name * @param nameStart the start index of the name, inclusive * @param nameEnd the end index of the name, exclusive * @return true if a sub-pattern matches the sub-part of the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) { return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, false); } /** * Return true if a sub-pattern matches the sub-part of the given name using CamelCase rules, or * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and * is inherently case sensitive. Can match only subset of name/pattern, considering end positions * as non-inclusive. The sub-pattern is defined by the patternStart and patternEnd positions. * <p> * CamelCase denotes the convention of writing compound names without spaces, and capitalizing * every term. This function recognizes both upper and lower CamelCase, depending whether the * leading character is capitalized or not. The leading part of an upper CamelCase pattern is * assumed to contain a sequence of capitals which are appearing in the matching name; e.g. 'NPE' * will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses a * lowercase first character. In Java, type names follow the upper CamelCase convention, whereas * method or field names follow the lower CamelCase convention. * <p> * The pattern may contain lowercase characters, which will be matched in a case sensitive way. * These characters must appear in sequence in the name. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION' or 'NuPoEx' will match * 'NullPointerException', but not 'NoPointerException'. * <p> * Digit characters are treated in a special way. They can be used in the pattern but are not * always considered as leading character. For instance, both 'UTF16DSS' and 'UTFDSS' patterns * will match 'UTF16DocumentScannerSupport'. * <p> * CamelCase can be restricted to match only the same count of parts. When this restriction is * specified the given pattern and the given name must have <b>exactly</b> the same number of * parts (i.e. the same number of uppercase characters).<br> * For instance, 'HM' , 'HaMa' and 'HMap' patterns will match 'HashMap' and 'HatMapper' <b>but * not</b> 'HashMapEntry'. * <p> * * <pre> * Examples: * <ol> * <li> pattern = "NPE".toCharArray() * patternStart = 0 * patternEnd = 3 * name = "NullPointerException".toCharArray() * nameStart = 0 * nameEnd = 20 * result => true</li> * <li> pattern = "NPE".toCharArray() * patternStart = 0 * patternEnd = 3 * name = "NoPermissionException".toCharArray() * nameStart = 0 * nameEnd = 21 * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * patternStart = 0 * patternEnd = 6 * name = "NullPointerException".toCharArray() * nameStart = 0 * nameEnd = 20 * result => true</li> * <li> pattern = "NuPoEx".toCharArray() * patternStart = 0 * patternEnd = 6 * name = "NoPermissionException".toCharArray() * nameStart = 0 * nameEnd = 21 * result => false</li> * <li> pattern = "npe".toCharArray() * patternStart = 0 * patternEnd = 3 * name = "NullPointerException".toCharArray() * nameStart = 0 * nameEnd = 20 * result => false</li> * <li> pattern = "IPL3".toCharArray() * patternStart = 0 * patternEnd = 4 * name = "IPerspectiveListener3".toCharArray() * nameStart = 0 * nameEnd = 21 * result => true</li> * <li> pattern = "HM".toCharArray() * patternStart = 0 * patternEnd = 2 * name = "HashMapEntry".toCharArray() * nameStart = 0 * nameEnd = 12 * result => (samePartCount == false)</li> * </ol> * </pre> * * @param pattern the given pattern * @param patternStart the start index of the pattern, inclusive * @param patternEnd the end index of the pattern, exclusive * @param name the given name * @param nameStart the start index of the name, inclusive * @param nameEnd the end index of the name, exclusive * @param samePartCount flag telling whether the pattern and the name should have the same count * of parts or not.<br> * &nbsp;&nbsp;For example: * <ul> * <li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not * 'HashMapEntry'</li> <li>'HMap' type string pattern will still match previous 'HashMap' * and 'HtmlMapper' types, but not 'HighMagnitude'</li> * </ul> * @return true if a sub-pattern matches the sub-part of the given name, false otherwise */ public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount) { // null name cannot match if (name == null) { return false; } // null pattern is equivalent to '*' if (pattern == null) { return true; } if (patternEnd < 0) { patternEnd = pattern.length; } if (nameEnd < 0) { nameEnd = name.length; } if (patternEnd <= patternStart) { return nameEnd <= nameStart; } if (nameEnd <= nameStart) { return false; } // check first pattern char if (name[nameStart] != pattern[patternStart]) { // first char must strictly match (upper/lower) return false; } char patternChar, nameChar; int iPattern = patternStart; int iName = nameStart; // Main loop is on pattern characters while (true) { iPattern++; iName++; if (iPattern == patternEnd) { // we have exhausted pattern... // it's a match if the name can have additional parts (i.e. uppercase // characters) or is also exhausted if (!samePartCount || iName == nameEnd) { return true; } // otherwise it's a match only if the name has no more uppercase characters while (true) { if (iName == nameEnd) { // we have exhausted the name, so it's a match return true; } nameChar = name[iName]; // test if the name character is uppercase if (!Character.isJavaIdentifierPart(nameChar) || Character.isUpperCase(nameChar)) { return false; } iName++; } } if (iName == nameEnd) { // We have exhausted the name (and not the pattern), so it's not a match return false; } // For as long as we're exactly matching, bring it on (even if it's a lower case character) if ((patternChar = pattern[iPattern]) == name[iName]) { continue; } // If characters are not equals, then it's not a match if patternChar is lowercase if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) { return false; } // patternChar is uppercase, so let's find the next uppercase in name while (true) { if (iName == nameEnd) { // We have exhausted name (and not pattern), so it's not a match return false; } nameChar = name[iName]; if (Character.isJavaIdentifierPart(nameChar) && !Character.isUpperCase(nameChar) && !Character.isDigit(nameChar)) { iName++; } else if (Character.isDigit(nameChar)) { if (patternChar == nameChar) { break; } iName++; } else if (patternChar != nameChar) { return false; } else { break; } } // At this point, either name has been exhausted, or it is at an uppercase // letter. // Since pattern is also at an uppercase letter } } /** * Return true if the pattern matches the given name, false otherwise. This char[] pattern * matching accepts wild-cards '*' and '?'. When not case sensitive, the pattern is assumed to * already be lowercased, the name will be lowercased character per character as comparing. If * name is null, the answer is false. If pattern is null, the answer is true if name is not null. <br> * <br> * For example: * <ol> * <li> * * <pre> * pattern = { '?', 'b', '*' } * name = { 'a', 'b', 'c' , 'd' } * isCaseSensitive = true * result => true * </pre> * </li> * <li> * * <pre> * pattern = { '?', 'b', '?' } * name = { 'a', 'b', 'c' , 'd' } * isCaseSensitive = true * result => false * </pre> * </li> * <li> * * <pre> * pattern = { 'b', '*' } * name = { 'a', 'b', 'c' , 'd' } * isCaseSensitive = true * result => false * </pre> * </li> * </ol> * * @param pattern the given pattern * @param name the given name * @param isCaseSensitive flag to know whether or not the matching should be case sensitive * @return true if the pattern matches the given name, false otherwise */ public static final boolean match(char[] pattern, char[] name, boolean isCaseSensitive) { if (name == null) { return false; // null name cannot match } if (pattern == null) { return true; // null pattern is equivalent to '*' } return match(pattern, 0, pattern.length, name, 0, name.length, isCaseSensitive); } /** * Return true if a sub-pattern matches the subpart of the given name, false otherwise. char[] * pattern matching, accepting wild-cards '*' and '?'. Can match only subset of name/pattern. end * positions are non-inclusive. The subpattern is defined by the patternStart and pattternEnd * positions. When not case sensitive, the pattern is assumed to already be lowercased, the name * will be lowercased character per character as comparing. <br> * <br> * For example: * <ol> * <li> * * <pre> * pattern = { '?', 'b', '*' } * patternStart = 1 * patternEnd = 3 * name = { 'a', 'b', 'c' , 'd' } * nameStart = 1 * nameEnd = 4 * isCaseSensitive = true * result => true * </pre> * </li> * <li> * * <pre> * pattern = { '?', 'b', '*' } * patternStart = 1 * patternEnd = 2 * name = { 'a', 'b', 'c' , 'd' } * nameStart = 1 * nameEnd = 2 * isCaseSensitive = true * result => false * </pre> * </li> * </ol> * * @param pattern the given pattern * @param patternStart the given pattern start * @param patternEnd the given pattern end * @param name the given name * @param nameStart the given name start * @param nameEnd the given name end * @param isCaseSensitive flag to know if the matching should be case sensitive * @return true if a sub-pattern matches the subpart of the given name, false otherwise */ public static final boolean match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive) { if (name == null) { return false; // null name cannot match } if (pattern == null) { return true; // null pattern is equivalent to '*' } int iPattern = patternStart; int iName = nameStart; if (patternEnd < 0) { patternEnd = pattern.length; } if (nameEnd < 0) { nameEnd = name.length; } /* check first segment */ char patternChar = 0; while ((iPattern < patternEnd) && (patternChar = pattern[iPattern]) != '*') { if (iName == nameEnd) { return false; } if (patternChar != (isCaseSensitive ? name[iName] : toLowerCase(name[iName])) && patternChar != '?') { return false; } iName++; iPattern++; } /* check sequence of star+segment */ int segmentStart; if (patternChar == '*') { segmentStart = ++iPattern; // skip star } else { segmentStart = 0; // force iName check } int prefixStart = iName; checkSegment : while (iName < nameEnd) { if (iPattern == patternEnd) { iPattern = segmentStart; // mismatch - restart current segment iName = ++prefixStart; continue checkSegment; } /* segment is ending */ if ((patternChar = pattern[iPattern]) == '*') { segmentStart = ++iPattern; // skip start if (segmentStart == patternEnd) { return true; } prefixStart = iName; continue checkSegment; } /* check current name character */ if ((isCaseSensitive ? name[iName] : toLowerCase(name[iName])) != patternChar && patternChar != '?') { iPattern = segmentStart; // mismatch - restart current segment iName = ++prefixStart; continue checkSegment; } iName++; iPattern++; } return (segmentStart == patternEnd) || (iName == nameEnd && iPattern == patternEnd) || (iPattern == patternEnd - 1 && pattern[iPattern] == '*'); } private static char toLowerCase(char c) { return Character.toLowerCase(c); } }
24,530
0.644313
0.639136
615
38.886177
32.235466
104
false
false
0
0
0
0
0
0
0.421138
false
false
12
b920543bc78b10ac400f89369a3d3f73bcee42ba
18,279,380,873,477
d2a37d30eee0ce01d338f26794ab4f45a7210149
/Excercise/DeTai/DuoiHinhBatChu/app/src/main/java/com/example/caculator/MainActivity.java
599d329a96219c465f2ff443728d1da0f969c04c
[]
no_license
linh14755/LapTrinhAndroid
https://github.com/linh14755/LapTrinhAndroid
a4240cef31e8fe8498625f196fea31c8a5c0dcac
847e2ef92e1038585781817de6f13a29a6d61bef
refs/heads/master
2023-02-10T09:24:44.968000
2021-01-07T12:47:34
2021-01-07T12:47:34
294,886,015
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.caculator; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.caculator.API.LayCauHoi; import com.example.caculator.Object.DATA; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new LayCauHoi().execute(); findViewById(R.id.btn_play).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (DATA.getData().arrCauDo.size() > 0) { startActivity(new Intent(getApplicationContext(), PlayGameActivity.class)); } else { Toast.makeText(MainActivity.this, "Chฦฐa bแบญt XAMPP hoแบทc chฦฐa nhแบญn ฤ‘ฦฐแปฃc dแปฏ liแป‡u tแปซ sever!", Toast.LENGTH_SHORT).show(); } } }); } }
UTF-8
Java
1,071
java
MainActivity.java
Java
[]
null
[]
package com.example.caculator; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.caculator.API.LayCauHoi; import com.example.caculator.Object.DATA; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new LayCauHoi().execute(); findViewById(R.id.btn_play).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (DATA.getData().arrCauDo.size() > 0) { startActivity(new Intent(getApplicationContext(), PlayGameActivity.class)); } else { Toast.makeText(MainActivity.this, "Chฦฐa bแบญt XAMPP hoแบทc chฦฐa nhแบญn ฤ‘ฦฐแปฃc dแปฏ liแป‡u tแปซ sever!", Toast.LENGTH_SHORT).show(); } } }); } }
1,071
0.65717
0.65622
33
30.939394
30.471983
137
false
false
0
0
0
0
0
0
0.515152
false
false
12
bb8dc861bf66bf9d9082a0f1258f401c893a9180
25,434,796,380,727
df4f03e6365672ab89cf195560d6adb9c44ffb91
/app/src/main/java/ais/sample/com/returnpurchase/presentation/ReturnPurchaseFragment.java
4f65afd6923c41fb363819e808b919d9411a293d
[]
no_license
YaTomat/sample
https://github.com/YaTomat/sample
c102887c00ed56615470bdfd44487cb136039ea3
f010afacc4d20c77002743506931f550e9175199
refs/heads/master
2020-03-26T20:26:55.373000
2018-08-19T19:10:01
2018-08-19T19:10:01
145,324,380
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ais.sample.com.returnpurchase.presentation; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.v7.app.AlertDialog; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.daimajia.swipe.util.Attributes; import java.util.ArrayList; import java.util.Map; import javax.inject.Inject; import ais.sample.com.MyApplication; import ais.sample.com.R; import ais.sample.com.common.BaseTitleFragment; import ais.sample.com.common.BaseStatelessPresenter; import ais.sample.com.common.DividerItemDecoration; import ais.sample.com.common.FullscreenProgressDialogFragment; import ais.sample.com.dagger.returnpurchase.DaggerReturnPurchaseComponent; import ais.sample.com.dagger.returnpurchase.ReturnPurchaseComponent; import ais.sample.com.statistic.data.StatisticItem; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.recyclerview.animators.FadeInLeftAnimator; import static ais.sample.com.common.FragmentUtils.show; /** * Created by YaTomat on 13.09.2017. */ public class ReturnPurchaseFragment extends BaseTitleFragment implements ReturnPurchaseView { public static final String ARG_PURCHASE_ITEMS = "ARG_PURCHASE_ITEMS"; @Inject ReturnPurchasePresenter presenter; @Inject Map<String, BaseStatelessPresenter> statelessPresenterMap; @BindView(R.id.rv_purchases) RecyclerView rvPurchases; private ReturnPurchaseAdapter returnPurchaseAdapter; private FullscreenProgressDialogFragment dialogFragment; private ReturnPurchaseComponent injectionComponent; public static ReturnPurchaseFragment newInstance(ArrayList<StatisticItem> items) { Bundle args = new Bundle(); args.putParcelableArrayList(ARG_PURCHASE_ITEMS, items); ReturnPurchaseFragment fragment = new ReturnPurchaseFragment(); fragment.setArguments(args); return fragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpInjectionComponent().inject(this); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_return_purchase, container, false); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ButterKnife.bind(this, view); presenter.onCreated(this, savedInstanceState); ArrayList<StatisticItem> statisticItemArrayList = getArguments().getParcelableArrayList(ARG_PURCHASE_ITEMS); presenter.setPurchaseList(statisticItemArrayList); returnPurchaseAdapter = new ReturnPurchaseAdapter(presenter); rvPurchases.setLayoutManager(new LinearLayoutManager(getContext())); rvPurchases.setItemAnimator(new FadeInLeftAnimator()); rvPurchases.addItemDecoration(new DividerItemDecoration(getContext())); returnPurchaseAdapter.setMode(Attributes.Mode.Single); rvPurchases.setAdapter(returnPurchaseAdapter); } @Override public void onStart() { super.onStart(); presenter.onStart(); } @Nullable @Override protected CharSequence provideTitle() { return getString(R.string.return_item_title); } @Override public void onStop() { presenter.onStop(); super.onStop(); } @Override public void onDestroyView() { returnPurchaseAdapter.setOnReturnClickListener(null); super.onDestroyView(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); presenter.onSavedInstance(); statelessPresenterMap.put(ReturnPurchasePresenter.class.getSimpleName(), presenter); } @Override public void onDestroy() { presenter.onDestroyed(); super.onDestroy(); } @Override public void removePresenter() { statelessPresenterMap.remove(FindPurchasePresenter.class.getSimpleName()); } @Override public void handleError() { } @Override public void handleError(@StringRes int errorMessage) { handleError(getString(errorMessage)); } @Override public void handleError(String errorMessage) { AlertDialog.Builder builder; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder = new AlertDialog.Builder(getContext(), android.R.style.Theme_Material_Dialog_Alert); } else { builder = new AlertDialog.Builder(getContext()); } builder.setTitle(getString(R.string.login_error_title)) .setMessage(errorMessage) .setPositiveButton(android.R.string.ok, (dialog, which) -> { }) .show(); } @Override public void showProgress() { dialogFragment = FullscreenProgressDialogFragment.newInstance(); show(getActivity().getSupportFragmentManager(), dialogFragment); } @Override public void showProgress(@StringRes int message) { } @Override public void stopProgress() { if (dialogFragment != null && !getActivity().getSupportFragmentManager().isDestroyed()) { dialogFragment.dismissAllowingStateLoss(); } } private ReturnPurchaseComponent setUpInjectionComponent() { if (injectionComponent == null) { injectionComponent = DaggerReturnPurchaseComponent.builder() .applicationComponent(MyApplication.getComponent()) .build(); } return injectionComponent; } @Override public void updateView(ArrayList<StatisticItem> returnPurchaseResponse) { if (returnPurchaseResponse.size() == 0) { getActivity().onBackPressed(); } else { if (returnPurchaseAdapter != null) { returnPurchaseAdapter.setStatisticItems(returnPurchaseResponse); returnPurchaseAdapter.notifyDataSetChanged(); } } } }
UTF-8
Java
6,394
java
ReturnPurchaseFragment.java
Java
[ { "context": ".com.common.FragmentUtils.show;\n\n/**\n * Created by YaTomat on 13.09.2017.\n */\n\npublic class ReturnPurchaseFr", "end": 1235, "score": 0.9721068739891052, "start": 1228, "tag": "USERNAME", "value": "YaTomat" } ]
null
[]
package ais.sample.com.returnpurchase.presentation; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.v7.app.AlertDialog; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.daimajia.swipe.util.Attributes; import java.util.ArrayList; import java.util.Map; import javax.inject.Inject; import ais.sample.com.MyApplication; import ais.sample.com.R; import ais.sample.com.common.BaseTitleFragment; import ais.sample.com.common.BaseStatelessPresenter; import ais.sample.com.common.DividerItemDecoration; import ais.sample.com.common.FullscreenProgressDialogFragment; import ais.sample.com.dagger.returnpurchase.DaggerReturnPurchaseComponent; import ais.sample.com.dagger.returnpurchase.ReturnPurchaseComponent; import ais.sample.com.statistic.data.StatisticItem; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.recyclerview.animators.FadeInLeftAnimator; import static ais.sample.com.common.FragmentUtils.show; /** * Created by YaTomat on 13.09.2017. */ public class ReturnPurchaseFragment extends BaseTitleFragment implements ReturnPurchaseView { public static final String ARG_PURCHASE_ITEMS = "ARG_PURCHASE_ITEMS"; @Inject ReturnPurchasePresenter presenter; @Inject Map<String, BaseStatelessPresenter> statelessPresenterMap; @BindView(R.id.rv_purchases) RecyclerView rvPurchases; private ReturnPurchaseAdapter returnPurchaseAdapter; private FullscreenProgressDialogFragment dialogFragment; private ReturnPurchaseComponent injectionComponent; public static ReturnPurchaseFragment newInstance(ArrayList<StatisticItem> items) { Bundle args = new Bundle(); args.putParcelableArrayList(ARG_PURCHASE_ITEMS, items); ReturnPurchaseFragment fragment = new ReturnPurchaseFragment(); fragment.setArguments(args); return fragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpInjectionComponent().inject(this); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_return_purchase, container, false); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ButterKnife.bind(this, view); presenter.onCreated(this, savedInstanceState); ArrayList<StatisticItem> statisticItemArrayList = getArguments().getParcelableArrayList(ARG_PURCHASE_ITEMS); presenter.setPurchaseList(statisticItemArrayList); returnPurchaseAdapter = new ReturnPurchaseAdapter(presenter); rvPurchases.setLayoutManager(new LinearLayoutManager(getContext())); rvPurchases.setItemAnimator(new FadeInLeftAnimator()); rvPurchases.addItemDecoration(new DividerItemDecoration(getContext())); returnPurchaseAdapter.setMode(Attributes.Mode.Single); rvPurchases.setAdapter(returnPurchaseAdapter); } @Override public void onStart() { super.onStart(); presenter.onStart(); } @Nullable @Override protected CharSequence provideTitle() { return getString(R.string.return_item_title); } @Override public void onStop() { presenter.onStop(); super.onStop(); } @Override public void onDestroyView() { returnPurchaseAdapter.setOnReturnClickListener(null); super.onDestroyView(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); presenter.onSavedInstance(); statelessPresenterMap.put(ReturnPurchasePresenter.class.getSimpleName(), presenter); } @Override public void onDestroy() { presenter.onDestroyed(); super.onDestroy(); } @Override public void removePresenter() { statelessPresenterMap.remove(FindPurchasePresenter.class.getSimpleName()); } @Override public void handleError() { } @Override public void handleError(@StringRes int errorMessage) { handleError(getString(errorMessage)); } @Override public void handleError(String errorMessage) { AlertDialog.Builder builder; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder = new AlertDialog.Builder(getContext(), android.R.style.Theme_Material_Dialog_Alert); } else { builder = new AlertDialog.Builder(getContext()); } builder.setTitle(getString(R.string.login_error_title)) .setMessage(errorMessage) .setPositiveButton(android.R.string.ok, (dialog, which) -> { }) .show(); } @Override public void showProgress() { dialogFragment = FullscreenProgressDialogFragment.newInstance(); show(getActivity().getSupportFragmentManager(), dialogFragment); } @Override public void showProgress(@StringRes int message) { } @Override public void stopProgress() { if (dialogFragment != null && !getActivity().getSupportFragmentManager().isDestroyed()) { dialogFragment.dismissAllowingStateLoss(); } } private ReturnPurchaseComponent setUpInjectionComponent() { if (injectionComponent == null) { injectionComponent = DaggerReturnPurchaseComponent.builder() .applicationComponent(MyApplication.getComponent()) .build(); } return injectionComponent; } @Override public void updateView(ArrayList<StatisticItem> returnPurchaseResponse) { if (returnPurchaseResponse.size() == 0) { getActivity().onBackPressed(); } else { if (returnPurchaseAdapter != null) { returnPurchaseAdapter.setStatisticItems(returnPurchaseResponse); returnPurchaseAdapter.notifyDataSetChanged(); } } } }
6,394
0.707695
0.705818
197
31.456852
27.968699
123
false
false
0
0
0
0
0
0
0.482233
false
false
12
1ab18f0cdba1d260cf5d10da91a70ff3a8e1135e
25,297,357,416,940
a1eae811cd58336f979e2e6586f3fd8a05c89bd0
/src/AffineTransform.java
87a7a4bf044e2c744f60aee7c149a596a6027c43
[]
no_license
KhanhDoHoang/SchoolworkLevel2-Lab2-DrawingViewer
https://github.com/KhanhDoHoang/SchoolworkLevel2-Lab2-DrawingViewer
16d7f3eda181c654e8c57485d6c01458db58441b
dfcb4330804446c781f05c799a75cfa5ca8a85c5
refs/heads/master
2020-12-20T00:01:42.943000
2020-07-27T14:20:27
2020-07-27T14:20:27
235,891,953
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
public class AffineTransform { public String name; public double[][] affine; public int[][] twoDArray; public double scale; public int height; public int width; public int xOffset; public int yOffset; public double x; public double y; public int xDisp; public int yDisp; //the name of the resulting ifs image(use in IfsPanel) public String getName() { return name; } //the 2D affine matrix for the image public double[][] getAffine(){ return affine; } //The scale of the resulting image public double getScale() { return scale; } //The height of the resulting image public int getHeight() { return height; } ///The width of the resulting image public int getWdith() { return width; } //The x offset of the resulting image public int getXoffset() { return xOffset; } //The y offset of the resulting image public int getYoffset() { return yOffset; } } //public AffineTransform() { //this.name = ""; //this.twoDArray = new int[width][height]; //this.scale = 0; //this.height = 0; //this.width = 0; //this.xOffset = 0; //this.yOffset = 0; //this.x = 0; //this.y = 0; //this.xDisp = 0; //this.yDisp = 0; //}
UTF-8
Java
1,210
java
AffineTransform.java
Java
[]
null
[]
public class AffineTransform { public String name; public double[][] affine; public int[][] twoDArray; public double scale; public int height; public int width; public int xOffset; public int yOffset; public double x; public double y; public int xDisp; public int yDisp; //the name of the resulting ifs image(use in IfsPanel) public String getName() { return name; } //the 2D affine matrix for the image public double[][] getAffine(){ return affine; } //The scale of the resulting image public double getScale() { return scale; } //The height of the resulting image public int getHeight() { return height; } ///The width of the resulting image public int getWdith() { return width; } //The x offset of the resulting image public int getXoffset() { return xOffset; } //The y offset of the resulting image public int getYoffset() { return yOffset; } } //public AffineTransform() { //this.name = ""; //this.twoDArray = new int[width][height]; //this.scale = 0; //this.height = 0; //this.width = 0; //this.xOffset = 0; //this.yOffset = 0; //this.x = 0; //this.y = 0; //this.xDisp = 0; //this.yDisp = 0; //}
1,210
0.645455
0.63719
57
19.228069
11.772727
55
false
false
0
0
0
0
0
0
1.368421
false
false
12
d9c7f4733c98d1c2fd699c21fa8028b5ca35db4e
6,313,601,961,458
017249c3f09177e62598c2b3c2f97e0fdb5ff653
/_quiz-answers/presentation-8oct/Doctor.java
de142382dab25f43acda2aad1f0a0aa023661441
[]
no_license
hubertme/LectureRepo-OOP
https://github.com/hubertme/LectureRepo-OOP
3f1ca0b658451571a6418e7ea27a3566fb365364
9dd77bce76088eee24ab9f822e6dc6cb93d26609
refs/heads/master
2020-03-28T04:17:06.458000
2018-11-02T06:11:32
2018-11-02T06:11:32
147,705,180
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Doctor extends Employee implements Salary{ private int patientOperated = 0; private double salaryAmount = baseSalary; public Doctor(String name, int age, int patient){ super(name,age); this.patientOperated = patient; updateSalary(patient); } // From interface public double fetchSalaryAmount(){ return this.salaryAmount; } public void printSalary(){ // System.out.println("This doctor salary is: "+fetchSalaryAmount()); System.out.printf("This doctor salary is %.2f\n",fetchSalaryAmount()); } private void updateSalary(int value){ salaryAmount+=(value*500000); } public int fetchPatient(){ return patientOperated; } public void printPatient(){ System.out.println("This doctor has operated "+fetchPatient()+" patient(s)"); } public void setPatient(int value){ if (value>patientOperated){ updateSalary(value-patientOperated); patientOperated = value; return; } System.out.println("Please enter a higher value than "+fetchPatient()); } public void addPatient(){ patientOperated+=1; updateSalary(1); } }
UTF-8
Java
1,072
java
Doctor.java
Java
[]
null
[]
public class Doctor extends Employee implements Salary{ private int patientOperated = 0; private double salaryAmount = baseSalary; public Doctor(String name, int age, int patient){ super(name,age); this.patientOperated = patient; updateSalary(patient); } // From interface public double fetchSalaryAmount(){ return this.salaryAmount; } public void printSalary(){ // System.out.println("This doctor salary is: "+fetchSalaryAmount()); System.out.printf("This doctor salary is %.2f\n",fetchSalaryAmount()); } private void updateSalary(int value){ salaryAmount+=(value*500000); } public int fetchPatient(){ return patientOperated; } public void printPatient(){ System.out.println("This doctor has operated "+fetchPatient()+" patient(s)"); } public void setPatient(int value){ if (value>patientOperated){ updateSalary(value-patientOperated); patientOperated = value; return; } System.out.println("Please enter a higher value than "+fetchPatient()); } public void addPatient(){ patientOperated+=1; updateSalary(1); } }
1,072
0.727612
0.718284
41
25.170732
21.884289
79
false
false
0
0
0
0
0
0
1.902439
false
false
12
20397afa0632c4cb3a49f4141ffdab13beb251d5
12,171,937,364,870
b2ffbff108e53ab05f4b51255e15cc54e9a2a55e
/java/jupiter/common/test/source/jupiter/common/util/StringsTest.java
70567f30545cb801dc900fcb429509e4cf6ae200
[ "MIT" ]
permissive
b-io/io.barras
https://github.com/b-io/io.barras
0fcfc53d842ae987c6a73ff2eca9f034fd103179
26645f0f804811fc2324407de02c97a1a58b5fac
refs/heads/master
2023-06-11T22:04:08.441000
2023-06-04T22:06:23
2023-06-04T22:06:23
144,495,919
6
1
MIT
false
2022-10-09T20:48:11
2018-08-12T19:43:13
2022-01-09T17:52:53
2022-10-09T20:48:11
8,884
5
1
4
Java
false
false
/* * The MIT License (MIT) * * Copyright ยฉ 2013-2022 Florian Barras <https://barras.io> (florian@barras.io) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package jupiter.common.util; import static jupiter.common.io.InputOutput.IO; import static jupiter.common.util.Characters.BAR; import static jupiter.common.util.Characters.BULLET; import static jupiter.common.util.Strings.EMPTY; import jupiter.common.test.Test; public class StringsTest extends Test { protected static final char[] DELIMITERS = new char[] {'.', ':', ',', ';', '-'}; protected static final String[] STRING_DELIMITERS = new String[] {".", ":", ",", ";", "-"}; protected static final String STRING = "-A.B:C,D;E-"; //////////////////////////////////////////////////////////////////////////////////////////////// public StringsTest(final String name) { super(name); } //////////////////////////////////////////////////////////////////////////////////////////////// /** * Tests {@link Strings#toUnicode}. */ public void testToUnicode() { IO.test(BULLET, "toUnicode"); assertEquals("\\u0030", Strings.toUnicode("0")); assertEquals("\\u0061", Strings.toUnicode("a")); assertEquals("\\u2022", Strings.toUnicode("โ€ข")); } ////////////////////////////////////////////// /** * Tests {@link Strings#toCase}. */ public void testToCase() { IO.test(BULLET, "toCase"); assertEquals("hello world!", Strings.toCase("helloWorld!")); } /** * Tests {@link Strings#toCamelCase}. */ public void testToCamelCase() { IO.test(BULLET, "toCamelCase"); assertEquals("helloWorld!", Strings.toCamelCase("Hello world!")); } //////////////////////////////////////////////////////////////////////////////////////////////// /** * Tests {@link Strings#capitalizeFirst}. */ public void testCapitalizeFirst() { IO.test(BULLET, "capitalizeFirst"); assertEquals("A", Strings.capitalizeFirst("a")); assertEquals("Hello", Strings.capitalizeFirst("hello")); } /** * Tests {@link Strings#capitalizeStrictly}. */ public void testCapitalizeFully() { IO.test(BULLET, "capitalizeStrictly"); assertEquals("Hello World!", Strings.capitalizeStrictly("hELLO wORLD!")); } ////////////////////////////////////////////// /** * Tests {@link Strings#replaceAll}. */ public void testReplaceAll() { IO.test(BULLET, "replaceAll"); assertEquals(EMPTY, Strings.replaceAll(EMPTY, DELIMITERS, String.valueOf(BAR))); assertEquals("|A|B|C|D|E|", Strings.replaceAll(STRING, DELIMITERS, String.valueOf(BAR))); } ////////////////////////////////////////////// /** * Tests {@link Strings#trim}. */ public void testTrim() { IO.test(BULLET, "trim"); assertEquals("A B C D", Strings.trim(" A B C D ", true)); assertEquals("A B C D", Strings.trim(" \b A \f B \r C \n D \t ", true, true)); } //////////////////////////////////////////////////////////////////////////////////////////////// /** * Tests {@link Strings#split}. */ public void testSplit() { IO.test(BULLET, "split"); assertTrue(Arrays.equals(new String[] {EMPTY}, Strings.split(EMPTY, DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, EMPTY}, Strings.split("-", DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, "A", "B", "C", "D", "E", EMPTY}, Strings.split(STRING, DELIMITERS).toArray())); } /** * Tests {@link Strings#splitString}. */ public void testSplitString() { IO.test(BULLET, "splitString"); assertTrue(Arrays.equals(new String[] {EMPTY}, Strings.splitString(EMPTY, STRING_DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, EMPTY}, Strings.splitString("-", STRING_DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, "A", "B", "C", "D", "E", EMPTY}, Strings.splitString(STRING, STRING_DELIMITERS).toArray())); } }
UTF-8
Java
4,902
java
StringsTest.java
Java
[ { "context": " The MIT License (MIT)\n *\n * Copyright ยฉ 2013-2022 Florian Barras <https://barras.io> (florian@barras.io)\n *\n * Per", "end": 70, "score": 0.9998711347579956, "start": 56, "tag": "NAME", "value": "Florian Barras" }, { "context": "t ยฉ 2013-2022 Florian Barras <https://barras.io> (florian@barras.io)\n *\n * Permission is hereby granted, free of char", "end": 109, "score": 0.9999268054962158, "start": 92, "tag": "EMAIL", "value": "florian@barras.io" } ]
null
[]
/* * The MIT License (MIT) * * Copyright ยฉ 2013-2022 <NAME> <https://barras.io> (<EMAIL>) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package jupiter.common.util; import static jupiter.common.io.InputOutput.IO; import static jupiter.common.util.Characters.BAR; import static jupiter.common.util.Characters.BULLET; import static jupiter.common.util.Strings.EMPTY; import jupiter.common.test.Test; public class StringsTest extends Test { protected static final char[] DELIMITERS = new char[] {'.', ':', ',', ';', '-'}; protected static final String[] STRING_DELIMITERS = new String[] {".", ":", ",", ";", "-"}; protected static final String STRING = "-A.B:C,D;E-"; //////////////////////////////////////////////////////////////////////////////////////////////// public StringsTest(final String name) { super(name); } //////////////////////////////////////////////////////////////////////////////////////////////// /** * Tests {@link Strings#toUnicode}. */ public void testToUnicode() { IO.test(BULLET, "toUnicode"); assertEquals("\\u0030", Strings.toUnicode("0")); assertEquals("\\u0061", Strings.toUnicode("a")); assertEquals("\\u2022", Strings.toUnicode("โ€ข")); } ////////////////////////////////////////////// /** * Tests {@link Strings#toCase}. */ public void testToCase() { IO.test(BULLET, "toCase"); assertEquals("hello world!", Strings.toCase("helloWorld!")); } /** * Tests {@link Strings#toCamelCase}. */ public void testToCamelCase() { IO.test(BULLET, "toCamelCase"); assertEquals("helloWorld!", Strings.toCamelCase("Hello world!")); } //////////////////////////////////////////////////////////////////////////////////////////////// /** * Tests {@link Strings#capitalizeFirst}. */ public void testCapitalizeFirst() { IO.test(BULLET, "capitalizeFirst"); assertEquals("A", Strings.capitalizeFirst("a")); assertEquals("Hello", Strings.capitalizeFirst("hello")); } /** * Tests {@link Strings#capitalizeStrictly}. */ public void testCapitalizeFully() { IO.test(BULLET, "capitalizeStrictly"); assertEquals("Hello World!", Strings.capitalizeStrictly("hELLO wORLD!")); } ////////////////////////////////////////////// /** * Tests {@link Strings#replaceAll}. */ public void testReplaceAll() { IO.test(BULLET, "replaceAll"); assertEquals(EMPTY, Strings.replaceAll(EMPTY, DELIMITERS, String.valueOf(BAR))); assertEquals("|A|B|C|D|E|", Strings.replaceAll(STRING, DELIMITERS, String.valueOf(BAR))); } ////////////////////////////////////////////// /** * Tests {@link Strings#trim}. */ public void testTrim() { IO.test(BULLET, "trim"); assertEquals("A B C D", Strings.trim(" A B C D ", true)); assertEquals("A B C D", Strings.trim(" \b A \f B \r C \n D \t ", true, true)); } //////////////////////////////////////////////////////////////////////////////////////////////// /** * Tests {@link Strings#split}. */ public void testSplit() { IO.test(BULLET, "split"); assertTrue(Arrays.equals(new String[] {EMPTY}, Strings.split(EMPTY, DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, EMPTY}, Strings.split("-", DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, "A", "B", "C", "D", "E", EMPTY}, Strings.split(STRING, DELIMITERS).toArray())); } /** * Tests {@link Strings#splitString}. */ public void testSplitString() { IO.test(BULLET, "splitString"); assertTrue(Arrays.equals(new String[] {EMPTY}, Strings.splitString(EMPTY, STRING_DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, EMPTY}, Strings.splitString("-", STRING_DELIMITERS).toArray())); assertTrue(Arrays.equals(new String[] {EMPTY, "A", "B", "C", "D", "E", EMPTY}, Strings.splitString(STRING, STRING_DELIMITERS).toArray())); } }
4,884
0.609308
0.605021
153
31.019608
30.274662
97
false
false
0
0
0
0
98
0.080016
1.777778
false
false
12
9e1bd5ecc0891922afdd3d9580819398c09ba39d
17,093,969,884,449
c4bca4944069cc1abe34b040a8bc2c2691be5c28
/AllianzFireXOM/src/com/allianz/insurance/fire/FireRiskSurveyItem.java
29c9dda33ee767f9a5951585d77c7c4214d904c6
[]
no_license
unturkk/ODM
https://github.com/unturkk/ODM
25570bb52e5f2c302d3ae6c4e689dcfc383e6070
f308bfabb62abb8a27e23f13eb854aca42ca27c6
refs/heads/master
2016-06-03T13:38:08.757000
2016-02-10T08:12:43
2016-02-10T08:12:43
48,744,708
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.allianz.insurance.fire; import java.io.Serializable; public class FireRiskSurveyItem implements Serializable { private static final long serialVersionUID = 1L; private int riskQuestionId; private int riskAnswerId; private double discountRatio; public int getRiskQuestionId() { return riskQuestionId; } public void setRiskQuestionId(int riskQuestionId) { this.riskQuestionId = riskQuestionId; } public int getRiskAnswerId() { return riskAnswerId; } public void setRiskAnswerId(int riskAnswerId) { this.riskAnswerId = riskAnswerId; } public double getDiscountRatio() { return discountRatio; } public void setDiscountRatio(double discountRatio) { this.discountRatio = discountRatio; } }
UTF-8
Java
743
java
FireRiskSurveyItem.java
Java
[]
null
[]
package com.allianz.insurance.fire; import java.io.Serializable; public class FireRiskSurveyItem implements Serializable { private static final long serialVersionUID = 1L; private int riskQuestionId; private int riskAnswerId; private double discountRatio; public int getRiskQuestionId() { return riskQuestionId; } public void setRiskQuestionId(int riskQuestionId) { this.riskQuestionId = riskQuestionId; } public int getRiskAnswerId() { return riskAnswerId; } public void setRiskAnswerId(int riskAnswerId) { this.riskAnswerId = riskAnswerId; } public double getDiscountRatio() { return discountRatio; } public void setDiscountRatio(double discountRatio) { this.discountRatio = discountRatio; } }
743
0.768506
0.76716
36
19.638889
19.062984
58
false
false
0
0
0
0
0
0
1.333333
false
false
12
35af127c7b0b6cd2e7f2d638c751dc7ecc9260fe
858,993,486,790
13c03a6975bcb8f6d32b9b54e9c1a61696f253a9
/src/main/java/MinMaxAlphaBetaPlayer.java
ef9cd62475c25efcacb3c47faab49d1968d6578f
[]
no_license
whitewhim2718/Flip-Your-Wig
https://github.com/whitewhim2718/Flip-Your-Wig
25b6e62c87f25c0d0f38f97e1171723fce2ea69e
82dabc6370da5cd967ef0764a89e7a379792961b
refs/heads/master
2020-03-01T04:33:24.169000
2012-11-24T01:28:22
2012-11-24T01:28:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.lhup.ai; import java.util.*; import java.text.*; import java.util.logging.*; /** * A concrete player that plays any {@link IBoard game} using the minimax * algorithm with alpha-beta pruning and a cutoff. The code used by this * player is based on the psuedo code presented in Russell and Norvig's book, * "Artificial Intelligence: A Modern Approach". The * {@link IEvaluator evaluator} used by this player (see * {@link #setEvaluator(IEvaluator)}) is important because it determines how the * end states are evaluated during the minimax search. * * <p> * This software is for educational purposes only. * @author Mark Cohen */ public class MinMaxAlphaBetaPlayer implements IPlayer { public MinMaxAlphaBetaPlayer() { m_format = NumberFormat.getNumberInstance(); m_format.setMaximumFractionDigits(3); m_format.setMinimumFractionDigits(3); } public void setCutoff(int cutoff) { m_cutoff = cutoff; } public void setEvaluator(IEvaluator evaluator) { m_evaluator = evaluator; } public String getDescription() { return "Computer based player. Moves are selected using the minimax " + "algorithm with alpha-beta pruning. Evaluator: " + m_evaluator; } public String getShortDescription() { return "Computer"; } public String toString() { return getShortDescription(); } /** * This player makes moves using the minimax algorithm with alpha-beta * pruning and a cutoff. The {@link IEvaluator evaluator} used by this * player determines how end states will be evaluated during the minimax * search. * * @param board the {@link IBoard} object that this player will make a move * on. * * @return the {@link IMove move} taken by the player. * * @throws StateException if the player attempts to push an invalid * move onto the games stack. */ public IMove takeTurn(IBoard board) { Logger logger = Logger.getLogger("edu.lhup.ai.MinMaxAlphaBetaPlayer"); logger.entering("edu.lhup.ai.MinMaxAlphaBetaPlayer", "takeTurn", "\n" + board.toString()); System.out.println("MINMAX Start\n" + board); long start = System.currentTimeMillis(); int bestRating = Integer.MIN_VALUE; IMove bestMove = null; List moves = new LinkedList(); board.moves(moves); logger.finest("Testing " + moves.size() + " moves"); for (int i = 0; i < moves.size(); i++) { m_totalMoves++; IMove move = (IMove)moves.get(i); try { logger.finest("Pushing move " + board); System.out.println("Pushing move \n" + board); board.pushMove(move); System.out.println("Board After push\n" + board); int currentRating = getRating(board, 0, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.finest("Rating for move " + move + " is " + currentRating); logger.finest("Poping move " + move); System.out.println("Poping move\n" + board); board.popMove(); System.out.println("Board After pop\n" + board); logger.finest("Best rating so far is " + bestRating); if (currentRating > bestRating) { bestMove = move; bestRating = currentRating; logger.finest("Better rating found, new best move is " + bestMove); } } catch (StateException e) { System.out.println("Move failed in MinMaxPlayer"); System.out.println("Move = " + move); System.out.println("Board \n" + board); } } logger.finest("Best move found, board is\n" + board); logger.finest("Best move is " + bestMove); try { board.pushMove(bestMove); } catch (StateException e) { System.out.println("Best Move failed in MinMaxPlayer"); System.out.println("Best Move = " + bestMove); System.out.println("Board \n" + board); } long stop = System.currentTimeMillis(); String totalMins = m_format.format(((stop-start)/1000.0/60.0)); logger.fine("MIN/MAX Search Statistics: "); logger.fine("\t" + m_totalMoves + " moves examined"); logger.fine("\t" + (m_deepestLevel+1) + " levels examined"); logger.fine("\t" + "Search time: " + totalMins + " minutes"); m_totalMoves = 0; m_deepestLevel = 0; logger.exiting("edu.lhup.ai.MinMaxAlphaBetaPlayer", "takeTurn", "\n" + board.toString()); System.out.println("MINMAX Stop\n" + board); System.out.println("MINMAX Move " + bestMove); return bestMove; } protected boolean cutoff(IBoard board, int iLevel) { return (iLevel >= m_cutoff); } protected int getRating(IBoard board, int level, int alpha, int beta) { Logger logger = Logger.getLogger("edu.lhup.ai.MinMaxAlphaBetaPlayer"); logger.entering("edu.lhup.ai.MinMaxAlphaBetaPlayer", "getRating", "Level " + level + " alpha " + alpha + " beta " + beta + "\n" + board.toString()); int rating = Integer.MIN_VALUE; Iterator players = board.playerIterator(); if (!cutoff(board, level) && players.hasNext()) { m_deepestLevel = level; IPlayer player = (IPlayer)players.next(); if (player == this) { logger.finest("MAX's move"); int bestRating = Integer.MIN_VALUE; List moves = new LinkedList(); board.moves(moves); System.out.println("Testing Moves on board \n" + board); for (int i = 0; i < moves.size(); i++) System.out.println("Move : " + moves.get(i)); logger.finest("Testing " + moves.size() + " moves"); for (int i = 0; i < moves.size(); i++) { m_totalMoves++; IMove move = (IMove)moves.get(i); try { logger.finest("Pushing move " + move); board.pushMove(move); int currentRating = getRating(board, level+1, alpha, beta); logger.finest("Rating for move " + move + " is " + currentRating); logger.finest("Poping move " + move); board.popMove(); logger.finest("Best rating so far is " + bestRating); if (currentRating > bestRating) { bestRating = currentRating; logger.finest("Better rating found, new rating is " + bestRating); } if (currentRating >= beta) { logger.finest("Pruning MAX, current rating is: " + currentRating + " beta: " + beta); break; } alpha = bestRating; logger.finest("New alpha rating is " + alpha); } catch (StateException e) { System.out.println("Move failed in MinMaxPlayer"); System.out.println("Move = " + move); System.out.println("Board \n" + board); } } logger.finest("Best rating " + bestRating); rating = bestRating; } else { logger.finest("MIN's move"); int leastRating = Integer.MAX_VALUE; List moves = new LinkedList(); board.moves(moves); logger.finest("Testing " + moves.size() + " moves"); for (int i = 0; i < moves.size(); i++) { m_totalMoves++; IMove move = (IMove)moves.get(i); try { logger.finest("Pushing move " + move); board.pushMove(move); int currentRating = getRating(board, level+1, alpha, beta); logger.finest("Rating for move " + move + " is " + currentRating); logger.finest("Poping move " + move); board.popMove(); logger.finest("Least rating so far is " + leastRating); if (currentRating < leastRating) { leastRating = currentRating; logger.finest("Lesser rating found, new rating is " + leastRating); } if (currentRating <= alpha) { logger.finest("Pruning MIN, current rating is: " + currentRating + " alpha: " + alpha); break; } beta = leastRating; logger.finest("New beta rating is " + beta); } catch (StateException e) { System.out.println("Move failed in MinMaxPlayer"); System.out.println("Move = " + move); System.out.println("Board \n" + board); } } logger.finest("Least rating " + leastRating); rating = leastRating; } } else { logger.finest("Terminal state reached, evaluate"); rating = m_evaluator.evaluate(board, this); logger.finest("Evaluation returned " + rating); } logger.exiting("edu.lhup.ai.MinMaxAlphaBetaPlayer", "getRating", new Integer(rating)); return rating; } protected int m_cutoff = Integer.MAX_VALUE; protected IEvaluator m_evaluator; private NumberFormat m_format; private long m_totalMoves = 0; private int m_deepestLevel = 0; }
UTF-8
Java
8,687
java
MinMaxAlphaBetaPlayer.java
Java
[ { "context": " player is based on the psuedo code presented in Russell and Norvig's book,\r\n * \"Artificial Intelligence: ", "end": 311, "score": 0.5528309941291809, "start": 305, "tag": "NAME", "value": "ussell" }, { "context": "ware is for educational purposes only.\r\n * @author Mark Cohen \r\n */\r\npublic class MinMaxAlphaBetaPlayer impleme", "end": 671, "score": 0.9998175501823425, "start": 661, "tag": "NAME", "value": "Mark Cohen" } ]
null
[]
package edu.lhup.ai; import java.util.*; import java.text.*; import java.util.logging.*; /** * A concrete player that plays any {@link IBoard game} using the minimax * algorithm with alpha-beta pruning and a cutoff. The code used by this * player is based on the psuedo code presented in Russell and Norvig's book, * "Artificial Intelligence: A Modern Approach". The * {@link IEvaluator evaluator} used by this player (see * {@link #setEvaluator(IEvaluator)}) is important because it determines how the * end states are evaluated during the minimax search. * * <p> * This software is for educational purposes only. * @author <NAME> */ public class MinMaxAlphaBetaPlayer implements IPlayer { public MinMaxAlphaBetaPlayer() { m_format = NumberFormat.getNumberInstance(); m_format.setMaximumFractionDigits(3); m_format.setMinimumFractionDigits(3); } public void setCutoff(int cutoff) { m_cutoff = cutoff; } public void setEvaluator(IEvaluator evaluator) { m_evaluator = evaluator; } public String getDescription() { return "Computer based player. Moves are selected using the minimax " + "algorithm with alpha-beta pruning. Evaluator: " + m_evaluator; } public String getShortDescription() { return "Computer"; } public String toString() { return getShortDescription(); } /** * This player makes moves using the minimax algorithm with alpha-beta * pruning and a cutoff. The {@link IEvaluator evaluator} used by this * player determines how end states will be evaluated during the minimax * search. * * @param board the {@link IBoard} object that this player will make a move * on. * * @return the {@link IMove move} taken by the player. * * @throws StateException if the player attempts to push an invalid * move onto the games stack. */ public IMove takeTurn(IBoard board) { Logger logger = Logger.getLogger("edu.lhup.ai.MinMaxAlphaBetaPlayer"); logger.entering("edu.lhup.ai.MinMaxAlphaBetaPlayer", "takeTurn", "\n" + board.toString()); System.out.println("MINMAX Start\n" + board); long start = System.currentTimeMillis(); int bestRating = Integer.MIN_VALUE; IMove bestMove = null; List moves = new LinkedList(); board.moves(moves); logger.finest("Testing " + moves.size() + " moves"); for (int i = 0; i < moves.size(); i++) { m_totalMoves++; IMove move = (IMove)moves.get(i); try { logger.finest("Pushing move " + board); System.out.println("Pushing move \n" + board); board.pushMove(move); System.out.println("Board After push\n" + board); int currentRating = getRating(board, 0, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.finest("Rating for move " + move + " is " + currentRating); logger.finest("Poping move " + move); System.out.println("Poping move\n" + board); board.popMove(); System.out.println("Board After pop\n" + board); logger.finest("Best rating so far is " + bestRating); if (currentRating > bestRating) { bestMove = move; bestRating = currentRating; logger.finest("Better rating found, new best move is " + bestMove); } } catch (StateException e) { System.out.println("Move failed in MinMaxPlayer"); System.out.println("Move = " + move); System.out.println("Board \n" + board); } } logger.finest("Best move found, board is\n" + board); logger.finest("Best move is " + bestMove); try { board.pushMove(bestMove); } catch (StateException e) { System.out.println("Best Move failed in MinMaxPlayer"); System.out.println("Best Move = " + bestMove); System.out.println("Board \n" + board); } long stop = System.currentTimeMillis(); String totalMins = m_format.format(((stop-start)/1000.0/60.0)); logger.fine("MIN/MAX Search Statistics: "); logger.fine("\t" + m_totalMoves + " moves examined"); logger.fine("\t" + (m_deepestLevel+1) + " levels examined"); logger.fine("\t" + "Search time: " + totalMins + " minutes"); m_totalMoves = 0; m_deepestLevel = 0; logger.exiting("edu.lhup.ai.MinMaxAlphaBetaPlayer", "takeTurn", "\n" + board.toString()); System.out.println("MINMAX Stop\n" + board); System.out.println("MINMAX Move " + bestMove); return bestMove; } protected boolean cutoff(IBoard board, int iLevel) { return (iLevel >= m_cutoff); } protected int getRating(IBoard board, int level, int alpha, int beta) { Logger logger = Logger.getLogger("edu.lhup.ai.MinMaxAlphaBetaPlayer"); logger.entering("edu.lhup.ai.MinMaxAlphaBetaPlayer", "getRating", "Level " + level + " alpha " + alpha + " beta " + beta + "\n" + board.toString()); int rating = Integer.MIN_VALUE; Iterator players = board.playerIterator(); if (!cutoff(board, level) && players.hasNext()) { m_deepestLevel = level; IPlayer player = (IPlayer)players.next(); if (player == this) { logger.finest("MAX's move"); int bestRating = Integer.MIN_VALUE; List moves = new LinkedList(); board.moves(moves); System.out.println("Testing Moves on board \n" + board); for (int i = 0; i < moves.size(); i++) System.out.println("Move : " + moves.get(i)); logger.finest("Testing " + moves.size() + " moves"); for (int i = 0; i < moves.size(); i++) { m_totalMoves++; IMove move = (IMove)moves.get(i); try { logger.finest("Pushing move " + move); board.pushMove(move); int currentRating = getRating(board, level+1, alpha, beta); logger.finest("Rating for move " + move + " is " + currentRating); logger.finest("Poping move " + move); board.popMove(); logger.finest("Best rating so far is " + bestRating); if (currentRating > bestRating) { bestRating = currentRating; logger.finest("Better rating found, new rating is " + bestRating); } if (currentRating >= beta) { logger.finest("Pruning MAX, current rating is: " + currentRating + " beta: " + beta); break; } alpha = bestRating; logger.finest("New alpha rating is " + alpha); } catch (StateException e) { System.out.println("Move failed in MinMaxPlayer"); System.out.println("Move = " + move); System.out.println("Board \n" + board); } } logger.finest("Best rating " + bestRating); rating = bestRating; } else { logger.finest("MIN's move"); int leastRating = Integer.MAX_VALUE; List moves = new LinkedList(); board.moves(moves); logger.finest("Testing " + moves.size() + " moves"); for (int i = 0; i < moves.size(); i++) { m_totalMoves++; IMove move = (IMove)moves.get(i); try { logger.finest("Pushing move " + move); board.pushMove(move); int currentRating = getRating(board, level+1, alpha, beta); logger.finest("Rating for move " + move + " is " + currentRating); logger.finest("Poping move " + move); board.popMove(); logger.finest("Least rating so far is " + leastRating); if (currentRating < leastRating) { leastRating = currentRating; logger.finest("Lesser rating found, new rating is " + leastRating); } if (currentRating <= alpha) { logger.finest("Pruning MIN, current rating is: " + currentRating + " alpha: " + alpha); break; } beta = leastRating; logger.finest("New beta rating is " + beta); } catch (StateException e) { System.out.println("Move failed in MinMaxPlayer"); System.out.println("Move = " + move); System.out.println("Board \n" + board); } } logger.finest("Least rating " + leastRating); rating = leastRating; } } else { logger.finest("Terminal state reached, evaluate"); rating = m_evaluator.evaluate(board, this); logger.finest("Evaluation returned " + rating); } logger.exiting("edu.lhup.ai.MinMaxAlphaBetaPlayer", "getRating", new Integer(rating)); return rating; } protected int m_cutoff = Integer.MAX_VALUE; protected IEvaluator m_evaluator; private NumberFormat m_format; private long m_totalMoves = 0; private int m_deepestLevel = 0; }
8,683
0.609416
0.606884
298
27.157719
22.642656
81
false
false
0
0
0
0
0
0
3.563758
false
false
12
ef46d0893696956c03b7f375091a25638735132d
10,471,130,277,806
678566edaf75724ac432bda0353e3335c0f85c3f
/02_SourceCode/branch/20151230/service/app/models/dao/cart/CartDao.java
f173e4364ce244839625d5348d9427ac26fb2f10
[ "Apache-2.0" ]
permissive
happy6eve/AppPackager
https://github.com/happy6eve/AppPackager
5e2ab7354773b06672284916d953e37c60d8bf88
26b5d4c928bc93112454aa4eb7bdc353cb9daf9a
refs/heads/master
2018-04-23T08:21:18.091000
2017-04-12T06:06:18
2017-04-12T06:06:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package models.dao.cart; import com.sm.core.db.sql.OutSqlHelp; import com.sm.core.db.sql.SqlRow; import java.util.LinkedHashMap; import java.util.List; /** * Created by liufeng on 2015/11/18. */ public class CartDao { /** * ๆ นๆฎๅฎขๆˆทID่Žทๅ–ๅœบๆ™ฏไปทๆ ผ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryCartSceneByPrice(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryCartSceneByPrice",paramter); } /** * ๆ นๆฎๅœบๆ™ฏID้›†ๅˆๆŸฅ่ฏขๅœบๆ™ฏ็š„ไปทๆ ผ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qrySceneByPrice(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qrySceneByPrice",paramter); } /** * ๆŸฅๆ‰พๆฅผ็›˜ไฟกๆฏ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryHouseInfo(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryHouseInfo",paramter); } /** * ๆŸฅๆ‰พๆˆทๅž‹ๅ•ๅ…ƒไฟกๆฏ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryHouseLayoutUnit(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryHouseLayoutUnit",paramter); } /** * ๅœบๆ™ฏๅฎš้‡‘ๅ’Œ็Šถๆ€ๅˆ—่กจ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qrySceneDepositamount(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qrySceneDepositamount",paramter); } /** * ๆŸฅ่ฏขๅœบๆ™ฏๅ›พ็‰‡ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryScenePic(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryScenePic",paramter); } /** * ๆŸฅ่ฏขๅฝ“ๅ‰็”จๆˆทๆœ‰ๆ•ˆ็š„่ดญ็‰ฉ่ฝฆไฟกๆฏ ๅœบๆ™ฏID-ๆฅผ็›˜ID-ๆฅผๆ ‹ID-ๆˆทๅž‹ID-ๆˆฟๆบID-ๆ˜ฏๅฆ่ขซ้€‰ไธญ-ๅŽŸๆ€ป้‡‘้ข-ไผ˜ๆƒ ๅŽ้‡‘้ข-่ดญ็‰ฉ่ฝฆID * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryCustomerCart(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryCustomerCart",paramter); } /** * ไฟๅญ˜่ดญ็‰ฉ่ฝฆ * @param map * @return * @throws Exception */ public static int saveCart(LinkedHashMap map)throws Exception{ return OutSqlHelp.executeUpdate("cart.saveCart",map); } /** * ๆ นๆฎๅฎขๆˆทID่Žทๅ–่ดญ็‰ฉ่ฝฆๆ•ฐ้‡ * @param map * @return * @throws Exception */ public static SqlRow getCartCount(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.qryCustomerByCountCart",map); } /** * ๆ นๆฎๅฎขๆˆทIDๆŸฅ่ฏขๆ‰€ๆœ‰่ดญ็‰ฉ่ฝฆๆ•ฐๆฎ * @param map * @return * @throws Exception */ public static List<SqlRow> qryCustomerIdByCart(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryCustomerIdByCart",map); } /** * ๆ‰น้‡ๅˆ ้™ค่ดญ็‰ฉ่ฝฆ * @param map * @return * @throws Exception */ public static int deleteCart(LinkedHashMap map) throws Exception{ return OutSqlHelp.executeUpdate("cart.deleteCart",map); } /** * ๆ‰น้‡ไฟฎๆ”น่ดญ็‰ฉ่ฝฆ้€‰ไธญ่ฎฐๅฝ•็Šถๆ€ * @param map * @return * @throws Exception */ public static int updateCartChoose(LinkedHashMap map)throws Exception{ return OutSqlHelp.executeUpdate("cart.updateCartChoose",map); } /** * ๆ‰น้‡ไฟฎๆ”น่ดญ็‰ฉ่ฝฆๅ…ถไป–่ฎฐๅฝ• * @param map * @return * @throws Exception */ public static int updateCartChooseNot(LinkedHashMap map)throws Exception{ return OutSqlHelp.executeUpdate("cart.updateCartChooseNot",map); } /** * ๆŸฅ่ฏข้€‰ไธญ็š„่ดญ็‰ฉ่ฝฆไฟกๆฏ * @param map * @return * @throws Exception */ public static List<SqlRow> qryChooseCart(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryChooseCart",map); } /** * ๆŸฅ่ฏขๆฅผๆ ‹ๅ’Œๅ•ๅ…ƒ * @param map * @return * @throws Exception */ public static List<SqlRow> houseUnitInfo(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.houseUnitInfo",map); } /** * ๆŸฅ่ฏขๅฎขๆˆทไฟกๆฏ * @param map * @return * @throws Exception */ public static SqlRow customerInfo(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.customerInfo",map); } /** * ๆ นๆฎ ๅœบๆ™ฏID-ๆฅผ็›˜ID-ๅ•ๅ…ƒID-ๆˆทๅž‹ID * @param map * @return * @throws Exception */ public static List<SqlRow> qryIdesShoppingcart(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryIdesShoppingcart",map); } /** * ้—ฎๅท่ฐƒๆŸฅ่Žทๅ–่ดญ็‰ฉ่ฝฆ็”Ÿๆ•ˆๆ•ฐๆฎ * @param map * @return * @throws Exception */ public static List<SqlRow> cartQuestionnaire(LinkedHashMap map) throws Exception{ return OutSqlHelp.findList("cart.cartQuestionnaire",map); } /** * ๆŸฅ่ฏขๅœบๆ™ฏไฟกๆฏ * @param map * @return * @throws Exception */ public static SqlRow sceneidByScene(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.sceneidByScene",map); } /** * ๆ นๆฎ็‰ฉๆ–™ๆŸฅ่ฏขไบงๅ“ * @param map * @return * @throws Exception */ public static List<SqlRow> sceneidByProduct(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.sceneidByProduct", map); } /** * ๆ นๆฎ็‰ฉๆ–™็‰ฉๆ–™ไบงๅ“ * @param map * @return * @throws Exception */ public static List<SqlRow> sceneidByMaterial(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.sceneidByMaterial", map); } /** * ๆ นๆฎๅ•ๅ…ƒIDๆŸฅ่ฏขๅ•ๅ…ƒไฟกๆฏ * @param map * @return * @throws Exception */ public static SqlRow qryUnitInfo(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.qryUnitInfo",map); } /** * ๆŸฅ่ฏขไบ’ๆ–ฅๅœบๆ™ฏ * @param map * @return * @throws Exception */ public static List<SqlRow> qryPolymerizationRelation(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryPolymerizationRelation",map); } }
UTF-8
Java
6,748
java
CartDao.java
Java
[ { "context": "Map;\r\nimport java.util.List;\r\n\r\n/**\r\n * Created by liufeng on 2015/11/18.\r\n */\r\npublic class CartDao {\r\n\r\n\r\n", "end": 189, "score": 0.998985767364502, "start": 182, "tag": "USERNAME", "value": "liufeng" } ]
null
[]
package models.dao.cart; import com.sm.core.db.sql.OutSqlHelp; import com.sm.core.db.sql.SqlRow; import java.util.LinkedHashMap; import java.util.List; /** * Created by liufeng on 2015/11/18. */ public class CartDao { /** * ๆ นๆฎๅฎขๆˆทID่Žทๅ–ๅœบๆ™ฏไปทๆ ผ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryCartSceneByPrice(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryCartSceneByPrice",paramter); } /** * ๆ นๆฎๅœบๆ™ฏID้›†ๅˆๆŸฅ่ฏขๅœบๆ™ฏ็š„ไปทๆ ผ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qrySceneByPrice(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qrySceneByPrice",paramter); } /** * ๆŸฅๆ‰พๆฅผ็›˜ไฟกๆฏ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryHouseInfo(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryHouseInfo",paramter); } /** * ๆŸฅๆ‰พๆˆทๅž‹ๅ•ๅ…ƒไฟกๆฏ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryHouseLayoutUnit(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryHouseLayoutUnit",paramter); } /** * ๅœบๆ™ฏๅฎš้‡‘ๅ’Œ็Šถๆ€ๅˆ—่กจ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qrySceneDepositamount(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qrySceneDepositamount",paramter); } /** * ๆŸฅ่ฏขๅœบๆ™ฏๅ›พ็‰‡ * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryScenePic(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryScenePic",paramter); } /** * ๆŸฅ่ฏขๅฝ“ๅ‰็”จๆˆทๆœ‰ๆ•ˆ็š„่ดญ็‰ฉ่ฝฆไฟกๆฏ ๅœบๆ™ฏID-ๆฅผ็›˜ID-ๆฅผๆ ‹ID-ๆˆทๅž‹ID-ๆˆฟๆบID-ๆ˜ฏๅฆ่ขซ้€‰ไธญ-ๅŽŸๆ€ป้‡‘้ข-ไผ˜ๆƒ ๅŽ้‡‘้ข-่ดญ็‰ฉ่ฝฆID * @param paramter * @return * @throws Exception */ public static List<SqlRow> qryCustomerCart(LinkedHashMap paramter)throws Exception{ return OutSqlHelp.findList("cart.qryCustomerCart",paramter); } /** * ไฟๅญ˜่ดญ็‰ฉ่ฝฆ * @param map * @return * @throws Exception */ public static int saveCart(LinkedHashMap map)throws Exception{ return OutSqlHelp.executeUpdate("cart.saveCart",map); } /** * ๆ นๆฎๅฎขๆˆทID่Žทๅ–่ดญ็‰ฉ่ฝฆๆ•ฐ้‡ * @param map * @return * @throws Exception */ public static SqlRow getCartCount(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.qryCustomerByCountCart",map); } /** * ๆ นๆฎๅฎขๆˆทIDๆŸฅ่ฏขๆ‰€ๆœ‰่ดญ็‰ฉ่ฝฆๆ•ฐๆฎ * @param map * @return * @throws Exception */ public static List<SqlRow> qryCustomerIdByCart(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryCustomerIdByCart",map); } /** * ๆ‰น้‡ๅˆ ้™ค่ดญ็‰ฉ่ฝฆ * @param map * @return * @throws Exception */ public static int deleteCart(LinkedHashMap map) throws Exception{ return OutSqlHelp.executeUpdate("cart.deleteCart",map); } /** * ๆ‰น้‡ไฟฎๆ”น่ดญ็‰ฉ่ฝฆ้€‰ไธญ่ฎฐๅฝ•็Šถๆ€ * @param map * @return * @throws Exception */ public static int updateCartChoose(LinkedHashMap map)throws Exception{ return OutSqlHelp.executeUpdate("cart.updateCartChoose",map); } /** * ๆ‰น้‡ไฟฎๆ”น่ดญ็‰ฉ่ฝฆๅ…ถไป–่ฎฐๅฝ• * @param map * @return * @throws Exception */ public static int updateCartChooseNot(LinkedHashMap map)throws Exception{ return OutSqlHelp.executeUpdate("cart.updateCartChooseNot",map); } /** * ๆŸฅ่ฏข้€‰ไธญ็š„่ดญ็‰ฉ่ฝฆไฟกๆฏ * @param map * @return * @throws Exception */ public static List<SqlRow> qryChooseCart(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryChooseCart",map); } /** * ๆŸฅ่ฏขๆฅผๆ ‹ๅ’Œๅ•ๅ…ƒ * @param map * @return * @throws Exception */ public static List<SqlRow> houseUnitInfo(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.houseUnitInfo",map); } /** * ๆŸฅ่ฏขๅฎขๆˆทไฟกๆฏ * @param map * @return * @throws Exception */ public static SqlRow customerInfo(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.customerInfo",map); } /** * ๆ นๆฎ ๅœบๆ™ฏID-ๆฅผ็›˜ID-ๅ•ๅ…ƒID-ๆˆทๅž‹ID * @param map * @return * @throws Exception */ public static List<SqlRow> qryIdesShoppingcart(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryIdesShoppingcart",map); } /** * ้—ฎๅท่ฐƒๆŸฅ่Žทๅ–่ดญ็‰ฉ่ฝฆ็”Ÿๆ•ˆๆ•ฐๆฎ * @param map * @return * @throws Exception */ public static List<SqlRow> cartQuestionnaire(LinkedHashMap map) throws Exception{ return OutSqlHelp.findList("cart.cartQuestionnaire",map); } /** * ๆŸฅ่ฏขๅœบๆ™ฏไฟกๆฏ * @param map * @return * @throws Exception */ public static SqlRow sceneidByScene(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.sceneidByScene",map); } /** * ๆ นๆฎ็‰ฉๆ–™ๆŸฅ่ฏขไบงๅ“ * @param map * @return * @throws Exception */ public static List<SqlRow> sceneidByProduct(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.sceneidByProduct", map); } /** * ๆ นๆฎ็‰ฉๆ–™็‰ฉๆ–™ไบงๅ“ * @param map * @return * @throws Exception */ public static List<SqlRow> sceneidByMaterial(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.sceneidByMaterial", map); } /** * ๆ นๆฎๅ•ๅ…ƒIDๆŸฅ่ฏขๅ•ๅ…ƒไฟกๆฏ * @param map * @return * @throws Exception */ public static SqlRow qryUnitInfo(LinkedHashMap map)throws Exception{ return OutSqlHelp.findUnique("cart.qryUnitInfo",map); } /** * ๆŸฅ่ฏขไบ’ๆ–ฅๅœบๆ™ฏ * @param map * @return * @throws Exception */ public static List<SqlRow> qryPolymerizationRelation(LinkedHashMap map)throws Exception{ return OutSqlHelp.findList("cart.qryPolymerizationRelation",map); } }
6,748
0.611093
0.609818
241
24.033195
25.995829
93
false
false
0
0
0
0
0
0
0.211618
false
false
12
42f715d1cbc1774501228828c2e05cb0f8d52eb7
26,800,595,964,832
693aedd8517e820b8607c8663bcb567c5c8165d0
/app/src/main/java/com/android/appify/util/LogUtil.java
712cb7d348726f283f9b635b63a687ce75b03394
[]
no_license
TeamAppify/AppifyAndroid
https://github.com/TeamAppify/AppifyAndroid
b612b123e6429b641988965d34610656aa2ba940
54fdd5b81390b107f660bc0f835fba5b65b2c4e4
refs/heads/master
2018-12-25T01:43:05.673000
2018-12-21T01:52:55
2018-12-21T01:52:55
144,081,737
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.android.appify.util; import android.util.Log; /** * Created by Jagtej on 10/2/18. */ public class LogUtil { public static void testLog(String log) { Log.e("TestLog", log); } public static void logErr(String tag, String log) { Log.e(tag, log); } public static void logErr(String log) { Log.e("Jagtej", log); } public static void logSuccess(String tag, String log) { Log.d(tag, log); } public static void logSuccess(String log) { Log.d("Jagtej", log); } public static void log(String log) { Log.d("Jagtej", log); } }
UTF-8
Java
635
java
LogUtil.java
Java
[ { "context": "util;\n\nimport android.util.Log;\n\n/**\n * Created by Jagtej on 10/2/18.\n */\n\npublic class LogUtil {\n\n publ", "end": 84, "score": 0.9877155423164368, "start": 78, "tag": "USERNAME", "value": "Jagtej" } ]
null
[]
package com.android.appify.util; import android.util.Log; /** * Created by Jagtej on 10/2/18. */ public class LogUtil { public static void testLog(String log) { Log.e("TestLog", log); } public static void logErr(String tag, String log) { Log.e(tag, log); } public static void logErr(String log) { Log.e("Jagtej", log); } public static void logSuccess(String tag, String log) { Log.d(tag, log); } public static void logSuccess(String log) { Log.d("Jagtej", log); } public static void log(String log) { Log.d("Jagtej", log); } }
635
0.582677
0.574803
35
17.142857
18.25712
59
false
false
0
0
0
0
0
0
0.457143
false
false
12
50b36a99fb47c0ebfb60302248a9dcc64b7619b4
26,800,595,965,100
eeb1d08033f13bd9e57c0b60d79ade6a7b860ef7
/VZ-03/src/cell/road/RoadTest.java
0e945abbec83863894250ddd69acdd6b844e12bc
[]
no_license
dewitast/Robust-Zoo
https://github.com/dewitast/Robust-Zoo
471e28bbad32e1a3153cd940feac5a1d6d262bec
fddedb3c5aae734e40368bc2c303ec092cb7cfcb
refs/heads/master
2021-01-23T04:33:42.332000
2017-03-28T17:13:19
2017-03-28T17:13:19
86,207,426
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cell.road; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import cell.Cell; import org.junit.Test; /** * Testing Road. * @author nim_13515111 */ public class RoadTest { /** * Test method for {@link cell.road.Road#isHabitat()}. */ @Test public void testIsHabitat() { Cell c = new Road(); assertFalse(c.isHabitat()); } /** * Test method for {@link cell.road.Road#render()}. */ @Test public void testRender() { Cell c = new Road(); assertEquals('+', c.render()); } }
UTF-8
Java
569
java
RoadTest.java
Java
[ { "context": "t org.junit.Test;\n\n/**\n * Testing Road.\n * @author nim_13515111\n */\n\npublic class RoadTest {\n /**\n * Test meth", "end": 198, "score": 0.9995777606964111, "start": 186, "tag": "USERNAME", "value": "nim_13515111" } ]
null
[]
package cell.road; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import cell.Cell; import org.junit.Test; /** * Testing Road. * @author nim_13515111 */ public class RoadTest { /** * Test method for {@link cell.road.Road#isHabitat()}. */ @Test public void testIsHabitat() { Cell c = new Road(); assertFalse(c.isHabitat()); } /** * Test method for {@link cell.road.Road#render()}. */ @Test public void testRender() { Cell c = new Road(); assertEquals('+', c.render()); } }
569
0.627416
0.613357
35
15.257143
16.250439
56
false
false
0
0
0
0
0
0
0.285714
false
false
12
b12fefd2de6248767f9606ee2005d5baa2765361
22,024,592,349,596
5a01f73bbb2fcadaf2837f4a924b1e7e147ef27d
/family/src/main/java/geektrust/family/relations/impl/PaternalAunt.java
2a2f9b1a15caf9b95de1b4220bcc7d4f05efb559
[]
no_license
imsushil/Meet-The-Family
https://github.com/imsushil/Meet-The-Family
08a6be400353c10328ad63c0f600510517a2c76c
ddfcdb9e4af8f24fb7b547e3a800d0a009f48a6a
refs/heads/master
2021-05-22T16:42:25.274000
2020-06-15T18:57:36
2020-06-15T18:57:36
253,007,310
0
0
null
false
2020-10-13T20:54:29
2020-04-04T13:43:05
2020-06-15T19:00:11
2020-10-13T20:54:27
35
0
0
1
Java
false
false
package geektrust.family.relations.impl; import static geektrust.family.pojo.Constants.NONE; import java.util.stream.Collectors; import geektrust.family.pojo.Member; import geektrust.family.relations.Relationship; public class PaternalAunt implements Relationship { @Override public String of(Member person) { if(person.getFather() == null) return NONE; if(person.getFather().getMother() == null) return NONE; String aunts = person.getFather().getMother().getChildren().stream() .filter(Member::isFemale) .map(Member::getName) .collect(Collectors.joining(" ")); return aunts.isEmpty() ? NONE : aunts; } }
UTF-8
Java
639
java
PaternalAunt.java
Java
[]
null
[]
package geektrust.family.relations.impl; import static geektrust.family.pojo.Constants.NONE; import java.util.stream.Collectors; import geektrust.family.pojo.Member; import geektrust.family.relations.Relationship; public class PaternalAunt implements Relationship { @Override public String of(Member person) { if(person.getFather() == null) return NONE; if(person.getFather().getMother() == null) return NONE; String aunts = person.getFather().getMother().getChildren().stream() .filter(Member::isFemale) .map(Member::getName) .collect(Collectors.joining(" ")); return aunts.isEmpty() ? NONE : aunts; } }
639
0.737089
0.737089
24
25.625
22.173206
70
false
false
0
0
0
0
0
0
1.458333
false
false
12
9a4d90bd2554362b2177af070b04bb8284b846c8
24,721,831,760,363
f549cf2fca256f890864d362b3c7d6b34cedd2de
/src/com/example/designpatterns/abstractfactory/AmericanFactory.java
4fac51c76bfb5b073c604f8533a5d2c6e69e1e83
[]
no_license
tinagaki/design-pattern
https://github.com/tinagaki/design-pattern
bac4eaebd9858fe5e4602a4c5ff15b477301cf26
c7817ea1010d06fe61847216eab906e1f97eb3e9
refs/heads/master
2020-06-02T20:09:07.035000
2019-06-20T07:15:48
2019-06-20T07:15:48
191,293,850
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.designpatterns.abstractfactory; public class AmericanFactory extends AbstractFactory{ @Override public AbstractHuman getRace() { return new American(); } }
UTF-8
Java
198
java
AmericanFactory.java
Java
[]
null
[]
package com.example.designpatterns.abstractfactory; public class AmericanFactory extends AbstractFactory{ @Override public AbstractHuman getRace() { return new American(); } }
198
0.732323
0.732323
9
21
20.634384
53
false
false
0
0
0
0
0
0
0.222222
false
false
12
8429170a46cf7c1654deeacd485e1893b73fe1dd
21,208,548,571,728
77a7120c33201c984153c93eeec5b5dc1d943e60
/src/main/java/com/ippse/web/oauth/UserFeignClient.java
152c1d1cbe39e8f776c8d8fab35c079d8aef571b
[]
no_license
mahaorong/ippse-web
https://github.com/mahaorong/ippse-web
2bdfb3d9c7515ec3bdd8c78e2d035626eae412c3
54833ec84b23845f6f11e820a7c8a64b8d117793
refs/heads/master
2023-05-12T15:30:22.918000
2019-06-24T02:22:11
2019-06-24T02:22:11
193,419,358
0
0
null
false
2023-05-06T03:18:52
2019-06-24T02:21:19
2019-06-24T02:22:59
2023-05-06T03:18:51
4,308
0
0
2
JavaScript
false
false
package com.ippse.web.oauth; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.ippse.web.domain.User; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @FeignClient(value = "kxuser-api"/*, fallback = UserFeignClientFallback.class*/) public interface UserFeignClient { //่Žทๅ–idๆŸฅ่ฏข็”จๆˆท @RequestMapping(value = "/api/user/{userid}", method = RequestMethod.GET) public User findById(@PathVariable("userid") String userid); } @Data @AllArgsConstructor @NoArgsConstructor class UserParam { String id; String username; } /*@Component class UserFeignClientFallback implements UserFeignClient { protected final Logger log = LoggerFactory.getLogger(getClass()); @Override public User findById(String userid) { log.info("failed......." + userid); return new User(); } @Override public User findByUsername(UserParam userParam) { log.info("failed......." + userParam.toString()); return new User(); } }*/
UTF-8
Java
1,171
java
UserFeignClient.java
Java
[]
null
[]
package com.ippse.web.oauth; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.ippse.web.domain.User; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @FeignClient(value = "kxuser-api"/*, fallback = UserFeignClientFallback.class*/) public interface UserFeignClient { //่Žทๅ–idๆŸฅ่ฏข็”จๆˆท @RequestMapping(value = "/api/user/{userid}", method = RequestMethod.GET) public User findById(@PathVariable("userid") String userid); } @Data @AllArgsConstructor @NoArgsConstructor class UserParam { String id; String username; } /*@Component class UserFeignClientFallback implements UserFeignClient { protected final Logger log = LoggerFactory.getLogger(getClass()); @Override public User findById(String userid) { log.info("failed......." + userid); return new User(); } @Override public User findByUsername(UserParam userParam) { log.info("failed......." + userParam.toString()); return new User(); } }*/
1,171
0.767903
0.767903
46
24.195652
24.087358
80
false
false
0
0
0
0
0
0
0.891304
false
false
12
6fce5d56c3477e4799daff710ba5f73a1650c7cd
28,784,870,863,876
85b42d192968b59fc4c1922bbea932f78917b428
/week-05/day-2/src/Dog.java
34df86ae4ac54adcbfe8b94b1a412328aaecbe46
[]
no_license
greenfox-zerda-raptors/ritaklebesz
https://github.com/greenfox-zerda-raptors/ritaklebesz
0135f63e02986f86c9938103dc1331dee9efec22
e06eeffcee8fb9ce001c2b4038e91f0f252ec59f
refs/heads/master
2021-01-13T07:30:34.080000
2017-02-17T08:53:24
2017-02-17T08:53:24
71,347,835
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by Rita on 2016-11-15. */ public class Dog extends Animal { public boolean hasTail = true; public Dog() { super(15, true); System.out.println("Dog is created."); } public void speak() { System.out.println("barks"); } public void beg() { System.out.println("beg"); } }
UTF-8
Java
346
java
Dog.java
Java
[ { "context": "/**\n * Created by Rita on 2016-11-15.\n */\npublic class Dog extends Anima", "end": 22, "score": 0.9997774362564087, "start": 18, "tag": "NAME", "value": "Rita" } ]
null
[]
/** * Created by Rita on 2016-11-15. */ public class Dog extends Animal { public boolean hasTail = true; public Dog() { super(15, true); System.out.println("Dog is created."); } public void speak() { System.out.println("barks"); } public void beg() { System.out.println("beg"); } }
346
0.549133
0.520231
18
18.222221
15.042737
46
false
false
0
0
0
0
0
0
0.333333
false
false
12