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
784f59f264f45e9bc3f7db933b87ef2c54df15c0
11,330,123,729,624
4f3447a5f65d780170a980938a8457e0afd61343
/src/main/java/org/barcodeapi/server/gen/CodeType.java
72940b311d9db29d479ea1221e5c64e1194cb4ab
[ "Apache-2.0" ]
permissive
BarcodeAPI/server
https://github.com/BarcodeAPI/server
8416bb70bf3f2baf940684f8c069ccd1d2e8cd1c
d30b7477016edee59843c97c47bbfe6225004d1c
refs/heads/master
2023-06-27T07:27:16.832000
2023-05-29T18:02:03
2023-05-29T18:02:03
245,997,520
14
5
NOASSERTION
false
2023-06-13T22:57:32
2020-03-09T09:47:25
2023-06-10T22:39:34
2023-06-13T22:57:28
453
8
3
3
Java
false
false
package org.barcodeapi.server.gen; import org.json.JSONObject; public enum CodeType { /** * UPC-E type UPC code; */ UPC_E(new String[] { "e", "upc-e", "upce" }, // "^(?=.*0)[0-9]{8}$", // "^(?=.*0)[0-9]{7,8}$", // "01023459", // "A compact version of UPC-A, removing unneeded '0's."), /** * UPC-A type UPC code; */ UPC_A(new String[] { "a", "upc-a", "upca", "upc" }, // "^(?=.*0)[0-9]{12}$", // "^(?=.*0)[0-9]{11,12}$", // "123456789012", // "A universally recognized 12 digit barcode. Encodes manufacturer, product / variant, and store use codes."), /** * EAN-8 type UPC code; * * 7 numerical digits followed by a single checksum digit. */ EAN8(new String[] { "8", "ean-8", "ean8" }, // "^[0-9]{8}$", // "^[0-9]{7,8}$", // "01023459", // "Derived from the longer EAN-13 UPC code. For smaller packages."), /** * EAN-13 type UPC code; * * 12 numerical digits followed by a single checksum digit. */ EAN13(new String[] { "13", "ean-13", "ean13" }, // "^[0-9]{13}$", // "^[0-9]{12,13}$", // "1234567890128", // "A globally recognized product identification code. Encodes manufacturer, product / variant, and store use codes."), /** * Codabar type code; */ CODABAR(new String[] { "codabar" }, // "^[0-9:$]{4,12}$", // "^[0-9-:$\\/.+]+$", // "1234567890", // "An early barode designed to be printed on dot-matrix printers."), /** * ITF-14 type code; */ ITF14(new String[] {"14", "itf-14", "scc-14", "gtin"}, // "^[0-9]{14}$",// "^[0-9]{14}$", // "98765432109213", // "Interleaved 2 of 5, type 14."), /** * Code39 type code; * * Variable length consisting of only numbers and upper-case characters. */ Code39(new String[] { "39", "code-39", "code39" }, // "^[A-Z0-9 $.\\/]{1,12}$", // "^[A-Z*0-9 -$%.\\/+]+$", // "TRY 39 ME", // "A basic alphanumeric barcode. Uppercase letters and numbers only."), /** * Code128 type code; * * Variable length consisting of numbers, letters, and symbols. */ Code128(new String[] { "128", "code-128", "code128" }, // "^[ !#$()*.\\/0-9=?A-Z_a-z~]{1,16}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]+$", // "Try Me!", // "A medium densisty alphanumeric barcode with a larger character set."), /** * Aztec type barcode. * * A square 2d barcode resembling a pyramid. */ Aztec(new String[] { "aztec" }, // "^[ !#$()*.\\/0-9=?A-Z_a-z~]{1,16}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]+$", // "Aztec Barcode", // "A 2D data barcode whose timing markers radiate outward from the middle."), /** * QR type code; * * A high density data code with error correction. */ QRCode(new String[] { "qr", "qr-code", "qrcode" }, // "^.{1,64}$", // "^.{1,65535}$", // "QR Barcode", // "A 2D data barcode whose timing markers are aligned at the corners."), /** * Data Matrix type code; * * A high density data code with error correction. */ DataMatrix(new String[] { "dm", "data-matrix", "datamatrix", "matrix", "data" }, // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "Data Matrix Barcode", // "A 2D data barode whose timing markers are along the the edges."), /** * PDF417 * * */ PDF417(new String[] { "417", "pdf417", "pdf" }, // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "PDF - 417", // "A stacked linear barcode most commonly found on identification cards."), /** * USPS Intelligent Mail */ USPSMail(new String[] { "usps", "intelligent-mail" }, // "^[0-9]{1,32}$", // "^[0-9]{1,32}$", // "0123456709498765432101234567891", // "USPS Intelligent Mail"), /** * Royal Mail */ RoyalMail(new String[] { "royal", "royal-mail" }, // "^[0-9]{1,32}$", // "^[0-9]{1,32}$", // "11212345612345678", // "Royal Mail"); /** * Local Variables */ private final String[] types; private final String autoPattern; private final String formatPattern; private final String example; private final String description; /** * Create a new CodeType with its pattern and list of associated IDs. * * @param typeStrings */ CodeType(String[] typeStrings, String automatchPattern, // String extendedPattern, String example, String description) { this.types = typeStrings; this.autoPattern = automatchPattern; this.formatPattern = extendedPattern; this.example = example; this.description = description; } /** * Get a list of all IDs associated with a CodeType. * * @return */ public String[] getTypeStrings() { return types; } /** * Get the regular expression that matches on auto-typing. * * @return */ public String getAutomatchPattern() { return autoPattern; } /** * Get the regular expression that validates the data for the code type. * * @return */ public String getFormatPattern() { return formatPattern; } /** * Get an example barcode format. * * @return */ public String getExample() { return example; } /** * Get the description of the specific barcode type. * * @return */ public String getDescription() { return description; } /** * Return the the code type as a JSON object. * * @return */ public JSONObject toJSON() { return new JSONObject() // .put("name", name())// .put("example", getExample())// .put("target", getTypeStrings()[0])// .put("pattern", getFormatPattern())// .put("description", getDescription()); } }
UTF-8
Java
5,707
java
CodeType.java
Java
[]
null
[]
package org.barcodeapi.server.gen; import org.json.JSONObject; public enum CodeType { /** * UPC-E type UPC code; */ UPC_E(new String[] { "e", "upc-e", "upce" }, // "^(?=.*0)[0-9]{8}$", // "^(?=.*0)[0-9]{7,8}$", // "01023459", // "A compact version of UPC-A, removing unneeded '0's."), /** * UPC-A type UPC code; */ UPC_A(new String[] { "a", "upc-a", "upca", "upc" }, // "^(?=.*0)[0-9]{12}$", // "^(?=.*0)[0-9]{11,12}$", // "123456789012", // "A universally recognized 12 digit barcode. Encodes manufacturer, product / variant, and store use codes."), /** * EAN-8 type UPC code; * * 7 numerical digits followed by a single checksum digit. */ EAN8(new String[] { "8", "ean-8", "ean8" }, // "^[0-9]{8}$", // "^[0-9]{7,8}$", // "01023459", // "Derived from the longer EAN-13 UPC code. For smaller packages."), /** * EAN-13 type UPC code; * * 12 numerical digits followed by a single checksum digit. */ EAN13(new String[] { "13", "ean-13", "ean13" }, // "^[0-9]{13}$", // "^[0-9]{12,13}$", // "1234567890128", // "A globally recognized product identification code. Encodes manufacturer, product / variant, and store use codes."), /** * Codabar type code; */ CODABAR(new String[] { "codabar" }, // "^[0-9:$]{4,12}$", // "^[0-9-:$\\/.+]+$", // "1234567890", // "An early barode designed to be printed on dot-matrix printers."), /** * ITF-14 type code; */ ITF14(new String[] {"14", "itf-14", "scc-14", "gtin"}, // "^[0-9]{14}$",// "^[0-9]{14}$", // "98765432109213", // "Interleaved 2 of 5, type 14."), /** * Code39 type code; * * Variable length consisting of only numbers and upper-case characters. */ Code39(new String[] { "39", "code-39", "code39" }, // "^[A-Z0-9 $.\\/]{1,12}$", // "^[A-Z*0-9 -$%.\\/+]+$", // "TRY 39 ME", // "A basic alphanumeric barcode. Uppercase letters and numbers only."), /** * Code128 type code; * * Variable length consisting of numbers, letters, and symbols. */ Code128(new String[] { "128", "code-128", "code128" }, // "^[ !#$()*.\\/0-9=?A-Z_a-z~]{1,16}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]+$", // "Try Me!", // "A medium densisty alphanumeric barcode with a larger character set."), /** * Aztec type barcode. * * A square 2d barcode resembling a pyramid. */ Aztec(new String[] { "aztec" }, // "^[ !#$()*.\\/0-9=?A-Z_a-z~]{1,16}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]+$", // "Aztec Barcode", // "A 2D data barcode whose timing markers radiate outward from the middle."), /** * QR type code; * * A high density data code with error correction. */ QRCode(new String[] { "qr", "qr-code", "qrcode" }, // "^.{1,64}$", // "^.{1,65535}$", // "QR Barcode", // "A 2D data barcode whose timing markers are aligned at the corners."), /** * Data Matrix type code; * * A high density data code with error correction. */ DataMatrix(new String[] { "dm", "data-matrix", "datamatrix", "matrix", "data" }, // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "Data Matrix Barcode", // "A 2D data barode whose timing markers are along the the edges."), /** * PDF417 * * */ PDF417(new String[] { "417", "pdf417", "pdf" }, // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "^[ !\"#$%&'()*+,-.\\/0-9:;<=>?@A-Z\\[\\\\\\]^_`a-z{|}~]{1,2335}$", // "PDF - 417", // "A stacked linear barcode most commonly found on identification cards."), /** * USPS Intelligent Mail */ USPSMail(new String[] { "usps", "intelligent-mail" }, // "^[0-9]{1,32}$", // "^[0-9]{1,32}$", // "0123456709498765432101234567891", // "USPS Intelligent Mail"), /** * Royal Mail */ RoyalMail(new String[] { "royal", "royal-mail" }, // "^[0-9]{1,32}$", // "^[0-9]{1,32}$", // "11212345612345678", // "Royal Mail"); /** * Local Variables */ private final String[] types; private final String autoPattern; private final String formatPattern; private final String example; private final String description; /** * Create a new CodeType with its pattern and list of associated IDs. * * @param typeStrings */ CodeType(String[] typeStrings, String automatchPattern, // String extendedPattern, String example, String description) { this.types = typeStrings; this.autoPattern = automatchPattern; this.formatPattern = extendedPattern; this.example = example; this.description = description; } /** * Get a list of all IDs associated with a CodeType. * * @return */ public String[] getTypeStrings() { return types; } /** * Get the regular expression that matches on auto-typing. * * @return */ public String getAutomatchPattern() { return autoPattern; } /** * Get the regular expression that validates the data for the code type. * * @return */ public String getFormatPattern() { return formatPattern; } /** * Get an example barcode format. * * @return */ public String getExample() { return example; } /** * Get the description of the specific barcode type. * * @return */ public String getDescription() { return description; } /** * Return the the code type as a JSON object. * * @return */ public JSONObject toJSON() { return new JSONObject() // .put("name", name())// .put("example", getExample())// .put("target", getTypeStrings()[0])// .put("pattern", getFormatPattern())// .put("description", getDescription()); } }
5,707
0.543893
0.48642
241
22.680498
23.77404
119
false
false
0
0
0
0
0
0
2.141079
false
false
6
d035a67843683a680b5df83db3fd4aba0fd51c07
11,330,123,731,172
655a48463923e619b64e95203082794f04d87708
/src/main/java/com/revolut/payments/SimplePaymentsApp.java
2b3fed547fc73d0fa4b2b6b4e51a3ab171271fa6
[]
no_license
rock-machine/simple-payments
https://github.com/rock-machine/simple-payments
6e1db1ea453b19b31649b2d1f5b8736e2a5944e9
eaead383f7e5c93ee5dbd03993047ae467aca9f1
refs/heads/master
2020-09-26T06:37:15.803000
2019-12-06T08:56:36
2019-12-12T12:06:21
226,191,006
0
0
null
false
2020-10-13T18:10:25
2019-12-05T21:20:08
2019-12-12T12:06:38
2020-10-13T18:10:24
21,577
0
0
1
Java
false
false
package com.revolut.payments; import com.revolut.payments.app.DbInitializer; import com.revolut.payments.app.ServiceBinder; import com.revolut.payments.exception.ConstraintViolationExceptionMapper; import com.revolut.payments.exception.GlobalExceptionMapper; import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.validation.ValidationFeature; import java.io.IOException; import java.net.URI; import java.util.concurrent.TimeUnit; /** * The entry point of the application. */ public class SimplePaymentsApp { public static final String BASE_URI = "http://localhost:8080"; public static void main(String[] args) throws IOException { final HttpServer server = startServer(URI.create(BASE_URI)); System.out.println("Server has been successfully started at: " + BASE_URI); System.out.println("Press enter to shutdown..."); System.in.read(); System.out.println("Stopping the server..."); shutdownServerGracefully(server); } public static HttpServer startServer(URI uri) { final ResourceConfig config = new ResourceConfig().packages(true, "com.revolut.payments.api") .register(new ServiceBinder()) .register(new DbInitializer()) .register(new ConstraintViolationExceptionMapper()) .register(new GlobalExceptionMapper()) .register(ValidationFeature.class) .register(JacksonFeature.class); return GrizzlyHttpServerFactory.createHttpServer(uri, config); } public static void shutdownServerGracefully(HttpServer server) { try { server.shutdown().get(60, TimeUnit.SECONDS); } catch (Exception e) { System.err.println("Failed to shutdown server gracefully!"); e.printStackTrace(); } } }
UTF-8
Java
2,023
java
SimplePaymentsApp.java
Java
[]
null
[]
package com.revolut.payments; import com.revolut.payments.app.DbInitializer; import com.revolut.payments.app.ServiceBinder; import com.revolut.payments.exception.ConstraintViolationExceptionMapper; import com.revolut.payments.exception.GlobalExceptionMapper; import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.validation.ValidationFeature; import java.io.IOException; import java.net.URI; import java.util.concurrent.TimeUnit; /** * The entry point of the application. */ public class SimplePaymentsApp { public static final String BASE_URI = "http://localhost:8080"; public static void main(String[] args) throws IOException { final HttpServer server = startServer(URI.create(BASE_URI)); System.out.println("Server has been successfully started at: " + BASE_URI); System.out.println("Press enter to shutdown..."); System.in.read(); System.out.println("Stopping the server..."); shutdownServerGracefully(server); } public static HttpServer startServer(URI uri) { final ResourceConfig config = new ResourceConfig().packages(true, "com.revolut.payments.api") .register(new ServiceBinder()) .register(new DbInitializer()) .register(new ConstraintViolationExceptionMapper()) .register(new GlobalExceptionMapper()) .register(ValidationFeature.class) .register(JacksonFeature.class); return GrizzlyHttpServerFactory.createHttpServer(uri, config); } public static void shutdownServerGracefully(HttpServer server) { try { server.shutdown().get(60, TimeUnit.SECONDS); } catch (Exception e) { System.err.println("Failed to shutdown server gracefully!"); e.printStackTrace(); } } }
2,023
0.713791
0.710331
56
35.107143
27.517319
101
false
false
0
0
0
0
0
0
0.5
false
false
6
dcd107b5925da4b4045b1d9e90e4e5315e23652d
25,039,659,343,953
08846c62361284a6771e89ec93453d3109b571b9
/src/main/java/com/jtzh/service/NoticeServiceImpl.java
2d912d17e11af1b465c634a92325ba3200fd2f63
[]
no_license
lzj1995822/zhbh-api
https://github.com/lzj1995822/zhbh-api
a497b176a1ec1302143684652d18113be752e383
5c8a02d2f55e8733f91fe68ae9e0d09934fa3de3
refs/heads/master
2023-08-04T14:33:05.831000
2020-01-19T02:19:13
2020-01-19T02:19:13
206,700,789
0
1
null
false
2023-07-22T15:28:54
2019-09-06T02:57:22
2020-01-19T02:19:24
2023-07-22T15:28:54
8,368
0
1
4
TSQL
false
false
package com.jtzh.service; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.jtzh.common.Constants; import com.jtzh.common.ResultObject; import com.jtzh.entity.LoginUserTest; import com.jtzh.entity.NoticeInf; import com.jtzh.entity.NoticeLaw; import com.jtzh.entity.NoticeTrain; import com.jtzh.mapper.NoticeInfMapper; import com.jtzh.mapper.NoticeLawMapper; import com.jtzh.mapper.NoticeTrainMapper; import com.jtzh.pojo.BaseResponse; import com.jtzh.pojo.NoticeParam; @Service("noticeService") public class NoticeServiceImpl implements NoticeService { @Resource private NoticeInfMapper noticeInfMapper; @Resource private NoticeLawMapper noticeLawMapper; @Resource private NoticeTrainMapper noticeTrainMapper; @Override public BaseResponse<List<NoticeInf>> getInfoListApp(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeInf>> res= new BaseResponse<>(); int total = noticeInfMapper.selectInfoTotalAPP(param); List<NoticeInf> list = new ArrayList<NoticeInf>(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeInfMapper.selectInfoAPP(param); } res.setResponseData(list); return res; } // 通知公告 // 查询 @Override public BaseResponse<List<NoticeInf>> getNoticeInfList(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeInf>> res = new BaseResponse<>(); int total = noticeInfMapper.selectInfTotal(param); List<NoticeInf> list = new ArrayList<NoticeInf>(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeInfMapper.selectInfo(param); } //res.setRows(list); res.setResponseData(list); return res; } // 查询详情 @Override public NoticeInf getNoticeInf(String id) { // 根据id去查询通知公告信息 NoticeInf noticeInf = noticeInfMapper.getNoticeInf(id); return noticeInf; } // 修改 @Override public Object updateNoticeInf(NoticeInf param) { noticeInfMapper.updateNoticeInf(param); return new ResultObject(); } // 新建 @Override public Object addNoticeInf(NoticeInf inf, LoginUserTest user) { // inf.setYhzh("宝华镇"); inf.setYhzh(Constants.YHZH_BAOHUA); inf.setCreateTime(new Date()); inf.setIsdeleted("0"); inf.setCreateId(user.getLoginId()); noticeInfMapper.addNoticeInf(inf); return new ResultObject(); } // 删除 @Override public Object deleteNoticeInf(String id) { // 删除问题---a).删除问题表记录; b)删除对应的资源表记录. noticeInfMapper.deleteNoticeInf(id); return new ResultObject(); } // 法律法规 // 查询 @Override public BaseResponse<List<NoticeLaw>> getNoticeLawList(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeLaw>> res = new BaseResponse<>(); int total = noticeLawMapper.selectLawTotal(param); List<NoticeLaw> list = new ArrayList<NoticeLaw>(); //PageResult res = new PageResult(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeLawMapper.selectInfo(param); } res.setResponseData(list); return res; } // 查询详情 @Override public NoticeLaw getNoticeLaw(String id) { // 根据id去查询通知公告信息 NoticeLaw noticeLaw = noticeLawMapper.getNoticeLaw(id); return noticeLaw; } // 修改 @Override public Object updateNoticeLaw(NoticeLaw param) { noticeLawMapper.updateNoticeLaw(param); return new ResultObject(); } // 新建 @Override public Object addNoticeLaw(NoticeLaw law, LoginUserTest user) { law.setYhzh(Constants.YHZH_BAOHUA); law.setCreateTime(new Date()); law.setIsdeleted("0"); law.setCreateId(user.getLoginId()); noticeLawMapper.addNoticeLaw(law); return new ResultObject(); } // 删除 @Override public Object deleteNoticeLaw(String id) { // 删除问题---a).删除问题表记录; b)删除对应的资源表记录. noticeLawMapper.deleteNoticeLaw(id); return new ResultObject(); } // 教育培训 // 查询 @Override public BaseResponse<List<NoticeTrain>> getNoticeTrainList(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeTrain>> res = new BaseResponse<>(); int total = noticeTrainMapper.selectTrainTotal(param); List<NoticeTrain> list = new ArrayList<NoticeTrain>(); //PageResult res = new PageResult(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeTrainMapper.selectInfo(param); } res.setResponseData(list); return res; } @Override public NoticeTrain getNoticeTrain(String id) { // 根据id去查询通知公告信息 NoticeTrain noticeTrain = noticeTrainMapper.getNoticeTrain(id); return noticeTrain; } // 修改 @Override public Object updateNoticeTrain(NoticeTrain param) { noticeTrainMapper.updateNoticeTrain(param); return new ResultObject(); } // 新建 @Override public Object addNoticeTrain(NoticeTrain train, LoginUserTest user) { train.setYhzh(Constants.YHZH_BAOHUA); train.setCreateTime(new Date()); train.setIsdeleted("0"); train.setCreateId(user.getLoginId()); noticeTrainMapper.addNoticeTrain(train); return new ResultObject(); } // 删除 @Override public Object deleteNoticeTrain(String id) { // 删除问题---a).删除问题表记录; b)删除对应的资源表记录. noticeTrainMapper.deleteNoticeTrain(id); return new ResultObject(); } }
UTF-8
Java
5,639
java
NoticeServiceImpl.java
Java
[]
null
[]
package com.jtzh.service; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.jtzh.common.Constants; import com.jtzh.common.ResultObject; import com.jtzh.entity.LoginUserTest; import com.jtzh.entity.NoticeInf; import com.jtzh.entity.NoticeLaw; import com.jtzh.entity.NoticeTrain; import com.jtzh.mapper.NoticeInfMapper; import com.jtzh.mapper.NoticeLawMapper; import com.jtzh.mapper.NoticeTrainMapper; import com.jtzh.pojo.BaseResponse; import com.jtzh.pojo.NoticeParam; @Service("noticeService") public class NoticeServiceImpl implements NoticeService { @Resource private NoticeInfMapper noticeInfMapper; @Resource private NoticeLawMapper noticeLawMapper; @Resource private NoticeTrainMapper noticeTrainMapper; @Override public BaseResponse<List<NoticeInf>> getInfoListApp(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeInf>> res= new BaseResponse<>(); int total = noticeInfMapper.selectInfoTotalAPP(param); List<NoticeInf> list = new ArrayList<NoticeInf>(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeInfMapper.selectInfoAPP(param); } res.setResponseData(list); return res; } // 通知公告 // 查询 @Override public BaseResponse<List<NoticeInf>> getNoticeInfList(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeInf>> res = new BaseResponse<>(); int total = noticeInfMapper.selectInfTotal(param); List<NoticeInf> list = new ArrayList<NoticeInf>(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeInfMapper.selectInfo(param); } //res.setRows(list); res.setResponseData(list); return res; } // 查询详情 @Override public NoticeInf getNoticeInf(String id) { // 根据id去查询通知公告信息 NoticeInf noticeInf = noticeInfMapper.getNoticeInf(id); return noticeInf; } // 修改 @Override public Object updateNoticeInf(NoticeInf param) { noticeInfMapper.updateNoticeInf(param); return new ResultObject(); } // 新建 @Override public Object addNoticeInf(NoticeInf inf, LoginUserTest user) { // inf.setYhzh("宝华镇"); inf.setYhzh(Constants.YHZH_BAOHUA); inf.setCreateTime(new Date()); inf.setIsdeleted("0"); inf.setCreateId(user.getLoginId()); noticeInfMapper.addNoticeInf(inf); return new ResultObject(); } // 删除 @Override public Object deleteNoticeInf(String id) { // 删除问题---a).删除问题表记录; b)删除对应的资源表记录. noticeInfMapper.deleteNoticeInf(id); return new ResultObject(); } // 法律法规 // 查询 @Override public BaseResponse<List<NoticeLaw>> getNoticeLawList(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeLaw>> res = new BaseResponse<>(); int total = noticeLawMapper.selectLawTotal(param); List<NoticeLaw> list = new ArrayList<NoticeLaw>(); //PageResult res = new PageResult(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeLawMapper.selectInfo(param); } res.setResponseData(list); return res; } // 查询详情 @Override public NoticeLaw getNoticeLaw(String id) { // 根据id去查询通知公告信息 NoticeLaw noticeLaw = noticeLawMapper.getNoticeLaw(id); return noticeLaw; } // 修改 @Override public Object updateNoticeLaw(NoticeLaw param) { noticeLawMapper.updateNoticeLaw(param); return new ResultObject(); } // 新建 @Override public Object addNoticeLaw(NoticeLaw law, LoginUserTest user) { law.setYhzh(Constants.YHZH_BAOHUA); law.setCreateTime(new Date()); law.setIsdeleted("0"); law.setCreateId(user.getLoginId()); noticeLawMapper.addNoticeLaw(law); return new ResultObject(); } // 删除 @Override public Object deleteNoticeLaw(String id) { // 删除问题---a).删除问题表记录; b)删除对应的资源表记录. noticeLawMapper.deleteNoticeLaw(id); return new ResultObject(); } // 教育培训 // 查询 @Override public BaseResponse<List<NoticeTrain>> getNoticeTrainList(NoticeParam param) { // 查询总数 BaseResponse<List<NoticeTrain>> res = new BaseResponse<>(); int total = noticeTrainMapper.selectTrainTotal(param); List<NoticeTrain> list = new ArrayList<NoticeTrain>(); //PageResult res = new PageResult(); res.setOk(true); res.setTotal(total); // 如果存在,查询具体的数据作为分页数据 if (total > 0) { list = noticeTrainMapper.selectInfo(param); } res.setResponseData(list); return res; } @Override public NoticeTrain getNoticeTrain(String id) { // 根据id去查询通知公告信息 NoticeTrain noticeTrain = noticeTrainMapper.getNoticeTrain(id); return noticeTrain; } // 修改 @Override public Object updateNoticeTrain(NoticeTrain param) { noticeTrainMapper.updateNoticeTrain(param); return new ResultObject(); } // 新建 @Override public Object addNoticeTrain(NoticeTrain train, LoginUserTest user) { train.setYhzh(Constants.YHZH_BAOHUA); train.setCreateTime(new Date()); train.setIsdeleted("0"); train.setCreateId(user.getLoginId()); noticeTrainMapper.addNoticeTrain(train); return new ResultObject(); } // 删除 @Override public Object deleteNoticeTrain(String id) { // 删除问题---a).删除问题表记录; b)删除对应的资源表记录. noticeTrainMapper.deleteNoticeTrain(id); return new ResultObject(); } }
5,639
0.734788
0.733436
209
23.770334
19.643349
79
false
false
0
0
0
0
0
0
1.84689
false
false
6
761e0eaec623b2c7ff61320bab57d1c51ffc0e35
8,967,891,777,113
1f49af851bd77165171f70db94594d6d8a047af2
/app/src/main/java/com/simon/appmanager_vip/https/CommonCallBack.java
dce93c95e31cd2de3d0ef7be8181af23ea741a3c
[]
no_license
SimonJGH/AppManager-Vip
https://github.com/SimonJGH/AppManager-Vip
e8df4c1882635568bcc0d8eeb1a396fce2116c08
590087dde254e7377592d41e279516b25043e665
refs/heads/master
2020-11-23T20:42:55.068000
2020-03-23T03:43:08
2020-03-23T03:43:08
227,813,246
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.simon.appmanager_vip.https; /** * 请求回调 * * @param <T> */ public interface CommonCallBack<T> { void requestSuccess(T result); void requestError(T errorMsg); void requestFinished(); }
UTF-8
Java
223
java
CommonCallBack.java
Java
[]
null
[]
package com.simon.appmanager_vip.https; /** * 请求回调 * * @param <T> */ public interface CommonCallBack<T> { void requestSuccess(T result); void requestError(T errorMsg); void requestFinished(); }
223
0.660465
0.660465
15
13.266666
15.185373
39
false
false
0
0
0
0
0
0
0.266667
false
false
6
6201679e9bfb58c3a4a5296842250b4ca530f398
4,398,046,514,018
0e2c9bffdf5dbe74bb6f3d17ccaf9024cd4f9cf9
/src/com/wechatpay/servlet/TopayServlet.java
d793bd8ecbfd1557757b47211b978ef40168dc30
[]
no_license
duyishuaixue/wexinPay
https://github.com/duyishuaixue/wexinPay
28861571b451c0ba87bd59f02d75260417530d03
206eed3dac5c892aa9fb4696968567ad248f4a47
refs/heads/master
2021-01-11T18:20:39.722000
2016-11-08T06:44:44
2016-11-08T06:44:44
69,621,620
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wechatpay.servlet; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Map; import java.util.Random; import java.util.SortedMap; import java.util.TreeMap; import java.util.UUID; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.wechatpay.util.CommonUtil; import com.wechatpay.util.MPConfigUtils; import net.sf.json.JSONObject; /** * 这个类是微信那边请求调用这个类 * @author zhangwenchao * @CreateDate 2016-09-25 08:30 * */ public class TopayServlet extends HttpServlet { private static final long serialVersionUID = -4946802691127283340L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { //网页授权后获取传递的参数 String orderNo = request.getParameter("orderNo"); String code = request.getParameter("code"); System.out.println("获取到的code是: "+code +" 订单号是: "+orderNo); /** * 第2步:通过code获取openId */ String openId = CommonUtil.getOpenIdByCode(code); /** * 第3步:获取签名,把签名与PayInfo中的其他数据转成XML格式,当做参数传递给统一下单地址 */ String nonceStr = UUID.randomUUID().toString().replace("-",""); //随机字符串 //String ip = CommonUtil.getIpAddr(request); orderNo = new Random().nextInt(10)+new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());//商品订单号 SortedMap<Object,Object> parameters = new TreeMap<Object,Object>(); //公众账号ID 微信分配的公众账号ID(企业号corpid即为此appId) parameters.put("appid", MPConfigUtils.APPID); //商户号 微信支付分配的商户号 parameters.put("mch_id", MPConfigUtils.MCH_ID); //随机字符串 随机字符串,不长于32位。推荐随机数生成算法 parameters.put("nonce_str", nonceStr); //商品描述 商品或支付单简要描述 parameters.put("body", "Iphone7"); parameters.put("out_trade_no", orderNo); parameters.put("total_fee", "1");//订单总金额 parameters.put("spbill_create_ip",request.getRemoteHost()); parameters.put("notify_url", MPConfigUtils.NOTIFY_URL); Calendar start=Calendar.getInstance(); SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss"); String time_start =sdf.format(start.getTimeInMillis()); //交易起始时间 订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则 parameters.put("time_start", time_start); //订单失效时间 订单失效时间为下单后30分钟,30分钟未支付则一律作废,如果有需求可以调整时间 Calendar expire=Calendar.getInstance(); int cont = 30; expire.add(Calendar.MINUTE,cont); String time_expire=sdf.format(expire.getTimeInMillis()); //交易结束时间 订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则注意:最短失效时间间隔必须大于5分钟 parameters.put("time_expire", time_expire); //交易类型 取值如下:JSAPI,NATIVE,APP,WAP,详细说明见参数规定 parameters.put("trade_type", "JSAPI"); //用户标识 trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识。 //openid如何获取,可参考【获取openid】 parameters.put("openid", openId); String sign = CommonUtil.createSign("UTF-8", parameters); parameters.put("sign", sign); String requestXML = CommonUtil.getRequestXml(parameters); System.out.println("生成的签名是: "+sign); /** * 第4步:调用统一下单地址 */ Map<String, String> map = CommonUtil.httpsRequestToXML(MPConfigUtils.UNIFIED_ORDER_URL, "POST", requestXML.replace("__", "_").replace("<![CDATA[", "").replace("]]>", "")); /** * 第5步:获取 prepay_Id 预支付ID */ String return_code = map.get("return_code"); if(return_code!=null && return_code.length()>0 && "SUCCESS".equals(return_code)){ String return_msg = map.get("return_msg"); if(return_msg!=null && return_msg.length()>0 && !return_msg.equals("OK")) { System.out.println("统一下单错误!return_msg的值为:"+return_msg); } }else{ System.out.println("统一下单错误!return_code 为空或不为SUCCESS "+return_code); } String prepay_id = map.get("prepay_id"); /** * 第6步:跳转到我们系统的支付界面 * 再次生成签名 */ String userAgent = request.getHeader("user-agent"); char agent = userAgent.charAt(userAgent.indexOf("MicroMessenger")+15); JSONObject json = new JSONObject(); if (prepay_id!=""||prepay_id!=null) { //生成时间戳 String timestamp=Long.toString(new Date().getTime()).substring(0, 10); SortedMap<Object,Object> params = new TreeMap<Object,Object>(); params.put("appId", MPConfigUtils.APPID); params.put("timeStamp", timestamp); params.put("nonceStr", nonceStr); params.put("package", "prepay_id="+prepay_id); params.put("signType", "MD5"); String paySign = CommonUtil.createSign("UTF-8", params); params.put("packageValue", "prepay_id="+prepay_id); //这里用packageValue是预防package是关键字在js获取值出错 params.put("paySign", paySign); //paySign的生成规则和Sign的生成规则一致 params.put("agent", agent);//微信版本号,用于前面提到的判断用户手机微信的版本是否是5.0以上版本。 json = JSONObject.fromObject(params); request.setAttribute("json", json); }else { request.setAttribute("json", json); } String params = "appId="+MPConfigUtils.APPID+"&timeStamp="+json.getString("timeStamp")+"&nonceStr="+nonceStr+"&signature="+json.getString("paySign")+"&prepay_id="+prepay_id+"&package1="+json.getString("package"); response.sendRedirect(request.getContextPath()+"/weixin_pay/weixin_pay.jsp?"+params); } catch (Exception e) { e.printStackTrace(); response.sendRedirect(request.getContextPath()+"/weixin_pay/weixin_pay.jsp"); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
UTF-8
Java
6,881
java
TopayServlet.java
Java
[ { "context": "son.JSONObject;\n\n/**\n * 这个类是微信那边请求调用这个类\n * @author zhangwenchao\n * @CreateDate 2016-09-25 08:30\n *\n */\npublic cla", "end": 600, "score": 0.9987605214118958, "start": 588, "tag": "USERNAME", "value": "zhangwenchao" } ]
null
[]
package com.wechatpay.servlet; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Map; import java.util.Random; import java.util.SortedMap; import java.util.TreeMap; import java.util.UUID; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.wechatpay.util.CommonUtil; import com.wechatpay.util.MPConfigUtils; import net.sf.json.JSONObject; /** * 这个类是微信那边请求调用这个类 * @author zhangwenchao * @CreateDate 2016-09-25 08:30 * */ public class TopayServlet extends HttpServlet { private static final long serialVersionUID = -4946802691127283340L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { //网页授权后获取传递的参数 String orderNo = request.getParameter("orderNo"); String code = request.getParameter("code"); System.out.println("获取到的code是: "+code +" 订单号是: "+orderNo); /** * 第2步:通过code获取openId */ String openId = CommonUtil.getOpenIdByCode(code); /** * 第3步:获取签名,把签名与PayInfo中的其他数据转成XML格式,当做参数传递给统一下单地址 */ String nonceStr = UUID.randomUUID().toString().replace("-",""); //随机字符串 //String ip = CommonUtil.getIpAddr(request); orderNo = new Random().nextInt(10)+new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());//商品订单号 SortedMap<Object,Object> parameters = new TreeMap<Object,Object>(); //公众账号ID 微信分配的公众账号ID(企业号corpid即为此appId) parameters.put("appid", MPConfigUtils.APPID); //商户号 微信支付分配的商户号 parameters.put("mch_id", MPConfigUtils.MCH_ID); //随机字符串 随机字符串,不长于32位。推荐随机数生成算法 parameters.put("nonce_str", nonceStr); //商品描述 商品或支付单简要描述 parameters.put("body", "Iphone7"); parameters.put("out_trade_no", orderNo); parameters.put("total_fee", "1");//订单总金额 parameters.put("spbill_create_ip",request.getRemoteHost()); parameters.put("notify_url", MPConfigUtils.NOTIFY_URL); Calendar start=Calendar.getInstance(); SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss"); String time_start =sdf.format(start.getTimeInMillis()); //交易起始时间 订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则 parameters.put("time_start", time_start); //订单失效时间 订单失效时间为下单后30分钟,30分钟未支付则一律作废,如果有需求可以调整时间 Calendar expire=Calendar.getInstance(); int cont = 30; expire.add(Calendar.MINUTE,cont); String time_expire=sdf.format(expire.getTimeInMillis()); //交易结束时间 订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则注意:最短失效时间间隔必须大于5分钟 parameters.put("time_expire", time_expire); //交易类型 取值如下:JSAPI,NATIVE,APP,WAP,详细说明见参数规定 parameters.put("trade_type", "JSAPI"); //用户标识 trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识。 //openid如何获取,可参考【获取openid】 parameters.put("openid", openId); String sign = CommonUtil.createSign("UTF-8", parameters); parameters.put("sign", sign); String requestXML = CommonUtil.getRequestXml(parameters); System.out.println("生成的签名是: "+sign); /** * 第4步:调用统一下单地址 */ Map<String, String> map = CommonUtil.httpsRequestToXML(MPConfigUtils.UNIFIED_ORDER_URL, "POST", requestXML.replace("__", "_").replace("<![CDATA[", "").replace("]]>", "")); /** * 第5步:获取 prepay_Id 预支付ID */ String return_code = map.get("return_code"); if(return_code!=null && return_code.length()>0 && "SUCCESS".equals(return_code)){ String return_msg = map.get("return_msg"); if(return_msg!=null && return_msg.length()>0 && !return_msg.equals("OK")) { System.out.println("统一下单错误!return_msg的值为:"+return_msg); } }else{ System.out.println("统一下单错误!return_code 为空或不为SUCCESS "+return_code); } String prepay_id = map.get("prepay_id"); /** * 第6步:跳转到我们系统的支付界面 * 再次生成签名 */ String userAgent = request.getHeader("user-agent"); char agent = userAgent.charAt(userAgent.indexOf("MicroMessenger")+15); JSONObject json = new JSONObject(); if (prepay_id!=""||prepay_id!=null) { //生成时间戳 String timestamp=Long.toString(new Date().getTime()).substring(0, 10); SortedMap<Object,Object> params = new TreeMap<Object,Object>(); params.put("appId", MPConfigUtils.APPID); params.put("timeStamp", timestamp); params.put("nonceStr", nonceStr); params.put("package", "prepay_id="+prepay_id); params.put("signType", "MD5"); String paySign = CommonUtil.createSign("UTF-8", params); params.put("packageValue", "prepay_id="+prepay_id); //这里用packageValue是预防package是关键字在js获取值出错 params.put("paySign", paySign); //paySign的生成规则和Sign的生成规则一致 params.put("agent", agent);//微信版本号,用于前面提到的判断用户手机微信的版本是否是5.0以上版本。 json = JSONObject.fromObject(params); request.setAttribute("json", json); }else { request.setAttribute("json", json); } String params = "appId="+MPConfigUtils.APPID+"&timeStamp="+json.getString("timeStamp")+"&nonceStr="+nonceStr+"&signature="+json.getString("paySign")+"&prepay_id="+prepay_id+"&package1="+json.getString("package"); response.sendRedirect(request.getContextPath()+"/weixin_pay/weixin_pay.jsp?"+params); } catch (Exception e) { e.printStackTrace(); response.sendRedirect(request.getContextPath()+"/weixin_pay/weixin_pay.jsp"); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
6,881
0.661912
0.642214
142
40.471832
32.675247
216
false
false
0
0
0
0
0
0
2.37324
false
false
6
856f2bcd536a02a69d638e09b239f3f64302f7c1
19,782,619,427,004
e1703b48c2898330c2de6def806a75640e0eb706
/m1-capstone_VendingMachine/src/main/java/com/techelevator/VendingMachineCLI.java
92597bec9fc71d3d79d7afe1c8591de05d5d1f1b
[]
no_license
Chris-Niederkofler-Tech-Elevator/Projects_Capstone
https://github.com/Chris-Niederkofler-Tech-Elevator/Projects_Capstone
b6c32e6280c496add85275dabcadc683795f5d96
a8104970e1b674c7324a23e2c7f777e775217a43
refs/heads/master
2020-03-11T19:31:46.234000
2018-04-19T12:14:50
2018-04-19T12:14:50
126,190,759
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.techelevator; import java.util.Scanner; import com.techelevator.view.DisplayItemsStock; import com.techelevator.view.Machine; import com.techelevator.view.DisplayItemStock; import com.techelevator.view.Machine; import com.techelevator.view.Menu; public class VendingMachineCLI { private static final String MAIN_MENU_OPTION_DISPLAY_ITEMS = "Display Vending Machine Items"; private static final String MAIN_MENU_OPTION_PURCHASE = "Purchase"; private static final String[] MAIN_MENU_OPTIONS = { MAIN_MENU_OPTION_DISPLAY_ITEMS, MAIN_MENU_OPTION_PURCHASE }; private static final String SUB_MENU_OPTION_1 = "Feed Money"; private static final String SUB_MENU_OPTION_2 = "Purchase"; private static final String SUB_MENU_OPTION_3 = "Finish Transaction"; private static final String[] SUB_MENU_OPTIONS = {SUB_MENU_OPTION_1, SUB_MENU_OPTION_2, SUB_MENU_OPTION_3}; private static final String MONEY_MENU_OPTION_1 = "Feed 1 Dollar"; private static final String MONEY_MENU_OPTION_2 = "Feed 2 Dollars"; private static final String MONEY_MENU_OPTION_5 = "Feed 5 Dollars"; private static final String MONEY_MENU_OPTION_10 = "Feed 10 Dollars"; private static final String [] MONEY_MENU_OPTIONS = { MONEY_MENU_OPTION_1, MONEY_MENU_OPTION_2, MONEY_MENU_OPTION_5, MONEY_MENU_OPTION_10 }; private static Machine vendingMachine = null; private Menu menu; public VendingMachineCLI(Menu menu) { this.menu = menu; } public void run() { while(true) { String choice = (String)menu.getChoiceFromOptions(MAIN_MENU_OPTIONS); if(choice.equals(MAIN_MENU_OPTION_DISPLAY_ITEMS)) { vendingMachine.displayItems(); }else if(choice.equals(MAIN_MENU_OPTION_PURCHASE)) { while(true) { String submenuOptions = (String) menu.getChoiceFromOptions(SUB_MENU_OPTIONS); if(submenuOptions.equals(SUB_MENU_OPTION_1)){ String moneyMenuOption = (String)menu.getChoiceFromOptions(MONEY_MENU_OPTIONS); if(moneyMenuOption.equals(MONEY_MENU_OPTION_1)) { vendingMachine.feedMoney(1); }else if (moneyMenuOption.equals(MONEY_MENU_OPTION_2)) { vendingMachine.feedMoney(2); }else if (moneyMenuOption.equals(MONEY_MENU_OPTION_5)) { vendingMachine.feedMoney(3); }else if ((moneyMenuOption.equals(MONEY_MENU_OPTION_10))) { vendingMachine.feedMoney(4); } }else if (submenuOptions.equals(SUB_MENU_OPTION_2)) { vendingMachine.displayItems(); System.out.println("Please input your Selection"); Scanner selection = new Scanner(System.in); String inventoryControl = selection.nextLine(); vendingMachine.control(inventoryControl); }else if(submenuOptions.equals(SUB_MENU_OPTION_3)) { vendingMachine.completeTransaction(); break; } } } } } public static void main(String[] args) { Menu menu = new Menu(System.in, System.out); VendingMachineCLI cli = new VendingMachineCLI(menu); vendingMachine = new Machine(new DisplayItemsStock().importedCsv()); cli.run(); } }
UTF-8
Java
3,068
java
VendingMachineCLI.java
Java
[]
null
[]
package com.techelevator; import java.util.Scanner; import com.techelevator.view.DisplayItemsStock; import com.techelevator.view.Machine; import com.techelevator.view.DisplayItemStock; import com.techelevator.view.Machine; import com.techelevator.view.Menu; public class VendingMachineCLI { private static final String MAIN_MENU_OPTION_DISPLAY_ITEMS = "Display Vending Machine Items"; private static final String MAIN_MENU_OPTION_PURCHASE = "Purchase"; private static final String[] MAIN_MENU_OPTIONS = { MAIN_MENU_OPTION_DISPLAY_ITEMS, MAIN_MENU_OPTION_PURCHASE }; private static final String SUB_MENU_OPTION_1 = "Feed Money"; private static final String SUB_MENU_OPTION_2 = "Purchase"; private static final String SUB_MENU_OPTION_3 = "Finish Transaction"; private static final String[] SUB_MENU_OPTIONS = {SUB_MENU_OPTION_1, SUB_MENU_OPTION_2, SUB_MENU_OPTION_3}; private static final String MONEY_MENU_OPTION_1 = "Feed 1 Dollar"; private static final String MONEY_MENU_OPTION_2 = "Feed 2 Dollars"; private static final String MONEY_MENU_OPTION_5 = "Feed 5 Dollars"; private static final String MONEY_MENU_OPTION_10 = "Feed 10 Dollars"; private static final String [] MONEY_MENU_OPTIONS = { MONEY_MENU_OPTION_1, MONEY_MENU_OPTION_2, MONEY_MENU_OPTION_5, MONEY_MENU_OPTION_10 }; private static Machine vendingMachine = null; private Menu menu; public VendingMachineCLI(Menu menu) { this.menu = menu; } public void run() { while(true) { String choice = (String)menu.getChoiceFromOptions(MAIN_MENU_OPTIONS); if(choice.equals(MAIN_MENU_OPTION_DISPLAY_ITEMS)) { vendingMachine.displayItems(); }else if(choice.equals(MAIN_MENU_OPTION_PURCHASE)) { while(true) { String submenuOptions = (String) menu.getChoiceFromOptions(SUB_MENU_OPTIONS); if(submenuOptions.equals(SUB_MENU_OPTION_1)){ String moneyMenuOption = (String)menu.getChoiceFromOptions(MONEY_MENU_OPTIONS); if(moneyMenuOption.equals(MONEY_MENU_OPTION_1)) { vendingMachine.feedMoney(1); }else if (moneyMenuOption.equals(MONEY_MENU_OPTION_2)) { vendingMachine.feedMoney(2); }else if (moneyMenuOption.equals(MONEY_MENU_OPTION_5)) { vendingMachine.feedMoney(3); }else if ((moneyMenuOption.equals(MONEY_MENU_OPTION_10))) { vendingMachine.feedMoney(4); } }else if (submenuOptions.equals(SUB_MENU_OPTION_2)) { vendingMachine.displayItems(); System.out.println("Please input your Selection"); Scanner selection = new Scanner(System.in); String inventoryControl = selection.nextLine(); vendingMachine.control(inventoryControl); }else if(submenuOptions.equals(SUB_MENU_OPTION_3)) { vendingMachine.completeTransaction(); break; } } } } } public static void main(String[] args) { Menu menu = new Menu(System.in, System.out); VendingMachineCLI cli = new VendingMachineCLI(menu); vendingMachine = new Machine(new DisplayItemsStock().importedCsv()); cli.run(); } }
3,068
0.713494
0.702738
98
30.295918
30.543114
141
false
false
0
0
0
0
0
0
2.77551
false
false
6
23a752809db2ddcc517eb19c6566679c8c84a6d5
4,784,593,629,924
038fde85b5fd9838c21fe06a5b443a8e4f994497
/src/test/java/com/mikerussell/javacodedom/elements/FieldDeclarationTest.java
d0057c6d064413b1c8993710e07f75f3fd7b2dfc
[]
no_license
mikerussellnz/javacodedom
https://github.com/mikerussellnz/javacodedom
017a98f77c4a044d9e9501e685d8a55f079ff0fe
d791faefa74507c8e4cdcc45f38d0cffee64bdb3
refs/heads/master
2021-06-04T05:52:12.998000
2020-05-28T09:32:15
2020-05-28T09:32:15
101,973,956
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mikerussell.javacodedom.elements; import static com.mikerussell.javacodedom.core.AccessModifier.FINAL; import static com.mikerussell.javacodedom.core.AccessModifier.PRIVATE; import static com.mikerussell.javacodedom.core.AccessModifier.PUBLIC; import static com.mikerussell.javacodedom.core.AccessModifier.STATIC; import com.mikerussell.javacodedom.BaseTest; import com.mikerussell.javacodedom.core.AccessModifier; import org.junit.Test; public class FieldDeclarationTest extends BaseTest{ @Test public void testFieldDeclaration() { FieldDeclaration fieldDeclaration = new FieldDeclaration(PRIVATE, TypeReference.INT, "a"); generateAndCompare("TestFieldDeclaration", fieldDeclaration); } @Test public void testFieldDeclarationFinal() { FieldDeclaration fieldDeclaration = new FieldDeclaration(PUBLIC | FINAL | STATIC , TypeReference.INT, "a"); generateAndCompare("TestFieldDeclarationConstant", fieldDeclaration); } @Test public void testFieldDeclarationWithInitializer() { FieldDeclaration fieldDeclaration = new FieldDeclaration(PRIVATE, TypeReference.INT, "a") .initializeWith(new Primitive(5)); generateAndCompare("TestFieldDeclarationWithInitializer", fieldDeclaration); } }
UTF-8
Java
1,246
java
FieldDeclarationTest.java
Java
[]
null
[]
package com.mikerussell.javacodedom.elements; import static com.mikerussell.javacodedom.core.AccessModifier.FINAL; import static com.mikerussell.javacodedom.core.AccessModifier.PRIVATE; import static com.mikerussell.javacodedom.core.AccessModifier.PUBLIC; import static com.mikerussell.javacodedom.core.AccessModifier.STATIC; import com.mikerussell.javacodedom.BaseTest; import com.mikerussell.javacodedom.core.AccessModifier; import org.junit.Test; public class FieldDeclarationTest extends BaseTest{ @Test public void testFieldDeclaration() { FieldDeclaration fieldDeclaration = new FieldDeclaration(PRIVATE, TypeReference.INT, "a"); generateAndCompare("TestFieldDeclaration", fieldDeclaration); } @Test public void testFieldDeclarationFinal() { FieldDeclaration fieldDeclaration = new FieldDeclaration(PUBLIC | FINAL | STATIC , TypeReference.INT, "a"); generateAndCompare("TestFieldDeclarationConstant", fieldDeclaration); } @Test public void testFieldDeclarationWithInitializer() { FieldDeclaration fieldDeclaration = new FieldDeclaration(PRIVATE, TypeReference.INT, "a") .initializeWith(new Primitive(5)); generateAndCompare("TestFieldDeclarationWithInitializer", fieldDeclaration); } }
1,246
0.806581
0.805779
32
37.9375
33.864563
111
false
false
0
0
0
0
0
0
0.78125
false
false
6
7a030ca03ba21270766b19fea51987aefc1bb109
7,516,192,777,162
be2c47a44076058967ca3d03ba08ab46497abb60
/src/main/java/com/largecode/dailylunch/utility/HashUtility.java
53718a2aa67a92799ebee880f6de9dd76970c6ba
[]
no_license
andzejstefanovic/dailylunch
https://github.com/andzejstefanovic/dailylunch
b7452e01489af8cbcb50bee072b1e23db13ebdc3
c16c282ab199db1891de4555a46009b0003ae829
refs/heads/master
2018-01-08T14:30:47.737000
2016-01-11T23:04:41
2016-01-11T23:04:41
49,382,230
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.largecode.dailylunch.utility; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class HashUtility { private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String getSHA1(String message) { try { MessageDigest messageDigestSHA1 = MessageDigest.getInstance("SHA1"); messageDigestSHA1.update(message.getBytes()); return getHex(messageDigestSHA1.digest()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } private static String getHex(byte[] bytes) { StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { stringBuffer.append(HEX_DIGITS[(bytes[i] >> 4) & 0x0f]); stringBuffer.append(HEX_DIGITS[bytes[i] & 0x0f]); } return stringBuffer.toString(); } }
UTF-8
Java
913
java
HashUtility.java
Java
[]
null
[]
package com.largecode.dailylunch.utility; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class HashUtility { private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String getSHA1(String message) { try { MessageDigest messageDigestSHA1 = MessageDigest.getInstance("SHA1"); messageDigestSHA1.update(message.getBytes()); return getHex(messageDigestSHA1.digest()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } private static String getHex(byte[] bytes) { StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { stringBuffer.append(HEX_DIGITS[(bytes[i] >> 4) & 0x0f]); stringBuffer.append(HEX_DIGITS[bytes[i] & 0x0f]); } return stringBuffer.toString(); } }
913
0.657174
0.634173
29
29.482759
28.721758
125
false
false
0
0
0
0
0
0
2.275862
false
false
6
b11007290cb6cd80288359437bf877f22c242b25
6,863,357,747,760
9dbf5c57a7eb0683e342b1c431be9bc7b7e4ebf9
/src/main/java/net/designforcode/util/TranslateUtil.java
f151a2276a23904b3ebccf19cc500eb7be1cdfc0
[]
no_license
bdmstyle/jtranslate
https://github.com/bdmstyle/jtranslate
1544306cc6f324db6ee733aebf985d3969dc354d
d0685bd4d1725df1b0654bbc14df5444df3e2262
refs/heads/master
2020-03-01T18:52:08.086000
2017-12-31T17:52:42
2017-12-31T17:52:42
22,746,633
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.designforcode.util; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; /** * @author bruno bdmstyle2@gmail.com * */ @SuppressWarnings("rawtypes") public class TranslateUtil { private static ExecutorService executorService = Executors.newFixedThreadPool(10); public static ExecutorService getExecutorService() { return executorService; } public static void executeAsync(Runnable process){ executorService.execute(process); } public static void waitFinish( Future process) { try { process.get(10,TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); } } public static void delay(long time){ try { Thread.sleep(time); } catch (Exception e) { e.printStackTrace(); } } public static String getRawText() { try{ Transferable clipboardContents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); if (clipboardContents !=null && clipboardContents.isDataFlavorSupported(DataFlavor.stringFlavor)) { String text = (String) clipboardContents.getTransferData(DataFlavor.stringFlavor); return truncateNicely(text,300); } }catch (Exception e) { e.printStackTrace(); } return "no text"; } public static String truncateNicely(String text, int length) { int lowerBound, upperBound; if (text.length() <= length) { return text; } lowerBound = length / 4; upperBound = length + (length / 2); for (int i = length - 1; i > lowerBound; i--) { if (Character.isWhitespace(text.charAt(i))) { return text.substring(0, i); } } for (int i = (length); i < upperBound; i++) { if (Character.isWhitespace(text.charAt(i))) { return text.substring(0, i); } } return text.substring(0, length); } }
UTF-8
Java
2,252
java
TranslateUtil.java
Java
[ { "context": "ort java.util.concurrent.TimeUnit;\n\n/**\n * @author bruno bdmstyle2@gmail.com\n * */\n@SuppressWarnings(\"rawt", "end": 321, "score": 0.9818348288536072, "start": 316, "tag": "NAME", "value": "bruno" }, { "context": "va.util.concurrent.TimeUnit;\n\n/**\n * @author bruno bdmstyle2@gmail.com\n * */\n@SuppressWarnings(\"rawtypes\")\npublic class ", "end": 341, "score": 0.9998971223831177, "start": 322, "tag": "EMAIL", "value": "bdmstyle2@gmail.com" } ]
null
[]
package net.designforcode.util; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; /** * @author bruno <EMAIL> * */ @SuppressWarnings("rawtypes") public class TranslateUtil { private static ExecutorService executorService = Executors.newFixedThreadPool(10); public static ExecutorService getExecutorService() { return executorService; } public static void executeAsync(Runnable process){ executorService.execute(process); } public static void waitFinish( Future process) { try { process.get(10,TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); } } public static void delay(long time){ try { Thread.sleep(time); } catch (Exception e) { e.printStackTrace(); } } public static String getRawText() { try{ Transferable clipboardContents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); if (clipboardContents !=null && clipboardContents.isDataFlavorSupported(DataFlavor.stringFlavor)) { String text = (String) clipboardContents.getTransferData(DataFlavor.stringFlavor); return truncateNicely(text,300); } }catch (Exception e) { e.printStackTrace(); } return "no text"; } public static String truncateNicely(String text, int length) { int lowerBound, upperBound; if (text.length() <= length) { return text; } lowerBound = length / 4; upperBound = length + (length / 2); for (int i = length - 1; i > lowerBound; i--) { if (Character.isWhitespace(text.charAt(i))) { return text.substring(0, i); } } for (int i = (length); i < upperBound; i++) { if (Character.isWhitespace(text.charAt(i))) { return text.substring(0, i); } } return text.substring(0, length); } }
2,240
0.615453
0.609236
80
27.15
25.160534
112
false
false
0
0
0
0
0
0
0.6125
false
false
6
3d415f0d9cac9a26e23aaffa4d704da2ac7ecbc6
9,586,367,071,280
7fa62bfcf4732728fcb7ab559b019968d3423009
/src/main/java/controller/RelationshipsControl.java
b6625b53bc6abfdcb75b04e930ba9be48e21e280
[]
no_license
ShiroNatsu22/ProjectLudum
https://github.com/ShiroNatsu22/ProjectLudum
51b3ccb8d0e488ccf50fcc0037ffcea1a594a7c0
2f5e6e7063e97f6f1dae720286eab02dc5d7f414
refs/heads/master
2020-12-03T00:30:20.306000
2017-09-14T03:16:42
2017-09-14T03:16:42
96,036,867
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import dao.RelationshipDAO; import dao.RelationshipDAOImpl; import dao.UserDAO; import dao.UserDAOImpl; import model.Relationship; import model.User; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; @WebServlet("/controller/RelationshipsControl") public class RelationshipsControl extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); RelationshipDAO relationshipDAO = new RelationshipDAOImpl(); Relationship currentRelationship = new Relationship(); User currentUser = (User) req.getSession(true).getAttribute("currentUser"); String id = req.getParameter("id"); if (id != null) { int user_id_pk = Integer.parseInt(id); // Se obtiene la relación del usuario de sesión con el usuario if (currentUser != null) currentRelationship = relationshipDAO.getRelationshipByUserIDandUserID(currentUser.getUser_id_pk(), user_id_pk); req.setAttribute("currentRelationship", currentRelationship); // Se obtienen todas los amigos del usuario de la id req.setAttribute("friendsCurrentUser", getUserFriends(user_id_pk)); // Se obtienen todas las peticiones de amistad del usuario req.setAttribute("friendRequestsCurrentUser", getUserFriendRequests(user_id_pk)); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); RelationshipDAO relationshipDAO = new RelationshipDAOImpl(); User currentUser = (User) req.getSession(true).getAttribute("currentUser"); String relationshipRequest = req.getParameter("newRelationshipRequest"); String acceptRelationship = req.getParameter("acceptRelationship"); String rejectRelationship = req.getParameter("rejectRelationship"); // Enviar petición de amistad if (relationshipRequest != null) { relationshipDAO.createRelationship(new Relationship(0, currentUser.getUser_id_pk(), Integer.parseInt(relationshipRequest), "pending")); } // Aceptar o rechazar la petición de amistad else if (acceptRelationship != null || rejectRelationship != null) { Relationship previousRelationship = relationshipDAO.getRelationshipByUserIDandUserID(Integer.parseInt(acceptRelationship != null ? acceptRelationship : rejectRelationship), currentUser.getUser_id_pk()); // Borramos la relación anterior relationshipDAO.deleteRelationshipByID(previousRelationship.getRelationship_id_pk()); // En caso de aceptar la relación if (acceptRelationship != null) relationshipDAO.createRelationship(new Relationship(0, previousRelationship.getSender_user_id_fk(), previousRelationship.getReceiver_user_id_fk(), "accepted")); } resp.sendRedirect(req.getHeader("Referer")); } private List<User> getUserFriends(int user_id_fk) { return getUserRelationshipUsers(user_id_fk, "accepted"); } private List<User> getUserFriendRequests(int user_id_fk) { return getUserRelationshipUsers(user_id_fk, "pending"); } private List<User> getUserRelationshipUsers(int user_id_fk, String status) { UserDAO userDAO = new UserDAOImpl(); RelationshipDAO relationshipDAO = new RelationshipDAOImpl(); List<Relationship> relationshipList = relationshipDAO.getRelationshipsByIDAndStatus(user_id_fk, status); List<User> userList = new ArrayList<User>(); for (Relationship relationship : relationshipList) { if (relationship.getSender_user_id_fk() != user_id_fk) userList.add(userDAO.getUserByUserID(relationship.getSender_user_id_fk())); else userList.add(userDAO.getUserByUserID(relationship.getReceiver_user_id_fk())); } return userList; } }
UTF-8
Java
4,377
java
RelationshipsControl.java
Java
[]
null
[]
package controller; import dao.RelationshipDAO; import dao.RelationshipDAOImpl; import dao.UserDAO; import dao.UserDAOImpl; import model.Relationship; import model.User; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; @WebServlet("/controller/RelationshipsControl") public class RelationshipsControl extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); RelationshipDAO relationshipDAO = new RelationshipDAOImpl(); Relationship currentRelationship = new Relationship(); User currentUser = (User) req.getSession(true).getAttribute("currentUser"); String id = req.getParameter("id"); if (id != null) { int user_id_pk = Integer.parseInt(id); // Se obtiene la relación del usuario de sesión con el usuario if (currentUser != null) currentRelationship = relationshipDAO.getRelationshipByUserIDandUserID(currentUser.getUser_id_pk(), user_id_pk); req.setAttribute("currentRelationship", currentRelationship); // Se obtienen todas los amigos del usuario de la id req.setAttribute("friendsCurrentUser", getUserFriends(user_id_pk)); // Se obtienen todas las peticiones de amistad del usuario req.setAttribute("friendRequestsCurrentUser", getUserFriendRequests(user_id_pk)); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); RelationshipDAO relationshipDAO = new RelationshipDAOImpl(); User currentUser = (User) req.getSession(true).getAttribute("currentUser"); String relationshipRequest = req.getParameter("newRelationshipRequest"); String acceptRelationship = req.getParameter("acceptRelationship"); String rejectRelationship = req.getParameter("rejectRelationship"); // Enviar petición de amistad if (relationshipRequest != null) { relationshipDAO.createRelationship(new Relationship(0, currentUser.getUser_id_pk(), Integer.parseInt(relationshipRequest), "pending")); } // Aceptar o rechazar la petición de amistad else if (acceptRelationship != null || rejectRelationship != null) { Relationship previousRelationship = relationshipDAO.getRelationshipByUserIDandUserID(Integer.parseInt(acceptRelationship != null ? acceptRelationship : rejectRelationship), currentUser.getUser_id_pk()); // Borramos la relación anterior relationshipDAO.deleteRelationshipByID(previousRelationship.getRelationship_id_pk()); // En caso de aceptar la relación if (acceptRelationship != null) relationshipDAO.createRelationship(new Relationship(0, previousRelationship.getSender_user_id_fk(), previousRelationship.getReceiver_user_id_fk(), "accepted")); } resp.sendRedirect(req.getHeader("Referer")); } private List<User> getUserFriends(int user_id_fk) { return getUserRelationshipUsers(user_id_fk, "accepted"); } private List<User> getUserFriendRequests(int user_id_fk) { return getUserRelationshipUsers(user_id_fk, "pending"); } private List<User> getUserRelationshipUsers(int user_id_fk, String status) { UserDAO userDAO = new UserDAOImpl(); RelationshipDAO relationshipDAO = new RelationshipDAOImpl(); List<Relationship> relationshipList = relationshipDAO.getRelationshipsByIDAndStatus(user_id_fk, status); List<User> userList = new ArrayList<User>(); for (Relationship relationship : relationshipList) { if (relationship.getSender_user_id_fk() != user_id_fk) userList.add(userDAO.getUserByUserID(relationship.getSender_user_id_fk())); else userList.add(userDAO.getUserByUserID(relationship.getReceiver_user_id_fk())); } return userList; } }
4,377
0.704644
0.703729
117
36.358974
40.724941
214
false
false
0
0
0
0
0
0
0.564103
false
false
6
e81ff5810bae0a59087cf9074775534b558c0048
12,180,527,312,751
900d4ef53572dbda9a5127001dc69b50bf16a8e3
/src/main/java/org/tamacat/log/impl/Log4j2Logger.java
235bae9287c542f203a342f30742b4fd0496007d
[ "Apache-2.0" ]
permissive
tamacat-1-4/tamacat-core-1.4
https://github.com/tamacat-1-4/tamacat-core-1.4
919952c61e5b13963755a15024de1283f60cda9e
55b4b6140d0db8c3f245906b0e64a401d5bbaac8
refs/heads/master
2023-01-05T05:48:08.598000
2020-11-03T16:29:01
2020-11-03T16:29:01
299,150,891
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2018 tamacat.org * All rights reserved. */ package org.tamacat.log.impl; import java.io.IOException; import java.io.Serializable; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class Log4j2Logger extends AbstractLogger<Level> implements Serializable { private static final long serialVersionUID = 1L; private transient Logger delegate; static final String callerFQCN = Log4j2Logger.class.getName(); private String name; public Log4j2Logger(String name) { this.name = name; delegate = createLog4j2Logger(name); } static Logger createLog4j2Logger(String name) { return LogManager.getLogger(name); } private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); delegate = createLog4j2Logger(name); } @Override protected void log(Level level, Object message) { delegate.log(level, message, null); } @Override protected Level getDebugLevel() { return Level.DEBUG; } @Override protected Level getErrorLevel() { return Level.ERROR; } @Override protected Level getFatalLevel() { return Level.FATAL; } @Override protected Level getInfoLevel() { return Level.INFO; } @Override protected Level getTraceLevel() { return Level.TRACE; } @Override protected Level getWarnLevel() { return Level.WARN; } @Override protected boolean isEnabled(Level level) { return delegate.isEnabled(level); } public Object getOriginalLogger() { return delegate; } }
UTF-8
Java
1,660
java
Log4j2Logger.java
Java
[ { "context": "/*\r\n * Copyright (c) 2018 tamacat.org\r\n * All rights reserved.\r\n */\r\npackage org.tamaca", "end": 37, "score": 0.7511326670646667, "start": 29, "tag": "EMAIL", "value": "acat.org" } ]
null
[]
/* * Copyright (c) 2018 tam<EMAIL> * All rights reserved. */ package org.tamacat.log.impl; import java.io.IOException; import java.io.Serializable; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class Log4j2Logger extends AbstractLogger<Level> implements Serializable { private static final long serialVersionUID = 1L; private transient Logger delegate; static final String callerFQCN = Log4j2Logger.class.getName(); private String name; public Log4j2Logger(String name) { this.name = name; delegate = createLog4j2Logger(name); } static Logger createLog4j2Logger(String name) { return LogManager.getLogger(name); } private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); delegate = createLog4j2Logger(name); } @Override protected void log(Level level, Object message) { delegate.log(level, message, null); } @Override protected Level getDebugLevel() { return Level.DEBUG; } @Override protected Level getErrorLevel() { return Level.ERROR; } @Override protected Level getFatalLevel() { return Level.FATAL; } @Override protected Level getInfoLevel() { return Level.INFO; } @Override protected Level getTraceLevel() { return Level.TRACE; } @Override protected Level getWarnLevel() { return Level.WARN; } @Override protected boolean isEnabled(Level level) { return delegate.isEnabled(level); } public Object getOriginalLogger() { return delegate; } }
1,659
0.714458
0.70241
79
19.012659
20.162939
99
false
false
0
0
0
0
0
0
1.164557
false
false
6
60cf3972239a8e007b91fccbccb68d1247a8b23d
1,752,346,677,282
9bb928c3b412eea14af02032c584d0c776633429
/TP/src/main/java/isi/died/tp/estructuras/Arista.java
2e4db69c260482953b8cd1cb49c03e2694ce140a
[]
no_license
palovazquez/Trabajo-Practico-DIED
https://github.com/palovazquez/Trabajo-Practico-DIED
05006f1aa8647ae9863ba58a166e0168b425ab16
91b887fd49619a6e24a2d2bcba58488e9578f177
refs/heads/master
2021-07-08T09:27:22.388000
2019-08-08T05:12:56
2019-08-08T05:12:56
201,176,705
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package isi.died.tp.estructuras; import java.awt.BasicStroke; import java.awt.Graphics; import java.awt.Shape; import java.awt.Stroke; import java.awt.geom.Line2D; import java.awt.geom.Point2D; public class Arista<T> { private Vertice<T> inicio; private Vertice<T> fin; private int id; private Number valor; private String nombre; private int xInicio, xFin, yInicio, yFin; private Stroke formatoLinea; private Shape linea = null; public Arista(){ valor=1.0; } public Arista(T p1, T p2, String nombre, int id) { this.inicio = new Vertice(p1); this.fin = new Vertice(p2); this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); this.nombre = nombre; this.id = id; } public Arista(Vertice<T> ini,Vertice<T> fin){ this(); this.inicio = ini; this.fin = fin; this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); } public Arista(Vertice<T> ini, Vertice<T> fin, Number val){ this(ini, fin); this.valor = val; this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); } public Arista(Vertice<T> inicio, Vertice<T> fin, String nombre, int id) { this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); this.inicio = inicio; this.fin = fin; this.nombre = nombre; this.id = id; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public int getxInicio() { return xInicio; } public void setxInicio(int xInicio) { this.xInicio = xInicio; } public int getxFin() { return xFin; } public void setxFin(int xFin) { this.xFin = xFin; } public int getyInicio() { return yInicio; } public void setyInicio(int yInicio) { this.yInicio = yInicio; } public int getyFin() { return yFin; } public void setyFin(int yFin) { this.yFin = yFin; } public Stroke getFormatoLinea() { if(this.formatoLinea==null) this.formatoLinea = new BasicStroke(3.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); return formatoLinea; } public void setFormatoLinea(Stroke formatoLinea) { this.formatoLinea = formatoLinea; } public Shape getLinea() { if(this.linea==null) this.linea = new Line2D.Double(xInicio+10, yInicio+10, xFin+10, yFin+10); return linea; } public void setLinea(Shape linea) { this.linea = linea; } public Vertice<T> getInicio() { return inicio; } public void setInicio(Vertice<T> inicio) { this.inicio = inicio; } public Vertice<T> getFin() { return fin; } public void setFin(Vertice<T> fin) { this.fin = fin; } public Number getValor() { return valor; } public void setValor(Number valor) { this.valor = valor; } @Override public String toString() { return "( "+this.inicio.getId()+" --> "+this.fin.getId()+" )"; } @Override public boolean equals(Object obj) { return (obj instanceof Arista<?>) && ((Arista<?>)obj).getValor().equals(this.valor); } public boolean pertenece(Point2D p) { return this.linea.contains(p); } }
UTF-8
Java
3,373
java
Arista.java
Java
[]
null
[]
package isi.died.tp.estructuras; import java.awt.BasicStroke; import java.awt.Graphics; import java.awt.Shape; import java.awt.Stroke; import java.awt.geom.Line2D; import java.awt.geom.Point2D; public class Arista<T> { private Vertice<T> inicio; private Vertice<T> fin; private int id; private Number valor; private String nombre; private int xInicio, xFin, yInicio, yFin; private Stroke formatoLinea; private Shape linea = null; public Arista(){ valor=1.0; } public Arista(T p1, T p2, String nombre, int id) { this.inicio = new Vertice(p1); this.fin = new Vertice(p2); this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); this.nombre = nombre; this.id = id; } public Arista(Vertice<T> ini,Vertice<T> fin){ this(); this.inicio = ini; this.fin = fin; this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); } public Arista(Vertice<T> ini, Vertice<T> fin, Number val){ this(ini, fin); this.valor = val; this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); } public Arista(Vertice<T> inicio, Vertice<T> fin, String nombre, int id) { this.xInicio = inicio.getX(); this.xFin = fin.getX(); this.yInicio = inicio.getY(); this.yFin = fin.getY(); this.inicio = inicio; this.fin = fin; this.nombre = nombre; this.id = id; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public int getxInicio() { return xInicio; } public void setxInicio(int xInicio) { this.xInicio = xInicio; } public int getxFin() { return xFin; } public void setxFin(int xFin) { this.xFin = xFin; } public int getyInicio() { return yInicio; } public void setyInicio(int yInicio) { this.yInicio = yInicio; } public int getyFin() { return yFin; } public void setyFin(int yFin) { this.yFin = yFin; } public Stroke getFormatoLinea() { if(this.formatoLinea==null) this.formatoLinea = new BasicStroke(3.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); return formatoLinea; } public void setFormatoLinea(Stroke formatoLinea) { this.formatoLinea = formatoLinea; } public Shape getLinea() { if(this.linea==null) this.linea = new Line2D.Double(xInicio+10, yInicio+10, xFin+10, yFin+10); return linea; } public void setLinea(Shape linea) { this.linea = linea; } public Vertice<T> getInicio() { return inicio; } public void setInicio(Vertice<T> inicio) { this.inicio = inicio; } public Vertice<T> getFin() { return fin; } public void setFin(Vertice<T> fin) { this.fin = fin; } public Number getValor() { return valor; } public void setValor(Number valor) { this.valor = valor; } @Override public String toString() { return "( "+this.inicio.getId()+" --> "+this.fin.getId()+" )"; } @Override public boolean equals(Object obj) { return (obj instanceof Arista<?>) && ((Arista<?>)obj).getValor().equals(this.valor); } public boolean pertenece(Point2D p) { return this.linea.contains(p); } }
3,373
0.644234
0.638304
171
18.730993
17.971001
104
false
false
0
0
0
0
0
0
1.555556
false
false
6
137edde911d03b076c47c09576d9ba5c5a9d8891
22,840,636,144,124
796b2a20eaa6c3ae23041b02b646170550f87e3c
/app/src/main/java/com/vn/ntsc/widget/adapter/IMultifunctionAdapter.java
45dac24ca79baec04f8740a9d0dd318f068dd95b
[]
no_license
vinhnb90/NationalTrafficSocialAndroid
https://github.com/vinhnb90/NationalTrafficSocialAndroid
f3bca20789d340b7bdbb9781d734949c31184457
b14029f8977c81b0966309d669693cedfac65aba
refs/heads/master
2020-03-19T20:44:55.945000
2018-06-11T11:09:13
2018-06-11T11:09:13
136,914,888
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vn.ntsc.widget.adapter; import android.support.annotation.IntRange; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.vn.ntsc.core.model.BaseBean; import com.vn.ntsc.widget.adapter.animation.BaseAnimation; import com.vn.ntsc.widget.adapter.loadmore.LoadMoreView; import java.util.Collection; import java.util.List; /** * Đây là template cài đặt các phương thức cho {@LinK MultifunctionAdapter} */ public interface IMultifunctionAdapter<T extends BaseBean> { /** * Use with {@link #openLoadAnimation} */ int ALPHAIN = 0x00000001; /** * Use with {@link #openLoadAnimation} */ int SCALEIN = 0x00000002; /** * Use with {@link #openLoadAnimation} */ int SLIDEIN_BOTTOM = 0x00000003; /** * Use with {@link #openLoadAnimation} */ int SLIDEIN_LEFT = 0x00000004; /** * Use with {@link #openLoadAnimation} */ int SLIDEIN_RIGHT = 0x00000005; int HEADER_VIEW = 0x00000111; //Animation int LOADING_VIEW = 0x00000222; int FOOTER_VIEW = 0x00000333; int EMPTY_VIEW = 0x00000555; /** * same as recyclerView.setAdapter(), and save the instance of recyclerView */ void bindToRecyclerView(RecyclerView recyclerView); /** * @see #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView) * @deprecated This method is because it can lead to crash: always call this method while RecyclerView is computing a layout or scrolling. * Please use {@link #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView)} */ @Deprecated void setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener requestLoadMoreListener); /** * @see #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView) * @deprecated This method is because it can lead to crash: always call this method while RecyclerView is computing a layout or scrolling. * Please use {@link #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView)} */ void setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener requestLoadMoreListener, RecyclerView recyclerView); /** * bind recyclerView {@link #bindToRecyclerView(RecyclerView)} before use! * * @see #disableLoadMoreIfNeed(RecyclerView) */ void disableLoadMoreIfNeed(); /** * check if full page after {@link #setNewData(List)}, if full, it will enable load more again. * * @param recyclerView your recyclerView * @see #setNewData(List) */ void disableLoadMoreIfNeed(RecyclerView recyclerView); /** * up fetch end */ void setNotDoAnimationCount(int count); /** * Set custom load more * * @param loadingView */ void setLoadMoreView(LoadMoreView loadingView); /** * Load more view count * * @return 0 or 1 */ int getLoadMoreViewCount(); /** * Gets to load more locations * * @return */ int getLoadMoreViewPosition(); /** * @return Whether the Adapter is actively showing load * ic_progress. */ boolean isLoading(); /** * Refresh end, no more data */ void loadMoreEnd(); /** * Refresh end, no more data */ void loadMoreEmpty(); /** * Refresh end, no more data * * @param gone if true gone the load more view */ void loadMoreEnd(boolean gone); /** * Refresh getLstBlockComplete */ void loadMoreComplete(); /** * Refresh failed */ void loadMoreFail(); /** * Set the enabled state of load more. * * @param enable True if load more is enabled, false otherwise. */ void setEnableLoadMore(boolean enable); /** * Returns the enabled status for load more. * * @return True if load more is enabled, false otherwise. */ boolean isLoadMoreEnable(); /** * Sets the duration of the animation. * * @param duration The length of the animation, in milliseconds. */ void setDuration(int duration); /** * setting up a new instance to data; * * @param data */ void setNewData(@Nullable List<T> data); /** * insert a item associated with the specified position of adapter * * @param position * @param item * @deprecated use instead */ @Deprecated void add(@IntRange(from = 0) int position, @NonNull T item); /** * add one new data in to certain location * * @param position */ void addData(@IntRange(from = 0) int position, @NonNull T data); /** * add one new data in to first list * * @param data */ void addFirst(@NonNull T data); /** * add one new data */ void addData(@NonNull T data); /** * add new data in to certain location * * @param position the insert position * @param newData the new data collection */ void addData(@IntRange(from = 0) int position, @NonNull Collection<? extends T> newData); /** * add new data to the end of mData * * @param newData the new data collection */ void addData(@NonNull Collection<? extends T> newData); /** * remove the item associated with the specified position of adapter * * @param position */ void remove(@IntRange(from = 0) int position); /** * remove the item associated with the specified position of adapter * * @param adapterItemPosition * @param dataPosition */ void removeByPositionAdapter(@IntRange(from = 0) int adapterItemPosition, @IntRange(from = 0) int dataPosition); /** * change data */ void setData(@IntRange(from = 0) int index, @NonNull T data); /** * change data */ void updateData(@IntRange(from = 0) int index, @NonNull T data); /** * use data to replace all item in mData. this method is different {@link #setNewData(List)}, * it doesn't change the mData reference * * @param data data collection */ void replaceData(@NonNull Collection<? extends T> data); void replaceData(@IntRange(from = 0) int position, @NonNull T data); /** * Get the data of list * * @return List<T> */ @NonNull List<T> getData(); /** * Get the data item associated with the specified position in the data set. * * @param position Position of the item whose data we want within the adapter's * data set. * @return The data at the specified position. */ T getItem(@IntRange(from = 0) int position); /** * @param position * @return data at the specified position. */ T getData(@IntRange(from = 0) int position); /** * if setHeadView will be return 1 if not will be return 0. * notice: Deprecated! Use {@link ViewGroup#getChildCount()} of {@link #getHeaderLayout()} to replace. * * @return */ @Deprecated int getHeaderViewsCount(); /** * if mFooterLayout will be return 1 or not will be return 0. * notice: Deprecated! Use {@link ViewGroup#getChildCount()} of {@link #getFooterLayout()} to replace. * * @return */ @Deprecated int getFooterViewsCount(); /** * if addHeaderView will be return 1, if not will be return 0 */ int getHeaderLayoutCount(); /** * if addFooterView will be return 1, if not will be return 0 */ int getFooterLayoutCount(); /** * if show empty view will be return 1 or not will be return 0 * * @return */ int getEmptyViewCount(); int getItemCount(); int getItemViewType(int position); /** * The notification starts the callback and loads more */ void notifyLoadMoreToLoading(); /** * Load more without data when settings are clicked loaded * * @param enable */ void enableLoadMoreEndClick(boolean enable); boolean isHeaderViewAsFlow(); void setHeaderViewAsFlow(boolean headerViewAsFlow); boolean isFooterViewAsFlow(); void setFooterViewAsFlow(boolean footerViewAsFlow); /** * @param spanSizeLookup instance to be used to query number of spans occupied by each item */ void setSpanSizeLookup(MultifunctionAdapter.SpanSizeLookup spanSizeLookup); /** * Return root layout of header */ LinearLayout getHeaderLayout(); /** * Return root layout of footer */ LinearLayout getFooterLayout(); /** * Append header to the rear of the mHeaderLayout. * * @param header */ int addHeaderView(View header); /** * Add header view to mHeaderLayout and set header view position in mHeaderLayout. * When index = -1 or index >= child count in mHeaderLayout, * the effect of this method is the same as that of {@link #addHeaderView(View)}. * * @param header * @param index the position in mHeaderLayout of this header. * When index = -1 or index >= child count in mHeaderLayout, * the effect of this method is the same as that of {@link #addHeaderView(View)}. */ int addHeaderView(View header, int index); /** * @param header * @param index * @param orientation */ int addHeaderView(View header, int index, int orientation); int setHeaderView(View header); int setHeaderView(View header, int index); int setHeaderView(View header, int index, int orientation); /** * Append footer to the rear of the mFooterLayout. * * @param footer */ int addFooterView(View footer); int addFooterView(View footer, int index); /** * Add footer view to mFooterLayout and set footer view position in mFooterLayout. * When index = -1 or index >= child count in mFooterLayout, * the effect of this method is the same as that of {@link #addFooterView(View)}. * * @param footer * @param index the position in mFooterLayout of this footer. * When index = -1 or index >= child count in mFooterLayout, * the effect of this method is the same as that of {@link #addFooterView(View)}. */ int addFooterView(View footer, int index, int orientation); int setFooterView(View header); int setFooterView(View header, int index); int setFooterView(View header, int index, int orientation); /** * remove header view from mHeaderLayout. * When the child count of mHeaderLayout is 0, mHeaderLayout will be set to null. * * @param header */ void removeHeaderView(View header); /** * remove footer view from mFooterLayout, * When the child count of mFooterLayout is 0, mFooterLayout will be set to null. * * @param footer */ void removeFooterView(View footer); /** * remove all header view from mHeaderLayout and set null to mHeaderLayout */ void removeAllHeaderView(); /** * remove all footer view from mFooterLayout and set null to mFooterLayout */ void removeAllFooterView(); /** * bind recyclerView {@link #bindToRecyclerView(RecyclerView)} before use! * * @see #bindToRecyclerView(RecyclerView) */ void setEmptyView(int layoutResId, ViewGroup viewGroup); /** * bind recyclerView {@link #bindToRecyclerView(RecyclerView)} before use! * * @see #bindToRecyclerView(RecyclerView) */ void setEmptyView(int layoutResId); /** * Call before {@link RecyclerView#setAdapter(RecyclerView.Adapter)} * * @param isHeadAndEmpty false will not show headView if the data is empty true will show emptyView and headView */ void setHeaderAndEmpty(boolean isHeadAndEmpty); /** * set emptyView show if adapter is empty and want to show headview and footview * Call before {@link RecyclerView#setAdapter(RecyclerView.Adapter)} * * @param isHeadAndEmpty * @param isFootAndEmpty */ void setHeaderFooterEmpty(boolean isHeadAndEmpty, boolean isFootAndEmpty); /** * Set whether to use empty view * * @param isUseEmpty */ void isUseEmpty(boolean isUseEmpty); /** * When the current adapter is empty, the BaseQuickAdapter can display a special view * called the empty view. The empty view is used to provide feedback to the user * that no data is available in this AdapterView. * * @return The view to show if the adapter is empty. */ View getEmptyView(); void setEmptyView(View emptyView); void setAutoLoadMoreSize(int preLoadNumber); void setPreLoadNumber(int preLoadNumber); /** * Set the view animation type. * * @param animationType One of {@link #@AnimationType.ALPHAIN}, {@link #@AnimationType.SCALEIN}, {@link #@AnimationType.SLIDEIN_BOTTOM}, * {@link #@AnimationType.SLIDEIN_LEFT}, {@link #@AnimationType.SLIDEIN_RIGHT}. */ void openLoadAnimation(@MultifunctionAdapter.AnimationType int animationType); /** * Set Custom ObjectAnimator * * @param animation ObjectAnimator */ void openLoadAnimation(BaseAnimation animation); /** * To open the animation when layout_loading */ void openLoadAnimation(); /** * @param firstOnly true just show anim when first layout_loading false show anim when load the data every time */ void isFirstOnly(boolean firstOnly); }
UTF-8
Java
13,886
java
IMultifunctionAdapter.java
Java
[]
null
[]
package com.vn.ntsc.widget.adapter; import android.support.annotation.IntRange; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.vn.ntsc.core.model.BaseBean; import com.vn.ntsc.widget.adapter.animation.BaseAnimation; import com.vn.ntsc.widget.adapter.loadmore.LoadMoreView; import java.util.Collection; import java.util.List; /** * Đây là template cài đặt các phương thức cho {@LinK MultifunctionAdapter} */ public interface IMultifunctionAdapter<T extends BaseBean> { /** * Use with {@link #openLoadAnimation} */ int ALPHAIN = 0x00000001; /** * Use with {@link #openLoadAnimation} */ int SCALEIN = 0x00000002; /** * Use with {@link #openLoadAnimation} */ int SLIDEIN_BOTTOM = 0x00000003; /** * Use with {@link #openLoadAnimation} */ int SLIDEIN_LEFT = 0x00000004; /** * Use with {@link #openLoadAnimation} */ int SLIDEIN_RIGHT = 0x00000005; int HEADER_VIEW = 0x00000111; //Animation int LOADING_VIEW = 0x00000222; int FOOTER_VIEW = 0x00000333; int EMPTY_VIEW = 0x00000555; /** * same as recyclerView.setAdapter(), and save the instance of recyclerView */ void bindToRecyclerView(RecyclerView recyclerView); /** * @see #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView) * @deprecated This method is because it can lead to crash: always call this method while RecyclerView is computing a layout or scrolling. * Please use {@link #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView)} */ @Deprecated void setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener requestLoadMoreListener); /** * @see #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView) * @deprecated This method is because it can lead to crash: always call this method while RecyclerView is computing a layout or scrolling. * Please use {@link #setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener, RecyclerView)} */ void setOnLoadMoreListener(MultifunctionAdapter.RequestLoadMoreListener requestLoadMoreListener, RecyclerView recyclerView); /** * bind recyclerView {@link #bindToRecyclerView(RecyclerView)} before use! * * @see #disableLoadMoreIfNeed(RecyclerView) */ void disableLoadMoreIfNeed(); /** * check if full page after {@link #setNewData(List)}, if full, it will enable load more again. * * @param recyclerView your recyclerView * @see #setNewData(List) */ void disableLoadMoreIfNeed(RecyclerView recyclerView); /** * up fetch end */ void setNotDoAnimationCount(int count); /** * Set custom load more * * @param loadingView */ void setLoadMoreView(LoadMoreView loadingView); /** * Load more view count * * @return 0 or 1 */ int getLoadMoreViewCount(); /** * Gets to load more locations * * @return */ int getLoadMoreViewPosition(); /** * @return Whether the Adapter is actively showing load * ic_progress. */ boolean isLoading(); /** * Refresh end, no more data */ void loadMoreEnd(); /** * Refresh end, no more data */ void loadMoreEmpty(); /** * Refresh end, no more data * * @param gone if true gone the load more view */ void loadMoreEnd(boolean gone); /** * Refresh getLstBlockComplete */ void loadMoreComplete(); /** * Refresh failed */ void loadMoreFail(); /** * Set the enabled state of load more. * * @param enable True if load more is enabled, false otherwise. */ void setEnableLoadMore(boolean enable); /** * Returns the enabled status for load more. * * @return True if load more is enabled, false otherwise. */ boolean isLoadMoreEnable(); /** * Sets the duration of the animation. * * @param duration The length of the animation, in milliseconds. */ void setDuration(int duration); /** * setting up a new instance to data; * * @param data */ void setNewData(@Nullable List<T> data); /** * insert a item associated with the specified position of adapter * * @param position * @param item * @deprecated use instead */ @Deprecated void add(@IntRange(from = 0) int position, @NonNull T item); /** * add one new data in to certain location * * @param position */ void addData(@IntRange(from = 0) int position, @NonNull T data); /** * add one new data in to first list * * @param data */ void addFirst(@NonNull T data); /** * add one new data */ void addData(@NonNull T data); /** * add new data in to certain location * * @param position the insert position * @param newData the new data collection */ void addData(@IntRange(from = 0) int position, @NonNull Collection<? extends T> newData); /** * add new data to the end of mData * * @param newData the new data collection */ void addData(@NonNull Collection<? extends T> newData); /** * remove the item associated with the specified position of adapter * * @param position */ void remove(@IntRange(from = 0) int position); /** * remove the item associated with the specified position of adapter * * @param adapterItemPosition * @param dataPosition */ void removeByPositionAdapter(@IntRange(from = 0) int adapterItemPosition, @IntRange(from = 0) int dataPosition); /** * change data */ void setData(@IntRange(from = 0) int index, @NonNull T data); /** * change data */ void updateData(@IntRange(from = 0) int index, @NonNull T data); /** * use data to replace all item in mData. this method is different {@link #setNewData(List)}, * it doesn't change the mData reference * * @param data data collection */ void replaceData(@NonNull Collection<? extends T> data); void replaceData(@IntRange(from = 0) int position, @NonNull T data); /** * Get the data of list * * @return List<T> */ @NonNull List<T> getData(); /** * Get the data item associated with the specified position in the data set. * * @param position Position of the item whose data we want within the adapter's * data set. * @return The data at the specified position. */ T getItem(@IntRange(from = 0) int position); /** * @param position * @return data at the specified position. */ T getData(@IntRange(from = 0) int position); /** * if setHeadView will be return 1 if not will be return 0. * notice: Deprecated! Use {@link ViewGroup#getChildCount()} of {@link #getHeaderLayout()} to replace. * * @return */ @Deprecated int getHeaderViewsCount(); /** * if mFooterLayout will be return 1 or not will be return 0. * notice: Deprecated! Use {@link ViewGroup#getChildCount()} of {@link #getFooterLayout()} to replace. * * @return */ @Deprecated int getFooterViewsCount(); /** * if addHeaderView will be return 1, if not will be return 0 */ int getHeaderLayoutCount(); /** * if addFooterView will be return 1, if not will be return 0 */ int getFooterLayoutCount(); /** * if show empty view will be return 1 or not will be return 0 * * @return */ int getEmptyViewCount(); int getItemCount(); int getItemViewType(int position); /** * The notification starts the callback and loads more */ void notifyLoadMoreToLoading(); /** * Load more without data when settings are clicked loaded * * @param enable */ void enableLoadMoreEndClick(boolean enable); boolean isHeaderViewAsFlow(); void setHeaderViewAsFlow(boolean headerViewAsFlow); boolean isFooterViewAsFlow(); void setFooterViewAsFlow(boolean footerViewAsFlow); /** * @param spanSizeLookup instance to be used to query number of spans occupied by each item */ void setSpanSizeLookup(MultifunctionAdapter.SpanSizeLookup spanSizeLookup); /** * Return root layout of header */ LinearLayout getHeaderLayout(); /** * Return root layout of footer */ LinearLayout getFooterLayout(); /** * Append header to the rear of the mHeaderLayout. * * @param header */ int addHeaderView(View header); /** * Add header view to mHeaderLayout and set header view position in mHeaderLayout. * When index = -1 or index >= child count in mHeaderLayout, * the effect of this method is the same as that of {@link #addHeaderView(View)}. * * @param header * @param index the position in mHeaderLayout of this header. * When index = -1 or index >= child count in mHeaderLayout, * the effect of this method is the same as that of {@link #addHeaderView(View)}. */ int addHeaderView(View header, int index); /** * @param header * @param index * @param orientation */ int addHeaderView(View header, int index, int orientation); int setHeaderView(View header); int setHeaderView(View header, int index); int setHeaderView(View header, int index, int orientation); /** * Append footer to the rear of the mFooterLayout. * * @param footer */ int addFooterView(View footer); int addFooterView(View footer, int index); /** * Add footer view to mFooterLayout and set footer view position in mFooterLayout. * When index = -1 or index >= child count in mFooterLayout, * the effect of this method is the same as that of {@link #addFooterView(View)}. * * @param footer * @param index the position in mFooterLayout of this footer. * When index = -1 or index >= child count in mFooterLayout, * the effect of this method is the same as that of {@link #addFooterView(View)}. */ int addFooterView(View footer, int index, int orientation); int setFooterView(View header); int setFooterView(View header, int index); int setFooterView(View header, int index, int orientation); /** * remove header view from mHeaderLayout. * When the child count of mHeaderLayout is 0, mHeaderLayout will be set to null. * * @param header */ void removeHeaderView(View header); /** * remove footer view from mFooterLayout, * When the child count of mFooterLayout is 0, mFooterLayout will be set to null. * * @param footer */ void removeFooterView(View footer); /** * remove all header view from mHeaderLayout and set null to mHeaderLayout */ void removeAllHeaderView(); /** * remove all footer view from mFooterLayout and set null to mFooterLayout */ void removeAllFooterView(); /** * bind recyclerView {@link #bindToRecyclerView(RecyclerView)} before use! * * @see #bindToRecyclerView(RecyclerView) */ void setEmptyView(int layoutResId, ViewGroup viewGroup); /** * bind recyclerView {@link #bindToRecyclerView(RecyclerView)} before use! * * @see #bindToRecyclerView(RecyclerView) */ void setEmptyView(int layoutResId); /** * Call before {@link RecyclerView#setAdapter(RecyclerView.Adapter)} * * @param isHeadAndEmpty false will not show headView if the data is empty true will show emptyView and headView */ void setHeaderAndEmpty(boolean isHeadAndEmpty); /** * set emptyView show if adapter is empty and want to show headview and footview * Call before {@link RecyclerView#setAdapter(RecyclerView.Adapter)} * * @param isHeadAndEmpty * @param isFootAndEmpty */ void setHeaderFooterEmpty(boolean isHeadAndEmpty, boolean isFootAndEmpty); /** * Set whether to use empty view * * @param isUseEmpty */ void isUseEmpty(boolean isUseEmpty); /** * When the current adapter is empty, the BaseQuickAdapter can display a special view * called the empty view. The empty view is used to provide feedback to the user * that no data is available in this AdapterView. * * @return The view to show if the adapter is empty. */ View getEmptyView(); void setEmptyView(View emptyView); void setAutoLoadMoreSize(int preLoadNumber); void setPreLoadNumber(int preLoadNumber); /** * Set the view animation type. * * @param animationType One of {@link #@AnimationType.ALPHAIN}, {@link #@AnimationType.SCALEIN}, {@link #@AnimationType.SLIDEIN_BOTTOM}, * {@link #@AnimationType.SLIDEIN_LEFT}, {@link #@AnimationType.SLIDEIN_RIGHT}. */ void openLoadAnimation(@MultifunctionAdapter.AnimationType int animationType); /** * Set Custom ObjectAnimator * * @param animation ObjectAnimator */ void openLoadAnimation(BaseAnimation animation); /** * To open the animation when layout_loading */ void openLoadAnimation(); /** * @param firstOnly true just show anim when first layout_loading false show anim when load the data every time */ void isFirstOnly(boolean firstOnly); }
13,886
0.640334
0.632334
515
25.939806
29.003553
142
false
false
0
0
0
0
0
0
0.295146
false
false
6
3948fc928641f16929818774abbca4bbe16cf0f7
15,358,803,066,928
d4a99ce633fdf64dbae3a8d9d852627225186309
/springboot/src/main/java/com/zws/jdk/example/transfer/TransferExample.java
a9589c7974796b9c2614cdabfb43e9cd064dc424
[]
no_license
zengwensheng/framework
https://github.com/zengwensheng/framework
e9d2d9fbf5236f9d480d416c2d2593305c715ba9
7074bda7fd66f8727f79f0c2537e0349b78981fa
refs/heads/master
2020-03-30T01:31:45.846000
2019-10-29T07:48:30
2019-10-29T07:48:30
150,580,076
1
1
null
false
2019-10-29T07:49:44
2018-09-27T12:02:33
2019-10-29T07:48:43
2019-10-29T07:49:43
33,694
1
1
1
Java
false
false
package com.zws.jdk.example.transfer; import lombok.Data; import lombok.extern.slf4j.Slf4j; /** * @author zws * @email 2848392861@qq.com * date 2018/11/14 * * 值传递(pass by value)是指在调用函数时将实际参数复制一份传递到函数中,这样在函数中如果对参数进行修改,将不会影响到实际参数。 * * 引用传递(pass by reference)是指在调用函数时将实际参数的地址直接传递到函数中,那么在函数中对参数所进行的修改,将影响到实际参数。 * 值转递 引用传递 * 根本区别 会创建对象 不创建副本 * 所以 函数中无法改变原始对象 函数中可以改变原始对象 * * */ @Slf4j public class TransferExample { public static void main(String[] args) { /** * 值传递 */ String str = "a"; changeStr(str); // 实参 log.info("str:{}",str); /** * 引用传递 ??? * 这个例子是错误的,它是改变了只是堆中的值,而不是这个对象的引用 * * 你有一把钥匙,当你的朋友想要去你家的时候,如果你直接把你的钥匙给他了,这就是引用传递。 * 这种情况下,如果他对这把钥匙做了什么事情,比如他在钥匙上刻下了自己名字,那么这把钥匙还给你的时候, * 你自己的钥匙上也会多出他刻的名字。 * * 你有一把钥匙,当你的朋友想要去你家的时候,你复刻了一把新钥匙给他,自己的还在自己手里,这就是值传递。 * 这种情况下,他对这把钥匙做什么都不会影响你手里的这把钥匙。 * * 但是,不管上面哪种情况,你的朋友拿着你给他的钥匙,进到你的家里,把你家的电视砸了。 * 那你说你会不会受到影响?而我们在pass方法中,改变user对象的name属性的值的时候, * 不就是在“砸电视”么。你改变的不是那把钥匙,而是钥匙打开的房子。 */ User user = new User(); user.setGender("男"); user.setName("a"); changeUser1(user); System.out.println(user); /** * 这个例子才是正确的 * 如果java存在引用传递并且这个是引用传递的话,那么形参就是这个引用,这个方法中将new的对象赋值给这个引用 * 所以实参中的引用就会发生改变 * 但是实际的结果不是的,因此java不存在引用转递 * 如果实在不理解的话,可以去看看c语言中的引用传递的例子 */ user.setGender("男"); user.setName("a"); changeUser2(user); System.out.println(user); } public static void changeStr(String str){ //形参 str = "b"; } public static void changeUser1(User user){//形参 user.setName("b"); } public static void changeUser2(User user){//形参 user = new User(); user.setName("b"); user.setGender("男"); } } @Data class User{ private String name; private String gender; }
UTF-8
Java
3,316
java
TransferExample.java
Java
[ { "context": "\nimport lombok.extern.slf4j.Slf4j;\n\n/**\n * @author zws\n * @email 2848392861@qq.com\n * date 2018/11/14\n *", "end": 112, "score": 0.9996891617774963, "start": 109, "tag": "USERNAME", "value": "zws" }, { "context": "extern.slf4j.Slf4j;\n\n/**\n * @author zws\n * @email 2848392861@qq.com\n * date 2018/11/14\n *\n * 值传递(pass by value)是指在调用函", "end": 140, "score": 0.9998359084129333, "start": 123, "tag": "EMAIL", "value": "2848392861@qq.com" } ]
null
[]
package com.zws.jdk.example.transfer; import lombok.Data; import lombok.extern.slf4j.Slf4j; /** * @author zws * @email <EMAIL> * date 2018/11/14 * * 值传递(pass by value)是指在调用函数时将实际参数复制一份传递到函数中,这样在函数中如果对参数进行修改,将不会影响到实际参数。 * * 引用传递(pass by reference)是指在调用函数时将实际参数的地址直接传递到函数中,那么在函数中对参数所进行的修改,将影响到实际参数。 * 值转递 引用传递 * 根本区别 会创建对象 不创建副本 * 所以 函数中无法改变原始对象 函数中可以改变原始对象 * * */ @Slf4j public class TransferExample { public static void main(String[] args) { /** * 值传递 */ String str = "a"; changeStr(str); // 实参 log.info("str:{}",str); /** * 引用传递 ??? * 这个例子是错误的,它是改变了只是堆中的值,而不是这个对象的引用 * * 你有一把钥匙,当你的朋友想要去你家的时候,如果你直接把你的钥匙给他了,这就是引用传递。 * 这种情况下,如果他对这把钥匙做了什么事情,比如他在钥匙上刻下了自己名字,那么这把钥匙还给你的时候, * 你自己的钥匙上也会多出他刻的名字。 * * 你有一把钥匙,当你的朋友想要去你家的时候,你复刻了一把新钥匙给他,自己的还在自己手里,这就是值传递。 * 这种情况下,他对这把钥匙做什么都不会影响你手里的这把钥匙。 * * 但是,不管上面哪种情况,你的朋友拿着你给他的钥匙,进到你的家里,把你家的电视砸了。 * 那你说你会不会受到影响?而我们在pass方法中,改变user对象的name属性的值的时候, * 不就是在“砸电视”么。你改变的不是那把钥匙,而是钥匙打开的房子。 */ User user = new User(); user.setGender("男"); user.setName("a"); changeUser1(user); System.out.println(user); /** * 这个例子才是正确的 * 如果java存在引用传递并且这个是引用传递的话,那么形参就是这个引用,这个方法中将new的对象赋值给这个引用 * 所以实参中的引用就会发生改变 * 但是实际的结果不是的,因此java不存在引用转递 * 如果实在不理解的话,可以去看看c语言中的引用传递的例子 */ user.setGender("男"); user.setName("a"); changeUser2(user); System.out.println(user); } public static void changeStr(String str){ //形参 str = "b"; } public static void changeUser1(User user){//形参 user.setName("b"); } public static void changeUser2(User user){//形参 user = new User(); user.setName("b"); user.setGender("男"); } } @Data class User{ private String name; private String gender; }
3,306
0.564485
0.552454
96
20.645834
19.606005
76
false
false
0
0
0
0
0
0
0.239583
false
false
6
fa682571485b42c5f56fc4d35ae10499d487880c
10,565,619,576,440
cca9255c0662aec9665e5003565a2905b3279396
/src/exerciseTypes/StaticNonstaticAccessExercise.java
7e51f1eb8efccc05be2748fef813e066d379eb5b
[]
no_license
pongraczl/JavaExercises
https://github.com/pongraczl/JavaExercises
66c2b55ee2097886e9ebb2d62fdc44db69d68bcd
6f541e4d3d0c966a33f025669b6f926227fef537
refs/heads/master
2020-12-13T11:36:55.844000
2020-01-16T22:32:03
2020-01-16T22:32:03
234,405,500
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package exerciseTypes; import model.exerciseElements.Exercise; import model.exerciseElements.Figure; import model.exerciseElements.Solution; import model.langElements.general.DataType; import model.langElements.general.Value; import model.langElements.general.Variable; import model.langElements.imperative.Expression; import model.langElements.imperative.Statement; import model.langElements.objectOriented.ClassElement; import model.langElements.objectOriented.Field; import model.langElements.objectOriented.MemberAccess; import model.langElements.procedural.Method; import model.langElements.projectStructure.Program_Default1; import java.util.Random; public class StaticNonstaticAccessExercise extends Exercise { private static final String DEFAULT_mainClassName = "Main"; private static final String DEFAULT_sampleClassName = "ExampleClass"; private static final String DEFAULT_objectName = "obj"; private static final String DEFAULT_varOrMethodName = "something"; private static final boolean DEFAULT_isMethod = false; private static final Value DEFAULT_usedValue = Value.getInt(5); public StaticNonstaticAccessExercise(String mainClassName, String sampleClassName, String objectName, String varOrMethodName, boolean isMethod, Value usedValue, boolean isStatic, boolean notationByObjectName) { super("Static vs non-static", "Accessing a static or non-static field or member of the class", "Is the code syntactically correct?", null, new Solution.BoolSolution(true)); Program_Default1 program = new Program_Default1(); program.getMainClass().setName(mainClassName); ClassElement exampleClass = program.getSampleClass(); exampleClass.setName(sampleClassName); DataType exampleClassDataType = DataType.makeObjectType(exampleClass); DataType usedDataType = (usedValue == null ? DataType.VOID : usedValue.getDataType()); Method main = program.getEntryPoint(); Variable objVar = new Variable(objectName, exampleClassDataType); main.add(Statement.builder() .declaration() .dataType(objVar.getDataType()) .addVariable(objVar) .initLastVariable( Expression.make(exampleClass.addDefaultConstructor()) ).build() ); Expression notation = notationByObjectName ? Expression.make(objVar) : Expression.make(exampleClass) ; if (isMethod) { //method Method sampleMethod = program.getSampleClass().addMethod(varOrMethodName, usedDataType, null); if (isStatic) sampleMethod.setStatic(); main.add(Statement.builder() .methodCall() .method(sampleMethod) .memberOf(notation) .build() ); sampleMethod.add(Statement.builder() .returnStmt() .returnValue( Expression.make(usedValue) ).build() ); } else { //field Field sampleField = program.getSampleClass().addField(varOrMethodName, usedDataType); if (isStatic) sampleField.setStatic(); main.add(Statement.builder() .assignment() .leftExp( MemberAccess.makeFieldAccess(notation, sampleField) ) .rightExp(usedValue) .build() ); } if (!isStatic && !notationByObjectName) { solution = new Solution.BoolSolution(false); } else { solution = new Solution.BoolSolution(true); } exerciseFigure = new Figure.CodeFigure(program); } public StaticNonstaticAccessExercise(boolean isMethod, Value usedValue, boolean isStatic, boolean notationByObjectName) { this(DEFAULT_mainClassName, DEFAULT_sampleClassName, DEFAULT_objectName, DEFAULT_varOrMethodName, isMethod, usedValue, isStatic, notationByObjectName); } public StaticNonstaticAccessExercise(boolean isStatic, boolean notationByObjectName) { this(DEFAULT_isMethod, DEFAULT_usedValue, isStatic, notationByObjectName); } public static StaticNonstaticAccessExercise getRandomExercise(boolean balancedAnswers) { Random rnd = new Random(); Value usedValue = Value.getInt(rnd.nextInt(100)); boolean isMethod = rnd.nextBoolean(); if (balancedAnswers) { boolean answer = rnd.nextBoolean(); boolean isStatic, notationByObjectName; if (!answer) { //Syntactically incorrect: calling instance with class notation isStatic = false; //instance notationByObjectName = false; //class notation } else { switch (rnd.nextInt(3)) { case 0: isStatic = false; notationByObjectName = true; break; case 1: isStatic = true; notationByObjectName = false; break; case 2: default: isStatic = true; notationByObjectName = true; break; } } return new StaticNonstaticAccessExercise(isMethod, usedValue, isStatic, notationByObjectName); } else { boolean isStatic = rnd.nextBoolean(); boolean notationByObjectName = rnd.nextBoolean(); return new StaticNonstaticAccessExercise(isMethod, usedValue, isStatic, notationByObjectName); } } }
UTF-8
Java
5,831
java
StaticNonstaticAccessExercise.java
Java
[]
null
[]
package exerciseTypes; import model.exerciseElements.Exercise; import model.exerciseElements.Figure; import model.exerciseElements.Solution; import model.langElements.general.DataType; import model.langElements.general.Value; import model.langElements.general.Variable; import model.langElements.imperative.Expression; import model.langElements.imperative.Statement; import model.langElements.objectOriented.ClassElement; import model.langElements.objectOriented.Field; import model.langElements.objectOriented.MemberAccess; import model.langElements.procedural.Method; import model.langElements.projectStructure.Program_Default1; import java.util.Random; public class StaticNonstaticAccessExercise extends Exercise { private static final String DEFAULT_mainClassName = "Main"; private static final String DEFAULT_sampleClassName = "ExampleClass"; private static final String DEFAULT_objectName = "obj"; private static final String DEFAULT_varOrMethodName = "something"; private static final boolean DEFAULT_isMethod = false; private static final Value DEFAULT_usedValue = Value.getInt(5); public StaticNonstaticAccessExercise(String mainClassName, String sampleClassName, String objectName, String varOrMethodName, boolean isMethod, Value usedValue, boolean isStatic, boolean notationByObjectName) { super("Static vs non-static", "Accessing a static or non-static field or member of the class", "Is the code syntactically correct?", null, new Solution.BoolSolution(true)); Program_Default1 program = new Program_Default1(); program.getMainClass().setName(mainClassName); ClassElement exampleClass = program.getSampleClass(); exampleClass.setName(sampleClassName); DataType exampleClassDataType = DataType.makeObjectType(exampleClass); DataType usedDataType = (usedValue == null ? DataType.VOID : usedValue.getDataType()); Method main = program.getEntryPoint(); Variable objVar = new Variable(objectName, exampleClassDataType); main.add(Statement.builder() .declaration() .dataType(objVar.getDataType()) .addVariable(objVar) .initLastVariable( Expression.make(exampleClass.addDefaultConstructor()) ).build() ); Expression notation = notationByObjectName ? Expression.make(objVar) : Expression.make(exampleClass) ; if (isMethod) { //method Method sampleMethod = program.getSampleClass().addMethod(varOrMethodName, usedDataType, null); if (isStatic) sampleMethod.setStatic(); main.add(Statement.builder() .methodCall() .method(sampleMethod) .memberOf(notation) .build() ); sampleMethod.add(Statement.builder() .returnStmt() .returnValue( Expression.make(usedValue) ).build() ); } else { //field Field sampleField = program.getSampleClass().addField(varOrMethodName, usedDataType); if (isStatic) sampleField.setStatic(); main.add(Statement.builder() .assignment() .leftExp( MemberAccess.makeFieldAccess(notation, sampleField) ) .rightExp(usedValue) .build() ); } if (!isStatic && !notationByObjectName) { solution = new Solution.BoolSolution(false); } else { solution = new Solution.BoolSolution(true); } exerciseFigure = new Figure.CodeFigure(program); } public StaticNonstaticAccessExercise(boolean isMethod, Value usedValue, boolean isStatic, boolean notationByObjectName) { this(DEFAULT_mainClassName, DEFAULT_sampleClassName, DEFAULT_objectName, DEFAULT_varOrMethodName, isMethod, usedValue, isStatic, notationByObjectName); } public StaticNonstaticAccessExercise(boolean isStatic, boolean notationByObjectName) { this(DEFAULT_isMethod, DEFAULT_usedValue, isStatic, notationByObjectName); } public static StaticNonstaticAccessExercise getRandomExercise(boolean balancedAnswers) { Random rnd = new Random(); Value usedValue = Value.getInt(rnd.nextInt(100)); boolean isMethod = rnd.nextBoolean(); if (balancedAnswers) { boolean answer = rnd.nextBoolean(); boolean isStatic, notationByObjectName; if (!answer) { //Syntactically incorrect: calling instance with class notation isStatic = false; //instance notationByObjectName = false; //class notation } else { switch (rnd.nextInt(3)) { case 0: isStatic = false; notationByObjectName = true; break; case 1: isStatic = true; notationByObjectName = false; break; case 2: default: isStatic = true; notationByObjectName = true; break; } } return new StaticNonstaticAccessExercise(isMethod, usedValue, isStatic, notationByObjectName); } else { boolean isStatic = rnd.nextBoolean(); boolean notationByObjectName = rnd.nextBoolean(); return new StaticNonstaticAccessExercise(isMethod, usedValue, isStatic, notationByObjectName); } } }
5,831
0.622878
0.620991
137
41.562042
29.338663
129
false
false
0
0
0
0
0
0
0.737226
false
false
6
4162d0cc3eeb6de94b596030c828853d07b793b3
20,675,972,583,981
1a2e410ade5ccbb5aa5aa9f9639874d4ccb86646
/Sort/162-Find-Peak-Element.java
81093184d68fd9490ddfc3588d04bdc538991dec
[]
no_license
ty-mark/LeetCode
https://github.com/ty-mark/LeetCode
1237d7ca371b0a3db43ebf05ba42a60402550b06
82ae25f4d4c46dcc25b9e4471b0c03a3d6124303
refs/heads/master
2021-06-20T00:20:31.455000
2019-08-08T01:40:52
2019-08-08T01:40:52
144,029,834
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index. The array may contain multiple peaks, in that case return the index to any one of the peaks is fine. You may imagine that nums[-1] = nums[n] = -∞. Example 1: Input: nums = [1,2,3,1] Output: 2 Explanation: 3 is a peak element and your function should return the index number 2. Example 2: Input: nums = [1,2,1,3,5,6,4] Output: 1 or 5 Explanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6. */ /* Find peak => find the turning point 1. compare the mid with its right neighbor, two situations: a) '<' => ascending => search to the right b) '>' => descending => search to the left 2. Fact: mid is either at the mid location (total number is odd) or closer to lo end (total even) 0 1 2 3 1 -> 2 -> 3 -> 1 lo mid hi Well, it actually does not matter in this problem... */ class Solution { public int findPeakElement(int[] nums) { int lo = 0, hi = nums.length - 1; while (lo < hi - 1) { // eventually we compare two neighbors, // either at (3, 1) or (2, 3), answer is the larger one int mid = lo + (hi - lo) / 2; // hi - lo > 1 => mid will never be lo or hi if (nums[mid] > nums[mid + 1]) hi = mid; // descending => peak to the left else (nums[mid] < nums[mid + 1]) lo = mid + 1; // ascending => peak to the right // no such case: nums[i] ≠ nums[i+1] } if (lo == nums.length - 1 || nums[lo] > nums[lo + 1]) return lo; return hi; } }
UTF-8
Java
1,749
java
162-Find-Peak-Element.java
Java
[]
null
[]
/* A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index. The array may contain multiple peaks, in that case return the index to any one of the peaks is fine. You may imagine that nums[-1] = nums[n] = -∞. Example 1: Input: nums = [1,2,3,1] Output: 2 Explanation: 3 is a peak element and your function should return the index number 2. Example 2: Input: nums = [1,2,1,3,5,6,4] Output: 1 or 5 Explanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6. */ /* Find peak => find the turning point 1. compare the mid with its right neighbor, two situations: a) '<' => ascending => search to the right b) '>' => descending => search to the left 2. Fact: mid is either at the mid location (total number is odd) or closer to lo end (total even) 0 1 2 3 1 -> 2 -> 3 -> 1 lo mid hi Well, it actually does not matter in this problem... */ class Solution { public int findPeakElement(int[] nums) { int lo = 0, hi = nums.length - 1; while (lo < hi - 1) { // eventually we compare two neighbors, // either at (3, 1) or (2, 3), answer is the larger one int mid = lo + (hi - lo) / 2; // hi - lo > 1 => mid will never be lo or hi if (nums[mid] > nums[mid + 1]) hi = mid; // descending => peak to the left else (nums[mid] < nums[mid + 1]) lo = mid + 1; // ascending => peak to the right // no such case: nums[i] ≠ nums[i+1] } if (lo == nums.length - 1 || nums[lo] > nums[lo + 1]) return lo; return hi; } }
1,749
0.604131
0.576018
48
35.333332
31.103546
100
false
false
0
0
0
0
0
0
1.520833
false
false
6
248e9f789985e128016e9ac91f4dd810591c35f0
4,621,384,855,200
e73f8719821efc6b2811e2b51c7e00f0c6181bc5
/src/main/java/com/rkissvincze/Beans/ModifyTaskRB.java
4e308f7e6efa400b3637bb4d5f7d6bd1964f0376
[]
no_license
kvrobert/newTLOGRS
https://github.com/kvrobert/newTLOGRS
f7aaffb3d57561215e6ee8701d454985bec84f8f
6461ef5783f1836805932eaaa91f871cb07e0acd
refs/heads/master
2021-04-28T17:43:59.606000
2018-03-25T19:35:03
2018-03-25T19:35:03
121,858,663
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rkissvincze.Beans; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * * @author rkissvincze */ @Getter @Setter @NoArgsConstructor public class ModifyTaskRB { int year; int month; int day; String TaskId; String startTime; String newTaskId; String newComment; String newStartTime; String newEndTime; }
UTF-8
Java
394
java
ModifyTaskRB.java
Java
[ { "context": "structor;\nimport lombok.Setter;\n\n/**\n *\n * @author rkissvincze\n */\n@Getter\n@Setter\n@NoArgsConstructor\npublic cla", "end": 139, "score": 0.9990493655204773, "start": 128, "tag": "USERNAME", "value": "rkissvincze" } ]
null
[]
package com.rkissvincze.Beans; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * * @author rkissvincze */ @Getter @Setter @NoArgsConstructor public class ModifyTaskRB { int year; int month; int day; String TaskId; String startTime; String newTaskId; String newComment; String newStartTime; String newEndTime; }
394
0.692893
0.692893
25
14.76
9.969072
32
false
false
0
0
0
0
0
0
0.52
false
false
6
8deac4cf0c6857d4330901f8b932329732a55f8c
31,181,462,604,702
1bc9a0c80e82b9a57fe21f394755bb96cae1a5a0
/lab2/src/com/company/Qvest3.java
3319f722b534b960b8bf90a9fe641d86830ad933
[]
no_license
rtu-mirea/1-lab-Rino095
https://github.com/rtu-mirea/1-lab-Rino095
1a216f7755a7e5c59db1cdfb174d5c0fadb83131
b8b8f7bd2d0c3c1280927c0bbe37883d70d12dd5
refs/heads/master
2020-07-21T18:22:07.968000
2019-12-13T23:51:00
2019-12-13T23:51:00
206,942,171
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Qvest3 { private String line = ""; void Input(String line){ if (line.charAt(line.length() - 1) != ' ') line += ' '; this.line = line; } boolean IPv4() { if (line == null || line.isEmpty()) return false; line = line.trim(); if ((line.length() < 6) || (line.length() > 15)) return false; try { Pattern pattern = Pattern.compile("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); Matcher matcher = pattern.matcher(line); return matcher.matches(); } catch (Exception ex) { return false; } } void IPv6(){ String str=""; line = line.trim(); boolean qwe= false; try { Pattern pattern = Pattern.compile("([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}"); Matcher matcher = pattern.matcher(line); while(matcher.find()) { str = matcher.group(); System.out.print("IPv6: "+ str +" в двоичном представлении: "); Translation(str); qwe = true; } if(!qwe){ System.out.println("\nIP не соответствует формату IPv6\n"); } } catch (Exception ex) { System.out.println("error"); } } private void Translation(String str){ String str2="",str3=""; int ind = 0, num = 0; for(int i = 0; i < 8; i++){ str3+=":"; for(int j = 0;j < 4;j++){ str2 += str.charAt(ind); ind+=1; } num = Integer.parseInt(str2, 16); str3 += Integer.toBinaryString(num); ind+=1; str2 = ""; } System.out.println(str3); } }
UTF-8
Java
2,007
java
Qvest3.java
Java
[]
null
[]
package com.company; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Qvest3 { private String line = ""; void Input(String line){ if (line.charAt(line.length() - 1) != ' ') line += ' '; this.line = line; } boolean IPv4() { if (line == null || line.isEmpty()) return false; line = line.trim(); if ((line.length() < 6) || (line.length() > 15)) return false; try { Pattern pattern = Pattern.compile("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); Matcher matcher = pattern.matcher(line); return matcher.matches(); } catch (Exception ex) { return false; } } void IPv6(){ String str=""; line = line.trim(); boolean qwe= false; try { Pattern pattern = Pattern.compile("([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}"); Matcher matcher = pattern.matcher(line); while(matcher.find()) { str = matcher.group(); System.out.print("IPv6: "+ str +" в двоичном представлении: "); Translation(str); qwe = true; } if(!qwe){ System.out.println("\nIP не соответствует формату IPv6\n"); } } catch (Exception ex) { System.out.println("error"); } } private void Translation(String str){ String str2="",str3=""; int ind = 0, num = 0; for(int i = 0; i < 8; i++){ str3+=":"; for(int j = 0;j < 4;j++){ str2 += str.charAt(ind); ind+=1; } num = Integer.parseInt(str2, 16); str3 += Integer.toBinaryString(num); ind+=1; str2 = ""; } System.out.println(str3); } }
2,007
0.449312
0.415181
63
30.15873
22.607912
142
false
false
0
0
0
0
0
0
0.809524
false
false
6
9110ba987102c06efc193a2676b0316f9edcd11e
31,628,139,194,235
93c250a12b21d82cf945ed6f1d1de5b79b04f7c6
/app/src/main/java/com/alashoo/signmvp/ui/activities/GuideActivity.java
72f95758adf3de1c9bf2ef8f65faa5a70c884fdd
[]
no_license
svenjung/MVP-Login
https://github.com/svenjung/MVP-Login
8ea286545eb9d439b059d503e9d263285e04f136
01a6107dad06f8bd9e5d3d61a7427ac81a4e094d
refs/heads/master
2020-05-20T03:25:34.175000
2019-05-07T08:43:18
2019-05-07T08:43:18
185,358,970
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alashoo.signmvp.ui.activities; import com.alashoo.signmvp.R; import com.alashoo.signmvp.ui.AbsActivity; import com.alashoo.signmvp.ui.signin.LoginActivity; import butterknife.ButterKnife; import butterknife.OnClick; public class GuideActivity extends AbsActivity { @OnClick(R.id.show_home) void showSignIn() { LoginActivity.launch(this); } @Override protected int getContentLayoutId() { return R.layout.activity_guide; } @Override protected boolean showActionBar() { return false; } @Override protected void initView() { ButterKnife.bind(this); } }
UTF-8
Java
644
java
GuideActivity.java
Java
[]
null
[]
package com.alashoo.signmvp.ui.activities; import com.alashoo.signmvp.R; import com.alashoo.signmvp.ui.AbsActivity; import com.alashoo.signmvp.ui.signin.LoginActivity; import butterknife.ButterKnife; import butterknife.OnClick; public class GuideActivity extends AbsActivity { @OnClick(R.id.show_home) void showSignIn() { LoginActivity.launch(this); } @Override protected int getContentLayoutId() { return R.layout.activity_guide; } @Override protected boolean showActionBar() { return false; } @Override protected void initView() { ButterKnife.bind(this); } }
644
0.697205
0.697205
30
20.466667
17.832056
51
false
false
0
0
0
0
0
0
0.333333
false
false
6
78084d5614e61de109347694bfaf3f7861adbff2
19,361,712,591,324
e593fd8902ef395b2c1626a3126a4e0002e2c0df
/app/src/main/java/com/warrous/ready2ride/bike/DefaultBikeActivity.java
15c4f8afc3302ace6886b17d3cb4e5c153bb0cb6
[]
no_license
AshaPemma/Ready2Ride
https://github.com/AshaPemma/Ready2Ride
3d1c93a7e5d1f31469abf9d255ab5382871a13e4
8308c0cd51e113a347a19c165c0a6e6ff3cc000e
refs/heads/master
2022-02-12T11:19:07.178000
2019-07-23T05:20:12
2019-07-23T05:20:12
198,356,504
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.warrous.ready2ride.bike; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import com.warrous.ready2ride.R; import com.warrous.ready2ride.Util.ImagePickerUtils; import com.warrous.ready2ride.auth.profile.PofileFragment; import com.warrous.ready2ride.base.BaseActivity; import com.warrous.ready2ride.bike.model.DefaultBikeDetailsResponse; import com.warrous.ready2ride.bike.model.RideList; import com.warrous.ready2ride.bike.model.RideLogResponse; import com.warrous.ready2ride.common.ViewPagerAdapter; import com.warrous.ready2ride.createbike.CreateBikeActivity; import com.warrous.ready2ride.createbike.CreateBikeActivityGarage; import com.warrous.ready2ride.dealership.DealerShipActivity; import com.warrous.ready2ride.framework.ActivityUtils; import com.warrous.ready2ride.framework.PreferenceManager; import com.warrous.ready2ride.navigation.fragments.InboxFragment; import com.warrous.ready2ride.navigation.fragments.InfoFragment; import com.warrous.ready2ride.navigation.fragments.TrackFragment; import java.io.File; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.OnClick; public class DefaultBikeActivity extends BaseActivity implements DefaultBikeContract.View { @BindView(R.id.vp_dealership) ViewPager vpDealerships; @BindView(R.id.vp_bike) ViewPager viewPagerBike; @BindView(R.id.rv_default_bike) RelativeLayout rvDefaultBike; @BindView(R.id.iv_homme) ImageView ivHome; @BindView(R.id.iv_bike) ImageView ivBike; @BindView(R.id.iv_road_track) ImageView ivTrack; @BindView(R.id.iv_store) ImageView ivStore; @BindView(R.id.iv_profile_image) ImageView ivProfileImage; @BindView(R.id.rl_toolbar) RelativeLayout rlToolbar; private int menuItemId; DefaultBikeContract.Presenter mpresenter; ArrayList<DefaultBikeDetailsResponse> bikesList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dealership); injectButterKnife(this); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.ic_bike)); mpresenter=new DefaultBikePresenter(this); bikesList=new ArrayList<>(); mpresenter.getCycleDetails(0,PreferenceManager.getIntegerValue(this,PreferenceManager.KEY_OWNER_ID)); vpDealerships.setVisibility(View.GONE); viewPagerBike.setVisibility(View.VISIBLE); rlToolbar.setVisibility(View.GONE); // vpDealerships.setVisibility(View.GONE); //loading the default fragment //getting bottom navigation view and attaching the listener // BottomNavigationView navigation = findViewById(R.id.navigationView); // navigation.setSelectedItemId(R.id.navigation_bike); // navigation.setOnNavigationItemSelectedListener(this); viewPagerBike.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(),getPages())); } @OnClick(R.id.btn_create_bike) public void btnCreateBike(){ ActivityUtils.startActivity(this,CreateBikeActivityGarage.class,null); finish(); } private List<Fragment> getPages() { List<Fragment> fragmentList = new ArrayList<>(); for (int i = 0; i <bikesList.size(); i++) { bikesList.get(i).setPosition(i); fragmentList.add(DefaultBikeFragment.getInstance(bikesList.get(i),bikesList.size(),i)); } return fragmentList; } @OnClick(R.id.iv_homme) public void onClickHome(){ Intent intent; vpDealerships.setVisibility(View.VISIBLE); intent = new Intent(this, DealerShipActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); this.startActivity(intent); // fragment = new HomeFragment(); // fragment=new DealerShipFragment(); rlToolbar.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.GONE); } @OnClick(R.id.iv_bike) public void onClickBike(){ Intent intent; vpDealerships.setVisibility(View.GONE); viewPagerBike.setVisibility(View.VISIBLE); intent = new Intent(this, DefaultBikeActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); this.startActivity(intent); // fragmentj = new BikeFragment(); // fragment = new DefaultBikeFragment(); rlToolbar.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.GONE); } @OnClick(R.id.iv_road_track) public void onClickTrack(){ ivTrack.setImageDrawable(getResources().getDrawable(R.drawable.ic_track_blue)); ivHome.setImageDrawable(getResources().getDrawable(R.drawable.iv_home_light)); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.iv_bike_light)); ivProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.ic_default_profile)); ivStore.setImageDrawable(getResources().getDrawable(R.drawable.ic_store_light)); Fragment fragment = null; rvDefaultBike.setVisibility(View.GONE); fragment = new TrackFragment(); viewPagerBike.setVisibility(View.GONE); rlToolbar.setVisibility(View.GONE); vpDealerships.setVisibility(View.GONE); loadFragment(fragment); } @OnClick(R.id.iv_store) public void onClickStore(){ ivTrack.setImageDrawable(getResources().getDrawable(R.drawable.ic_track_light)); ivHome.setImageDrawable(getResources().getDrawable(R.drawable.iv_home_light)); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.iv_bike_light)); ivProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.ic_default_profile)); ivStore.setImageDrawable(getResources().getDrawable(R.drawable.ic_store_blue)); Fragment fragment = null; fragment = new InboxFragment(); viewPagerBike.setVisibility(View.GONE); vpDealerships.setVisibility(View.GONE); rlToolbar.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.GONE); loadFragment(fragment); } @OnClick(R.id.iv_profile_image) public void onClickProfile(){ ivTrack.setImageDrawable(getResources().getDrawable(R.drawable.ic_track_light)); ivHome.setImageDrawable(getResources().getDrawable(R.drawable.iv_home_light)); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.iv_bike_light)); ivProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.ic_default_profile)); ivStore.setImageDrawable(getResources().getDrawable(R.drawable.ic_store_light)); Fragment fragment = null; fragment = new PofileFragment(); viewPagerBike.setVisibility(View.GONE); vpDealerships.setVisibility(View.GONE); rlToolbar.setVisibility(View.GONE); loadFragment(fragment); rvDefaultBike.setVisibility(View.GONE); } // @Override // public boolean onNavigationItemSelected(@NonNull MenuItem item) { // Fragment fragment = null; // Intent intent; // if (menuItemId == item.getItemId()) { // return false; // } else { // switch (item.getItemId()) { // case R.id.navigation_home: // viewPagerBike.setVisibility(View.GONE); // vpDealerships.setVisibility(View.VISIBLE); // intent = new Intent(this, DealerShipActivity.class); // intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // this.startActivity(intent); // // // fragment = new HomeFragment(); // // fragment=new DealerShipFragment(); // rlToolbar.setVisibility(View.GONE); // break; // // case R.id.navigation_bike: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.VISIBLE); // intent = new Intent(this, DefaultBikeActivity.class); // intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // this.startActivity(intent); // // fragmentj = new BikeFragment(); // // fragment=new DefaultBikeFragment(); // rlToolbar.setVisibility(View.GONE); // break; // // // case R.id.navigation_info: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.GONE); // fragment = new TrackFragment(); // rlToolbar.setVisibility(View.GONE); // rvDefaultBike.setVisibility(View.GONE); // break; // // case R.id.navigation_track: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.GONE); // fragment = new InboxFragment(); // rlToolbar.setVisibility(View.GONE); // rvDefaultBike.setVisibility(View.GONE); // break; // case R.id.navigation_profile: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.GONE); // fragment = new PofileFragment(); // rvDefaultBike.setVisibility(View.GONE); // rlToolbar.setVisibility(View.GONE); // break; // } // menuItemId=item.getItemId(); // return loadFragment(fragment); // } // } private boolean loadFragment(Fragment fragment) { //switching fragment if (fragment != null) { getSupportFragmentManager() .beginTransaction() .replace(R.id.container, fragment) .commit(); return true; } return false; } @Override public void onCycleDetailsSucess(ArrayList<DefaultBikeDetailsResponse> segmentResponses) { if(segmentResponses.size()>0){ viewPagerBike.setVisibility(View.VISIBLE); rvDefaultBike.setVisibility(View.GONE); bikesList=segmentResponses; viewPagerBike.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(),getPages())); }else{ viewPagerBike.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.VISIBLE); } } @Override public void onGetRideLogResponse(ArrayList<RideList> segmentResponses) { } }
UTF-8
Java
10,982
java
DefaultBikeActivity.java
Java
[]
null
[]
package com.warrous.ready2ride.bike; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import com.warrous.ready2ride.R; import com.warrous.ready2ride.Util.ImagePickerUtils; import com.warrous.ready2ride.auth.profile.PofileFragment; import com.warrous.ready2ride.base.BaseActivity; import com.warrous.ready2ride.bike.model.DefaultBikeDetailsResponse; import com.warrous.ready2ride.bike.model.RideList; import com.warrous.ready2ride.bike.model.RideLogResponse; import com.warrous.ready2ride.common.ViewPagerAdapter; import com.warrous.ready2ride.createbike.CreateBikeActivity; import com.warrous.ready2ride.createbike.CreateBikeActivityGarage; import com.warrous.ready2ride.dealership.DealerShipActivity; import com.warrous.ready2ride.framework.ActivityUtils; import com.warrous.ready2ride.framework.PreferenceManager; import com.warrous.ready2ride.navigation.fragments.InboxFragment; import com.warrous.ready2ride.navigation.fragments.InfoFragment; import com.warrous.ready2ride.navigation.fragments.TrackFragment; import java.io.File; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.OnClick; public class DefaultBikeActivity extends BaseActivity implements DefaultBikeContract.View { @BindView(R.id.vp_dealership) ViewPager vpDealerships; @BindView(R.id.vp_bike) ViewPager viewPagerBike; @BindView(R.id.rv_default_bike) RelativeLayout rvDefaultBike; @BindView(R.id.iv_homme) ImageView ivHome; @BindView(R.id.iv_bike) ImageView ivBike; @BindView(R.id.iv_road_track) ImageView ivTrack; @BindView(R.id.iv_store) ImageView ivStore; @BindView(R.id.iv_profile_image) ImageView ivProfileImage; @BindView(R.id.rl_toolbar) RelativeLayout rlToolbar; private int menuItemId; DefaultBikeContract.Presenter mpresenter; ArrayList<DefaultBikeDetailsResponse> bikesList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dealership); injectButterKnife(this); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.ic_bike)); mpresenter=new DefaultBikePresenter(this); bikesList=new ArrayList<>(); mpresenter.getCycleDetails(0,PreferenceManager.getIntegerValue(this,PreferenceManager.KEY_OWNER_ID)); vpDealerships.setVisibility(View.GONE); viewPagerBike.setVisibility(View.VISIBLE); rlToolbar.setVisibility(View.GONE); // vpDealerships.setVisibility(View.GONE); //loading the default fragment //getting bottom navigation view and attaching the listener // BottomNavigationView navigation = findViewById(R.id.navigationView); // navigation.setSelectedItemId(R.id.navigation_bike); // navigation.setOnNavigationItemSelectedListener(this); viewPagerBike.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(),getPages())); } @OnClick(R.id.btn_create_bike) public void btnCreateBike(){ ActivityUtils.startActivity(this,CreateBikeActivityGarage.class,null); finish(); } private List<Fragment> getPages() { List<Fragment> fragmentList = new ArrayList<>(); for (int i = 0; i <bikesList.size(); i++) { bikesList.get(i).setPosition(i); fragmentList.add(DefaultBikeFragment.getInstance(bikesList.get(i),bikesList.size(),i)); } return fragmentList; } @OnClick(R.id.iv_homme) public void onClickHome(){ Intent intent; vpDealerships.setVisibility(View.VISIBLE); intent = new Intent(this, DealerShipActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); this.startActivity(intent); // fragment = new HomeFragment(); // fragment=new DealerShipFragment(); rlToolbar.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.GONE); } @OnClick(R.id.iv_bike) public void onClickBike(){ Intent intent; vpDealerships.setVisibility(View.GONE); viewPagerBike.setVisibility(View.VISIBLE); intent = new Intent(this, DefaultBikeActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); this.startActivity(intent); // fragmentj = new BikeFragment(); // fragment = new DefaultBikeFragment(); rlToolbar.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.GONE); } @OnClick(R.id.iv_road_track) public void onClickTrack(){ ivTrack.setImageDrawable(getResources().getDrawable(R.drawable.ic_track_blue)); ivHome.setImageDrawable(getResources().getDrawable(R.drawable.iv_home_light)); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.iv_bike_light)); ivProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.ic_default_profile)); ivStore.setImageDrawable(getResources().getDrawable(R.drawable.ic_store_light)); Fragment fragment = null; rvDefaultBike.setVisibility(View.GONE); fragment = new TrackFragment(); viewPagerBike.setVisibility(View.GONE); rlToolbar.setVisibility(View.GONE); vpDealerships.setVisibility(View.GONE); loadFragment(fragment); } @OnClick(R.id.iv_store) public void onClickStore(){ ivTrack.setImageDrawable(getResources().getDrawable(R.drawable.ic_track_light)); ivHome.setImageDrawable(getResources().getDrawable(R.drawable.iv_home_light)); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.iv_bike_light)); ivProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.ic_default_profile)); ivStore.setImageDrawable(getResources().getDrawable(R.drawable.ic_store_blue)); Fragment fragment = null; fragment = new InboxFragment(); viewPagerBike.setVisibility(View.GONE); vpDealerships.setVisibility(View.GONE); rlToolbar.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.GONE); loadFragment(fragment); } @OnClick(R.id.iv_profile_image) public void onClickProfile(){ ivTrack.setImageDrawable(getResources().getDrawable(R.drawable.ic_track_light)); ivHome.setImageDrawable(getResources().getDrawable(R.drawable.iv_home_light)); ivBike.setImageDrawable(getResources().getDrawable(R.drawable.iv_bike_light)); ivProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.ic_default_profile)); ivStore.setImageDrawable(getResources().getDrawable(R.drawable.ic_store_light)); Fragment fragment = null; fragment = new PofileFragment(); viewPagerBike.setVisibility(View.GONE); vpDealerships.setVisibility(View.GONE); rlToolbar.setVisibility(View.GONE); loadFragment(fragment); rvDefaultBike.setVisibility(View.GONE); } // @Override // public boolean onNavigationItemSelected(@NonNull MenuItem item) { // Fragment fragment = null; // Intent intent; // if (menuItemId == item.getItemId()) { // return false; // } else { // switch (item.getItemId()) { // case R.id.navigation_home: // viewPagerBike.setVisibility(View.GONE); // vpDealerships.setVisibility(View.VISIBLE); // intent = new Intent(this, DealerShipActivity.class); // intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // this.startActivity(intent); // // // fragment = new HomeFragment(); // // fragment=new DealerShipFragment(); // rlToolbar.setVisibility(View.GONE); // break; // // case R.id.navigation_bike: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.VISIBLE); // intent = new Intent(this, DefaultBikeActivity.class); // intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // this.startActivity(intent); // // fragmentj = new BikeFragment(); // // fragment=new DefaultBikeFragment(); // rlToolbar.setVisibility(View.GONE); // break; // // // case R.id.navigation_info: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.GONE); // fragment = new TrackFragment(); // rlToolbar.setVisibility(View.GONE); // rvDefaultBike.setVisibility(View.GONE); // break; // // case R.id.navigation_track: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.GONE); // fragment = new InboxFragment(); // rlToolbar.setVisibility(View.GONE); // rvDefaultBike.setVisibility(View.GONE); // break; // case R.id.navigation_profile: // vpDealerships.setVisibility(View.GONE); // viewPagerBike.setVisibility(View.GONE); // fragment = new PofileFragment(); // rvDefaultBike.setVisibility(View.GONE); // rlToolbar.setVisibility(View.GONE); // break; // } // menuItemId=item.getItemId(); // return loadFragment(fragment); // } // } private boolean loadFragment(Fragment fragment) { //switching fragment if (fragment != null) { getSupportFragmentManager() .beginTransaction() .replace(R.id.container, fragment) .commit(); return true; } return false; } @Override public void onCycleDetailsSucess(ArrayList<DefaultBikeDetailsResponse> segmentResponses) { if(segmentResponses.size()>0){ viewPagerBike.setVisibility(View.VISIBLE); rvDefaultBike.setVisibility(View.GONE); bikesList=segmentResponses; viewPagerBike.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(),getPages())); }else{ viewPagerBike.setVisibility(View.GONE); rvDefaultBike.setVisibility(View.VISIBLE); } } @Override public void onGetRideLogResponse(ArrayList<RideList> segmentResponses) { } }
10,982
0.660262
0.658259
273
39.227108
25.537441
109
false
false
0
0
0
0
0
0
0.681319
false
false
6
04236060b1f4a7f5fd941fa3dfabe37ffd5a68ff
12,850,542,173,304
fa77486743fa6edae3fd44f366662170d0ac5daf
/app/src/main/java/com/example/android/builder/Burger.java
da475d87f5c2c622a364cb6f2c40a679cd2a18f8
[]
no_license
anupkool/Builder
https://github.com/anupkool/Builder
693e196d5c1fa92163a02dc25621f854bb1ce300
f7b0b2f46fe66b3d3a2b65d5ac207a697ef050ee
refs/heads/master
2020-03-16T17:47:44.959000
2018-05-10T04:43:37
2018-05-10T04:43:37
132,847,427
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.android.builder; /** * @author Anup * * The Burger Class is abstract and customer can have a Cheese Burger(Meat) or Veg Burger. */ public abstract class Burger implements Item { }
UTF-8
Java
208
java
Burger.java
Java
[ { "context": "ckage com.example.android.builder;\n\n/**\n * @author Anup\n *\n * The Burger Class is abstract and customer c", "end": 57, "score": 0.53779536485672, "start": 53, "tag": "USERNAME", "value": "Anup" } ]
null
[]
package com.example.android.builder; /** * @author Anup * * The Burger Class is abstract and customer can have a Cheese Burger(Meat) or Veg Burger. */ public abstract class Burger implements Item { }
208
0.721154
0.721154
11
17.90909
27.510178
90
false
false
0
0
0
0
0
0
0.090909
false
false
6
95b9b82d12130c64b9781f0cbf8699066f82f800
9,036,611,217,144
629a61fd0d9a9f0cf79f1fc03d36a4b3bf344485
/webpayadminservice-client/src/main/java/com/svea/webpayadminservice/client/SortPaymentPlanProperty.java
62eff259ab1030ba3d59e2b15755ca925accc2d3
[ "Apache-2.0" ]
permissive
sveawebpay/webpay-common
https://github.com/sveawebpay/webpay-common
c5ee8cf503134934e7bb6990ba5e3abf5abcea70
c256aba6529c702d8a77559baa55b241234db5e0
refs/heads/master
2023-05-25T04:01:00.021000
2023-05-11T10:12:09
2023-05-11T10:12:09
224,838,641
0
1
Apache-2.0
false
2022-01-05T11:25:01
2019-11-29T11:11:34
2022-01-05T11:24:50
2022-01-05T11:25:00
503
0
1
0
Java
false
false
package com.svea.webpayadminservice.client; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for SortPaymentPlanProperty. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="SortPaymentPlanProperty"&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt; * &lt;enumeration value="ApprovedDate"/&gt; * &lt;enumeration value="Amount"/&gt; * &lt;enumeration value="ContractNumber"/&gt; * &lt;enumeration value="PaidDate"/&gt; * &lt;enumeration value="SveaOrderId"/&gt; * &lt;enumeration value="CustomerName"/&gt; * &lt;enumeration value="Status"/&gt; * &lt;enumeration value="NationalIdNumber"/&gt; * &lt;enumeration value="ClientOrderId"/&gt; * &lt;enumeration value="ContractLengthMonths"/&gt; * &lt;/restriction&gt; * &lt;/simpleType&gt; * </pre> * */ @XmlType(name = "SortPaymentPlanProperty") @XmlEnum public enum SortPaymentPlanProperty { @XmlEnumValue("ApprovedDate") APPROVED_DATE("ApprovedDate"), @XmlEnumValue("Amount") AMOUNT("Amount"), @XmlEnumValue("ContractNumber") CONTRACT_NUMBER("ContractNumber"), @XmlEnumValue("PaidDate") PAID_DATE("PaidDate"), @XmlEnumValue("SveaOrderId") SVEA_ORDER_ID("SveaOrderId"), @XmlEnumValue("CustomerName") CUSTOMER_NAME("CustomerName"), @XmlEnumValue("Status") STATUS("Status"), @XmlEnumValue("NationalIdNumber") NATIONAL_ID_NUMBER("NationalIdNumber"), @XmlEnumValue("ClientOrderId") CLIENT_ORDER_ID("ClientOrderId"), @XmlEnumValue("ContractLengthMonths") CONTRACT_LENGTH_MONTHS("ContractLengthMonths"); private final String value; SortPaymentPlanProperty(String v) { value = v; } public String value() { return value; } public static SortPaymentPlanProperty fromValue(String v) { for (SortPaymentPlanProperty c: SortPaymentPlanProperty.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
UTF-8
Java
2,242
java
SortPaymentPlanProperty.java
Java
[]
null
[]
package com.svea.webpayadminservice.client; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for SortPaymentPlanProperty. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="SortPaymentPlanProperty"&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt; * &lt;enumeration value="ApprovedDate"/&gt; * &lt;enumeration value="Amount"/&gt; * &lt;enumeration value="ContractNumber"/&gt; * &lt;enumeration value="PaidDate"/&gt; * &lt;enumeration value="SveaOrderId"/&gt; * &lt;enumeration value="CustomerName"/&gt; * &lt;enumeration value="Status"/&gt; * &lt;enumeration value="NationalIdNumber"/&gt; * &lt;enumeration value="ClientOrderId"/&gt; * &lt;enumeration value="ContractLengthMonths"/&gt; * &lt;/restriction&gt; * &lt;/simpleType&gt; * </pre> * */ @XmlType(name = "SortPaymentPlanProperty") @XmlEnum public enum SortPaymentPlanProperty { @XmlEnumValue("ApprovedDate") APPROVED_DATE("ApprovedDate"), @XmlEnumValue("Amount") AMOUNT("Amount"), @XmlEnumValue("ContractNumber") CONTRACT_NUMBER("ContractNumber"), @XmlEnumValue("PaidDate") PAID_DATE("PaidDate"), @XmlEnumValue("SveaOrderId") SVEA_ORDER_ID("SveaOrderId"), @XmlEnumValue("CustomerName") CUSTOMER_NAME("CustomerName"), @XmlEnumValue("Status") STATUS("Status"), @XmlEnumValue("NationalIdNumber") NATIONAL_ID_NUMBER("NationalIdNumber"), @XmlEnumValue("ClientOrderId") CLIENT_ORDER_ID("ClientOrderId"), @XmlEnumValue("ContractLengthMonths") CONTRACT_LENGTH_MONTHS("ContractLengthMonths"); private final String value; SortPaymentPlanProperty(String v) { value = v; } public String value() { return value; } public static SortPaymentPlanProperty fromValue(String v) { for (SortPaymentPlanProperty c: SortPaymentPlanProperty.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
2,242
0.67083
0.668599
74
29.283783
20.611937
95
false
false
0
0
0
0
0
0
0.635135
false
false
6
0672d8354071759614f2211bf2cf55372814ef58
13,623,636,291,272
6b8469cc678fd07c5cdbac88dd95634c602e7a4c
/src/delegate/mvc/controllers/OrderAction.java
16365eebbcb192f0b0df398ca7bc4c65a9e696eb
[]
no_license
doasdsadsaf/gupao_factory
https://github.com/doasdsadsaf/gupao_factory
479c51bc0f491a5666a18d7e12685e8188689d15
f5e0d0ddb6eb33442e75751f1ed2435059a0c224
refs/heads/master
2021-08-03T21:58:43.497000
2021-07-29T08:31:42
2021-07-29T08:31:42
242,999,342
7
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package delegate.mvc.controllers; /** * Created by Tom on 2018/3/14. */ public class OrderAction { public void getOrderById(String mid){ } }
UTF-8
Java
155
java
OrderAction.java
Java
[ { "context": "ckage delegate.mvc.controllers;\n\n/**\n * Created by Tom on 2018/3/14.\n */\npublic class OrderAction {\n\n ", "end": 56, "score": 0.9619497060775757, "start": 53, "tag": "NAME", "value": "Tom" } ]
null
[]
package delegate.mvc.controllers; /** * Created by Tom on 2018/3/14. */ public class OrderAction { public void getOrderById(String mid){ } }
155
0.664516
0.619355
12
11.916667
15.129763
41
false
false
0
0
0
0
0
0
0.083333
false
false
6
4ebf042288e1acb3cfd45620e662a7c6163ae66d
13,623,636,292,598
e7f67c2d1e1c8ed74d7d01adb29e981c2787ebcb
/odcleanstore/conflictresolution/src/main/java/cz/cuni/mff/odcleanstore/conflictresolution/quality/impl/DecidingConflictFQualityCalculator.java
1af78a57a4fcfee460fe52789fdfe3765b5f5b26
[ "Apache-2.0" ]
permissive
ODCleanStore/ODCleanStore
https://github.com/ODCleanStore/ODCleanStore
686d5b345b43c5d9a304b6e998b26c7ae8e70d30
3a68c345c5b67349447add8d61d97ae59edd8d7d
refs/heads/master
2016-09-15T18:45:05.982000
2015-10-07T10:57:35
2015-10-07T10:57:35
8,683,537
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cz.cuni.mff.odcleanstore.conflictresolution.quality.impl; import java.util.Collection; import org.openrdf.model.Model; import org.openrdf.model.Resource; import org.openrdf.model.Statement; import org.openrdf.model.Value; import cz.cuni.mff.odcleanstore.conflictresolution.CRContext; import cz.cuni.mff.odcleanstore.conflictresolution.DistanceMeasure; import cz.cuni.mff.odcleanstore.conflictresolution.quality.DecidingFQualityCalculator; import cz.cuni.mff.odcleanstore.conflictresolution.quality.SourceQualityCalculator; /** * Concrete implementation of {@link ConflictFQualityCalculator} suitable * for deciding conflict resolution functions (i.e. those choosing one or more values from their input). * The base quality (see {@link #valueQuality()}) is determined as the maximum of quality scores of * all value's sources. The resulting quality is then increased if there is exact agreement on the evaluated * value among multiple sources according to the following formula: * * <code>result_quality = quality + (1 - quality) * min(1, support_factor)</code> * * where <code>support_factor</code> is * * <code>(&lt;sum of quality scores of all sources&gt; - &lt;quality score of the best source&gt;) / agree_coefficient</code>. * * <code>agree_coefficient</code> is given in the constructor or the default value {@value #DEFAULT_AGREE_COEFICIENT} is used. * * @author Jan Michelfeit */ public class DecidingConflictFQualityCalculator extends ConflictFQualityCalculator implements DecidingFQualityCalculator { /** The default value of the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}). */ public static final double DEFAULT_AGREE_COEFICIENT = 4; /** Value of the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}). */ protected final double agreeCoeficient; /** * Creates a new instance. * @param sourceQualityCalculator calculator of quality of source named graphs of the evaluated value * @param agreeCoeficient the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}) * @param distanceMeasure distance measure used to measure the degree of conflict between values */ public DecidingConflictFQualityCalculator(SourceQualityCalculator sourceQualityCalculator, double agreeCoeficient, DistanceMeasure distanceMeasure) { super(sourceQualityCalculator, distanceMeasure); this.agreeCoeficient = agreeCoeficient; } /** * Creates a new instance. * @param sourceQualityCalculator calculator of quality of source named graphs of the evaluated value * @param agreeCoeficient the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}) */ public DecidingConflictFQualityCalculator(SourceQualityCalculator sourceQualityCalculator, double agreeCoeficient) { super(sourceQualityCalculator); this.agreeCoeficient = agreeCoeficient; } /** * Creates a new instance. * @param sourceQualityCalculator calculator of quality of source named graphs of the evaluated value */ public DecidingConflictFQualityCalculator(SourceQualityCalculator sourceQualityCalculator) { super(sourceQualityCalculator); this.agreeCoeficient = DEFAULT_AGREE_COEFICIENT; } /** * Creates a new instance. */ public DecidingConflictFQualityCalculator() { super(); this.agreeCoeficient = DEFAULT_AGREE_COEFICIENT; } @Override protected double valueQuality(Value value, Collection<Resource> sources, Model metadata) { double max = 0; for (Resource source : sources) { double sourceQuality = getSourceQuality(source, metadata); if (sourceQuality > max) { max = sourceQuality; } } return max; } @Override public double getFQuality(Value value, Collection<Statement> conflictingStatements, Collection<Resource> sources, CRContext context) { double quality = super.getFQuality(value, conflictingStatements, sources, context); // Increase score if multiple sources agree on the result value if (sources.size() > 1) { Model metadata = context.getMetadata(); double sourcesQualitySum = 0; double maxSourceQuality = 0; for (Resource source : sources) { double sourceQuality = getSourceQuality(source, metadata); sourcesQualitySum += sourceQuality; if (sourceQuality > maxSourceQuality) { maxSourceQuality = sourceQuality; } } double supportFactor = (sourcesQualitySum - maxSourceQuality) / agreeCoeficient; if (supportFactor > 1) { supportFactor = 1; } else if (supportFactor < 0) { supportFactor = 0; } quality += (1 - quality) * supportFactor; } return quality; } }
UTF-8
Java
5,081
java
DecidingConflictFQualityCalculator.java
Java
[ { "context": "#DEFAULT_AGREE_COEFICIENT} is used.\n * \n * @author Jan Michelfeit\n */\npublic class DecidingConflictFQualityCalculat", "end": 1416, "score": 0.9998684525489807, "start": 1402, "tag": "NAME", "value": "Jan Michelfeit" } ]
null
[]
package cz.cuni.mff.odcleanstore.conflictresolution.quality.impl; import java.util.Collection; import org.openrdf.model.Model; import org.openrdf.model.Resource; import org.openrdf.model.Statement; import org.openrdf.model.Value; import cz.cuni.mff.odcleanstore.conflictresolution.CRContext; import cz.cuni.mff.odcleanstore.conflictresolution.DistanceMeasure; import cz.cuni.mff.odcleanstore.conflictresolution.quality.DecidingFQualityCalculator; import cz.cuni.mff.odcleanstore.conflictresolution.quality.SourceQualityCalculator; /** * Concrete implementation of {@link ConflictFQualityCalculator} suitable * for deciding conflict resolution functions (i.e. those choosing one or more values from their input). * The base quality (see {@link #valueQuality()}) is determined as the maximum of quality scores of * all value's sources. The resulting quality is then increased if there is exact agreement on the evaluated * value among multiple sources according to the following formula: * * <code>result_quality = quality + (1 - quality) * min(1, support_factor)</code> * * where <code>support_factor</code> is * * <code>(&lt;sum of quality scores of all sources&gt; - &lt;quality score of the best source&gt;) / agree_coefficient</code>. * * <code>agree_coefficient</code> is given in the constructor or the default value {@value #DEFAULT_AGREE_COEFICIENT} is used. * * @author <NAME> */ public class DecidingConflictFQualityCalculator extends ConflictFQualityCalculator implements DecidingFQualityCalculator { /** The default value of the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}). */ public static final double DEFAULT_AGREE_COEFICIENT = 4; /** Value of the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}). */ protected final double agreeCoeficient; /** * Creates a new instance. * @param sourceQualityCalculator calculator of quality of source named graphs of the evaluated value * @param agreeCoeficient the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}) * @param distanceMeasure distance measure used to measure the degree of conflict between values */ public DecidingConflictFQualityCalculator(SourceQualityCalculator sourceQualityCalculator, double agreeCoeficient, DistanceMeasure distanceMeasure) { super(sourceQualityCalculator, distanceMeasure); this.agreeCoeficient = agreeCoeficient; } /** * Creates a new instance. * @param sourceQualityCalculator calculator of quality of source named graphs of the evaluated value * @param agreeCoeficient the agree coefficient (see {@link DecidingConflictFQualityCalculator class javadoc}) */ public DecidingConflictFQualityCalculator(SourceQualityCalculator sourceQualityCalculator, double agreeCoeficient) { super(sourceQualityCalculator); this.agreeCoeficient = agreeCoeficient; } /** * Creates a new instance. * @param sourceQualityCalculator calculator of quality of source named graphs of the evaluated value */ public DecidingConflictFQualityCalculator(SourceQualityCalculator sourceQualityCalculator) { super(sourceQualityCalculator); this.agreeCoeficient = DEFAULT_AGREE_COEFICIENT; } /** * Creates a new instance. */ public DecidingConflictFQualityCalculator() { super(); this.agreeCoeficient = DEFAULT_AGREE_COEFICIENT; } @Override protected double valueQuality(Value value, Collection<Resource> sources, Model metadata) { double max = 0; for (Resource source : sources) { double sourceQuality = getSourceQuality(source, metadata); if (sourceQuality > max) { max = sourceQuality; } } return max; } @Override public double getFQuality(Value value, Collection<Statement> conflictingStatements, Collection<Resource> sources, CRContext context) { double quality = super.getFQuality(value, conflictingStatements, sources, context); // Increase score if multiple sources agree on the result value if (sources.size() > 1) { Model metadata = context.getMetadata(); double sourcesQualitySum = 0; double maxSourceQuality = 0; for (Resource source : sources) { double sourceQuality = getSourceQuality(source, metadata); sourcesQualitySum += sourceQuality; if (sourceQuality > maxSourceQuality) { maxSourceQuality = sourceQuality; } } double supportFactor = (sourcesQualitySum - maxSourceQuality) / agreeCoeficient; if (supportFactor > 1) { supportFactor = 1; } else if (supportFactor < 0) { supportFactor = 0; } quality += (1 - quality) * supportFactor; } return quality; } }
5,073
0.701634
0.699272
119
41.697479
37.562622
126
false
false
0
0
0
0
0
0
0.462185
false
false
6
06275f7716a022ef25ead62df1588b3601136c36
29,394,756,202,108
35348f6624d46a1941ea7e286af37bb794bee5b7
/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/dyld/BindProcessor.java
158ddf462523c4e75fe2e81046be524c0a5e874c
[ "Apache-2.0", "GPL-1.0-or-later", "GPL-3.0-only", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "LicenseRef-scancode-unknown-license-reference" ]
permissive
StarCrossPortal/ghidracraft
https://github.com/StarCrossPortal/ghidracraft
7af6257c63a2bb7684e4c2ad763a6ada23297fa3
a960e81ff6144ec8834e187f5097dfcf64758e18
refs/heads/master
2023-08-23T20:17:26.250000
2021-10-22T00:53:49
2021-10-22T00:53:49
359,644,138
80
19
Apache-2.0
true
2021-10-20T03:59:55
2021-04-20T01:14:29
2021-10-19T08:33:56
2021-10-10T10:24:46
176,210
55
11
19
Java
false
false
/* ### * IP: GHIDRA * * 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 ghidra.app.util.bin.format.macho.commands.dyld; import java.io.ByteArrayInputStream; import ghidra.app.util.bin.ByteProvider; import ghidra.app.util.bin.format.macho.MachHeader; import ghidra.app.util.bin.format.macho.commands.DyldInfoCommand; import ghidra.app.util.bin.format.macho.commands.DyldInfoCommandConstants; import ghidra.program.model.listing.Program; import ghidra.util.task.TaskMonitor; public class BindProcessor extends AbstractDyldInfoProcessor { public BindProcessor( Program program, MachHeader header, ByteProvider provider, DyldInfoCommand command ) { super( header, program, provider, command ); } @Override public void process( TaskMonitor monitor ) throws Exception { BindState bind = new BindState( header, program ); boolean done = false; byte [] commandBytes = provider.readBytes( command.getBindOffset(), command.getBindSize() ); ByteArrayInputStream byteServer = new ByteArrayInputStream( commandBytes ); while ( !done ) { if ( monitor.isCancelled() ) { break; } int value = byteServer.read(); if ( value == -1 ) { break; } byte b = (byte) value; int opcode = b & DyldInfoCommandConstants.BIND_OPCODE_MASK; int immediate = b & DyldInfoCommandConstants.BIND_IMMEDIATE_MASK; switch ( opcode ) { case DyldInfoCommandConstants.BIND_OPCODE_ADD_ADDR_ULEB: { bind.segmentOffset += uleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND: { bind.perform( monitor ); bind.segmentOffset += program.getDefaultPointerSize(); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: { bind.perform( monitor ); bind.segmentOffset += ( immediate * program.getDefaultPointerSize() ) + program.getDefaultPointerSize(); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: { bind.perform( monitor ); bind.segmentOffset += uleb128( byteServer, monitor ) + program.getDefaultPointerSize(); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: { long count = uleb128( byteServer, monitor ); long skip = uleb128( byteServer, monitor ); for ( int i = 0 ; i < count ; ++i ) { if ( monitor.isCancelled() ) { break; } bind.perform( monitor ); bind.segmentOffset += skip + program.getDefaultPointerSize(); } break; } case DyldInfoCommandConstants.BIND_OPCODE_DONE: { done = true; break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_ADDEND_SLEB: { bind.addend = sleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_DYLIB_ORDINAL_IMM: { bind.libraryOrdinal = immediate; break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB: { bind.libraryOrdinal = (int) uleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: { //the special ordinals are negative numbers if ( immediate == 0 ) { bind.libraryOrdinal = 0; } else { byte signExtended = (byte) ( DyldInfoCommandConstants.BIND_OPCODE_MASK | immediate ); bind.libraryOrdinal = signExtended; } break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: { bind.segmentIndex = immediate; bind.segmentOffset = uleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: { bind.symbolName = readString( byteServer, monitor ); if ( ( immediate & DyldInfoCommandConstants.BIND_SYMBOL_FLAGS_WEAK_IMPORT ) != 0 ) { bind.setWeak( true ); } else { bind.setWeak( false ); } break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_TYPE_IMM: { bind.type = immediate; break; } default: { throw new Exception( "Unknown dyld info bind opcode " + Integer.toHexString(opcode)); } } } } }
UTF-8
Java
4,669
java
BindProcessor.java
Java
[ { "context": "/* ###\n * IP: GHIDRA\n *\n * Licensed under the Apache License, Ver", "end": 15, "score": 0.9171387553215027, "start": 14, "tag": "NAME", "value": "G" } ]
null
[]
/* ### * IP: GHIDRA * * 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 ghidra.app.util.bin.format.macho.commands.dyld; import java.io.ByteArrayInputStream; import ghidra.app.util.bin.ByteProvider; import ghidra.app.util.bin.format.macho.MachHeader; import ghidra.app.util.bin.format.macho.commands.DyldInfoCommand; import ghidra.app.util.bin.format.macho.commands.DyldInfoCommandConstants; import ghidra.program.model.listing.Program; import ghidra.util.task.TaskMonitor; public class BindProcessor extends AbstractDyldInfoProcessor { public BindProcessor( Program program, MachHeader header, ByteProvider provider, DyldInfoCommand command ) { super( header, program, provider, command ); } @Override public void process( TaskMonitor monitor ) throws Exception { BindState bind = new BindState( header, program ); boolean done = false; byte [] commandBytes = provider.readBytes( command.getBindOffset(), command.getBindSize() ); ByteArrayInputStream byteServer = new ByteArrayInputStream( commandBytes ); while ( !done ) { if ( monitor.isCancelled() ) { break; } int value = byteServer.read(); if ( value == -1 ) { break; } byte b = (byte) value; int opcode = b & DyldInfoCommandConstants.BIND_OPCODE_MASK; int immediate = b & DyldInfoCommandConstants.BIND_IMMEDIATE_MASK; switch ( opcode ) { case DyldInfoCommandConstants.BIND_OPCODE_ADD_ADDR_ULEB: { bind.segmentOffset += uleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND: { bind.perform( monitor ); bind.segmentOffset += program.getDefaultPointerSize(); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: { bind.perform( monitor ); bind.segmentOffset += ( immediate * program.getDefaultPointerSize() ) + program.getDefaultPointerSize(); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: { bind.perform( monitor ); bind.segmentOffset += uleb128( byteServer, monitor ) + program.getDefaultPointerSize(); break; } case DyldInfoCommandConstants.BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: { long count = uleb128( byteServer, monitor ); long skip = uleb128( byteServer, monitor ); for ( int i = 0 ; i < count ; ++i ) { if ( monitor.isCancelled() ) { break; } bind.perform( monitor ); bind.segmentOffset += skip + program.getDefaultPointerSize(); } break; } case DyldInfoCommandConstants.BIND_OPCODE_DONE: { done = true; break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_ADDEND_SLEB: { bind.addend = sleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_DYLIB_ORDINAL_IMM: { bind.libraryOrdinal = immediate; break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB: { bind.libraryOrdinal = (int) uleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: { //the special ordinals are negative numbers if ( immediate == 0 ) { bind.libraryOrdinal = 0; } else { byte signExtended = (byte) ( DyldInfoCommandConstants.BIND_OPCODE_MASK | immediate ); bind.libraryOrdinal = signExtended; } break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: { bind.segmentIndex = immediate; bind.segmentOffset = uleb128( byteServer, monitor ); break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: { bind.symbolName = readString( byteServer, monitor ); if ( ( immediate & DyldInfoCommandConstants.BIND_SYMBOL_FLAGS_WEAK_IMPORT ) != 0 ) { bind.setWeak( true ); } else { bind.setWeak( false ); } break; } case DyldInfoCommandConstants.BIND_OPCODE_SET_TYPE_IMM: { bind.type = immediate; break; } default: { throw new Exception( "Unknown dyld info bind opcode " + Integer.toHexString(opcode)); } } } } }
4,669
0.686228
0.679803
145
31.200001
28.858418
109
false
false
0
0
0
0
0
0
3.662069
false
false
6
38b39e51c46ed3194052ca7eb89a0180e9806b20
12,352,325,968,165
c6609acebfc3670d8b3f00df7ba9030ea80c14b0
/src/programmers/PrimeNumber.java
2888713f0f9a9a5579834fb60b5f44a397046577
[]
no_license
newkayak12/algorithm
https://github.com/newkayak12/algorithm
0af7db1ce6dc2c7f86df9dd297ed48f19dfc80c2
108ee0c2e7688af2560c091861c207c3eb00e112
refs/heads/master
2023-08-11T20:17:32.219000
2021-09-16T08:24:47
2021-09-16T08:24:47
381,694,739
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package programmers; import java.util.ArrayList; public class PrimeNumber { public static void main(String[] args) { // System.out.println(solution(100000)); // System.out.println(solution2(10)); // System.out.println(solution2(5)); // System.out.println(solution2(11)); System.out.println(solution3(10)); System.out.println(solution3(5)); System.out.println(solution3(11)); } public static int solution(int n) { ArrayList<Integer> num = new ArrayList<>(); for(int i = 2; i<=n; i++){ int count = 0; for(int j = 2; j<=i; j++){ if(i%j==0){ count++; } } if(count == 1){ num.add(i); } } return num.size(); } public static int solution2(int n){ int answer = 0; boolean[] sosu =new boolean [n+1]; for(int i=2; i<=n ; i++) sosu[i]=true; //에라테네스 int root=(int)Math.sqrt(n); for(int i=2; i<=root; i++){ if(sosu[i]==true){ for(int j=i; i*j<=n; j++) sosu[i*j]=false; } } for(int i =2; i<=n; i++) { if(sosu[i]==true) answer++; } return answer; } public static int solution3(int n){ boolean[] primeLists = new boolean[n+1]; primeLists[0] = false; primeLists[1] = false; for(int i=2; i<=n; i++){ primeLists[i] = true; } for(int i =2; (i*i)<=n; i++){ if(primeLists[i]){ for(int j = (i*i); j<=n; j+=i){ primeLists[j] = false; } } } // (int)primeLists.stream().filter(x->x.equals(true)).count(); int count = 0; for(boolean a : primeLists){ if(a){ count++; } } return count ; } } // 15 2,3,5,7,11,13 // 10 2,3,5,7 // 7 2,3,5,7 // 6 2,3,5 // 5 2,3,5 /* 2> 1 3> 2 4> 2 5> 3 6> 3 7> 4 8> 4 9> 4 10> 4 11> 5 12> 5 13> 6 14> 6 15> 6 16> 6 17> 7 18> 7 19> 8 20> 8 */
UTF-8
Java
1,895
java
PrimeNumber.java
Java
[]
null
[]
package programmers; import java.util.ArrayList; public class PrimeNumber { public static void main(String[] args) { // System.out.println(solution(100000)); // System.out.println(solution2(10)); // System.out.println(solution2(5)); // System.out.println(solution2(11)); System.out.println(solution3(10)); System.out.println(solution3(5)); System.out.println(solution3(11)); } public static int solution(int n) { ArrayList<Integer> num = new ArrayList<>(); for(int i = 2; i<=n; i++){ int count = 0; for(int j = 2; j<=i; j++){ if(i%j==0){ count++; } } if(count == 1){ num.add(i); } } return num.size(); } public static int solution2(int n){ int answer = 0; boolean[] sosu =new boolean [n+1]; for(int i=2; i<=n ; i++) sosu[i]=true; //에라테네스 int root=(int)Math.sqrt(n); for(int i=2; i<=root; i++){ if(sosu[i]==true){ for(int j=i; i*j<=n; j++) sosu[i*j]=false; } } for(int i =2; i<=n; i++) { if(sosu[i]==true) answer++; } return answer; } public static int solution3(int n){ boolean[] primeLists = new boolean[n+1]; primeLists[0] = false; primeLists[1] = false; for(int i=2; i<=n; i++){ primeLists[i] = true; } for(int i =2; (i*i)<=n; i++){ if(primeLists[i]){ for(int j = (i*i); j<=n; j+=i){ primeLists[j] = false; } } } // (int)primeLists.stream().filter(x->x.equals(true)).count(); int count = 0; for(boolean a : primeLists){ if(a){ count++; } } return count ; } } // 15 2,3,5,7,11,13 // 10 2,3,5,7 // 7 2,3,5,7 // 6 2,3,5 // 5 2,3,5 /* 2> 1 3> 2 4> 2 5> 3 6> 3 7> 4 8> 4 9> 4 10> 4 11> 5 12> 5 13> 6 14> 6 15> 6 16> 6 17> 7 18> 7 19> 8 20> 8 */
1,895
0.499204
0.436605
111
15.981982
14.15486
64
false
false
0
0
0
0
0
0
1.738739
false
false
6
c024f4c07b7be20567c2561bd58157390599ed9d
18,176,301,623,796
a67589aea4bf2ee1d70c33d8e0cd27c0994eeb1d
/SnapBilling-master/SnapBilling/src/com/snapbizz/snapbilling/adapters/DistributorSearchListAdapter.java
06c01f15494de3436785ad79852dbda5e0349b8d
[]
no_license
MaheshProfiles/Projects
https://github.com/MaheshProfiles/Projects
8759d6aa36b127e137a9e0acf6b8edc4d2a3e47a
8c366524316474d76be25a3324d86e737ba45d50
refs/heads/master
2021-01-19T12:16:06.646000
2016-10-05T09:26:46
2016-10-05T09:26:46
70,036,021
0
0
null
false
2016-10-05T09:26:46
2016-10-05T06:41:15
2016-10-05T08:02:11
2016-10-05T09:26:46
42,806
0
0
0
Java
null
null
package com.snapbizz.snapbilling.adapters; import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.snapbizz.snapbilling.R; import com.snapbizz.snaptoolkit.domains.Distributor; public class DistributorSearchListAdapter extends ArrayAdapter<Distributor> { private LayoutInflater layoutInflater; private int layoutId = R.layout.listitem_customer_search; public DistributorSearchListAdapter(Context context, int textViewResourceId, List<Distributor> objects) { super(context, textViewResourceId, objects); this.layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public DistributorSearchListAdapter(Context context, int textViewResourceId, List<Distributor> objects, int layoutId) { super(context, textViewResourceId, objects); this.layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.layoutId = layoutId; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) convertView = layoutInflater.inflate(layoutId, null); Distributor distributor=getItem(position); ((TextView) convertView.findViewById(R.id.search_customername_textview)).setText(distributor.getAgencyName()); ((TextView) convertView.findViewById(R.id.search_customernumber_textview)).setText(distributor.getPhoneNumber()); ((TextView) convertView.findViewById(R.id.search_customeraddress_textview)).setText(distributor.getTinNumber()); return convertView; } }
UTF-8
Java
1,678
java
DistributorSearchListAdapter.java
Java
[]
null
[]
package com.snapbizz.snapbilling.adapters; import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.snapbizz.snapbilling.R; import com.snapbizz.snaptoolkit.domains.Distributor; public class DistributorSearchListAdapter extends ArrayAdapter<Distributor> { private LayoutInflater layoutInflater; private int layoutId = R.layout.listitem_customer_search; public DistributorSearchListAdapter(Context context, int textViewResourceId, List<Distributor> objects) { super(context, textViewResourceId, objects); this.layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public DistributorSearchListAdapter(Context context, int textViewResourceId, List<Distributor> objects, int layoutId) { super(context, textViewResourceId, objects); this.layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.layoutId = layoutId; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) convertView = layoutInflater.inflate(layoutId, null); Distributor distributor=getItem(position); ((TextView) convertView.findViewById(R.id.search_customername_textview)).setText(distributor.getAgencyName()); ((TextView) convertView.findViewById(R.id.search_customernumber_textview)).setText(distributor.getPhoneNumber()); ((TextView) convertView.findViewById(R.id.search_customeraddress_textview)).setText(distributor.getTinNumber()); return convertView; } }
1,678
0.808105
0.808105
40
40.950001
33.710495
115
false
false
0
0
0
0
0
0
1.925
false
false
6
1412c56281a228f932b4bcef512a12dc9818549f
21,646,635,200,580
c385e576ad9e811e451788ae4bbd67ff15ecd2f5
/LPR_12_13-2/src/com/milway/TestMain.java
d77ef9e62563bd0a157da5024435e2b69a2fad14
[]
no_license
juliamilway/java
https://github.com/juliamilway/java
c2d93a4d4d1f55313427b21ac6d197523c1357d6
1718dc69c1106e602696bd945d2a31b7582a02a1
refs/heads/master
2020-09-27T08:34:43.886000
2019-12-27T06:38:10
2019-12-27T06:38:10
226,475,678
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.milway; /*Таксопарк. Визначити ієрархію легкових автомобілів. Створити таксопарк. Підрахувати вартість автопарку. Провести сортування автомобілів парку по витраті палива. Знайти автомобіль в компанії, що відповідає заданому діапазону параметрів швидкості.*/ public class TestMain { public static void main(String[] args) { AppConsole appConsole=new AppConsole(); appConsole.showConsole(); } }
UTF-8
Java
636
java
TestMain.java
Java
[]
null
[]
package com.milway; /*Таксопарк. Визначити ієрархію легкових автомобілів. Створити таксопарк. Підрахувати вартість автопарку. Провести сортування автомобілів парку по витраті палива. Знайти автомобіль в компанії, що відповідає заданому діапазону параметрів швидкості.*/ public class TestMain { public static void main(String[] args) { AppConsole appConsole=new AppConsole(); appConsole.showConsole(); } }
636
0.78066
0.78066
13
31.615385
31.643539
88
false
false
0
0
0
0
0
0
0.307692
false
false
6
5c4890b86c8e8705a0e2bf5a8c8d0bed697d3e9c
19,550,691,161,398
de72d62086bcf251046a62a86198d7648138ec03
/src/operaciones/Conversor.java
abd3261826c5074e92dfbf8fdbe89997c9e8fbb1
[]
no_license
nova-21/JavaApplication30
https://github.com/nova-21/JavaApplication30
c27d1e31ef54b7e5e054440dd4f2cd369403be5d
5adfe5bd648aa0c6518ef166dc19fafcdfd579f3
refs/heads/master
2020-10-01T10:52:07.371000
2020-02-06T04:18:24
2020-02-06T04:18:24
227,520,494
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package operaciones; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigInteger; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import java.util.zip.CRC32; /** * * @author David */ public class Conversor { private static final Charset UTF_8 = Charset.forName("UTF-8"); private String divisor = "1011"; ArrayList<String> mensajes; ArrayList<String> tramas; ArrayList<String> desentramado; ArrayList<String> recibidos; ArrayList<String> mensajeRec = new ArrayList(); public ArrayList<String> binary(String me) { String text = me; byte[] bytes = text.getBytes(UTF_8); mensajes = new ArrayList(); StringBuilder binary = new StringBuilder(); for (byte b : bytes) { StringBuilder fila = new StringBuilder(); int val = b; for (int i = 0; i < 8; i++) { binary.append((val & 128) == 0 ? 0 : 1); fila.append((val & 128) == 0 ? 0 : 1); val <<= 1; } mensajes.add(fila.toString()); binary.append(' '); } /*for (Object men : mensajes) { System.out.println(men); }*/ System.out.println("'" + text + "' to binary: " + binary); //System.out.println("bytes= " + bytes[0]); //System.out.println("text again= " + new String(bytes, UTF_8)); //System.out.println("Hola"); return this.mensajes; } static String div(String code, String gen) { int pointer = gen.length(); String result = code.substring(0, pointer); String rem = ""; for (int i = 0; i < gen.length(); i++) { if (result.charAt(i) == gen.charAt(i)) { rem += "0"; } else { rem += "1"; } } while (pointer < code.length()) { if (rem.charAt(0) == '0') { rem = rem.substring(1, rem.length()); rem = rem + String.valueOf(code.charAt(pointer)); pointer++; } result = rem; rem = ""; if (result.charAt(0) == '0') { for (int i = 0; i < gen.length(); i++) { if (result.charAt(i) == '1') { rem += 1; } else { rem += 0; } } } else { for (int i = 0; i < gen.length(); i++) { if (result.charAt(i) == gen.charAt(i)) { rem += "0"; } else { rem += "1"; } } } } return rem.substring(1, rem.length()); } public ArrayList<String> redundancia(ArrayList<String> mensajes) { int contador = 0; for (String men : mensajes) { String dividend = men + "000"; //System.out.println(divisor); //System.out.println(dividend); String remainder = div(dividend.toString(), divisor.toString()); mensajes.set(contador, mensajes.get(contador) + remainder); //System.out.println("remainder is: " + remainder); contador++; } /*System.out.println("Mensajes con redundancia"); for (Object men : mensajes) { System.out.println(men); }*/ return mensajes; } public int deteccion(String men) { int resultado; //System.out.println("verga"); String dividend = men; String remainder = div(dividend, divisor); //System.out.println(remainder); if (Integer.parseInt(remainder) == 0) { resultado = 1; } else { resultado = 0; } //System.out.println("Remainder is: " + remainder); //contador++; return resultado; } public ArrayList<String> entramado(ArrayList<String> mensajes) { tramas = new ArrayList(); String code = "01110"; String trama = ""; for (int i = 0; i < mensajes.size(); i++) { trama = ""; trama += code; trama += mensajes.get(i); trama += code; //System.out.println("Trama " + (i + 1) + ": " + trama + "\n"); tramas.add(trama); } return tramas; } public String desentramado(String trama) { return trama.substring(5, trama.length() - 5); } public String ascii(String s) { String s2 = ""; char nextChar; for (int i = 0; i <= s.length() - 8; i += 9) //this is a little tricky. we want [0, 7], [9, 16], etc (increment index by 9 if bytes are space-delimited) { nextChar = (char) Integer.parseInt(s.substring(i, i + 8), 2); s2 += nextChar; } return s2; } public void toAscii(byte[] bytes) { String texto = new String(bytes, UTF_8); File nueva = new File("./nuevo/sdf.ex"); } public void archivoAB() throws IOException { File file = new File("cosa.txt"); byte[] fileData = new byte[(int) file.length()]; FileInputStream in = new FileInputStream(file); in.read(fileData); in.close(); StringBuilder binary = new StringBuilder(); for (byte b : fileData) { int val = b; for (int i = 0; i < 8; i++) { binary.append((val & 128) == 0 ? 0 : 1); val <<= 1; } binary.append(' '); } //System.out.println(binary); //System.out.println(fileData[0]); } public void archivoRecibir(byte[] fileData) throws FileNotFoundException, IOException { File file2 = new File("nuevo.txt"); FileOutputStream out = new FileOutputStream(file2); out.write(fileData); out.close(); } }
UTF-8
Java
6,301
java
Conversor.java
Java
[ { "context": "st;\nimport java.util.zip.CRC32;\n\n/**\n *\n * @author David\n */\npublic class Conversor {\n\n private static ", "end": 524, "score": 0.9889942407608032, "start": 519, "tag": "NAME", "value": "David" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package operaciones; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigInteger; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import java.util.zip.CRC32; /** * * @author David */ public class Conversor { private static final Charset UTF_8 = Charset.forName("UTF-8"); private String divisor = "1011"; ArrayList<String> mensajes; ArrayList<String> tramas; ArrayList<String> desentramado; ArrayList<String> recibidos; ArrayList<String> mensajeRec = new ArrayList(); public ArrayList<String> binary(String me) { String text = me; byte[] bytes = text.getBytes(UTF_8); mensajes = new ArrayList(); StringBuilder binary = new StringBuilder(); for (byte b : bytes) { StringBuilder fila = new StringBuilder(); int val = b; for (int i = 0; i < 8; i++) { binary.append((val & 128) == 0 ? 0 : 1); fila.append((val & 128) == 0 ? 0 : 1); val <<= 1; } mensajes.add(fila.toString()); binary.append(' '); } /*for (Object men : mensajes) { System.out.println(men); }*/ System.out.println("'" + text + "' to binary: " + binary); //System.out.println("bytes= " + bytes[0]); //System.out.println("text again= " + new String(bytes, UTF_8)); //System.out.println("Hola"); return this.mensajes; } static String div(String code, String gen) { int pointer = gen.length(); String result = code.substring(0, pointer); String rem = ""; for (int i = 0; i < gen.length(); i++) { if (result.charAt(i) == gen.charAt(i)) { rem += "0"; } else { rem += "1"; } } while (pointer < code.length()) { if (rem.charAt(0) == '0') { rem = rem.substring(1, rem.length()); rem = rem + String.valueOf(code.charAt(pointer)); pointer++; } result = rem; rem = ""; if (result.charAt(0) == '0') { for (int i = 0; i < gen.length(); i++) { if (result.charAt(i) == '1') { rem += 1; } else { rem += 0; } } } else { for (int i = 0; i < gen.length(); i++) { if (result.charAt(i) == gen.charAt(i)) { rem += "0"; } else { rem += "1"; } } } } return rem.substring(1, rem.length()); } public ArrayList<String> redundancia(ArrayList<String> mensajes) { int contador = 0; for (String men : mensajes) { String dividend = men + "000"; //System.out.println(divisor); //System.out.println(dividend); String remainder = div(dividend.toString(), divisor.toString()); mensajes.set(contador, mensajes.get(contador) + remainder); //System.out.println("remainder is: " + remainder); contador++; } /*System.out.println("Mensajes con redundancia"); for (Object men : mensajes) { System.out.println(men); }*/ return mensajes; } public int deteccion(String men) { int resultado; //System.out.println("verga"); String dividend = men; String remainder = div(dividend, divisor); //System.out.println(remainder); if (Integer.parseInt(remainder) == 0) { resultado = 1; } else { resultado = 0; } //System.out.println("Remainder is: " + remainder); //contador++; return resultado; } public ArrayList<String> entramado(ArrayList<String> mensajes) { tramas = new ArrayList(); String code = "01110"; String trama = ""; for (int i = 0; i < mensajes.size(); i++) { trama = ""; trama += code; trama += mensajes.get(i); trama += code; //System.out.println("Trama " + (i + 1) + ": " + trama + "\n"); tramas.add(trama); } return tramas; } public String desentramado(String trama) { return trama.substring(5, trama.length() - 5); } public String ascii(String s) { String s2 = ""; char nextChar; for (int i = 0; i <= s.length() - 8; i += 9) //this is a little tricky. we want [0, 7], [9, 16], etc (increment index by 9 if bytes are space-delimited) { nextChar = (char) Integer.parseInt(s.substring(i, i + 8), 2); s2 += nextChar; } return s2; } public void toAscii(byte[] bytes) { String texto = new String(bytes, UTF_8); File nueva = new File("./nuevo/sdf.ex"); } public void archivoAB() throws IOException { File file = new File("cosa.txt"); byte[] fileData = new byte[(int) file.length()]; FileInputStream in = new FileInputStream(file); in.read(fileData); in.close(); StringBuilder binary = new StringBuilder(); for (byte b : fileData) { int val = b; for (int i = 0; i < 8; i++) { binary.append((val & 128) == 0 ? 0 : 1); val <<= 1; } binary.append(' '); } //System.out.println(binary); //System.out.println(fileData[0]); } public void archivoRecibir(byte[] fileData) throws FileNotFoundException, IOException { File file2 = new File("nuevo.txt"); FileOutputStream out = new FileOutputStream(file2); out.write(fileData); out.close(); } }
6,301
0.500714
0.487066
213
28.582159
22.563402
161
false
false
0
0
0
0
0
0
0.652582
false
false
6
f33d85ee7b69b5cd8c409fc0de048b497b661859
39,256,001,105,797
94f7bd3ca668aa1dc6a79ca72a333cc969cb6d94
/src/test/java/com/tja/injpro/site/InjproTest.java
228e50d06bdedfac5fd3d524dd586ef6662c127c
[]
no_license
XTU3xiaoxin/spring-inject-property
https://github.com/XTU3xiaoxin/spring-inject-property
e523df23e7fdd4bd9d15da3e4b8fd8a2575b9749
4bd3d364ddd9f430b8a2dcf1250817a83e8fbca2
refs/heads/master
2020-12-24T17:54:32.584000
2014-08-23T03:23:50
2014-08-23T03:23:50
23,246,736
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tja.injpro.site; import java.util.Set; import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.tja.injpro.util.Constants; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:context-application.xml"}) public class InjproTest { @Autowired private MenuHolder menuHolder; /** * 测试静态方法的注入(重要) */ @Test public void testMenuHolder() { Set<Menu> menus = menuHolder.getMenus(); Assert.assertEquals(4, menus); } /** * 测试系统默认值覆盖 */ @Test public void testConstants() { Assert.assertEquals("1.0", Constants.JPA_VERSION); Assert.assertEquals("this is jus test", Constants.JPA_DESC); Assert.assertEquals("test jpa name", Constants.JPA_NAME); } }
UTF-8
Java
998
java
InjproTest.java
Java
[]
null
[]
package com.tja.injpro.site; import java.util.Set; import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.tja.injpro.util.Constants; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:context-application.xml"}) public class InjproTest { @Autowired private MenuHolder menuHolder; /** * 测试静态方法的注入(重要) */ @Test public void testMenuHolder() { Set<Menu> menus = menuHolder.getMenus(); Assert.assertEquals(4, menus); } /** * 测试系统默认值覆盖 */ @Test public void testConstants() { Assert.assertEquals("1.0", Constants.JPA_VERSION); Assert.assertEquals("this is jus test", Constants.JPA_DESC); Assert.assertEquals("test jpa name", Constants.JPA_NAME); } }
998
0.762055
0.755765
41
22.268293
22.463005
71
false
false
0
0
0
0
0
0
1.097561
false
false
6
1040ca9d4bf4eea77f654f5173657e580a578ef0
15,951,508,607,873
704e61776da5fc4c8b08bfdc93ac48ee8bb40e16
/tst/project/datacollection/providers/impl/LegalEntityDataProviderImplTest.java
30fe771a5e69c5c04bd53c7f982bcf7bfde91912
[]
no_license
bastova/CodeSample
https://github.com/bastova/CodeSample
71dad3fe8be703ede462d053fbbae7a5d0c0f2b9
bd52adc3c89e87e0744bc1043bca97b280d4f13a
refs/heads/master
2016-08-11T22:14:47.266000
2015-11-22T19:21:58
2015-11-22T19:21:58
46,675,742
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package project.datacollection.providers.impl; import static org.junit.Assert.*; import java.util.Set; import org.junit.Test; import project.datacollection.config.Constants; import project.datacollection.exceptions.DataAccessException; import project.datacollection.model.Entity; import project.datacollection.providers.impl.EntityDataProviderImpl; import com.google.common.collect.ImmutableSet; public class LegalEntityDataProviderImplTest { EntityDataProviderImpl legalEntityService = new EntityDataProviderImpl(); private static final String IS_PRO_KEY = "isPro"; private static final String IS_PRO_TRUE = "True"; private static final Set<String> PRO_TIERS = (Set<String>) ImmutableSet.of("PLATINUM", "GOLD", "SILVER", "SILVER_MPBC"); @Test public void GetAllBusinessData() { try { @SuppressWarnings("unused") Entity legalEntity = legalEntityService.getAllEntityData("", ""); } catch (DataAccessException e) { assertEquals(e.getMessage(), Constants.ExceptionType.METHOD_NOT_IMPLEMENTED.getValue()); } } @Test public void immutableSetShouldBeNonEmpty() { assertFalse(PRO_TIERS.isEmpty()); } @Test public void proTiersShouldBePresentInTheSet() { assertTrue(PRO_TIERS.contains("SILVER")); assertTrue(PRO_TIERS.contains("PLATINUM")); assertTrue(PRO_TIERS.contains("GOLD")); assertTrue(PRO_TIERS.contains("SILVER_MPBC")); } @Test public void invalidTiersShouldNotBePresentInTheSet() { assertFalse(PRO_TIERS.contains("INDIVIDUAL")); assertFalse(PRO_TIERS.contains("INDIVIDUAL_MPBC")); assertFalse(PRO_TIERS.contains("INDVALID")); } @Test public void legalEntityAttributesMapShouldNotBeOverwrittenByAddingProTier() { Entity legalEntity = Entity.builder().build(); assertTrue(legalEntity.getAttributesMap().isEmpty()); if (PRO_TIERS.contains("SILVER")) { legalEntity.getAttributesMap().put(IS_PRO_KEY, IS_PRO_TRUE); } assertEquals(legalEntity.getAttributesMap().get(IS_PRO_KEY), "True"); } }
UTF-8
Java
2,187
java
LegalEntityDataProviderImplTest.java
Java
[ { "context": ");\n\n private static final String IS_PRO_KEY = \"isPro\";\n private static final String IS_PRO_TRUE = \"", "end": 580, "score": 0.9911038875579834, "start": 575, "tag": "KEY", "value": "isPro" } ]
null
[]
package project.datacollection.providers.impl; import static org.junit.Assert.*; import java.util.Set; import org.junit.Test; import project.datacollection.config.Constants; import project.datacollection.exceptions.DataAccessException; import project.datacollection.model.Entity; import project.datacollection.providers.impl.EntityDataProviderImpl; import com.google.common.collect.ImmutableSet; public class LegalEntityDataProviderImplTest { EntityDataProviderImpl legalEntityService = new EntityDataProviderImpl(); private static final String IS_PRO_KEY = "isPro"; private static final String IS_PRO_TRUE = "True"; private static final Set<String> PRO_TIERS = (Set<String>) ImmutableSet.of("PLATINUM", "GOLD", "SILVER", "SILVER_MPBC"); @Test public void GetAllBusinessData() { try { @SuppressWarnings("unused") Entity legalEntity = legalEntityService.getAllEntityData("", ""); } catch (DataAccessException e) { assertEquals(e.getMessage(), Constants.ExceptionType.METHOD_NOT_IMPLEMENTED.getValue()); } } @Test public void immutableSetShouldBeNonEmpty() { assertFalse(PRO_TIERS.isEmpty()); } @Test public void proTiersShouldBePresentInTheSet() { assertTrue(PRO_TIERS.contains("SILVER")); assertTrue(PRO_TIERS.contains("PLATINUM")); assertTrue(PRO_TIERS.contains("GOLD")); assertTrue(PRO_TIERS.contains("SILVER_MPBC")); } @Test public void invalidTiersShouldNotBePresentInTheSet() { assertFalse(PRO_TIERS.contains("INDIVIDUAL")); assertFalse(PRO_TIERS.contains("INDIVIDUAL_MPBC")); assertFalse(PRO_TIERS.contains("INDVALID")); } @Test public void legalEntityAttributesMapShouldNotBeOverwrittenByAddingProTier() { Entity legalEntity = Entity.builder().build(); assertTrue(legalEntity.getAttributesMap().isEmpty()); if (PRO_TIERS.contains("SILVER")) { legalEntity.getAttributesMap().put(IS_PRO_KEY, IS_PRO_TRUE); } assertEquals(legalEntity.getAttributesMap().get(IS_PRO_KEY), "True"); } }
2,187
0.686786
0.686786
64
33.171875
27.599567
100
false
false
0
0
0
0
0
0
0.53125
false
false
6
07a94e192c041a9ca70ddb9d2ccbebf1e03c1421
37,804,302,149,839
309f174361fda70010c1f20354ae8cda85f12810
/src/aufgabe5/Boat.java
5f198a68249cbbe2bff02086fe0e7799cd32aadc
[]
no_license
benjamindeu/1410653982_U3
https://github.com/benjamindeu/1410653982_U3
8d77e93b108a30ba6f4ca66c332c9be748bdbe33
316c27d0a54743e8bf06e2a1491e72b232c02ac8
refs/heads/master
2021-01-25T04:08:45.633000
2015-05-03T18:37:03
2015-05-03T18:37:03
34,996,479
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package aufgabe5; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author benjamindeutinger */ public class Boat extends Vehicle { private double draft; private short propeller; private double cargo; public Boat(){} public Boat(Color color, double draft, short propeller, double cargo, short wheels, short ps, short doors) { super(color, wheels, ps, doors); this.draft = draft; this.propeller = propeller; this.cargo = cargo; } public void unload(){ this.cargo = 0; try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(Boat.class.getName()).log(Level.SEVERE, null, ex); } } @Override public String toString() { return "Mein Wasserfahrzeug hat " + this.getPs() + " PS und einen " + "Tiefgang von " + this.getDraft() + " m"; } //---Getter & Setter------------------------------------------------------------ public double getDraft() { return draft; } public void setDraft(double draft) { this.draft = draft; } public short getPropeller() { return propeller; } public void setPropeller(short propeller) { this.propeller = propeller; } public double getCargo() { return cargo; } public void setCargo(double cargo) { this.cargo = cargo; } }
UTF-8
Java
1,485
java
Boat.java
Java
[ { "context": "mport java.util.logging.Logger;\n\n/**\n *\n * @author benjamindeutinger\n */\npublic class Boat extends Vehicle {\n priva", "end": 120, "score": 0.980577290058136, "start": 103, "tag": "USERNAME", "value": "benjamindeutinger" } ]
null
[]
package aufgabe5; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author benjamindeutinger */ public class Boat extends Vehicle { private double draft; private short propeller; private double cargo; public Boat(){} public Boat(Color color, double draft, short propeller, double cargo, short wheels, short ps, short doors) { super(color, wheels, ps, doors); this.draft = draft; this.propeller = propeller; this.cargo = cargo; } public void unload(){ this.cargo = 0; try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(Boat.class.getName()).log(Level.SEVERE, null, ex); } } @Override public String toString() { return "Mein Wasserfahrzeug hat " + this.getPs() + " PS und einen " + "Tiefgang von " + this.getDraft() + " m"; } //---Getter & Setter------------------------------------------------------------ public double getDraft() { return draft; } public void setDraft(double draft) { this.draft = draft; } public short getPropeller() { return propeller; } public void setPropeller(short propeller) { this.propeller = propeller; } public double getCargo() { return cargo; } public void setCargo(double cargo) { this.cargo = cargo; } }
1,485
0.552189
0.548148
65
21.846153
22.393152
112
false
false
0
0
0
0
0
0
0.476923
false
false
6
1273e1f5db37c41d54c2213c5ba7277313bea5d6
37,417,755,096,724
b73ab3deebda6405db62743f82adbdf666f77fd5
/Tarea_04_A_Jimenez/Tarea4/src/cr/ac/cenfotec/tarea3/dao/ClienteDAO.java
8a4ae844eebd814b4c6f1c86ce864b6379461a78
[]
no_license
jellyan07/Tarea4_POO
https://github.com/jellyan07/Tarea4_POO
e4703775b93e9b7928811b8ea0905216dc99010b
2bc81c785787d88a7d4ae1fbbb5e30e89b441c3b
refs/heads/master
2023-01-30T06:46:17.924000
2020-12-09T02:47:04
2020-12-09T02:47:04
319,199,886
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cr.ac.cenfotec.tarea3.dao; import cr.ac.cenfotec.tarea3.bl.entidades.Cliente; import cr.ac.cenfotec.tarea3.bl.entidades.Cuenta; import cr.ac.cenfotec.tarea3.bl.entidades.CuentaAhorro; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class ClienteDAO { Connection cnx; public ClienteDAO(Connection cnx){ this.cnx = cnx; } public void save(Cliente material) throws SQLException { Statement stmt = cnx.createStatement(); StringBuilder buildSentence = new StringBuilder("insert into cliente (idcliente, nombre, direccion)"); buildSentence.append(" values ("); buildSentence.append(material.getIdentificacion()); buildSentence.append(",'"); buildSentence.append(material.getNombre()); buildSentence.append("','"); buildSentence.append(material.getDireccion()); buildSentence.append("')"); System.out.println(buildSentence.toString()); stmt.execute(buildSentence.toString()); } public List<Cliente> findAll() throws SQLException { ArrayList<Cliente> listOfResults = new ArrayList<>(); Statement stmt = cnx.createStatement(); ResultSet result = stmt.executeQuery("select * from cliente"); while(result.next()){ Cliente uno = new Cliente(); uno.setIdentificacion(result.getInt("idcliente")); uno.setNombre(result.getString("nombre")); uno.setDireccion(result.getString("apellido")); listOfResults.add(uno); } return listOfResults; } public Cliente findClienteByID(int id) throws SQLException { List<Cliente> clientes = findAll(); for (Cliente cliente: clientes) { if(cliente.getIdentificacion() == id) { return cliente; } } return null; } }
UTF-8
Java
2,246
java
ClienteDAO.java
Java
[]
null
[]
package cr.ac.cenfotec.tarea3.dao; import cr.ac.cenfotec.tarea3.bl.entidades.Cliente; import cr.ac.cenfotec.tarea3.bl.entidades.Cuenta; import cr.ac.cenfotec.tarea3.bl.entidades.CuentaAhorro; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class ClienteDAO { Connection cnx; public ClienteDAO(Connection cnx){ this.cnx = cnx; } public void save(Cliente material) throws SQLException { Statement stmt = cnx.createStatement(); StringBuilder buildSentence = new StringBuilder("insert into cliente (idcliente, nombre, direccion)"); buildSentence.append(" values ("); buildSentence.append(material.getIdentificacion()); buildSentence.append(",'"); buildSentence.append(material.getNombre()); buildSentence.append("','"); buildSentence.append(material.getDireccion()); buildSentence.append("')"); System.out.println(buildSentence.toString()); stmt.execute(buildSentence.toString()); } public List<Cliente> findAll() throws SQLException { ArrayList<Cliente> listOfResults = new ArrayList<>(); Statement stmt = cnx.createStatement(); ResultSet result = stmt.executeQuery("select * from cliente"); while(result.next()){ Cliente uno = new Cliente(); uno.setIdentificacion(result.getInt("idcliente")); uno.setNombre(result.getString("nombre")); uno.setDireccion(result.getString("apellido")); listOfResults.add(uno); } return listOfResults; } public Cliente findClienteByID(int id) throws SQLException { List<Cliente> clientes = findAll(); for (Cliente cliente: clientes) { if(cliente.getIdentificacion() == id) { return cliente; } } return null; } }
2,246
0.674087
0.672306
68
32.029411
22.028706
110
false
false
0
0
0
0
0
0
0.691176
false
false
6
3d31046756b882a2472c365bef5b53ca5157135c
35,089,882,848,805
a55577907603f4b6fa107622ff04893a70aef716
/medCareApplication/src/main/java/com/application/medCareApplication/utils/ResourcesListRenderer.java
ad31e97b5dd0d9c90455c526bc833bb784266e41
[]
no_license
lukajvnv/knowledgeReasoning
https://github.com/lukajvnv/knowledgeReasoning
52e5a26a8c71c654eeb3c7198c3924842c836529
6cf0e402e242cc9b6723041898268d3a3b41d8a1
refs/heads/master
2021-06-15T01:05:04.658000
2021-05-06T20:06:25
2021-05-06T20:06:25
178,922,146
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.application.medCareApplication.utils; import java.awt.Component; import javax.swing.DefaultListCellRenderer; import javax.swing.ImageIcon; import javax.swing.JList; import com.application.medCareApplication.model.Resources; public class ResourcesListRenderer extends DefaultListCellRenderer { /** * */ private static final long serialVersionUID = 1L; @Override public Component getListCellRendererComponent(JList<? extends Object> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // TODO Auto-generated method stub super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Resources p = (Resources)value; setIcon(new ImageIcon("images/home_icon&16.png")); setText(p.toString()); //setBackground(Color.MAGENTA); return this; } }
UTF-8
Java
830
java
ResourcesListRenderer.java
Java
[]
null
[]
package com.application.medCareApplication.utils; import java.awt.Component; import javax.swing.DefaultListCellRenderer; import javax.swing.ImageIcon; import javax.swing.JList; import com.application.medCareApplication.model.Resources; public class ResourcesListRenderer extends DefaultListCellRenderer { /** * */ private static final long serialVersionUID = 1L; @Override public Component getListCellRendererComponent(JList<? extends Object> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // TODO Auto-generated method stub super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Resources p = (Resources)value; setIcon(new ImageIcon("images/home_icon&16.png")); setText(p.toString()); //setBackground(Color.MAGENTA); return this; } }
830
0.773494
0.76988
32
24.9375
26.924591
101
false
false
0
0
0
0
0
0
1.53125
false
false
6
4a9d61f14d0646b5f74ec3594feac070f1d02328
21,062,519,687,765
57ebb672b89c14c9d7bd8ac86c0045750e3820a4
/spring-samples/spring-boot-samples/springboot-data-jpa/src/test/java/com/sivalabs/springboot/ApplicationTests.java
0c9691d18f09b478e9b86ea583ebf322d5586402
[]
no_license
cryptopk-others/proof-of-concepts
https://github.com/cryptopk-others/proof-of-concepts
cb12e21b7ff5486818adeca9103422be839f2928
e0ec8c1ce25c2acc6e144f2a54446082e819b248
refs/heads/master
2021-06-06T16:29:44.154000
2016-07-14T08:20:44
2016-07-14T08:20:44
64,490,733
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sivalabs.springboot; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) public class ApplicationTests { @Autowired PersonService personService; @Test public void test_logging() { List<Person> persons = new ArrayList<Person>(); persons.add(new Person(null,"abcd")); persons.add(new Person(null,"xyz")); persons.add(new Person(null,"xxx")); persons.add(new Person(null,"pqr")); personService.save(persons); } }
UTF-8
Java
809
java
ApplicationTests.java
Java
[]
null
[]
package com.sivalabs.springboot; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) public class ApplicationTests { @Autowired PersonService personService; @Test public void test_logging() { List<Person> persons = new ArrayList<Person>(); persons.add(new Person(null,"abcd")); persons.add(new Person(null,"xyz")); persons.add(new Person(null,"xxx")); persons.add(new Person(null,"pqr")); personService.save(persons); } }
809
0.783684
0.779975
30
25.966667
21.687912
71
false
false
0
0
0
0
0
0
1.3
false
false
6
84ef3bb62d0b439b14ee03e31337167c1a9854c1
7,335,804,204,055
45c1344dbcbaccf09bb61796fe1103ed31e41fa2
/stier-core-parent/stier-core/src/main/java/com/aei/stier/core/service/CachedSystemSequenceService.java
34dae2cbf2240f0da27e6b1eea13ac900d37c09e
[]
no_license
kaf20/jipster
https://github.com/kaf20/jipster
06968f1f4b8e1a6401b0e622128d82ca2e1a8d70
d7bf136c677a4a9fcf1a4c8b369614f0ffae2364
refs/heads/master
2020-02-16T22:32:04.070000
2018-05-13T17:16:26
2018-05-13T17:16:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aei.stier.core.service; import com.aei.stier.core.service.dto.SystemSequencePatternDTO; public interface CachedSystemSequenceService { String getNextBase36SequenceValue(SystemSequencePatternDTO patternDTO, String valueToken); }
UTF-8
Java
247
java
CachedSystemSequenceService.java
Java
[]
null
[]
package com.aei.stier.core.service; import com.aei.stier.core.service.dto.SystemSequencePatternDTO; public interface CachedSystemSequenceService { String getNextBase36SequenceValue(SystemSequencePatternDTO patternDTO, String valueToken); }
247
0.842105
0.834008
8
29.875
33.553829
94
false
false
0
0
0
0
0
0
0.5
false
false
6
987923ce580b60beeb9bc632df9e289779d0767d
17,600,775,982,618
0fa6ccdd77e7cf877e6fd18cb1195e56143043c4
/java/src/main/java/com/splitit/sdk/model/CardData.java
7cede4b259381643bcc45ebb034aa785d4f5de0c
[]
no_license
Splitit/Splitit.SDKs
https://github.com/Splitit/Splitit.SDKs
3d2e6ae09b7e4ba027b269e0ad44bb43ebbef521
4a6377fad34c25afd6f34e863b13d1548bf65f82
refs/heads/master
2023-06-23T21:38:07.255000
2023-06-06T16:33:06
2023-06-06T16:33:06
224,385,604
0
4
null
false
2023-05-08T10:10:42
2019-11-27T08:50:13
2022-02-14T16:14:30
2023-05-08T10:10:41
3,365
0
2
5
Python
false
false
/* * splitit-web-api-public-sdk * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: 1.0.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.splitit.sdk.model; import java.util.Objects; import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.splitit.sdk.model.AddressData; import com.splitit.sdk.model.ReferenceEntityBase; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; /** * CardData */ @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2022-02-15T17:05:16.705Z") public class CardData { @SerializedName("CardId") private String cardId = null; @SerializedName("CardNumber") private String cardNumber = null; @SerializedName("CardExpMonth") private String cardExpMonth = null; @SerializedName("CardExpYear") private String cardExpYear = null; @SerializedName("CardBrand") private ReferenceEntityBase cardBrand = null; @SerializedName("CardType") private ReferenceEntityBase cardType = null; @SerializedName("Bin") private String bin = null; @SerializedName("CardHolderFullName") private String cardHolderFullName = null; @SerializedName("CardCvv") private String cardCvv = null; @SerializedName("Address") private AddressData address = null; @SerializedName("Token") private String token = null; public CardData cardId(String cardId) { this.cardId = cardId; return this; } /** * Get cardId * @return cardId **/ @ApiModelProperty(value = "") public String getCardId() { return cardId; } public void setCardId(String cardId) { this.cardId = cardId; } public CardData cardNumber(String cardNumber) { this.cardNumber = cardNumber; return this; } /** * Get cardNumber * @return cardNumber **/ @ApiModelProperty(value = "") public String getCardNumber() { return cardNumber; } public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; } public CardData cardExpMonth(String cardExpMonth) { this.cardExpMonth = cardExpMonth; return this; } /** * Get cardExpMonth * @return cardExpMonth **/ @ApiModelProperty(value = "") public String getCardExpMonth() { return cardExpMonth; } public void setCardExpMonth(String cardExpMonth) { this.cardExpMonth = cardExpMonth; } public CardData cardExpYear(String cardExpYear) { this.cardExpYear = cardExpYear; return this; } /** * Get cardExpYear * @return cardExpYear **/ @ApiModelProperty(value = "") public String getCardExpYear() { return cardExpYear; } public void setCardExpYear(String cardExpYear) { this.cardExpYear = cardExpYear; } public CardData cardBrand(ReferenceEntityBase cardBrand) { this.cardBrand = cardBrand; return this; } /** * Get cardBrand * @return cardBrand **/ @ApiModelProperty(value = "") public ReferenceEntityBase getCardBrand() { return cardBrand; } public void setCardBrand(ReferenceEntityBase cardBrand) { this.cardBrand = cardBrand; } public CardData cardType(ReferenceEntityBase cardType) { this.cardType = cardType; return this; } /** * Get cardType * @return cardType **/ @ApiModelProperty(value = "") public ReferenceEntityBase getCardType() { return cardType; } public void setCardType(ReferenceEntityBase cardType) { this.cardType = cardType; } public CardData bin(String bin) { this.bin = bin; return this; } /** * Get bin * @return bin **/ @ApiModelProperty(value = "") public String getBin() { return bin; } public void setBin(String bin) { this.bin = bin; } public CardData cardHolderFullName(String cardHolderFullName) { this.cardHolderFullName = cardHolderFullName; return this; } /** * Get cardHolderFullName * @return cardHolderFullName **/ @ApiModelProperty(value = "") public String getCardHolderFullName() { return cardHolderFullName; } public void setCardHolderFullName(String cardHolderFullName) { this.cardHolderFullName = cardHolderFullName; } public CardData cardCvv(String cardCvv) { this.cardCvv = cardCvv; return this; } /** * Get cardCvv * @return cardCvv **/ @ApiModelProperty(value = "") public String getCardCvv() { return cardCvv; } public void setCardCvv(String cardCvv) { this.cardCvv = cardCvv; } public CardData address(AddressData address) { this.address = address; return this; } /** * Get address * @return address **/ @ApiModelProperty(value = "") public AddressData getAddress() { return address; } public void setAddress(AddressData address) { this.address = address; } public CardData token(String token) { this.token = token; return this; } /** * Get token * @return token **/ @ApiModelProperty(value = "") public String getToken() { return token; } public void setToken(String token) { this.token = token; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CardData cardData = (CardData) o; return Objects.equals(this.cardId, cardData.cardId) && Objects.equals(this.cardNumber, cardData.cardNumber) && Objects.equals(this.cardExpMonth, cardData.cardExpMonth) && Objects.equals(this.cardExpYear, cardData.cardExpYear) && Objects.equals(this.cardBrand, cardData.cardBrand) && Objects.equals(this.cardType, cardData.cardType) && Objects.equals(this.bin, cardData.bin) && Objects.equals(this.cardHolderFullName, cardData.cardHolderFullName) && Objects.equals(this.cardCvv, cardData.cardCvv) && Objects.equals(this.address, cardData.address) && Objects.equals(this.token, cardData.token); } @Override public int hashCode() { return Objects.hash(cardId, cardNumber, cardExpMonth, cardExpYear, cardBrand, cardType, bin, cardHolderFullName, cardCvv, address, token); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CardData {\n"); sb.append(" cardId: ").append(toIndentedString(cardId)).append("\n"); sb.append(" cardNumber: ").append(toIndentedString(cardNumber)).append("\n"); sb.append(" cardExpMonth: ").append(toIndentedString(cardExpMonth)).append("\n"); sb.append(" cardExpYear: ").append(toIndentedString(cardExpYear)).append("\n"); sb.append(" cardBrand: ").append(toIndentedString(cardBrand)).append("\n"); sb.append(" cardType: ").append(toIndentedString(cardType)).append("\n"); sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); sb.append(" cardHolderFullName: ").append(toIndentedString(cardHolderFullName)).append("\n"); sb.append(" cardCvv: ").append(toIndentedString(cardCvv)).append("\n"); sb.append(" address: ").append(toIndentedString(address)).append("\n"); sb.append(" token: ").append(toIndentedString(token)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
UTF-8
Java
7,968
java
CardData.java
Java
[ { "context": " (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)\n *\n * OpenAPI spec version: 1.0.", "end": 120, "score": 0.999539315700531, "start": 109, "tag": "USERNAME", "value": "swagger-api" }, { "context": "ger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manu", "end": 289, "score": 0.9995601177215576, "start": 278, "tag": "USERNAME", "value": "swagger-api" } ]
null
[]
/* * splitit-web-api-public-sdk * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: 1.0.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.splitit.sdk.model; import java.util.Objects; import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.splitit.sdk.model.AddressData; import com.splitit.sdk.model.ReferenceEntityBase; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; /** * CardData */ @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2022-02-15T17:05:16.705Z") public class CardData { @SerializedName("CardId") private String cardId = null; @SerializedName("CardNumber") private String cardNumber = null; @SerializedName("CardExpMonth") private String cardExpMonth = null; @SerializedName("CardExpYear") private String cardExpYear = null; @SerializedName("CardBrand") private ReferenceEntityBase cardBrand = null; @SerializedName("CardType") private ReferenceEntityBase cardType = null; @SerializedName("Bin") private String bin = null; @SerializedName("CardHolderFullName") private String cardHolderFullName = null; @SerializedName("CardCvv") private String cardCvv = null; @SerializedName("Address") private AddressData address = null; @SerializedName("Token") private String token = null; public CardData cardId(String cardId) { this.cardId = cardId; return this; } /** * Get cardId * @return cardId **/ @ApiModelProperty(value = "") public String getCardId() { return cardId; } public void setCardId(String cardId) { this.cardId = cardId; } public CardData cardNumber(String cardNumber) { this.cardNumber = cardNumber; return this; } /** * Get cardNumber * @return cardNumber **/ @ApiModelProperty(value = "") public String getCardNumber() { return cardNumber; } public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; } public CardData cardExpMonth(String cardExpMonth) { this.cardExpMonth = cardExpMonth; return this; } /** * Get cardExpMonth * @return cardExpMonth **/ @ApiModelProperty(value = "") public String getCardExpMonth() { return cardExpMonth; } public void setCardExpMonth(String cardExpMonth) { this.cardExpMonth = cardExpMonth; } public CardData cardExpYear(String cardExpYear) { this.cardExpYear = cardExpYear; return this; } /** * Get cardExpYear * @return cardExpYear **/ @ApiModelProperty(value = "") public String getCardExpYear() { return cardExpYear; } public void setCardExpYear(String cardExpYear) { this.cardExpYear = cardExpYear; } public CardData cardBrand(ReferenceEntityBase cardBrand) { this.cardBrand = cardBrand; return this; } /** * Get cardBrand * @return cardBrand **/ @ApiModelProperty(value = "") public ReferenceEntityBase getCardBrand() { return cardBrand; } public void setCardBrand(ReferenceEntityBase cardBrand) { this.cardBrand = cardBrand; } public CardData cardType(ReferenceEntityBase cardType) { this.cardType = cardType; return this; } /** * Get cardType * @return cardType **/ @ApiModelProperty(value = "") public ReferenceEntityBase getCardType() { return cardType; } public void setCardType(ReferenceEntityBase cardType) { this.cardType = cardType; } public CardData bin(String bin) { this.bin = bin; return this; } /** * Get bin * @return bin **/ @ApiModelProperty(value = "") public String getBin() { return bin; } public void setBin(String bin) { this.bin = bin; } public CardData cardHolderFullName(String cardHolderFullName) { this.cardHolderFullName = cardHolderFullName; return this; } /** * Get cardHolderFullName * @return cardHolderFullName **/ @ApiModelProperty(value = "") public String getCardHolderFullName() { return cardHolderFullName; } public void setCardHolderFullName(String cardHolderFullName) { this.cardHolderFullName = cardHolderFullName; } public CardData cardCvv(String cardCvv) { this.cardCvv = cardCvv; return this; } /** * Get cardCvv * @return cardCvv **/ @ApiModelProperty(value = "") public String getCardCvv() { return cardCvv; } public void setCardCvv(String cardCvv) { this.cardCvv = cardCvv; } public CardData address(AddressData address) { this.address = address; return this; } /** * Get address * @return address **/ @ApiModelProperty(value = "") public AddressData getAddress() { return address; } public void setAddress(AddressData address) { this.address = address; } public CardData token(String token) { this.token = token; return this; } /** * Get token * @return token **/ @ApiModelProperty(value = "") public String getToken() { return token; } public void setToken(String token) { this.token = token; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CardData cardData = (CardData) o; return Objects.equals(this.cardId, cardData.cardId) && Objects.equals(this.cardNumber, cardData.cardNumber) && Objects.equals(this.cardExpMonth, cardData.cardExpMonth) && Objects.equals(this.cardExpYear, cardData.cardExpYear) && Objects.equals(this.cardBrand, cardData.cardBrand) && Objects.equals(this.cardType, cardData.cardType) && Objects.equals(this.bin, cardData.bin) && Objects.equals(this.cardHolderFullName, cardData.cardHolderFullName) && Objects.equals(this.cardCvv, cardData.cardCvv) && Objects.equals(this.address, cardData.address) && Objects.equals(this.token, cardData.token); } @Override public int hashCode() { return Objects.hash(cardId, cardNumber, cardExpMonth, cardExpYear, cardBrand, cardType, bin, cardHolderFullName, cardCvv, address, token); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CardData {\n"); sb.append(" cardId: ").append(toIndentedString(cardId)).append("\n"); sb.append(" cardNumber: ").append(toIndentedString(cardNumber)).append("\n"); sb.append(" cardExpMonth: ").append(toIndentedString(cardExpMonth)).append("\n"); sb.append(" cardExpYear: ").append(toIndentedString(cardExpYear)).append("\n"); sb.append(" cardBrand: ").append(toIndentedString(cardBrand)).append("\n"); sb.append(" cardType: ").append(toIndentedString(cardType)).append("\n"); sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); sb.append(" cardHolderFullName: ").append(toIndentedString(cardHolderFullName)).append("\n"); sb.append(" cardCvv: ").append(toIndentedString(cardCvv)).append("\n"); sb.append(" address: ").append(toIndentedString(address)).append("\n"); sb.append(" token: ").append(toIndentedString(token)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
7,968
0.676958
0.674322
326
23.43865
23.582792
142
false
false
0
0
0
0
0
0
0.352761
false
false
6
a21459cd0177e50dcbd26bdf298d670bacd4d0a0
7,636,451,918,231
359fc967847392916aa27fd2a1230bd9e5296438
/week11-week11_40.Calculator/src/calculator/GraphicCalculatorLogic.java
0300967773628b5db3e8ded11ff5b5444759c628
[]
no_license
ProjectBlueSky/Helsinki-MOOC-OO-Java-Part-II
https://github.com/ProjectBlueSky/Helsinki-MOOC-OO-Java-Part-II
eb312227c9284b6e57f71fe0bfaeef9087ff5f2a
9702d51e13f0bd0c0e089fca1a3156958f74ce53
refs/heads/master
2021-01-20T01:19:10.342000
2017-04-24T15:31:05
2017-04-24T15:31:05
89,255,951
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package calculator; /** * * @author W */ public class GraphicCalculatorLogic { private int value; public GraphicCalculatorLogic() { this.value = 0; } public void add(int input) { this.value += input; } public void subtract(int input) { this.value -= input; } public void reset() { this.value = 0; } public int getValue() { return value; } }
UTF-8
Java
624
java
GraphicCalculatorLogic.java
Java
[ { "context": "editor.\n */\npackage calculator;\n\n/**\n *\n * @author W\n */\npublic class GraphicCalculatorLogic {\n\n pr", "end": 225, "score": 0.5571363568305969, "start": 224, "tag": "NAME", "value": "W" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package calculator; /** * * @author W */ public class GraphicCalculatorLogic { private int value; public GraphicCalculatorLogic() { this.value = 0; } public void add(int input) { this.value += input; } public void subtract(int input) { this.value -= input; } public void reset() { this.value = 0; } public int getValue() { return value; } }
624
0.600962
0.597756
35
16.828571
18.374649
79
false
false
0
0
0
0
0
0
0.285714
false
false
6
6bbd1fc8dded99fe91c5d95032818614c36390c8
18,511,309,063,527
8542e91136a909a4ee9b8f1d8a5ecc9a925ecf1c
/java-common-android/src/common/android/extensions/AsyncTaskCallback.java
32a4c75cd6f0bd19c6f10978022a980e1e71e59d
[]
no_license
nativebinary/java-common
https://github.com/nativebinary/java-common
d7c404c60e7fc2213338d8c06dda59a23258df56
e471dfb004962b51b2d7472e010a83f241497f1b
refs/heads/master
2021-06-02T13:39:22.095000
2019-06-10T05:43:36
2019-06-10T05:43:36
20,173,645
1
2
null
false
2015-07-01T12:35:31
2014-05-26T04:07:49
2015-05-05T20:58:08
2015-07-01T12:35:30
3,481
1
5
0
Java
null
null
package common.android.extensions; import common.basic.interfaces.ICallback; public abstract class AsyncTaskCallback<T> extends AsyncTaskSimple<T> { private final ICallback<T> callback; public AsyncTaskCallback(final ICallback<T> callback) { this.callback = callback; } protected abstract T doInBackground() throws Exception; @Override protected void onSuccess(T t) { callback.onSuccess(t); } @Override protected void onFail(Exception exception) { callback.onFail(exception); } }
UTF-8
Java
551
java
AsyncTaskCallback.java
Java
[]
null
[]
package common.android.extensions; import common.basic.interfaces.ICallback; public abstract class AsyncTaskCallback<T> extends AsyncTaskSimple<T> { private final ICallback<T> callback; public AsyncTaskCallback(final ICallback<T> callback) { this.callback = callback; } protected abstract T doInBackground() throws Exception; @Override protected void onSuccess(T t) { callback.onSuccess(t); } @Override protected void onFail(Exception exception) { callback.onFail(exception); } }
551
0.702359
0.702359
24
21.958334
22.383921
71
false
false
0
0
0
0
0
0
0.291667
false
false
6
aacafc4c70a9f56ece6afea59e1ae6361c5c71d8
5,437,428,614,840
5ba551f617427c04039b4a922332708d0f34f2ae
/src/test/java/it/polimi/ingsw/model/gods/PrometheusTest.java
92f8ca00aa118fa7a2a863f981a4e62e2d7dd532
[]
no_license
alb-p/ing-sw-2020-Papiri-Peltrera-Jayasinghe
https://github.com/alb-p/ing-sw-2020-Papiri-Peltrera-Jayasinghe
467043afa58c49285bd4c16311da86d06d9ad1cd
5a934b2a7cc2f536b6c26c90447a6064a384bdcd
refs/heads/master
2022-11-13T02:42:33.089000
2020-07-03T09:41:28
2020-07-03T09:41:28
245,208,623
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.polimi.ingsw.model.gods; import it.polimi.ingsw.actions.FirstBuild; import it.polimi.ingsw.model.*; import it.polimi.ingsw.utils.Color; import it.polimi.ingsw.utils.Coordinate; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class PrometheusTest { BasicGodCard card = new Prometheus(); IslandBoard board = new IslandBoard(); @Before public void init() { board.infoSlot(new Coordinate(0, 1)).occupy(new Worker(new Coordinate(0, 1), Color.WHITE)); board.infoSlot(new Coordinate(0, 0)).construct(Construction.DOME); board.infoSlot(new Coordinate(2, 0)).construct(Construction.DOME); board.infoSlot(new Coordinate(4, 4)).construct(Construction.FLOOR); board.infoSlot(new Coordinate(4, 3)).construct(Construction.DOME); board.infoSlot(new Coordinate(3, 4)).construct(Construction.DOME); board.infoSlot(new Coordinate(1, 0)).occupy(new Worker(new Coordinate(1, 0), Color.RED)); board.infoSlot(new Coordinate(4, 4)).occupy(new Worker(new Coordinate(4, 4), Color.RED)); } @Test public void cardTreeSetupTest() { TreeActionNode root = card.cardTreeSetup(board.infoSlot(new Coordinate(1, 0)).getWorker(), board); assertEquals(2, root.getChildrenActions().size()); assertTrue(root.getChildren().get(0).getChildren().get(0).isLeaf()); assertTrue(root.getChildren().get(2).getChildren().get(0).getChildren().get(0).isLeaf()); TreeActionNode root2 = card.cardTreeSetup(board.infoSlot(new Coordinate(4, 4)).getWorker(), board); assertEquals(2, root2.getChildren().size()); } @Test public void modMoveTest() { Player player = new Player("pippo", "red"); player.setCard("PROMETHEUS"); board.infoSlot(new Coordinate(1, 0)).occupy(player.getWorker(0)); board.infoSlot(new Coordinate(4, 4)).occupy(player.getWorker(1)); player.getWorker(0).setPosition(new Coordinate(1, 0)); player.getWorker(1).setPosition(new Coordinate(4, 4)); player.selectWorker(new Coordinate(1, 0)); assertTrue(card.turnHandler(player, board, new FirstBuild(new Coordinate(1,0), new Coordinate(1,1)))); player.selectWorker(new Coordinate(4, 4)); assertTrue(card.turnHandler(player, board, new FirstBuild(new Coordinate(4,4), new Coordinate(3,3)))); } }
UTF-8
Java
2,402
java
PrometheusTest.java
Java
[ { "context": "dMoveTest() {\n Player player = new Player(\"pippo\", \"red\");\n player.setCard(\"PROMETHEUS\");\n ", "end": 1747, "score": 0.865300178527832, "start": 1742, "tag": "USERNAME", "value": "pippo" } ]
null
[]
package it.polimi.ingsw.model.gods; import it.polimi.ingsw.actions.FirstBuild; import it.polimi.ingsw.model.*; import it.polimi.ingsw.utils.Color; import it.polimi.ingsw.utils.Coordinate; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class PrometheusTest { BasicGodCard card = new Prometheus(); IslandBoard board = new IslandBoard(); @Before public void init() { board.infoSlot(new Coordinate(0, 1)).occupy(new Worker(new Coordinate(0, 1), Color.WHITE)); board.infoSlot(new Coordinate(0, 0)).construct(Construction.DOME); board.infoSlot(new Coordinate(2, 0)).construct(Construction.DOME); board.infoSlot(new Coordinate(4, 4)).construct(Construction.FLOOR); board.infoSlot(new Coordinate(4, 3)).construct(Construction.DOME); board.infoSlot(new Coordinate(3, 4)).construct(Construction.DOME); board.infoSlot(new Coordinate(1, 0)).occupy(new Worker(new Coordinate(1, 0), Color.RED)); board.infoSlot(new Coordinate(4, 4)).occupy(new Worker(new Coordinate(4, 4), Color.RED)); } @Test public void cardTreeSetupTest() { TreeActionNode root = card.cardTreeSetup(board.infoSlot(new Coordinate(1, 0)).getWorker(), board); assertEquals(2, root.getChildrenActions().size()); assertTrue(root.getChildren().get(0).getChildren().get(0).isLeaf()); assertTrue(root.getChildren().get(2).getChildren().get(0).getChildren().get(0).isLeaf()); TreeActionNode root2 = card.cardTreeSetup(board.infoSlot(new Coordinate(4, 4)).getWorker(), board); assertEquals(2, root2.getChildren().size()); } @Test public void modMoveTest() { Player player = new Player("pippo", "red"); player.setCard("PROMETHEUS"); board.infoSlot(new Coordinate(1, 0)).occupy(player.getWorker(0)); board.infoSlot(new Coordinate(4, 4)).occupy(player.getWorker(1)); player.getWorker(0).setPosition(new Coordinate(1, 0)); player.getWorker(1).setPosition(new Coordinate(4, 4)); player.selectWorker(new Coordinate(1, 0)); assertTrue(card.turnHandler(player, board, new FirstBuild(new Coordinate(1,0), new Coordinate(1,1)))); player.selectWorker(new Coordinate(4, 4)); assertTrue(card.turnHandler(player, board, new FirstBuild(new Coordinate(4,4), new Coordinate(3,3)))); } }
2,402
0.68443
0.659867
53
44.320755
34.740967
110
false
false
0
0
0
0
0
0
1.339623
false
false
6
d9ad22fbe17ee5228f9912d45a2ced6f5d966dd8
1,700,807,067,211
946eae5271e78d23a5d073d4cf7fc53f756e079c
/src/main/java/music/service/mvc/controllers/actions/SearchAction.java
d355b1232f63b581c870b7788aea2853a1cad5b2
[]
no_license
AlikJoke/MusicService
https://github.com/AlikJoke/MusicService
e5e00eef7af48babeeab8c1e6bbbe8e67929cf6d
2ae62a0d458d8cfa87e17c61700ff5b976121a6b
refs/heads/master
2023-08-31T23:42:02.898000
2023-08-20T11:57:27
2023-08-20T11:57:27
77,753,947
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package music.service.mvc.controllers.actions; import org.springframework.security.core.userdetails.User; import org.springframework.web.servlet.ModelAndView; public interface SearchAction { public ModelAndView get(String query, User authUser); public void add(String recordId, User authUser); }
UTF-8
Java
303
java
SearchAction.java
Java
[]
null
[]
package music.service.mvc.controllers.actions; import org.springframework.security.core.userdetails.User; import org.springframework.web.servlet.ModelAndView; public interface SearchAction { public ModelAndView get(String query, User authUser); public void add(String recordId, User authUser); }
303
0.815181
0.815181
11
26.545454
24.703197
58
false
false
0
0
0
0
0
0
0.909091
false
false
6
ee6de07024b91fefc2118ded75a3458f733379a6
1,451,698,981,321
a04db95539b22e6d6ff2aef88d4439978b1463d4
/ams/src/main/java/com/sample/ams/repository/AreaRepository.java
6aa1d740e1721f9b7f32972ac7cf905dc7a07d18
[]
no_license
MortezaEslami/ams-cloud
https://github.com/MortezaEslami/ams-cloud
ede5db336df0a7c20b3c04a02f8daa3214f99b90
cf9e9ab378729fee8883bdfb97e47b4dfe91aec3
refs/heads/main
2023-07-13T16:10:46.171000
2021-09-04T12:37:24
2021-09-04T12:37:24
403,048,477
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sample.ams.repository; import com.sample.ams.model.Area; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface AreaRepository extends JpaRepository<Area, Long>, JpaSpecificationExecutor<Area> { List<Area> findByParentId(Long id); Area findByCode(String code); }
UTF-8
Java
469
java
AreaRepository.java
Java
[]
null
[]
package com.sample.ams.repository; import com.sample.ams.model.Area; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface AreaRepository extends JpaRepository<Area, Long>, JpaSpecificationExecutor<Area> { List<Area> findByParentId(Long id); Area findByCode(String code); }
469
0.818763
0.818763
15
30.266666
29.242586
99
false
false
0
0
0
0
0
0
0.666667
false
false
6
ff6976d4fee5c0ab5b2ffc188a892cc6e91ef35b
25,314,537,247,348
67ebf4b0343b9ce10361a2e71fffa2a48ebd3e1c
/proj3testlocal/src/HelperClasses/cartSession.java
fa78e60cc19e73d1723ef513d50bedac062dff14
[]
no_license
isinger976/122B_Projects
https://github.com/isinger976/122B_Projects
221d6ae0775950e4f37d796fb826d93438bd547b
6584cd17730a711f9fcceba1579621e214843ddd
refs/heads/master
2021-06-18T01:58:48.149000
2017-06-15T19:45:50
2017-06-15T19:45:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package HelperClasses; import java.util.HashMap; import java.util.ArrayList; public class cartSession { private HashMap<Integer,Cart> cartItem; public cartSession(){ cartItem= new HashMap<Integer, Cart>(); } public Cart addtoCart(Movie movie, int quantity){ if (cartItem.containsKey(movie.id)){ Cart exists = cartItem.get(movie.id); exists.addQuantity(quantity); return exists; } else{ Cart newItem = new Cart(movie, quantity); cartItem.put(movie.id, newItem); return newItem; } } public void updateCartquantity(Movie movie, int quantity){ if(cartItem.containsKey(movie.id)){ Cart exists = cartItem.get(movie.id); if(quantity==0){ removeItem(movie); } if (quantity>=0){ exists.setQuantity(quantity); } } } public void removeItem(Movie movie){ if(cartItem.containsKey(movie.id)){ cartItem.remove(movie.id); } } public void clearall(){ cartItem.clear(); cartItem =new HashMap<Integer, Cart>(); } public ArrayList<Cart> returnitems(){ return new ArrayList<Cart>(cartItem.values()); } }
UTF-8
Java
1,066
java
cartSession.java
Java
[]
null
[]
package HelperClasses; import java.util.HashMap; import java.util.ArrayList; public class cartSession { private HashMap<Integer,Cart> cartItem; public cartSession(){ cartItem= new HashMap<Integer, Cart>(); } public Cart addtoCart(Movie movie, int quantity){ if (cartItem.containsKey(movie.id)){ Cart exists = cartItem.get(movie.id); exists.addQuantity(quantity); return exists; } else{ Cart newItem = new Cart(movie, quantity); cartItem.put(movie.id, newItem); return newItem; } } public void updateCartquantity(Movie movie, int quantity){ if(cartItem.containsKey(movie.id)){ Cart exists = cartItem.get(movie.id); if(quantity==0){ removeItem(movie); } if (quantity>=0){ exists.setQuantity(quantity); } } } public void removeItem(Movie movie){ if(cartItem.containsKey(movie.id)){ cartItem.remove(movie.id); } } public void clearall(){ cartItem.clear(); cartItem =new HashMap<Integer, Cart>(); } public ArrayList<Cart> returnitems(){ return new ArrayList<Cart>(cartItem.values()); } }
1,066
0.696998
0.695122
45
22.688889
16.508345
59
false
false
0
0
0
0
0
0
2.377778
false
false
6
895fd16ca8369fb2fc82e728aa969e7cbf8b0864
1,743,756,763,285
130cfbbf5b21b6323b46aff0f43cb67fdfbcef76
/src/main/java/br/com/temaproject/repository/CardRepository.java
e8c63186aa1fa1f831db593ace8c9b05e4a9518d
[]
no_license
gabrielqap/temaproject
https://github.com/gabrielqap/temaproject
e06be44899e156ebf468b8cf661cd4b8cb6f3ab4
0f950a1e07f99491a0e4df8cdd620dce1d0905bf
refs/heads/master
2023-03-03T05:01:21.107000
2021-02-12T18:30:32
2021-02-12T18:30:32
338,398,871
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.temaproject.repository; import java.util.Collection; import br.com.temaproject.model.Card; import br.com.temaproject.model.Class; import br.com.temaproject.model.Type; public interface CardRepository extends GameRepository<Card>{ Collection<Card> readByName(String name); Collection<Card> readByClass(Class className); Collection<Card> readByType(Type type); }
UTF-8
Java
382
java
CardRepository.java
Java
[]
null
[]
package br.com.temaproject.repository; import java.util.Collection; import br.com.temaproject.model.Card; import br.com.temaproject.model.Class; import br.com.temaproject.model.Type; public interface CardRepository extends GameRepository<Card>{ Collection<Card> readByName(String name); Collection<Card> readByClass(Class className); Collection<Card> readByType(Type type); }
382
0.811518
0.811518
13
28.384615
20.059675
61
false
false
0
0
0
0
0
0
0.846154
false
false
6
504effc92decf9d7c3c46b5401a05a6483cbc8c5
31,679,678,786,604
344936802b37e334a1948eb88ea7f67203dd2f39
/src/rs/etf/analyzer/parser/tokens/AbstractTokenizer.java
db3f5fc6596082b9b24f98d3c916f9cc54313fec
[]
no_license
AmirQadir/forum_analyzer
https://github.com/AmirQadir/forum_analyzer
54ca85def057b60ea7145795c942964e04c0c951
aab54de4a993ca751bac6a199ac7d6edad67cbed
refs/heads/master
2020-04-02T02:53:20.483000
2011-05-31T21:17:40
2011-05-31T21:17:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rs.etf.analyzer.parser.tokens; import java.text.ParseException; import java.util.HashSet; import java.util.Hashtable; public class AbstractTokenizer { // IMPORTANT - All keyword matches should be between START and END public static final int START = 2048; public static final int END = START + 2048; // IMPORTANT -- This should be < END public static final int ID = END - 1; public static final int SAFE = END - 2; // Individial token classes. public static final int WHITESPACE = END + 1; public static final int DIGIT = END + 2; public static final int ALPHA = END + 3; public static final int BACKSLASH = (int) '\\'; public static final int QUOTE = (int) '\''; public static final int AT = (int) '@'; public static final int SP = (int) ' '; public static final int HT = (int) '\t'; public static final int COLON = (int) ':'; public static final int STAR = (int) '*'; public static final int DOLLAR = (int) '$'; public static final int PLUS = (int) '+'; public static final int POUND = (int) '#'; public static final int MINUS = (int) '-'; public static final int DOUBLEQUOTE = (int) '\"'; public static final int TILDE = (int) '~'; public static final int BACK_QUOTE = (int) '`'; public static final int NULL = (int) '\0'; public static final int EQUALS = (int) '='; public static final int SEMICOLON = (int) ';'; public static final int SLASH = (int) '/'; public static final int L_SQUARE_BRACKET = (int) '['; public static final int R_SQUARE_BRACKET = (int) ']'; public static final int R_CURLY = (int) '}'; public static final int L_CURLY = (int) '{'; public static final int HAT = (int) '^'; public static final int BAR = (int) '|'; public static final int DOT = (int) '.'; public static final int EXCLAMATION = (int) '!'; public static final int LPAREN = (int) '('; public static final int RPAREN = (int) ')'; public static final int GREATER_THAN = (int) '>'; public static final int LESS_THAN = (int) '<'; public static final int PERCENT = (int) '%'; public static final int QUESTION = (int) '?'; public static final int AND = (int) '&'; public static final int UNDERSCORE = (int) '_'; public static final char ALPHA_VALID_CHARS = Character.MAX_VALUE; public static final char DIGIT_VALID_CHARS = Character.MAX_VALUE - 1; public static final char ALPHADIGIT_VALID_CHARS = Character.MAX_VALUE - 2; protected String isBuffer; protected int iiCurrentIndex; protected int iiBufferLength; protected int iiSavedIndex; private HashSet<Character> ioDelimiterSet = new HashSet<Character> (); private HashSet<Character> ioTokenSet = new HashSet<Character> (); private Hashtable<String, Integer> ioTypesTable = new Hashtable<String, Integer>(); private char[] delimiters = {' ', ',', '.', '!', '?', ':', '+', '-', '*', '/', '\'', '(', ')', '[', ']', '{', '}', '\n', '\r', '\t'}; private char[] token = {'-', '.', '!', '%', '*', '_', '+', '`', '\'', '~'}; public AbstractTokenizer() { isBuffer = ""; iiBufferLength = isBuffer.length(); iiCurrentIndex = 0; for (int i = 0; i < delimiters.length; i++) addDelimiter( (Character) delimiters[i]); for (int i = 0; i < token.length; i++) addTokenChar( (Character) token[i]); } public AbstractTokenizer(final String asBuffer) { isBuffer = asBuffer; iiBufferLength = isBuffer.length(); iiCurrentIndex = 0; for (int i = 0; i < delimiters.length; i++) addDelimiter((Character)delimiters[i]); } /** * Scan until you see a slash or an EOL. * * @return substring containing no slash. */ public String byteStringNoSlash() { StringBuffer retval = new StringBuffer(); try { while (true) { char next = getOffsetChar(0); // bug fix from Ben Evans. if (next == '\0' || next == '\n' || next == '/') { break; } else { move(1); retval.append(next); } } } catch (ParseException ex) { return retval.toString(); } return retval.toString(); } /** Return a substring containing no commas *@return a substring containing no commas. */ public String byteStringNoComma() { StringBuffer retval = new StringBuffer(); try { while (true) { char next = getOffsetChar(0); if (next == '\n' || next == ',') { break; } else { move(1); retval.append(next); } } } catch (ParseException ex) { } return retval.toString(); } /** Return a substring containing no semicolons. *@return a substring containing no semicolons. */ public String byteStringNoSemicolon() { StringBuffer retval = new StringBuffer(); try { while (true) { char next = getOffsetChar(0); // bug fix from Ben Evans. if (next == '\0' || next == '\n' || next == ';' || next == ',') { break; } else { move(1); retval.append(next); } } } catch (ParseException ex) { return retval.toString(); } return retval.toString(); } public void consumeValidChars(char[] validChars) { int validCharsLength = validChars.length; try { while (hasMoreChars()) { char nextChar = getOffsetChar(0); boolean isValid = false; for (int i = 0; i < validCharsLength; i++) { char validChar = validChars[i]; switch (validChar) { case ALPHA_VALID_CHARS: isValid = Character.isLetter(nextChar); break; case DIGIT_VALID_CHARS: isValid = Character.isDigit(nextChar); break; case ALPHADIGIT_VALID_CHARS: isValid = isAlphaDigit(nextChar); break; default: isValid = nextChar == validChar; } if (isValid) { break; } } if (isValid) { move(1); } else { break; } } } catch (ParseException ex) { } } public static boolean isHexDigit(char ch) { return (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f') || Character.isDigit(ch); } private void addDelimiter(Character aoDelimiter) { if (ioDelimiterSet.contains(aoDelimiter) == false) ioDelimiterSet.add(aoDelimiter); } private void addTokenChar(Character aoDelimiter) { if (ioTokenSet.contains(aoDelimiter) == false) ioTokenSet.add(aoDelimiter); } private void addKeyword(final String asName, int aiValue) { ioTypesTable.put(asName, aiValue); } public void setBuffer(final String asBuffer) { isBuffer = asBuffer; iiBufferLength = isBuffer.length(); iiCurrentIndex = 0; } public void setCurrentIndex(final int aiCurrentIndex) { iiCurrentIndex = aiCurrentIndex; } public String getBuffer() { return isBuffer; } public int getCurrentIndex() { return iiCurrentIndex; } public String nextToken(final char asDelimiter) throws ParseException { int liStartIndex = iiCurrentIndex; char c; while (iiCurrentIndex < iiBufferLength) { c = isBuffer.charAt(iiCurrentIndex); if (c == asDelimiter) break; else iiCurrentIndex++; } return isBuffer.substring(liStartIndex, iiCurrentIndex); } public String nextToken(final char acFirstDelimiter, final char acSecondDelimiter) throws ParseException { int liStartIndex = iiCurrentIndex; char c; while (iiCurrentIndex < iiBufferLength) { c = isBuffer.charAt(iiCurrentIndex); iiCurrentIndex++; if (c == acFirstDelimiter) { liStartIndex = iiCurrentIndex; c = isBuffer.charAt(iiCurrentIndex); iiCurrentIndex++; } if (c == acSecondDelimiter) break; } return isBuffer.substring(liStartIndex, iiCurrentIndex); } public String nextToken(final int aiOffset, final int aiLength) { if ((iiCurrentIndex + aiOffset + aiLength) > iiBufferLength) { return ""; } else return isBuffer.substring(iiCurrentIndex + aiOffset, iiCurrentIndex + aiOffset + aiLength); } public String nextToken() throws ParseException { int liStartIndex = iiCurrentIndex; boolean lbFirst = false; char c; while (iiCurrentIndex < iiBufferLength) { c = isBuffer.charAt(iiCurrentIndex); iiCurrentIndex++; if (ioDelimiterSet.contains(Character.valueOf(c))) { if (lbFirst == false) { liStartIndex = iiCurrentIndex; lbFirst = true; } else break; } } return isBuffer.substring(liStartIndex, iiCurrentIndex); } public String getField() throws ParseException { return nextToken(':'); } public String getField(final char asDelimiter) throws ParseException { return nextToken(asDelimiter); } public long nextLong() throws ParseException { try { String lsTemp = nextToken().trim(); return Long.parseLong(lsTemp); } catch (NumberFormatException e) { throw new ParseException("", 1); } } public int nextInt() throws ParseException { try { String lsTemp = nextToken(); return Integer.parseInt(lsTemp); } catch (NumberFormatException e) { throw new ParseException("", 1); } } public void move(final int aiPos) { iiCurrentIndex += aiPos; } public void moveTo(final char acToChar) { try { while (iiCurrentIndex <= iiBufferLength) { if (isBuffer.charAt(iiCurrentIndex++) == acToChar) break; } } catch (Exception e) { } } public int find(final String asFindStr) { return isBuffer.indexOf(asFindStr, iiCurrentIndex); } public void move(final char acChar) { char c; while (iiCurrentIndex < iiBufferLength) if (isBuffer.charAt(iiCurrentIndex++) == acChar) break; } public char getOffsetChar(final int aiOffset) throws ParseException { try { return isBuffer.charAt(iiCurrentIndex + aiOffset); } catch (Exception e) { throw new ParseException("getOffsetChar: ", iiCurrentIndex + aiOffset); } } public char getNextChar() { return isBuffer.charAt(iiCurrentIndex++); } public char nextChar(final int charpos) { iiCurrentIndex += charpos; return isBuffer.charAt(iiCurrentIndex); } public char getChar() throws ParseException { try { return isBuffer.charAt(iiCurrentIndex); } catch (IndexOutOfBoundsException e) { return '\0'; } } public String getRest() { if (iiCurrentIndex >= iiBufferLength) return null; else return isBuffer.substring(iiCurrentIndex); } public String subString(final int aiStartIndex, final int aiLength) { if (aiStartIndex + aiLength <= iiBufferLength) return isBuffer.substring(aiStartIndex, aiStartIndex + aiLength); else return ""; } public String getLine() { // trim(); char c; while (true) { c = isBuffer.charAt(iiCurrentIndex);; if (c < 0x20) iiCurrentIndex++; else break; } int startIdx = iiCurrentIndex; while (true) { c = isBuffer.charAt(iiCurrentIndex); if (c != '\r' && c!= '\n') iiCurrentIndex++; else break; } return isBuffer.substring(startIdx, iiCurrentIndex); } public void trim() { char c = isBuffer.charAt(iiCurrentIndex); while (c == ' ' || c == '\t') { // move(1); iiCurrentIndex++; c = isBuffer.charAt(iiCurrentIndex); } } public boolean isTokenChar(final char acTestChar) { if (Character.isLetterOrDigit(acTestChar)) return true; else switch (acTestChar) { case '-': case '.': case '!': case '%': case '*': case '_': case '+': case '`': case '\'': case '~': return true; default: return false; } } public boolean hasMoreChars() { return (iiCurrentIndex <= iiBufferLength); } public boolean isAlphaDigit(final char acTestChar) { return Character.isLetterOrDigit(acTestChar); } /** Parse a comment string cursor is at a ". Leave cursor at closing " *@return the substring containing the quoted string excluding the * closing quote. */ public String quotedString() throws ParseException { int startIdx = iiCurrentIndex + 1; if (getOffsetChar(0) != '\"') return null; move(1); while (true) { char next = getNextChar(); if (next == '\"') { // Got to the terminating quote. break; } else if (next == '\0') { throw new ParseException( isBuffer + " :unexpected EOL", iiCurrentIndex); } else if (next == '\\') { move(1); } } return isBuffer.substring(startIdx, iiCurrentIndex - 1); } public String ttoken() { int startIdx = iiCurrentIndex; try { while (hasMoreChars()) { char nextChar = getOffsetChar(0); if (isTokenChar(nextChar)) { move(1); } else { break; } } return isBuffer.substring(startIdx, iiCurrentIndex); } catch (ParseException ex) { return null; } } public boolean startsId() { try { char nextChar = getChar(); return isTokenChar(nextChar); } catch (ParseException ex) { return false; } } public String number() throws ParseException { int startIdx = iiCurrentIndex; try { if (!Character.isDigit(getOffsetChar(0))) { throw new ParseException( isBuffer + ": Unexpected token at " + getOffsetChar(0), iiCurrentIndex); } //move(1); while (true) { char next = getOffsetChar(0); if (Character.isDigit(next)) { move(1); } else break; } return isBuffer.substring(startIdx, iiCurrentIndex); } catch (ParseException ex) { return isBuffer.substring(startIdx, iiCurrentIndex); } catch (Exception e) { return isBuffer.substring(startIdx, iiCurrentIndex); } } }
UTF-8
Java
15,076
java
AbstractTokenizer.java
Java
[ { "context": "r next = getOffsetChar(0);\n // bug fix from Ben Evans.\n if (next == '\\0' || next == '\\n' |", "end": 4140, "score": 0.8207019567489624, "start": 4137, "tag": "NAME", "value": "Ben" }, { "context": "r next = getOffsetChar(0);\n // bug fix from Ben Evans.\n if (next == '\\0' || next == '\\n' || n", "end": 5272, "score": 0.6759675741195679, "start": 5266, "tag": "NAME", "value": "Ben Ev" } ]
null
[]
package rs.etf.analyzer.parser.tokens; import java.text.ParseException; import java.util.HashSet; import java.util.Hashtable; public class AbstractTokenizer { // IMPORTANT - All keyword matches should be between START and END public static final int START = 2048; public static final int END = START + 2048; // IMPORTANT -- This should be < END public static final int ID = END - 1; public static final int SAFE = END - 2; // Individial token classes. public static final int WHITESPACE = END + 1; public static final int DIGIT = END + 2; public static final int ALPHA = END + 3; public static final int BACKSLASH = (int) '\\'; public static final int QUOTE = (int) '\''; public static final int AT = (int) '@'; public static final int SP = (int) ' '; public static final int HT = (int) '\t'; public static final int COLON = (int) ':'; public static final int STAR = (int) '*'; public static final int DOLLAR = (int) '$'; public static final int PLUS = (int) '+'; public static final int POUND = (int) '#'; public static final int MINUS = (int) '-'; public static final int DOUBLEQUOTE = (int) '\"'; public static final int TILDE = (int) '~'; public static final int BACK_QUOTE = (int) '`'; public static final int NULL = (int) '\0'; public static final int EQUALS = (int) '='; public static final int SEMICOLON = (int) ';'; public static final int SLASH = (int) '/'; public static final int L_SQUARE_BRACKET = (int) '['; public static final int R_SQUARE_BRACKET = (int) ']'; public static final int R_CURLY = (int) '}'; public static final int L_CURLY = (int) '{'; public static final int HAT = (int) '^'; public static final int BAR = (int) '|'; public static final int DOT = (int) '.'; public static final int EXCLAMATION = (int) '!'; public static final int LPAREN = (int) '('; public static final int RPAREN = (int) ')'; public static final int GREATER_THAN = (int) '>'; public static final int LESS_THAN = (int) '<'; public static final int PERCENT = (int) '%'; public static final int QUESTION = (int) '?'; public static final int AND = (int) '&'; public static final int UNDERSCORE = (int) '_'; public static final char ALPHA_VALID_CHARS = Character.MAX_VALUE; public static final char DIGIT_VALID_CHARS = Character.MAX_VALUE - 1; public static final char ALPHADIGIT_VALID_CHARS = Character.MAX_VALUE - 2; protected String isBuffer; protected int iiCurrentIndex; protected int iiBufferLength; protected int iiSavedIndex; private HashSet<Character> ioDelimiterSet = new HashSet<Character> (); private HashSet<Character> ioTokenSet = new HashSet<Character> (); private Hashtable<String, Integer> ioTypesTable = new Hashtable<String, Integer>(); private char[] delimiters = {' ', ',', '.', '!', '?', ':', '+', '-', '*', '/', '\'', '(', ')', '[', ']', '{', '}', '\n', '\r', '\t'}; private char[] token = {'-', '.', '!', '%', '*', '_', '+', '`', '\'', '~'}; public AbstractTokenizer() { isBuffer = ""; iiBufferLength = isBuffer.length(); iiCurrentIndex = 0; for (int i = 0; i < delimiters.length; i++) addDelimiter( (Character) delimiters[i]); for (int i = 0; i < token.length; i++) addTokenChar( (Character) token[i]); } public AbstractTokenizer(final String asBuffer) { isBuffer = asBuffer; iiBufferLength = isBuffer.length(); iiCurrentIndex = 0; for (int i = 0; i < delimiters.length; i++) addDelimiter((Character)delimiters[i]); } /** * Scan until you see a slash or an EOL. * * @return substring containing no slash. */ public String byteStringNoSlash() { StringBuffer retval = new StringBuffer(); try { while (true) { char next = getOffsetChar(0); // bug fix from Ben Evans. if (next == '\0' || next == '\n' || next == '/') { break; } else { move(1); retval.append(next); } } } catch (ParseException ex) { return retval.toString(); } return retval.toString(); } /** Return a substring containing no commas *@return a substring containing no commas. */ public String byteStringNoComma() { StringBuffer retval = new StringBuffer(); try { while (true) { char next = getOffsetChar(0); if (next == '\n' || next == ',') { break; } else { move(1); retval.append(next); } } } catch (ParseException ex) { } return retval.toString(); } /** Return a substring containing no semicolons. *@return a substring containing no semicolons. */ public String byteStringNoSemicolon() { StringBuffer retval = new StringBuffer(); try { while (true) { char next = getOffsetChar(0); // bug fix from <NAME>ans. if (next == '\0' || next == '\n' || next == ';' || next == ',') { break; } else { move(1); retval.append(next); } } } catch (ParseException ex) { return retval.toString(); } return retval.toString(); } public void consumeValidChars(char[] validChars) { int validCharsLength = validChars.length; try { while (hasMoreChars()) { char nextChar = getOffsetChar(0); boolean isValid = false; for (int i = 0; i < validCharsLength; i++) { char validChar = validChars[i]; switch (validChar) { case ALPHA_VALID_CHARS: isValid = Character.isLetter(nextChar); break; case DIGIT_VALID_CHARS: isValid = Character.isDigit(nextChar); break; case ALPHADIGIT_VALID_CHARS: isValid = isAlphaDigit(nextChar); break; default: isValid = nextChar == validChar; } if (isValid) { break; } } if (isValid) { move(1); } else { break; } } } catch (ParseException ex) { } } public static boolean isHexDigit(char ch) { return (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f') || Character.isDigit(ch); } private void addDelimiter(Character aoDelimiter) { if (ioDelimiterSet.contains(aoDelimiter) == false) ioDelimiterSet.add(aoDelimiter); } private void addTokenChar(Character aoDelimiter) { if (ioTokenSet.contains(aoDelimiter) == false) ioTokenSet.add(aoDelimiter); } private void addKeyword(final String asName, int aiValue) { ioTypesTable.put(asName, aiValue); } public void setBuffer(final String asBuffer) { isBuffer = asBuffer; iiBufferLength = isBuffer.length(); iiCurrentIndex = 0; } public void setCurrentIndex(final int aiCurrentIndex) { iiCurrentIndex = aiCurrentIndex; } public String getBuffer() { return isBuffer; } public int getCurrentIndex() { return iiCurrentIndex; } public String nextToken(final char asDelimiter) throws ParseException { int liStartIndex = iiCurrentIndex; char c; while (iiCurrentIndex < iiBufferLength) { c = isBuffer.charAt(iiCurrentIndex); if (c == asDelimiter) break; else iiCurrentIndex++; } return isBuffer.substring(liStartIndex, iiCurrentIndex); } public String nextToken(final char acFirstDelimiter, final char acSecondDelimiter) throws ParseException { int liStartIndex = iiCurrentIndex; char c; while (iiCurrentIndex < iiBufferLength) { c = isBuffer.charAt(iiCurrentIndex); iiCurrentIndex++; if (c == acFirstDelimiter) { liStartIndex = iiCurrentIndex; c = isBuffer.charAt(iiCurrentIndex); iiCurrentIndex++; } if (c == acSecondDelimiter) break; } return isBuffer.substring(liStartIndex, iiCurrentIndex); } public String nextToken(final int aiOffset, final int aiLength) { if ((iiCurrentIndex + aiOffset + aiLength) > iiBufferLength) { return ""; } else return isBuffer.substring(iiCurrentIndex + aiOffset, iiCurrentIndex + aiOffset + aiLength); } public String nextToken() throws ParseException { int liStartIndex = iiCurrentIndex; boolean lbFirst = false; char c; while (iiCurrentIndex < iiBufferLength) { c = isBuffer.charAt(iiCurrentIndex); iiCurrentIndex++; if (ioDelimiterSet.contains(Character.valueOf(c))) { if (lbFirst == false) { liStartIndex = iiCurrentIndex; lbFirst = true; } else break; } } return isBuffer.substring(liStartIndex, iiCurrentIndex); } public String getField() throws ParseException { return nextToken(':'); } public String getField(final char asDelimiter) throws ParseException { return nextToken(asDelimiter); } public long nextLong() throws ParseException { try { String lsTemp = nextToken().trim(); return Long.parseLong(lsTemp); } catch (NumberFormatException e) { throw new ParseException("", 1); } } public int nextInt() throws ParseException { try { String lsTemp = nextToken(); return Integer.parseInt(lsTemp); } catch (NumberFormatException e) { throw new ParseException("", 1); } } public void move(final int aiPos) { iiCurrentIndex += aiPos; } public void moveTo(final char acToChar) { try { while (iiCurrentIndex <= iiBufferLength) { if (isBuffer.charAt(iiCurrentIndex++) == acToChar) break; } } catch (Exception e) { } } public int find(final String asFindStr) { return isBuffer.indexOf(asFindStr, iiCurrentIndex); } public void move(final char acChar) { char c; while (iiCurrentIndex < iiBufferLength) if (isBuffer.charAt(iiCurrentIndex++) == acChar) break; } public char getOffsetChar(final int aiOffset) throws ParseException { try { return isBuffer.charAt(iiCurrentIndex + aiOffset); } catch (Exception e) { throw new ParseException("getOffsetChar: ", iiCurrentIndex + aiOffset); } } public char getNextChar() { return isBuffer.charAt(iiCurrentIndex++); } public char nextChar(final int charpos) { iiCurrentIndex += charpos; return isBuffer.charAt(iiCurrentIndex); } public char getChar() throws ParseException { try { return isBuffer.charAt(iiCurrentIndex); } catch (IndexOutOfBoundsException e) { return '\0'; } } public String getRest() { if (iiCurrentIndex >= iiBufferLength) return null; else return isBuffer.substring(iiCurrentIndex); } public String subString(final int aiStartIndex, final int aiLength) { if (aiStartIndex + aiLength <= iiBufferLength) return isBuffer.substring(aiStartIndex, aiStartIndex + aiLength); else return ""; } public String getLine() { // trim(); char c; while (true) { c = isBuffer.charAt(iiCurrentIndex);; if (c < 0x20) iiCurrentIndex++; else break; } int startIdx = iiCurrentIndex; while (true) { c = isBuffer.charAt(iiCurrentIndex); if (c != '\r' && c!= '\n') iiCurrentIndex++; else break; } return isBuffer.substring(startIdx, iiCurrentIndex); } public void trim() { char c = isBuffer.charAt(iiCurrentIndex); while (c == ' ' || c == '\t') { // move(1); iiCurrentIndex++; c = isBuffer.charAt(iiCurrentIndex); } } public boolean isTokenChar(final char acTestChar) { if (Character.isLetterOrDigit(acTestChar)) return true; else switch (acTestChar) { case '-': case '.': case '!': case '%': case '*': case '_': case '+': case '`': case '\'': case '~': return true; default: return false; } } public boolean hasMoreChars() { return (iiCurrentIndex <= iiBufferLength); } public boolean isAlphaDigit(final char acTestChar) { return Character.isLetterOrDigit(acTestChar); } /** Parse a comment string cursor is at a ". Leave cursor at closing " *@return the substring containing the quoted string excluding the * closing quote. */ public String quotedString() throws ParseException { int startIdx = iiCurrentIndex + 1; if (getOffsetChar(0) != '\"') return null; move(1); while (true) { char next = getNextChar(); if (next == '\"') { // Got to the terminating quote. break; } else if (next == '\0') { throw new ParseException( isBuffer + " :unexpected EOL", iiCurrentIndex); } else if (next == '\\') { move(1); } } return isBuffer.substring(startIdx, iiCurrentIndex - 1); } public String ttoken() { int startIdx = iiCurrentIndex; try { while (hasMoreChars()) { char nextChar = getOffsetChar(0); if (isTokenChar(nextChar)) { move(1); } else { break; } } return isBuffer.substring(startIdx, iiCurrentIndex); } catch (ParseException ex) { return null; } } public boolean startsId() { try { char nextChar = getChar(); return isTokenChar(nextChar); } catch (ParseException ex) { return false; } } public String number() throws ParseException { int startIdx = iiCurrentIndex; try { if (!Character.isDigit(getOffsetChar(0))) { throw new ParseException( isBuffer + ": Unexpected token at " + getOffsetChar(0), iiCurrentIndex); } //move(1); while (true) { char next = getOffsetChar(0); if (Character.isDigit(next)) { move(1); } else break; } return isBuffer.substring(startIdx, iiCurrentIndex); } catch (ParseException ex) { return isBuffer.substring(startIdx, iiCurrentIndex); } catch (Exception e) { return isBuffer.substring(startIdx, iiCurrentIndex); } } }
15,076
0.565203
0.561687
673
21.401188
20.901512
106
false
false
0
0
0
0
0
0
0.430906
false
false
6
b9caad46aa8b1ed1948a26e39fd248de46b81d1a
31,714,038,523,673
f37b485544cd337fe7fb7b28072dac4b9d1a1bd4
/HotelAkal/app/src/main/java/com/example/hotelakal/models/GuestListModel.java
e34d4a0c850967dc00c90647c0a02a3f624e9779
[]
no_license
gurpartap0306/HotelAkal
https://github.com/gurpartap0306/HotelAkal
723a153a44478799b284740cfc0a63d309afa953
757549e7e516002bfa9a92f807423a09618118f4
refs/heads/main
2023-07-25T13:04:17.947000
2021-09-07T17:45:55
2021-09-07T17:45:55
401,059,718
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.hotelakal.models; import java.util.List; public class GuestListModel { private List<GuestDetails> guestList; public List<GuestDetails> getGuestList() { return guestList; } public void setGuestList(List<GuestDetails> guestList) { this.guestList = guestList; } }
UTF-8
Java
321
java
GuestListModel.java
Java
[]
null
[]
package com.example.hotelakal.models; import java.util.List; public class GuestListModel { private List<GuestDetails> guestList; public List<GuestDetails> getGuestList() { return guestList; } public void setGuestList(List<GuestDetails> guestList) { this.guestList = guestList; } }
321
0.700935
0.700935
15
20.4
19.578218
60
false
false
0
0
0
0
0
0
0.333333
false
false
6
b3b002a19ff6af84c13c1a3c130bf8af10d6485c
6,322,191,862,578
ed0ea2ad785cd833423656ea4d108797fbdd4fed
/src/com/lxy/ideaEdit/IdeaEdit.java
8b7c57b95feded49f9e63b7962f3297855e949dd
[]
no_license
xiaoyangLee/ideaEdit
https://github.com/xiaoyangLee/ideaEdit
04fcbcd7b75989d428750ffbbf9d14e788484461
2d74aa435a3ab060ecc3851b256c9e51d41e4111
refs/heads/master
2021-01-19T19:06:39.157000
2017-04-16T08:32:42
2017-04-16T08:32:42
88,400,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lxy.ideaEdit; import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.filechooser.FileFilter; import javax.swing.JMenuBar; import javax.swing.JToolBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JPopupMenu; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.KeyStroke; import java.awt.event.KeyEvent; import java.awt.event.InputEvent; import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JFileChooser; import javax.swing.ImageIcon; import javax.swing.JLabel; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.awt.event.KeyAdapter; import javax.swing.JTextPane; import javax.swing.JTable; public class IdeaEdit extends JFrame { private JTextArea textEditArea; private JPanel contentPane; private boolean flag = false; private JLabel lblWordCountMsg = null; private JLabel lblRowMsg = null; private JLabel lblFileMsg = null; private String filename; private String filepath; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { IdeaEdit frame = new IdeaEdit(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public IdeaEdit() { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Quit(); } }); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 951, 576); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JLabel lblNewLabel_3 = new JLabel(" "); menuBar.add(lblNewLabel_3); JMenu menu = new JMenu("\u6587\u4EF6"); menuBar.add(menu); JMenuItem menuItem_3 = new JMenuItem("\u65B0\u5EFA\u6587\u4EF6"); menuItem_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //有些功能并没有做全。 Jpanel.showMessageDialog("this function didn't implement"); } }); menu.add(menuItem_3); JMenuItem menuItem = new JMenuItem("\u6253\u5F00\u6587\u4EF6"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openfile(); } }); menu.add(menuItem); JMenuItem menuItem_1 = new JMenuItem("\u4FDD\u5B58\u6587\u4EF6"); menuItem_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFile(); } }); menu.add(menuItem_1); JMenuItem menuItem_2 = new JMenuItem("\u53E6\u5B58\u4E3A"); menuItem_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFileAs(); } }); menu.add(menuItem_2); JMenuItem menuItem_4 = new JMenuItem("\u5173\u95ED"); menuItem_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFile(); dispose(); } }); menu.add(menuItem_4); JMenuItem menuItem_20 = new JMenuItem("\u9000\u51FA"); menuItem_20.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { QuitActionPerform(e); } }); menu.add(menuItem_20); JMenu menu_1 = new JMenu(" \u7F16\u8F91"); menuBar.add(menu_1); JMenuItem menuItem_5 = new JMenuItem("\u590D\u5236"); menu_1.add(menuItem_5); JMenuItem menuItem_6 = new JMenuItem("\u526A\u5207"); menu_1.add(menuItem_6); JMenuItem menuItem_7 = new JMenuItem("\u7C98\u8D34"); menu_1.add(menuItem_7); JMenuItem menuItem_8 = new JMenuItem("\u5220\u9664"); menu_1.add(menuItem_8); JMenuItem menuItem_9 = new JMenuItem("\u5168\u9009"); menu_1.add(menuItem_9); JMenu menu_3 = new JMenu(" \u683C\u5F0F"); menuBar.add(menu_3); JMenuItem menuItem_13 = new JMenuItem("\u989C\u8272"); menuItem_13.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setTextColor(); } }); JMenu menu_5 = new JMenu("\u5B57\u4F53"); menu_3.add(menu_5); JMenuItem mntmSourceCodePro = new JMenuItem("source code pro 16"); mntmSourceCodePro.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.setFont(new java.awt.Font("souce code pro", 1, 16)); } }); menu_5.add(mntmSourceCodePro); JMenuItem menuItem_12 = new JMenuItem("\u5B8B\u4F53 20"); menuItem_12.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.setFont(new java.awt.Font("宋体", 1, 20)); } }); menu_5.add(menuItem_12); menu_3.add(menuItem_13); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JToolBar toolBar = new JToolBar(); contentPane.add(toolBar, BorderLayout.NORTH); JButton btnNewButton = new JButton(""); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFile(); } }); btnNewButton.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/save.png"))); toolBar.add(btnNewButton); JButton btnNewButton_1 = new JButton(""); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.copy(); } }); btnNewButton_1.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/copy.png"))); toolBar.add(btnNewButton_1); JButton btnNewButton_2 = new JButton(""); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.cut(); } }); btnNewButton_2.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/cut.png"))); toolBar.add(btnNewButton_2); JButton btnNewButton_3 = new JButton(""); btnNewButton_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.paste(); } }); btnNewButton_3.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/paste.png"))); toolBar.add(btnNewButton_3); JToolBar status = new JToolBar(); status.setEnabled(false); contentPane.add(status, BorderLayout.SOUTH); lblFileMsg = new JLabel("Java Source File "); status.add(lblFileMsg); lblRowMsg = new JLabel("\u5F53\u524D\u884C\u6570\uFF1A0 "); status.add(lblRowMsg); lblWordCountMsg = new JLabel("\u5F53\u524D\u5B57\u6570\uFF1A0 "); status.add(lblWordCountMsg); JScrollPane scrollPane = new JScrollPane(); contentPane.add(scrollPane, BorderLayout.CENTER); textEditArea = new JTextArea(); textEditArea.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { editKeyPressPerform(arg0); } @Override public void keyPressed(KeyEvent e) { linecount(e); } }); textEditArea.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { // TODO Auto-generated method stub flag = true; } @Override public void insertUpdate(DocumentEvent e) { // TODO Auto-generated method stub flag = true; } @Override public void changedUpdate(DocumentEvent e) { // TODO Auto-generated method stub flag = true; } }); scrollPane.setViewportView(textEditArea); JPopupMenu popupMenu = new JPopupMenu(); addPopup(textEditArea, popupMenu); JMenuItem menuItem_16 = new JMenuItem("\u590D\u5236 "); menuItem_16.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.copy(); } }); menuItem_16.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_16); JMenuItem menuItem_17 = new JMenuItem("\u526A\u5207"); menuItem_17.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.cut(); } }); menuItem_17.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_17); JMenuItem menuItem_18 = new JMenuItem("\u7C98\u8D34"); menuItem_18.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.paste(); } }); menuItem_18.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_18); JMenuItem menuItem_19 = new JMenuItem("\u5168\u9009"); menuItem_19.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.selectAll(); } }); menuItem_19.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_19); // 设置JFrame居中显示 this.setLocationRelativeTo(null); } // 设置文本颜色 @SuppressWarnings("static-access") private void setTextColor() { // TODO Auto-generated method stub JColorChooser chooser = new JColorChooser(); Color color = textEditArea.getForeground(); textEditArea.setForeground(chooser.showDialog(textEditArea, "选择字体颜色", color)); } // 保存文件操作 private void saveFile() { // TODO Auto-generated method stub if (filepath == null || filename == "") { saveFileAs(); return; } else { FileWriter fileWriter; try { fileWriter = new FileWriter(filepath); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); // 把文本框的内容全部写到文件 fileWriter.write(textEditArea.getText()); fileWriter.close(); bufferedWriter.close(); flag = false; } catch (FileNotFoundException e) { // TODO: handle exception e.printStackTrace(); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } } } // 另存为操作 private void saveFileAs() { // TODO Auto-generated method stub JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new Textfilefilter(".txt", "文本文件(*.txt)")); chooser.setFileFilter(new Textfilefilter(".xml", "xml(*.xml)")); chooser.setFileFilter(new Textfilefilter(".c", "c(*.c)")); int result = chooser.showSaveDialog(this); // 打开“另存为文件”对话框 if (result == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); this.setTitle(file.getName()); this.filename = file.getName(); this.filepath = file.getPath(); // 把文本框的内容写入到文件中 FileWriter fileWriter; try { fileWriter = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); fileWriter.write(textEditArea.getText()); bufferedWriter.close(); fileWriter.close(); } catch (FileNotFoundException e) { // TODO: handle exception e.printStackTrace(); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } } } // 打开文件操作 private void openfile() { // TODO Auto-generated method stub JFileChooser fileChooser = new JFileChooser(); Textfilefilter txtfilefilter = new Textfilefilter(".txt", "文本文件(*.txt)"); Textfilefilter xmlfilefilter = new Textfilefilter(".xml", "xml(*.xml)"); Textfilefilter cfilefilter = new Textfilefilter(".c", "c(*.c)"); Textfilefilter cplusfilefilter = new Textfilefilter(".cpp", "cpp(*.cpp)"); fileChooser.addChoosableFileFilter(txtfilefilter); fileChooser.addChoosableFileFilter(xmlfilefilter); fileChooser.addChoosableFileFilter(cfilefilter); fileChooser.addChoosableFileFilter(cplusfilefilter); fileChooser.setFileFilter(txtfilefilter); int result = fileChooser.showOpenDialog(this);// 打开“打开文件”对话框 // 将选择的File对象赋值给result if (result == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); this.setTitle(file.getName()); this.filepath = file.getPath(); this.filename = file.getName(); this.lblFileMsg.setText(this.filename.substring(filename.lastIndexOf(".") + 1) + " Source File "); // 读入文件的内容到文本框 FileReader fileReader; try { fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); textEditArea.setText(""); String string = ""; while ((string = bufferedReader.readLine()) != null) { textEditArea.append(string + "\r\n"); } bufferedReader.close(); fileReader.close(); } catch (FileNotFoundException e) { // TODO: handle exception e.printStackTrace(); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } } } // 下方状态栏变化 private void editKeyPressPerform(KeyEvent e) { // TODO Auto-generated method stub this.lblRowMsg.setText("当前字数:" + String.valueOf(textEditArea.getText().trim().length())); this.lblWordCountMsg.setText("当前行数:" + String.valueOf(textEditArea.getLineCount())); } //显示行号 private void linecount(KeyEvent e) { // TODO Auto-generated method stub //this.textArea.setText((textEditArea.getLineCount()+"\r\n")); } private static void addPopup(Component component, final JPopupMenu popup) { component.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showMenu(e); } } public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { showMenu(e); } } private void showMenu(MouseEvent e) { popup.show(e.getComponent(), e.getX(), e.getY()); } }); } // 退出事件处理 private void QuitActionPerform(ActionEvent e) { // TODO Auto-generated method stub Quit(); } // 退出处理 private void Quit() { if (flag == true) { int resp = JOptionPane.showConfirmDialog(null, "是否要保存文件并退出?"); if (resp == JOptionPane.YES_OPTION) { saveFile(); dispose(); } else if (resp == JOptionPane.NO_OPTION) { dispose(); } else if (resp == 2) { setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); } } else { dispose(); } } } /** * 自定义文件过滤器 * * @author xiaoyang * */ final class Textfilefilter extends FileFilter { private String extension; private String description; public Textfilefilter(String extension, String description) { super(); this.extension = extension; this.description = description.toLowerCase(); } @Override public boolean accept(File file) { // TODO Auto-generated method stub return file.getName().toLowerCase().endsWith(this.extension); } @Override public String getDescription() { // TODO Auto-generated method stub return description; } }
UTF-8
Java
15,694
java
IdeaEdit.java
Java
[ { "context": ";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * 自定义文件过滤器\r\n * \r\n * @author xiaoyang\r\n *\r\n */\r\nfinal class Textfilefilter extends File", "end": 14789, "score": 0.9636370539665222, "start": 14781, "tag": "USERNAME", "value": "xiaoyang" } ]
null
[]
package com.lxy.ideaEdit; import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.filechooser.FileFilter; import javax.swing.JMenuBar; import javax.swing.JToolBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JPopupMenu; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.KeyStroke; import java.awt.event.KeyEvent; import java.awt.event.InputEvent; import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JFileChooser; import javax.swing.ImageIcon; import javax.swing.JLabel; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.awt.event.KeyAdapter; import javax.swing.JTextPane; import javax.swing.JTable; public class IdeaEdit extends JFrame { private JTextArea textEditArea; private JPanel contentPane; private boolean flag = false; private JLabel lblWordCountMsg = null; private JLabel lblRowMsg = null; private JLabel lblFileMsg = null; private String filename; private String filepath; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { IdeaEdit frame = new IdeaEdit(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public IdeaEdit() { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Quit(); } }); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 951, 576); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JLabel lblNewLabel_3 = new JLabel(" "); menuBar.add(lblNewLabel_3); JMenu menu = new JMenu("\u6587\u4EF6"); menuBar.add(menu); JMenuItem menuItem_3 = new JMenuItem("\u65B0\u5EFA\u6587\u4EF6"); menuItem_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //有些功能并没有做全。 Jpanel.showMessageDialog("this function didn't implement"); } }); menu.add(menuItem_3); JMenuItem menuItem = new JMenuItem("\u6253\u5F00\u6587\u4EF6"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openfile(); } }); menu.add(menuItem); JMenuItem menuItem_1 = new JMenuItem("\u4FDD\u5B58\u6587\u4EF6"); menuItem_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFile(); } }); menu.add(menuItem_1); JMenuItem menuItem_2 = new JMenuItem("\u53E6\u5B58\u4E3A"); menuItem_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFileAs(); } }); menu.add(menuItem_2); JMenuItem menuItem_4 = new JMenuItem("\u5173\u95ED"); menuItem_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFile(); dispose(); } }); menu.add(menuItem_4); JMenuItem menuItem_20 = new JMenuItem("\u9000\u51FA"); menuItem_20.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { QuitActionPerform(e); } }); menu.add(menuItem_20); JMenu menu_1 = new JMenu(" \u7F16\u8F91"); menuBar.add(menu_1); JMenuItem menuItem_5 = new JMenuItem("\u590D\u5236"); menu_1.add(menuItem_5); JMenuItem menuItem_6 = new JMenuItem("\u526A\u5207"); menu_1.add(menuItem_6); JMenuItem menuItem_7 = new JMenuItem("\u7C98\u8D34"); menu_1.add(menuItem_7); JMenuItem menuItem_8 = new JMenuItem("\u5220\u9664"); menu_1.add(menuItem_8); JMenuItem menuItem_9 = new JMenuItem("\u5168\u9009"); menu_1.add(menuItem_9); JMenu menu_3 = new JMenu(" \u683C\u5F0F"); menuBar.add(menu_3); JMenuItem menuItem_13 = new JMenuItem("\u989C\u8272"); menuItem_13.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setTextColor(); } }); JMenu menu_5 = new JMenu("\u5B57\u4F53"); menu_3.add(menu_5); JMenuItem mntmSourceCodePro = new JMenuItem("source code pro 16"); mntmSourceCodePro.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.setFont(new java.awt.Font("souce code pro", 1, 16)); } }); menu_5.add(mntmSourceCodePro); JMenuItem menuItem_12 = new JMenuItem("\u5B8B\u4F53 20"); menuItem_12.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.setFont(new java.awt.Font("宋体", 1, 20)); } }); menu_5.add(menuItem_12); menu_3.add(menuItem_13); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JToolBar toolBar = new JToolBar(); contentPane.add(toolBar, BorderLayout.NORTH); JButton btnNewButton = new JButton(""); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveFile(); } }); btnNewButton.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/save.png"))); toolBar.add(btnNewButton); JButton btnNewButton_1 = new JButton(""); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.copy(); } }); btnNewButton_1.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/copy.png"))); toolBar.add(btnNewButton_1); JButton btnNewButton_2 = new JButton(""); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.cut(); } }); btnNewButton_2.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/cut.png"))); toolBar.add(btnNewButton_2); JButton btnNewButton_3 = new JButton(""); btnNewButton_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.paste(); } }); btnNewButton_3.setIcon(new ImageIcon(IdeaEdit.class.getResource("/images/paste.png"))); toolBar.add(btnNewButton_3); JToolBar status = new JToolBar(); status.setEnabled(false); contentPane.add(status, BorderLayout.SOUTH); lblFileMsg = new JLabel("Java Source File "); status.add(lblFileMsg); lblRowMsg = new JLabel("\u5F53\u524D\u884C\u6570\uFF1A0 "); status.add(lblRowMsg); lblWordCountMsg = new JLabel("\u5F53\u524D\u5B57\u6570\uFF1A0 "); status.add(lblWordCountMsg); JScrollPane scrollPane = new JScrollPane(); contentPane.add(scrollPane, BorderLayout.CENTER); textEditArea = new JTextArea(); textEditArea.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { editKeyPressPerform(arg0); } @Override public void keyPressed(KeyEvent e) { linecount(e); } }); textEditArea.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { // TODO Auto-generated method stub flag = true; } @Override public void insertUpdate(DocumentEvent e) { // TODO Auto-generated method stub flag = true; } @Override public void changedUpdate(DocumentEvent e) { // TODO Auto-generated method stub flag = true; } }); scrollPane.setViewportView(textEditArea); JPopupMenu popupMenu = new JPopupMenu(); addPopup(textEditArea, popupMenu); JMenuItem menuItem_16 = new JMenuItem("\u590D\u5236 "); menuItem_16.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.copy(); } }); menuItem_16.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_16); JMenuItem menuItem_17 = new JMenuItem("\u526A\u5207"); menuItem_17.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.cut(); } }); menuItem_17.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_17); JMenuItem menuItem_18 = new JMenuItem("\u7C98\u8D34"); menuItem_18.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.paste(); } }); menuItem_18.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_18); JMenuItem menuItem_19 = new JMenuItem("\u5168\u9009"); menuItem_19.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textEditArea.selectAll(); } }); menuItem_19.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK)); popupMenu.add(menuItem_19); // 设置JFrame居中显示 this.setLocationRelativeTo(null); } // 设置文本颜色 @SuppressWarnings("static-access") private void setTextColor() { // TODO Auto-generated method stub JColorChooser chooser = new JColorChooser(); Color color = textEditArea.getForeground(); textEditArea.setForeground(chooser.showDialog(textEditArea, "选择字体颜色", color)); } // 保存文件操作 private void saveFile() { // TODO Auto-generated method stub if (filepath == null || filename == "") { saveFileAs(); return; } else { FileWriter fileWriter; try { fileWriter = new FileWriter(filepath); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); // 把文本框的内容全部写到文件 fileWriter.write(textEditArea.getText()); fileWriter.close(); bufferedWriter.close(); flag = false; } catch (FileNotFoundException e) { // TODO: handle exception e.printStackTrace(); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } } } // 另存为操作 private void saveFileAs() { // TODO Auto-generated method stub JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new Textfilefilter(".txt", "文本文件(*.txt)")); chooser.setFileFilter(new Textfilefilter(".xml", "xml(*.xml)")); chooser.setFileFilter(new Textfilefilter(".c", "c(*.c)")); int result = chooser.showSaveDialog(this); // 打开“另存为文件”对话框 if (result == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); this.setTitle(file.getName()); this.filename = file.getName(); this.filepath = file.getPath(); // 把文本框的内容写入到文件中 FileWriter fileWriter; try { fileWriter = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); fileWriter.write(textEditArea.getText()); bufferedWriter.close(); fileWriter.close(); } catch (FileNotFoundException e) { // TODO: handle exception e.printStackTrace(); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } } } // 打开文件操作 private void openfile() { // TODO Auto-generated method stub JFileChooser fileChooser = new JFileChooser(); Textfilefilter txtfilefilter = new Textfilefilter(".txt", "文本文件(*.txt)"); Textfilefilter xmlfilefilter = new Textfilefilter(".xml", "xml(*.xml)"); Textfilefilter cfilefilter = new Textfilefilter(".c", "c(*.c)"); Textfilefilter cplusfilefilter = new Textfilefilter(".cpp", "cpp(*.cpp)"); fileChooser.addChoosableFileFilter(txtfilefilter); fileChooser.addChoosableFileFilter(xmlfilefilter); fileChooser.addChoosableFileFilter(cfilefilter); fileChooser.addChoosableFileFilter(cplusfilefilter); fileChooser.setFileFilter(txtfilefilter); int result = fileChooser.showOpenDialog(this);// 打开“打开文件”对话框 // 将选择的File对象赋值给result if (result == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); this.setTitle(file.getName()); this.filepath = file.getPath(); this.filename = file.getName(); this.lblFileMsg.setText(this.filename.substring(filename.lastIndexOf(".") + 1) + " Source File "); // 读入文件的内容到文本框 FileReader fileReader; try { fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); textEditArea.setText(""); String string = ""; while ((string = bufferedReader.readLine()) != null) { textEditArea.append(string + "\r\n"); } bufferedReader.close(); fileReader.close(); } catch (FileNotFoundException e) { // TODO: handle exception e.printStackTrace(); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } } } // 下方状态栏变化 private void editKeyPressPerform(KeyEvent e) { // TODO Auto-generated method stub this.lblRowMsg.setText("当前字数:" + String.valueOf(textEditArea.getText().trim().length())); this.lblWordCountMsg.setText("当前行数:" + String.valueOf(textEditArea.getLineCount())); } //显示行号 private void linecount(KeyEvent e) { // TODO Auto-generated method stub //this.textArea.setText((textEditArea.getLineCount()+"\r\n")); } private static void addPopup(Component component, final JPopupMenu popup) { component.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showMenu(e); } } public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { showMenu(e); } } private void showMenu(MouseEvent e) { popup.show(e.getComponent(), e.getX(), e.getY()); } }); } // 退出事件处理 private void QuitActionPerform(ActionEvent e) { // TODO Auto-generated method stub Quit(); } // 退出处理 private void Quit() { if (flag == true) { int resp = JOptionPane.showConfirmDialog(null, "是否要保存文件并退出?"); if (resp == JOptionPane.YES_OPTION) { saveFile(); dispose(); } else if (resp == JOptionPane.NO_OPTION) { dispose(); } else if (resp == 2) { setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); } } else { dispose(); } } } /** * 自定义文件过滤器 * * @author xiaoyang * */ final class Textfilefilter extends FileFilter { private String extension; private String description; public Textfilefilter(String extension, String description) { super(); this.extension = extension; this.description = description.toLowerCase(); } @Override public boolean accept(File file) { // TODO Auto-generated method stub return file.getName().toLowerCase().endsWith(this.extension); } @Override public String getDescription() { // TODO Auto-generated method stub return description; } }
15,694
0.684217
0.663691
529
27.009451
21.947994
101
false
false
0
0
30
0.008602
0
0
2.491493
false
false
6
34b231fcfe226996774f53207655e667287961e4
7,249,904,828,498
21665fddc6d8c3cf650f76118297082ef3163b32
/src/main/java/com/tour/app/model/mapper/UserMapper.java
67468843ac661c57b7f8b00474711cc71749a500
[]
no_license
Lyqxyz/tour
https://github.com/Lyqxyz/tour
c24d358fce37fd88fcf004047b1f9110697f67ca
f11afc6adac4969281684af725e5064541d1f954
refs/heads/master
2020-05-15T11:05:56.844000
2019-05-22T04:08:10
2019-05-22T04:08:10
182,212,204
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tour.app.model.mapper; import com.tour.app.model.entity.Users; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface UserMapper { List<Users> all(); Users login(Users users); Integer reg(Users users); Users check(String usename); Integer updatePwd(Users users); Integer updatePic(Users users); Integer toAdmin(Integer uid); Integer del(Integer id); Users checkEmail(String email); Users checkPhone(String phone); Users info(Integer id); Integer updateInfo(Users users); List<Users> rank(); }
UTF-8
Java
662
java
UserMapper.java
Java
[]
null
[]
package com.tour.app.model.mapper; import com.tour.app.model.entity.Users; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface UserMapper { List<Users> all(); Users login(Users users); Integer reg(Users users); Users check(String usename); Integer updatePwd(Users users); Integer updatePic(Users users); Integer toAdmin(Integer uid); Integer del(Integer id); Users checkEmail(String email); Users checkPhone(String phone); Users info(Integer id); Integer updateInfo(Users users); List<Users> rank(); }
662
0.645015
0.645015
37
15.891891
16.416512
44
false
false
0
0
0
0
0
0
0.459459
false
false
6
bdc5fbc90a0321516925783d630cfafade278b47
4,896,262,787,900
8af1abfbf7dd70207f3595c355232a3601dbd718
/spark/src/main/scala/DP23/Create/Builder/StandardMazeBuilder.java
e578a3e998f7f7318d956306a4dc79c32a117dfe
[]
no_license
Litianye/learn-and-practice
https://github.com/Litianye/learn-and-practice
d4178324d62528ca496d680a187bbd3a11a2437d
897022a2fcff068af1c9fbbecad1f7081ff9da37
refs/heads/master
2021-06-16T02:09:39.838000
2019-09-19T14:37:15
2019-09-19T14:37:15
176,891,631
0
0
null
false
2021-03-31T21:29:31
2019-03-21T07:24:17
2019-09-19T14:43:51
2021-03-31T21:29:30
4,406
0
0
1
Java
false
false
package DP23.Create.Builder; /** * Created by litianye on 2019-07-09 */ import DP23.Create.Product.Direction; import DP23.Create.Product.Maze; import DP23.Create.Product.Room; /** * @program: spark * * @description: simple implement of maze builder * * @author: litianye * * @create: 2019-07-09 **/ public class StandardMazeBuilder implements MazeBuilder { private Maze currentMaze; public StandardMazeBuilder(){ currentMaze = new Maze(); } @Override public void BuildMaze() { } @Override public void BuildWall() { } @Override public void BuildRoom(int roomNo) { } @Override public void BuildDoor(int roomFrom, int roomTo) { } @Override public Maze GetMaze() { return null; } }
UTF-8
Java
790
java
StandardMazeBuilder.java
Java
[ { "context": "package DP23.Create.Builder;\n/**\n * Created by litianye on 2019-07-09\n */\n\n\nimport DP23.Create.Product.Di", "end": 55, "score": 0.998782753944397, "start": 47, "tag": "USERNAME", "value": "litianye" }, { "context": "n: simple implement of maze builder\n *\n * @author: litianye\n *\n * @create: 2019-07-09\n **/\n\npublic class Stan", "end": 280, "score": 0.9981095194816589, "start": 272, "tag": "USERNAME", "value": "litianye" } ]
null
[]
package DP23.Create.Builder; /** * Created by litianye on 2019-07-09 */ import DP23.Create.Product.Direction; import DP23.Create.Product.Maze; import DP23.Create.Product.Room; /** * @program: spark * * @description: simple implement of maze builder * * @author: litianye * * @create: 2019-07-09 **/ public class StandardMazeBuilder implements MazeBuilder { private Maze currentMaze; public StandardMazeBuilder(){ currentMaze = new Maze(); } @Override public void BuildMaze() { } @Override public void BuildWall() { } @Override public void BuildRoom(int roomNo) { } @Override public void BuildDoor(int roomFrom, int roomTo) { } @Override public Maze GetMaze() { return null; } }
790
0.637975
0.607595
52
14.192307
15.867284
57
false
false
0
0
0
0
0
0
0.153846
false
false
6
e44a20185463d6a8cf0aac4a587c23e2b7ea6003
4,896,262,788,638
1ce5513f57c0581f753e09d25adf39493033e0d7
/app/src/main/java/com/cheng/consult/ui/fragment/ConsultFragment.java
3e877b444ee8d4539cece01625b3fe5c7be9b56c
[]
no_license
chweilisi/Consult
https://github.com/chweilisi/Consult
6fd47b72dd66ea57e9b5bb5f81099633d38e6bb6
3259793dc0474acfb531304eddec19ef93b09af3
refs/heads/master
2021-09-05T15:41:32.692000
2018-01-29T10:15:04
2018-01-29T10:15:04
114,847,527
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cheng.consult.ui.fragment; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; 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.cheng.consult.R; import com.cheng.consult.ui.view.ExpertListActivity; import com.cheng.consult.ui.adapter.ConsultCategoryListAdapter; /** * Created by cheng on 2017/11/13. */ public class ConsultFragment extends Fragment { private RecyclerView mRecycleView; private LinearLayoutManager mLayoutManager; //private TextView mEnterCategory; private ConsultCategoryListAdapter mAdapter; private String[] mConsultCategory; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.consultfrag_layout, null, false); //mEnterCategory = (TextView)view.findViewById(R.id.focus_button); mRecycleView = (RecyclerView)view.findViewById(R.id.recycle_view); mLayoutManager = new LinearLayoutManager(getActivity()); mRecycleView.setLayoutManager(mLayoutManager); mAdapter = new ConsultCategoryListAdapter(getActivity()); //mRecycleView.setAdapter(mAdapter); mAdapter.setOnCategoryItemClickListener(listener); initView(); return view; } private void initView(){ mConsultCategory = getActivity().getResources().getStringArray(R.array.consult_category); mAdapter.setData(mConsultCategory); mRecycleView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); } private ConsultCategoryListAdapter.categoryItemClickListener listener = new ConsultCategoryListAdapter.categoryItemClickListener() { @Override public void onItemClick(View view, int position) { //TODO enter category Intent intent = new Intent(getContext(),ExpertListActivity.class); intent.putExtra("cat",mConsultCategory[position]); intent.putExtra("position",position); startActivity(intent); if (getContext() instanceof Activity) { ((Activity) getContext()).overridePendingTransition(R.anim.slide_alpha_in, R.anim.slide_alpha_out); } } }; }
UTF-8
Java
2,521
java
ConsultFragment.java
Java
[ { "context": "ter.ConsultCategoryListAdapter;\n\n/**\n * Created by cheng on 2017/11/13.\n */\n\npublic class ConsultFragment ", "end": 574, "score": 0.9835779666900635, "start": 569, "tag": "USERNAME", "value": "cheng" } ]
null
[]
package com.cheng.consult.ui.fragment; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; 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.cheng.consult.R; import com.cheng.consult.ui.view.ExpertListActivity; import com.cheng.consult.ui.adapter.ConsultCategoryListAdapter; /** * Created by cheng on 2017/11/13. */ public class ConsultFragment extends Fragment { private RecyclerView mRecycleView; private LinearLayoutManager mLayoutManager; //private TextView mEnterCategory; private ConsultCategoryListAdapter mAdapter; private String[] mConsultCategory; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.consultfrag_layout, null, false); //mEnterCategory = (TextView)view.findViewById(R.id.focus_button); mRecycleView = (RecyclerView)view.findViewById(R.id.recycle_view); mLayoutManager = new LinearLayoutManager(getActivity()); mRecycleView.setLayoutManager(mLayoutManager); mAdapter = new ConsultCategoryListAdapter(getActivity()); //mRecycleView.setAdapter(mAdapter); mAdapter.setOnCategoryItemClickListener(listener); initView(); return view; } private void initView(){ mConsultCategory = getActivity().getResources().getStringArray(R.array.consult_category); mAdapter.setData(mConsultCategory); mRecycleView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); } private ConsultCategoryListAdapter.categoryItemClickListener listener = new ConsultCategoryListAdapter.categoryItemClickListener() { @Override public void onItemClick(View view, int position) { //TODO enter category Intent intent = new Intent(getContext(),ExpertListActivity.class); intent.putExtra("cat",mConsultCategory[position]); intent.putExtra("position",position); startActivity(intent); if (getContext() instanceof Activity) { ((Activity) getContext()).overridePendingTransition(R.anim.slide_alpha_in, R.anim.slide_alpha_out); } } }; }
2,521
0.724712
0.720349
69
35.536232
30.820461
136
false
false
0
0
0
0
0
0
0.695652
false
false
6
e2a2eb2ef29b88ae6b063bec30cd2f88c8cef679
31,250,182,101,912
8216def86c0876ab603c2335a91e2fa76519b38d
/test/src/com/test_01/inner_class_test02.java
d1897fd2ae339c9bb58a87c14458d6f2ce0df2e2
[]
no_license
zpf2012/test
https://github.com/zpf2012/test
612e068136673959b262c0fc0f767534cd4b4cf6
ed846647da13ea7bade947c38bb9470edc5e9e9d
refs/heads/master
2021-01-09T20:20:31.802000
2016-08-05T01:36:32
2016-08-05T01:36:32
64,640,286
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test_01; import com.test_IO.test_01_file; public class inner_class_test02 { public Contents getCont() { return new Contents(){ private int i = 11; public int value() { return i; } }; } public static void main(String[] args) { inner_class_test02 it = new inner_class_test02(); Contents c = it.getCont(); } }
UTF-8
Java
350
java
inner_class_test02.java
Java
[]
null
[]
package com.test_01; import com.test_IO.test_01_file; public class inner_class_test02 { public Contents getCont() { return new Contents(){ private int i = 11; public int value() { return i; } }; } public static void main(String[] args) { inner_class_test02 it = new inner_class_test02(); Contents c = it.getCont(); } }
350
0.642857
0.608571
19
17.421053
15.225725
51
false
false
0
0
0
0
0
0
1.842105
false
false
6
028a8ff2732e5d901af3894242014e7fdb43e01d
3,135,326,181,953
f8959e30eb7058a1ce2658349a12ee1d91632bb6
/src/main/java/com/king/nowedge/dto/ryx/RyxUserEcourseDTO.java
8a8f05cbe023e7df906ab6700c45b3e61649fc08
[]
no_license
hq20211124/com.ryx.noeedge
https://github.com/hq20211124/com.ryx.noeedge
190456e908b851cabbe3301eee1802641169ea87
f191be4c119a6f1a2f478e79fd06013c744ca140
refs/heads/master
2023-01-01T19:29:36.834000
2020-10-25T05:03:19
2020-10-25T05:03:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.king.nowedge.dto.ryx; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; import org.omg.CORBA.PRIVATE_MEMBER; import org.springframework.format.annotation.DateTimeFormat; import com.king.nowedge.dto.base.BaseDTO; import com.king.nowedge.dto.enums.EnumAccountType; /** * RyxUsers entity. @author MyEclipse Persistence Tools */ public class RyxUserEcourseDTO extends BaseDTO implements java.io.Serializable { private Long userId; private Long ecid ; private Long ecid1 ; private Integer category ; private Integer status ; public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Long getEcid() { return ecid; } public void setEcid(Long ecid) { this.ecid = ecid; } public Long getEcid1() { return ecid1; } public void setEcid1(Long ecid1) { this.ecid1 = ecid1; } public Integer getCategory() { return category; } public void setCategory(Integer category) { this.category = category; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } }
UTF-8
Java
1,361
java
RyxUserEcourseDTO.java
Java
[]
null
[]
package com.king.nowedge.dto.ryx; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; import org.omg.CORBA.PRIVATE_MEMBER; import org.springframework.format.annotation.DateTimeFormat; import com.king.nowedge.dto.base.BaseDTO; import com.king.nowedge.dto.enums.EnumAccountType; /** * RyxUsers entity. @author MyEclipse Persistence Tools */ public class RyxUserEcourseDTO extends BaseDTO implements java.io.Serializable { private Long userId; private Long ecid ; private Long ecid1 ; private Integer category ; private Integer status ; public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Long getEcid() { return ecid; } public void setEcid(Long ecid) { this.ecid = ecid; } public Long getEcid1() { return ecid1; } public void setEcid1(Long ecid1) { this.ecid1 = ecid1; } public Integer getCategory() { return category; } public void setCategory(Integer category) { this.category = category; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } }
1,361
0.736223
0.73108
81
15.814815
18.362005
80
false
false
0
0
0
0
0
0
1.037037
false
false
6
839943817d4a0aa189a162b840b01fd630ce0cbf
13,417,477,845,739
74135a229ec4b95a40ad3a1387a61bde9ced97ef
/app/src/main/java/com/example/registerapplication/BookingDoctorActivity.java
8c4c0588692893381d4c85c752aff3c2beb73f4f
[]
no_license
Kasunath-Lakmal/Mobile-Application-for-detection-Retinoblastoma-eye-cancer
https://github.com/Kasunath-Lakmal/Mobile-Application-for-detection-Retinoblastoma-eye-cancer
62753706a78d5fd06179d03e86404b71b3c87ac6
db3a1cb88e5bc581795a1d4bfbaffbc9587896dc
refs/heads/master
2023-02-19T22:40:06.876000
2021-01-19T05:37:04
2021-01-19T05:37:04
330,874,900
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.registerapplication; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ExpandableListView; import androidx.appcompat.app.AppCompatActivity; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class BookingDoctorActivity extends AppCompatActivity { // ImageView back_imageView; Button btn_one; ExpandableListAdapter listAdapter; ExpandableListView expListView; List<String> listDataHeader; HashMap<String, List<String>> listDataChild; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_booking_doctor); btn_one = (Button)findViewById(R.id.btn_change); btn_one.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(BookingDoctorActivity.this , FindDoctorActivity.class); startActivity(i); finish(); } }); /* back_imageView = (ImageView)findViewById(R.id.check_your_back_id); back_imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(BookingDoctorActivity.this, FindDoctorActivity.class); startActivity(i); finish(); } });*/ // get the listview expListView = (ExpandableListView)findViewById(R.id.booking_doctor); // preparing list data prepareListData(); // TextView textView = new TextView(ThirdFragment.this.getActivity()); listAdapter = new ExpandableListAdapter(BookingDoctorActivity.this, listDataHeader, listDataChild); // setting list adapter expListView.setAdapter(listAdapter); return ; } /* * Preparing the list data */ private void prepareListData() { listDataHeader = new ArrayList<String>(); listDataChild = new HashMap<String, List<String>>(); // Adding child data listDataHeader.add("Dr.Sujeewa Amarasighe"); listDataHeader.add("Dr.Nayana Wikramasinghe"); listDataHeader.add("Dr.Chalukya Karunasinha "); listDataHeader.add("Dr.Upendra Samaraweera"); listDataHeader.add("Dr.Lakmi Kodithuwakku"); listDataHeader.add("Dr.Rupika Gunawardana"); listDataHeader.add("Dr.Kavishaka Kumarasiri"); listDataHeader.add("Dr.Nihal Pathmasiri"); listDataHeader.add("Dr.Ashela Devapriya"); // Adding child data List<String> top250 = new ArrayList<String>(); top250.add("Hospital Name : Asiri Hospital"); top250.add("Address: 181, Kirula Road, Colombo 5"); top250.add("Contact Number: 0114523300"); /* top250.add("Pulp Fiction"); top250.add("The Good, the Bad and the Ugly"); top250.add("The Dark Knight"); top250.add("12 Angry Men");*/ List<String> top251 = new ArrayList<String>(); top251.add("Hospital Name : Asiri Surgical Hospital"); top251.add("21, Kirimandala Mawatha, Colombo 5"); top251.add("Contact Number: 0114524400"); List<String> top252 = new ArrayList<String>(); top252.add("Hospital Name :The Central"); top252.add("Address: 114, Noris Canal Road, Colombo 10"); top252.add("Contact Number: 0114665500"); List<String> top253 = new ArrayList<String>(); top253.add("Hospital Name :The Central"); top253.add("Address: 114, Noris Canal Road, Colombo 10"); top253.add("Contact Number: 0114665500"); List<String> top254 = new ArrayList<String>(); top254.add("Hospital Name :Borella Private Hostpital"); top254.add("Address: 114, 75, Kotta Road, Colombo8"); top254.add("Contact Number: 0112692753"); ///////////////////// /* List<String> top255 = new ArrayList<String>(); top255.add("Hospital Name :Ceylinco Halthcare center"); top255.add("Address:60, Park Street, Colombo 2"); top255.add("Contact Number:0112490290"); List<String> top256 = new ArrayList<String>(); top256.add("Hospital Name :Ceymed Health care"); top256.add("Address:132, S. De jayasinghe Mawatha, Nugegoda"); top256.add("Contact Number: 0114308877"); List<String> top257 = new ArrayList<String>(); top257.add("Hospital Name :Durdans Hospital"); top257.add("Address: 3, Alfred Place, Colombo 3"); top257.add("Contact Number: 1344 or 0112140000"); List<String> top258 = new ArrayList<String>(); top258.add("Hospital Name :Golden Key Eye and ENT Hospital"); top258.add("Address: 1175, Cotta Road, Rajagiriya"); top258.add("Contact Number: 0112880288"); List<String> top259 = new ArrayList<String>(); top259.add("Hospital Name :Grandpass Nursing Home"); top259.add("Address: 34,54 Grandpass Road, Colombo 14"); top259.add("Contact Number: 0112422184-6");*/ listDataChild.put(listDataHeader.get(0), top250); // Header, Child data listDataChild.put(listDataHeader.get(1), top251); listDataChild.put(listDataHeader.get(2), top252); listDataChild.put(listDataHeader.get(3), top253); listDataChild.put(listDataHeader.get(4), top254); /* listDataChild.put(listDataHeader.get(6), top256); listDataChild.put(listDataHeader.get(7), top257); listDataChild.put(listDataHeader.get(8), top258); listDataChild.put(listDataHeader.get(9), top259);*/ } }
UTF-8
Java
5,769
java
BookingDoctorActivity.java
Java
[ { "context": " Adding child data\n listDataHeader.add(\"Dr.Sujeewa Amarasighe\");\n listDataHeader.add(\"Dr.Nayana Wikramas", "end": 2271, "score": 0.9997389316558838, "start": 2253, "tag": "NAME", "value": "Sujeewa Amarasighe" }, { "context": "eewa Amarasighe\");\n listDataHeader.add(\"Dr.Nayana Wikramasinghe\");\n listDataHeader.add(\"Dr.Chalukya Karuna", "end": 2326, "score": 0.9998559951782227, "start": 2306, "tag": "NAME", "value": "Nayana Wikramasinghe" }, { "context": "a Wikramasinghe\");\n listDataHeader.add(\"Dr.Chalukya Karunasinha \");\n listDataHeader.add(\"Dr.Upendra Samara", "end": 2381, "score": 0.9998090267181396, "start": 2361, "tag": "NAME", "value": "Chalukya Karunasinha" }, { "context": "ya Karunasinha \");\n listDataHeader.add(\"Dr.Upendra Samaraweera\");\n listDataHeader.add(\"Dr.Lakmi Kodithuwa", "end": 2436, "score": 0.9996585249900818, "start": 2417, "tag": "NAME", "value": "Upendra Samaraweera" }, { "context": "dra Samaraweera\");\n listDataHeader.add(\"Dr.Lakmi Kodithuwakku\");\n listDataHeader.add(\"Dr.Rupika Gunaward", "end": 2489, "score": 0.9997854232788086, "start": 2471, "tag": "NAME", "value": "Lakmi Kodithuwakku" }, { "context": "mi Kodithuwakku\");\n listDataHeader.add(\"Dr.Rupika Gunawardana\");\n listDataHeader.add(\"Dr.Kavishaka Kumar", "end": 2542, "score": 0.9998459219932556, "start": 2524, "tag": "NAME", "value": "Rupika Gunawardana" }, { "context": "ika Gunawardana\");\n listDataHeader.add(\"Dr.Kavishaka Kumarasiri\");\n listDataHeader.add(\"Dr.Nihal Pathmasir", "end": 2597, "score": 0.999814510345459, "start": 2577, "tag": "NAME", "value": "Kavishaka Kumarasiri" }, { "context": "haka Kumarasiri\");\n listDataHeader.add(\"Dr.Nihal Pathmasiri\");\n listDataHeader.add(\"Dr.Ashela Devapriy", "end": 2648, "score": 0.9997866749763489, "start": 2632, "tag": "NAME", "value": "Nihal Pathmasiri" }, { "context": "ihal Pathmasiri\");\n listDataHeader.add(\"Dr.Ashela Devapriya\");\n\n // Adding child data\n List<Str", "end": 2699, "score": 0.9998258948326111, "start": 2683, "tag": "NAME", "value": "Ashela Devapriya" } ]
null
[]
package com.example.registerapplication; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ExpandableListView; import androidx.appcompat.app.AppCompatActivity; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class BookingDoctorActivity extends AppCompatActivity { // ImageView back_imageView; Button btn_one; ExpandableListAdapter listAdapter; ExpandableListView expListView; List<String> listDataHeader; HashMap<String, List<String>> listDataChild; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_booking_doctor); btn_one = (Button)findViewById(R.id.btn_change); btn_one.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(BookingDoctorActivity.this , FindDoctorActivity.class); startActivity(i); finish(); } }); /* back_imageView = (ImageView)findViewById(R.id.check_your_back_id); back_imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(BookingDoctorActivity.this, FindDoctorActivity.class); startActivity(i); finish(); } });*/ // get the listview expListView = (ExpandableListView)findViewById(R.id.booking_doctor); // preparing list data prepareListData(); // TextView textView = new TextView(ThirdFragment.this.getActivity()); listAdapter = new ExpandableListAdapter(BookingDoctorActivity.this, listDataHeader, listDataChild); // setting list adapter expListView.setAdapter(listAdapter); return ; } /* * Preparing the list data */ private void prepareListData() { listDataHeader = new ArrayList<String>(); listDataChild = new HashMap<String, List<String>>(); // Adding child data listDataHeader.add("Dr.<NAME>"); listDataHeader.add("Dr.<NAME>"); listDataHeader.add("Dr.<NAME> "); listDataHeader.add("Dr.<NAME>"); listDataHeader.add("Dr.<NAME>"); listDataHeader.add("Dr.<NAME>"); listDataHeader.add("Dr.<NAME>"); listDataHeader.add("Dr.<NAME>"); listDataHeader.add("Dr.<NAME>"); // Adding child data List<String> top250 = new ArrayList<String>(); top250.add("Hospital Name : Asiri Hospital"); top250.add("Address: 181, Kirula Road, Colombo 5"); top250.add("Contact Number: 0114523300"); /* top250.add("Pulp Fiction"); top250.add("The Good, the Bad and the Ugly"); top250.add("The Dark Knight"); top250.add("12 Angry Men");*/ List<String> top251 = new ArrayList<String>(); top251.add("Hospital Name : Asiri Surgical Hospital"); top251.add("21, Kirimandala Mawatha, Colombo 5"); top251.add("Contact Number: 0114524400"); List<String> top252 = new ArrayList<String>(); top252.add("Hospital Name :The Central"); top252.add("Address: 114, Noris Canal Road, Colombo 10"); top252.add("Contact Number: 0114665500"); List<String> top253 = new ArrayList<String>(); top253.add("Hospital Name :The Central"); top253.add("Address: 114, Noris Canal Road, Colombo 10"); top253.add("Contact Number: 0114665500"); List<String> top254 = new ArrayList<String>(); top254.add("Hospital Name :Borella Private Hostpital"); top254.add("Address: 114, 75, Kotta Road, Colombo8"); top254.add("Contact Number: 0112692753"); ///////////////////// /* List<String> top255 = new ArrayList<String>(); top255.add("Hospital Name :Ceylinco Halthcare center"); top255.add("Address:60, Park Street, Colombo 2"); top255.add("Contact Number:0112490290"); List<String> top256 = new ArrayList<String>(); top256.add("Hospital Name :Ceymed Health care"); top256.add("Address:132, S. De jayasinghe Mawatha, Nugegoda"); top256.add("Contact Number: 0114308877"); List<String> top257 = new ArrayList<String>(); top257.add("Hospital Name :Durdans Hospital"); top257.add("Address: 3, Alfred Place, Colombo 3"); top257.add("Contact Number: 1344 or 0112140000"); List<String> top258 = new ArrayList<String>(); top258.add("Hospital Name :Golden Key Eye and ENT Hospital"); top258.add("Address: 1175, Cotta Road, Rajagiriya"); top258.add("Contact Number: 0112880288"); List<String> top259 = new ArrayList<String>(); top259.add("Hospital Name :Grandpass Nursing Home"); top259.add("Address: 34,54 Grandpass Road, Colombo 14"); top259.add("Contact Number: 0112422184-6");*/ listDataChild.put(listDataHeader.get(0), top250); // Header, Child data listDataChild.put(listDataHeader.get(1), top251); listDataChild.put(listDataHeader.get(2), top252); listDataChild.put(listDataHeader.get(3), top253); listDataChild.put(listDataHeader.get(4), top254); /* listDataChild.put(listDataHeader.get(6), top256); listDataChild.put(listDataHeader.get(7), top257); listDataChild.put(listDataHeader.get(8), top258); listDataChild.put(listDataHeader.get(9), top259);*/ } }
5,658
0.645172
0.590397
152
36.960526
25.18664
107
false
false
0
0
0
0
0
0
0.894737
false
false
6
1650692db5980f886bf5a1420414d0105ba109b0
3,152,506,042,590
a48b090087600c0a2d6d616120333fe59e707bd3
/JdbcProject/src/TestSelectDemo2.java
c9befffff4781dca11e59af450cc8c0982f5e6a5
[]
no_license
Kanchankms/allprojects
https://github.com/Kanchankms/allprojects
831e1cc5c92a192388ea688d298ae3b33ba144a8
353371f7d87d48017ab165f6d88953f6a9f54707
refs/heads/master
2020-04-05T15:53:38.518000
2018-11-10T14:31:40
2018-11-10T14:31:40
156,988,494
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; public class TestSelectDemo2 { public static void main(String[] args) { // TODO Auto-generated method stub Connection con = null; Statement st = null; PreparedStatement pst = null; ResultSet rs = null; String url = "jdbc:oracle:thin:@localhost:1521:xe"; String uid = "system"; String pwd = "corp123"; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverManager.getConnection(url,uid,pwd); st = con.createStatement(); rs = st.executeQuery(QueryMapper.SELECTQRY1); ResultSetMetaData rsmd = rs.getMetaData(); System.out.println("Table Name"+rsmd.getTableName(1)); int columnCount = rsmd.getColumnCount(); System.out.println("Column Count:"+columnCount); for(int i=1;i<=columnCount;i++) { System.out.println("Column name: "+rsmd.getColumnName(i)+ " Column Type:"+rsmd.getColumnTypeName(i)); } /*//rs.next(); //for iteration System.out.println("EMPID\t\tEMPNAME\t\tEMPSAL\t\tEMPDOB"); while(rs.next()) //to iterate till all the records are fetched { System.out.println(rs.getInt("emp_id")+"\t\t"+rs.getString("emp_name")+"\t\t" +rs.getFloat("emp_sal")+"\t\t"+rs.getDate("emp_dob")); }*/ } catch(Exception e) { e.printStackTrace(); } } }
UTF-8
Java
1,510
java
TestSelectDemo2.java
Java
[ { "context": "1:xe\";\r\n\t\tString uid = \"system\";\r\n\t\tString pwd = \"corp123\";\r\n\t\ttry\r\n\t\t{\r\n\t\t\tClass.forName(\"oracle.jdbc.driv", "end": 519, "score": 0.9992245435714722, "start": 512, "tag": "PASSWORD", "value": "corp123" } ]
null
[]
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; public class TestSelectDemo2 { public static void main(String[] args) { // TODO Auto-generated method stub Connection con = null; Statement st = null; PreparedStatement pst = null; ResultSet rs = null; String url = "jdbc:oracle:thin:@localhost:1521:xe"; String uid = "system"; String pwd = "<PASSWORD>"; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverManager.getConnection(url,uid,pwd); st = con.createStatement(); rs = st.executeQuery(QueryMapper.SELECTQRY1); ResultSetMetaData rsmd = rs.getMetaData(); System.out.println("Table Name"+rsmd.getTableName(1)); int columnCount = rsmd.getColumnCount(); System.out.println("Column Count:"+columnCount); for(int i=1;i<=columnCount;i++) { System.out.println("Column name: "+rsmd.getColumnName(i)+ " Column Type:"+rsmd.getColumnTypeName(i)); } /*//rs.next(); //for iteration System.out.println("EMPID\t\tEMPNAME\t\tEMPSAL\t\tEMPDOB"); while(rs.next()) //to iterate till all the records are fetched { System.out.println(rs.getInt("emp_id")+"\t\t"+rs.getString("emp_name")+"\t\t" +rs.getFloat("emp_sal")+"\t\t"+rs.getDate("emp_dob")); }*/ } catch(Exception e) { e.printStackTrace(); } } }
1,513
0.650993
0.643709
54
25.962963
21.623001
80
false
false
0
0
0
0
0
0
2.611111
false
false
6
eba769832f0da3947873d643b4b162b8609b4709
18,202,071,466,134
98468f04f0d218652ff97ee772399f7243acdaa7
/app/src/main/java/art/com/currencyexchanger/utilities/WebSocketFactory.java
0297856049dde1dc809c28100e393080c8004ebb
[]
no_license
ArturAdamczyk/CurrencyExchanger
https://github.com/ArturAdamczyk/CurrencyExchanger
566b67b33eec2186ebab0e6417676db2b43758b8
ff2a3701a99391a1c31e7fc4e0014cdd91af26b0
refs/heads/master
2020-04-26T10:20:24.857000
2019-03-11T17:12:17
2019-03-11T17:12:17
173,483,399
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package art.com.currencyexchanger.utilities; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.WebSocket; import okhttp3.WebSocketListener; import timber.log.Timber; public class WebSocketFactory { private static final String CLASS_TAG = WebSocketFactory.class.getSimpleName(); public static WebSocket connect( WebSocketListener listener, OkHttpClient okHttpClient, Request request) throws IllegalArgumentException { try { return okHttpClient.newWebSocket(request, listener); } catch (IllegalArgumentException e) { Timber.d(CLASS_TAG, e.getMessage()); throw new IllegalArgumentException(e.getMessage()); } } }
UTF-8
Java
739
java
WebSocketFactory.java
Java
[]
null
[]
package art.com.currencyexchanger.utilities; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.WebSocket; import okhttp3.WebSocketListener; import timber.log.Timber; public class WebSocketFactory { private static final String CLASS_TAG = WebSocketFactory.class.getSimpleName(); public static WebSocket connect( WebSocketListener listener, OkHttpClient okHttpClient, Request request) throws IllegalArgumentException { try { return okHttpClient.newWebSocket(request, listener); } catch (IllegalArgumentException e) { Timber.d(CLASS_TAG, e.getMessage()); throw new IllegalArgumentException(e.getMessage()); } } }
739
0.700947
0.695535
23
31.130434
22.855509
83
false
false
0
0
0
0
0
0
0.608696
false
false
6
a1c0b838405b650021ce56ab0947118b01cecaa3
18,202,071,464,784
601d3670835119883c22ebd7d8134e981c6aae07
/myzstu/myzstu-boot/src/main/java/club/zstuca/myzstu/boot/aop/advice/GlobalSQLExceptionHandler.java
cb042180d483a9ed0e35bb0a95096952eb1184cb
[ "MIT" ]
permissive
STZG19991208/MyZSTU
https://github.com/STZG19991208/MyZSTU
c87557dd95052c06d47b64c8dc1e5183d5e829f7
691ef70279d8d249f21e42141270aa2ffeb741f9
refs/heads/master
2021-06-30T15:06:11.361000
2021-06-08T04:17:27
2021-06-08T10:23:56
232,466,102
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package club.zstuca.myzstu.boot.aop.advice; import club.zstuca.myzstu.common.web.R; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import java.sql.SQLException; import java.sql.SQLIntegrityConstraintViolationException; /** * @author ShenTuZhiGang * @version 1.0.0 * @date 2020-03-21 16:51 */ @Slf4j @RestControllerAdvice public class GlobalSQLExceptionHandler { @ExceptionHandler(SQLException.class) public R<?> sqlException(SQLException e) { if (e instanceof SQLIntegrityConstraintViolationException) { return R.builder() .code(50000) .msg("该数据有关联数据,操作失败!") .build(); } return R.builder() .code(50000) .msg("数据库异常,操作失败!") .build(); } }
UTF-8
Java
966
java
GlobalSQLExceptionHandler.java
Java
[ { "context": "grityConstraintViolationException;\n\n/**\n * @author ShenTuZhiGang\n * @version 1.0.0\n * @date 2020-03-21 16:51\n */\n@", "end": 371, "score": 0.9997180700302124, "start": 358, "tag": "NAME", "value": "ShenTuZhiGang" } ]
null
[]
package club.zstuca.myzstu.boot.aop.advice; import club.zstuca.myzstu.common.web.R; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import java.sql.SQLException; import java.sql.SQLIntegrityConstraintViolationException; /** * @author ShenTuZhiGang * @version 1.0.0 * @date 2020-03-21 16:51 */ @Slf4j @RestControllerAdvice public class GlobalSQLExceptionHandler { @ExceptionHandler(SQLException.class) public R<?> sqlException(SQLException e) { if (e instanceof SQLIntegrityConstraintViolationException) { return R.builder() .code(50000) .msg("该数据有关联数据,操作失败!") .build(); } return R.builder() .code(50000) .msg("数据库异常,操作失败!") .build(); } }
966
0.651087
0.620652
32
27.78125
19.78278
68
false
false
0
0
0
0
0
0
0.28125
false
false
6
f8f6f110dd653dbc2f2632dada3fd2ddd2f938f2
6,648,609,379,013
a9b8776e52c829c20e15e327316f2a14d87808e8
/new-smarthomeDemo/杂乱的Demo/ParBarDemo/src/com/example/parbardemo1/MainActivity.java
652c17e24fc1ae21d9160038c535534bf3302fe3
[ "Apache-2.0" ]
permissive
NOTFROMCONCEN/smarthomeearlier
https://github.com/NOTFROMCONCEN/smarthomeearlier
e01b566331599d9a79158e6ae979eab985ac79cf
a51f85e0dcdf9becbc46aafcdb45299639e11319
refs/heads/master
2022-12-24T14:36:11.227000
2020-06-09T11:06:17
2020-06-09T11:06:17
302,575,726
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.parbardemo1; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.LinearLayout; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout ll = (LinearLayout) findViewById(R.id.ll_main); ParBarView pb = new ParBarView(this); ll.addView(pb); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } }
UTF-8
Java
680
java
MainActivity.java
Java
[]
null
[]
package com.example.parbardemo1; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.LinearLayout; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout ll = (LinearLayout) findViewById(R.id.ll_main); ParBarView pb = new ParBarView(this); ll.addView(pb); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } }
680
0.683824
0.682353
26
25.153847
20.732161
68
false
false
0
0
0
0
0
0
0.5
false
false
6
fff12ca4cf143a7dead10f3d4505ae516bede69f
29,403,346,112,265
bda6b19a14b416f9ee48dd48a777ee976dbff5dd
/jrec/src/main/java/jrec/scheduler/receiver/ScheduledReceiver.java
d53efc7b119fcd2d41ab4359359195d72ca41a7d
[]
no_license
lostman-github/jrec
https://github.com/lostman-github/jrec
ade050c9521f9c12cff5e9f4b476a16efbd0f1ad
dda59f3df6048b35ebef7828c0d520ca70bc14df
HEAD
2016-06-01T10:32:48.959000
2014-04-19T17:29:16
2014-04-19T17:29:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jrec.scheduler.receiver; public interface ScheduledReceiver { }
UTF-8
Java
74
java
ScheduledReceiver.java
Java
[]
null
[]
package jrec.scheduler.receiver; public interface ScheduledReceiver { }
74
0.810811
0.810811
5
13.8
16.545694
36
false
false
0
0
0
0
0
0
0.2
false
false
6
8d64bf17d63682e26051261ed6e9f159f7663c40
23,235,773,135,572
410d5f1fa1c0168e19023d3efece636a3d2c7975
/MetaServer/src/main/java/Models/Trigger.java
00142a3685f25311e1e8241b9ae32093f8e399b1
[]
no_license
ErikTillberg/Project-Schwarma
https://github.com/ErikTillberg/Project-Schwarma
6c78e8023bb0e91fece2711b366e8aa8019277cf
265bdec345286eb4bbfae983d3f8635314f8a0ec
refs/heads/master
2021-01-11T19:45:36.521000
2017-04-07T12:00:57
2017-04-07T12:00:57
79,391,024
2
0
null
false
2017-03-23T02:30:10
2017-01-18T22:26:26
2017-03-16T05:38:27
2017-03-23T02:30:10
2,135
2
0
24
JavaScript
null
null
package Models; import com.google.gson.JsonObject; /** * @author FrancescosMac * @date 17-03-12. */ public class Trigger { private String lhs = null; private String rhs = null; private String operator = null; public Trigger(){} public String getLhs() { return lhs; } public void setLhs(String lhs) { this.lhs = lhs; } public String getRhs() { return rhs; } public void setRhs(String rhs) { this.rhs = rhs; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public JsonObject simplifyForBattle(){ JsonObject trigger_info = new JsonObject(); trigger_info.addProperty("lhs", this.getLhs()); trigger_info.addProperty("operator", this.getOperator()); trigger_info.addProperty("rhs", this.getRhs()); return trigger_info; } }
UTF-8
Java
966
java
Trigger.java
Java
[ { "context": "import com.google.gson.JsonObject;\n\n/**\n * @author FrancescosMac\n * @date 17-03-12.\n */\npublic class Tr", "end": 70, "score": 0.7218725085258484, "start": 68, "tag": "NAME", "value": "Fr" }, { "context": "ort com.google.gson.JsonObject;\n\n/**\n * @author FrancescosMac\n * @date 17-03-12.\n */\npublic class Trigger {\n\n ", "end": 81, "score": 0.8816991448402405, "start": 70, "tag": "USERNAME", "value": "ancescosMac" } ]
null
[]
package Models; import com.google.gson.JsonObject; /** * @author FrancescosMac * @date 17-03-12. */ public class Trigger { private String lhs = null; private String rhs = null; private String operator = null; public Trigger(){} public String getLhs() { return lhs; } public void setLhs(String lhs) { this.lhs = lhs; } public String getRhs() { return rhs; } public void setRhs(String rhs) { this.rhs = rhs; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public JsonObject simplifyForBattle(){ JsonObject trigger_info = new JsonObject(); trigger_info.addProperty("lhs", this.getLhs()); trigger_info.addProperty("operator", this.getOperator()); trigger_info.addProperty("rhs", this.getRhs()); return trigger_info; } }
966
0.602484
0.596273
50
18.32
17.844259
65
false
false
0
0
0
0
0
0
0.38
false
false
6
dae57e27544cb8b600fa100854098970d4522bcf
16,801,912,113,140
d76b8ef25ac4760cb5f1152fa90d5a59bacdd5a6
/data/src/main/java/dev/olog/data/model/StopEntity.java
d3a8b03a65c89e8d532f31849a8e9078af880e28
[ "MIT" ]
permissive
ologe/leeto
https://github.com/ologe/leeto
51c7dda3ac7a44e5b7d16921e3ed3495a9fe3402
d071d7af88b2b050c65c6ff53c58ffbedae5066d
refs/heads/master
2020-04-18T08:37:04.450000
2019-01-27T16:40:27
2019-01-27T16:40:27
167,402,599
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dev.olog.data.model; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Embedded; import android.arch.persistence.room.Entity; import android.arch.persistence.room.ForeignKey; import android.arch.persistence.room.Index; import android.arch.persistence.room.PrimaryKey; import java.util.Date; import io.reactivex.annotations.NonNull; @Entity(tableName = "journey_stops", indices = @Index(value = "stop_id", unique = true), foreignKeys = @ForeignKey( entity = JourneyEntity.class, parentColumns = "journey_id", childColumns = "journey_id_fk", onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE ) ) public class StopEntity { @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "stop_id") @NonNull private final int id; @ColumnInfo(name = "journey_id_fk") @NonNull private final int journeyId; @ColumnInfo(name = "stop_date") @NonNull private final Date date; @Embedded @NonNull private final LocationEntity location; public StopEntity(int id, int journeyId, @NonNull Date date, @NonNull LocationEntity location) { this.id = id; this.journeyId = journeyId; this.date = date; this.location = location; } public int getId() { return id; } public int getJourneyId() { return journeyId; } @NonNull public Date getDate() { return date; } @NonNull public LocationEntity getLocation() { return location; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StopEntity that = (StopEntity) o; if (id != that.id) return false; if (journeyId != that.journeyId) return false; if (!date.equals(that.date)) return false; return location.equals(that.location); } @Override public int hashCode() { int result = id; result = 31 * result + journeyId; result = 31 * result + date.hashCode(); result = 31 * result + location.hashCode(); return result; } }
UTF-8
Java
2,270
java
StopEntity.java
Java
[]
null
[]
package dev.olog.data.model; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Embedded; import android.arch.persistence.room.Entity; import android.arch.persistence.room.ForeignKey; import android.arch.persistence.room.Index; import android.arch.persistence.room.PrimaryKey; import java.util.Date; import io.reactivex.annotations.NonNull; @Entity(tableName = "journey_stops", indices = @Index(value = "stop_id", unique = true), foreignKeys = @ForeignKey( entity = JourneyEntity.class, parentColumns = "journey_id", childColumns = "journey_id_fk", onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE ) ) public class StopEntity { @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "stop_id") @NonNull private final int id; @ColumnInfo(name = "journey_id_fk") @NonNull private final int journeyId; @ColumnInfo(name = "stop_date") @NonNull private final Date date; @Embedded @NonNull private final LocationEntity location; public StopEntity(int id, int journeyId, @NonNull Date date, @NonNull LocationEntity location) { this.id = id; this.journeyId = journeyId; this.date = date; this.location = location; } public int getId() { return id; } public int getJourneyId() { return journeyId; } @NonNull public Date getDate() { return date; } @NonNull public LocationEntity getLocation() { return location; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StopEntity that = (StopEntity) o; if (id != that.id) return false; if (journeyId != that.journeyId) return false; if (!date.equals(that.date)) return false; return location.equals(that.location); } @Override public int hashCode() { int result = id; result = 31 * result + journeyId; result = 31 * result + date.hashCode(); result = 31 * result + location.hashCode(); return result; } }
2,270
0.617621
0.614978
89
24.505617
19.956202
100
false
false
0
0
0
0
0
0
0.505618
false
false
6
78d8fb2a348029767670445c14a979105ee27ebc
28,991,029,313,263
728bf2fe960df5f08067d2718a02d53f15345b97
/src/InsertionSorter.java
6ba924f42b300142ba97aa843cea47daa33481f7
[]
no_license
joshenz/myJavaSorter
https://github.com/joshenz/myJavaSorter
fc0b8f1d456a2174fa3d78964d5e02e8a04e1597
ce04722a74cde0a5b9298df42761a5df6ed31972
refs/heads/master
2021-03-14T10:40:43.304000
2020-03-12T06:30:58
2020-03-12T06:30:58
246,759,495
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * 插入排序 * * @author ZHENG * @version 1.0 * @date 2020/3/6 19:14 */ public class InsertionSorter implements Sorter { @Override public void sorter(int[] arr) { if (arr == null || arr.length <= 1){ return; } for (int i = 1; i < arr.length ; i++) { int elem = arr[i]; int j = i -1; while (j>=0 && elem < arr[j]){ arr[j+1] = arr[j]; j--; } arr[j+1] = elem; } } }
UTF-8
Java
525
java
InsertionSorter.java
Java
[ { "context": "/**\n * 插入排序\n *\n * @author ZHENG\n * @version 1.0\n * @date 2020/3/6 19:14\n */\npubli", "end": 31, "score": 0.9900827407836914, "start": 26, "tag": "NAME", "value": "ZHENG" } ]
null
[]
/** * 插入排序 * * @author ZHENG * @version 1.0 * @date 2020/3/6 19:14 */ public class InsertionSorter implements Sorter { @Override public void sorter(int[] arr) { if (arr == null || arr.length <= 1){ return; } for (int i = 1; i < arr.length ; i++) { int elem = arr[i]; int j = i -1; while (j>=0 && elem < arr[j]){ arr[j+1] = arr[j]; j--; } arr[j+1] = elem; } } }
525
0.396518
0.361702
26
18.884615
15.189386
48
false
false
0
0
0
0
0
0
0.384615
false
false
6
8b6790e1c077c42c3a2990fb763217f18205f997
28,991,029,313,599
dc4034c07c0f8d2d141ab810ffcacdc2df886510
/app/src/main/java/whimsicalgl/knowledgebank/ui/popupbox/ChooseTypePopupWindow.java
3cbb02e61d564ba562412dc2c1264b0f4cb35c15
[]
no_license
mylyed/KnowledgeBank
https://github.com/mylyed/KnowledgeBank
57a89a845e493b6fc38aef7489f56c7306ed76b5
3d94695ab44d05a45bb0fdb48cc39a1d28c4d64b
refs/heads/master
2021-01-10T06:58:06.616000
2015-12-02T03:21:58
2015-12-02T03:21:58
46,544,624
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package whimsicalgl.knowledgebank.ui.popupbox; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.FrameLayout; import android.widget.PopupWindow; import whimsicalgl.knowledgebank.R; import whimsicalgl.knowledgebank.model.Section; import whimsicalgl.knowledgebank.model.Topic; import whimsicalgl.knowledgebank.ui.activity.TopicActivity; /** * 题型选择对话框 */ public class ChooseTypePopupWindow implements View.OnClickListener { Context context; View view; Section section; AlertDialog alertDialog; public ChooseTypePopupWindow(Context context, Section section) { this.context = context; this.section = section; alertDialog = new AlertDialog.Builder(context).create(); alertDialog.show(); view = LayoutInflater.from(context).inflate(R.layout.choose_type, null); Window window = alertDialog.getWindow(); window.setContentView(view); initView(view); initParameter(); initListener(); } private Button danxuan; private Button duoxuan; private Button panduan; private void initView(View view) { danxuan = (Button) view.findViewById(R.id.danxuan); duoxuan = (Button) view.findViewById(R.id.duoxuan); panduan = (Button) view.findViewById(R.id.panduan); } private void initParameter() { danxuan.setText("单选:" + section.getCount_radio() + "道"); duoxuan.setText("多选:" + section.getCount_multi() + "道"); panduan.setText("判断:" + section.getCount_judge() + "道"); } private void initListener() { view.setOnClickListener(this); danxuan.setOnClickListener(this); duoxuan.setOnClickListener(this); panduan.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.danxuan: startActivity(Topic.TYPE.RADIO); break; case R.id.duoxuan: startActivity(Topic.TYPE.MULTISELECT); break; case R.id.panduan: startActivity(Topic.TYPE.JUDGE); break; } alertDialog.dismiss(); } private void startActivity(Topic.TYPE type) { Intent intent = new Intent(context, TopicActivity.class); intent.putExtra(Section.class.getCanonicalName(), section); intent.putExtra(Topic.TYPE.class.getCanonicalName(), type); context.startActivity(intent); } }
UTF-8
Java
2,735
java
ChooseTypePopupWindow.java
Java
[]
null
[]
package whimsicalgl.knowledgebank.ui.popupbox; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.FrameLayout; import android.widget.PopupWindow; import whimsicalgl.knowledgebank.R; import whimsicalgl.knowledgebank.model.Section; import whimsicalgl.knowledgebank.model.Topic; import whimsicalgl.knowledgebank.ui.activity.TopicActivity; /** * 题型选择对话框 */ public class ChooseTypePopupWindow implements View.OnClickListener { Context context; View view; Section section; AlertDialog alertDialog; public ChooseTypePopupWindow(Context context, Section section) { this.context = context; this.section = section; alertDialog = new AlertDialog.Builder(context).create(); alertDialog.show(); view = LayoutInflater.from(context).inflate(R.layout.choose_type, null); Window window = alertDialog.getWindow(); window.setContentView(view); initView(view); initParameter(); initListener(); } private Button danxuan; private Button duoxuan; private Button panduan; private void initView(View view) { danxuan = (Button) view.findViewById(R.id.danxuan); duoxuan = (Button) view.findViewById(R.id.duoxuan); panduan = (Button) view.findViewById(R.id.panduan); } private void initParameter() { danxuan.setText("单选:" + section.getCount_radio() + "道"); duoxuan.setText("多选:" + section.getCount_multi() + "道"); panduan.setText("判断:" + section.getCount_judge() + "道"); } private void initListener() { view.setOnClickListener(this); danxuan.setOnClickListener(this); duoxuan.setOnClickListener(this); panduan.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.danxuan: startActivity(Topic.TYPE.RADIO); break; case R.id.duoxuan: startActivity(Topic.TYPE.MULTISELECT); break; case R.id.panduan: startActivity(Topic.TYPE.JUDGE); break; } alertDialog.dismiss(); } private void startActivity(Topic.TYPE type) { Intent intent = new Intent(context, TopicActivity.class); intent.putExtra(Section.class.getCanonicalName(), section); intent.putExtra(Topic.TYPE.class.getCanonicalName(), type); context.startActivity(intent); } }
2,735
0.661105
0.661105
87
30
21.104557
80
false
false
0
0
0
0
0
0
0.666667
false
false
6
8bbb09ab6616a2bf4b74c9acca00480108282ff9
25,331,717,147,464
d2ed5e4ccb108c02c0d6d37e6c81ea0283230179
/app/src/main/java/com/example/retrofitexamples/Api.java
9aab7880bb0d6536f2ec646f35170d44cad1416e
[]
no_license
Brahmadatta/RetrofitExamples
https://github.com/Brahmadatta/RetrofitExamples
fa47f408563e1e7ccfde9a8d523b1bf6b8c217bb
973d1494e3925484f164d598358e46f4858eb003
refs/heads/master
2020-06-21T03:55:07.326000
2019-07-17T07:27:59
2019-07-17T07:27:59
197,337,944
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.retrofitexamples; public interface Api { }
UTF-8
Java
64
java
Api.java
Java
[]
null
[]
package com.example.retrofitexamples; public interface Api { }
64
0.796875
0.796875
4
15
15.443445
37
false
false
0
0
0
0
0
0
0.25
false
false
6
0beb70b63084021eecafd85913703cbc245ea4bb
25,331,717,145,180
f5eecee7944a7fe38d3d100fc8316a91252a1170
/RecursiveInsertion/src/InsertionSortRecursive.java
a4c53ecc58715fc772e7c8b23d7de0a5657b1a03
[]
no_license
joaobnd/tst-eda
https://github.com/joaobnd/tst-eda
729b99ce6e7b85cf12b8e2122fbcd6e428b2eb1b
5949c23db0aa4d7fd8823366e0078e6df8b19c24
refs/heads/master
2020-07-02T22:14:39.935000
2019-10-08T02:10:57
2019-10-08T02:10:57
201,684,067
1
1
null
false
2019-10-08T02:10:59
2019-08-10T21:19:37
2019-08-12T19:08:26
2019-10-08T02:10:58
82
1
1
0
Java
false
false
import java.util.Arrays; import java.util.Scanner; public class InsertionSortRecursive { public static void recursiveInsertion(int[] valores) { recursiveInsertion(valores, 1, valores.length); } public static void recursiveInsertion(int[] valores, int i, int n) { if(i <= n-1) { int aux = valores[i]; int j = i; while((j>0) && (valores[j-1] > aux)) { valores[j] = valores[j-1]; j--; } valores[j] = aux; System.out.println(Arrays.toString(valores)); recursiveInsertion(valores, i+1, n); } } public static void main(String[] args) { Scanner ler = new Scanner(System.in); String[] dados = ler.nextLine().split(" "); int[] valores = new int[dados.length]; ler.close(); for (int i=0;i<valores.length;i++) { valores[i] = Integer.parseInt(dados[i]); } recursiveInsertion(valores); } }
UTF-8
Java
861
java
InsertionSortRecursive.java
Java
[]
null
[]
import java.util.Arrays; import java.util.Scanner; public class InsertionSortRecursive { public static void recursiveInsertion(int[] valores) { recursiveInsertion(valores, 1, valores.length); } public static void recursiveInsertion(int[] valores, int i, int n) { if(i <= n-1) { int aux = valores[i]; int j = i; while((j>0) && (valores[j-1] > aux)) { valores[j] = valores[j-1]; j--; } valores[j] = aux; System.out.println(Arrays.toString(valores)); recursiveInsertion(valores, i+1, n); } } public static void main(String[] args) { Scanner ler = new Scanner(System.in); String[] dados = ler.nextLine().split(" "); int[] valores = new int[dados.length]; ler.close(); for (int i=0;i<valores.length;i++) { valores[i] = Integer.parseInt(dados[i]); } recursiveInsertion(valores); } }
861
0.630662
0.622532
41
20
19.45727
69
false
false
0
0
0
0
0
0
2.365854
false
false
6
28daf05651e2c59224289eeb8c8b022f5b1db090
4,904,852,694,999
8af6e4d430fce268088e6fcf5fc69a0fd51d0be4
/src/com/ltsznh/gwt/client/fb/DyAccount.java
7145673c8cff245ac7f8c189bbc410b47b43435f
[]
no_license
FamilySystem/FamilySystemWeb
https://github.com/FamilySystem/FamilySystemWeb
5eac8e6185692e2d6dd1b14ea81cc1496522332f
62afe524b4af238f05fafd8961857f998b620f56
refs/heads/master
2018-01-07T16:42:20.157000
2017-04-29T01:44:59
2017-04-29T01:44:59
37,499,812
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ltsznh.gwt.client.fb; import java.util.HashMap; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; import com.ltsznh.gwt.client.Home; import com.ltsznh.gwt.client.procResultData; import com.ltsznh.gwt.shared.grid.GDataGrid; import com.ltsznh.gwt.shared.model.ResultData; import com.ltsznh.gwt.shared.util.Message; import com.ltsznh.gwt.shared.util.NextFocus; import com.ltsznh.gwt.shared.widget.AddButton; import com.ltsznh.gwt.shared.widget.CancelButton; import com.ltsznh.gwt.shared.widget.EditButton; import com.ltsznh.gwt.shared.widget.ResetButton0; import com.ltsznh.gwt.shared.widget.SearchButton; import com.ltsznh.gwt.shared.widget.SelectBox; import com.ltsznh.gwt.shared.widget.SelectListBox; public class DyAccount extends Composite { private static Function0ManagePanelUiBinder uiBinder = GWT.create(Function0ManagePanelUiBinder.class); @UiField FlexTable selectTable; @UiField GDataGrid resultGrid; @UiField SelectListBox slIsEnabled; @UiField SearchButton sBtn; @UiField ResetButton0 rBtn; @UiField EditButton eBtn; @UiField VerticalPanel editPanel; @UiField SelectBox editAccountCode; @UiField SelectBox editAccountName; @UiField SelectListBox editIsEnabled; @UiField CancelButton editCBtn; @UiField EditButton editEBtn; @UiField SelectListBox slAccountTypeName; @UiField AddButton nBtn; @UiField AddButton newBtn; @UiField SelectBox editDisplayOrder; @UiField SelectListBox slIsCredit; @UiField SelectListBox editAccountTypeName; private DialogBox editDialogBox; interface Function0ManagePanelUiBinder extends UiBinder<Widget, DyAccount> { } public DyAccount() { initWidget(uiBinder.createAndBindUi(this)); selectTable.setWidget(0, 0, slAccountTypeName); selectTable.setWidget(0, 1, slIsEnabled); selectTable.setWidget(1, 0, slIsCredit); selectTable.setWidget(0, 3, sBtn); selectTable.setWidget(0, 4, rBtn); selectTable.setWidget(1, 3, eBtn); selectTable.setWidget(1, 4, nBtn); NextFocus.next(slAccountTypeName, slIsCredit); NextFocus.next(slIsCredit, slIsEnabled); NextFocus.next(slIsEnabled, sBtn); NextFocus.next(editAccountCode, editAccountName); NextFocus.next(editAccountName, editIsEnabled); NextFocus.next(editIsEnabled, editDisplayOrder); slIsCredit.setValue(new String[][] { { "", "" }, { "是", "Y" }, { "否", "N" } }); slIsEnabled.setValue(new String[][] { { "", "" }, { "是", "Y" }, { "否", "N" } }); editIsEnabled.setValue(new String[][] { { "是", "Y" }, { "否", "N" } }); slAccountTypeName.addBlank(); HashMap<String, Object> param = new HashMap<String, Object>(); Home.putParam(param); param.put("fromClass", this.getClass().toString()); param.put("className", "fb.dyAccount"); param.put("methodName", "getAccountType"); Home.greetingService.greetServer(param, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { slAccountTypeName.setValue(result, 1, 0, 0); editAccountTypeName.setValue(result, 1, 0, 0); } else { procResultData.proc(result); } } }); resultGrid.setSingleSelectionModel(); SearchResult(0); editDialogBox = new DialogBox(true, true); editDialogBox.setWidget(editPanel); editDialogBox.setGlassEnabled(true); sBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub SearchResult(0); } }); rBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub resetItem(); } }); eBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub updateOrInsert(event); } }); editCBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub editDialogBox.hide(); slAccountTypeName.setFocus(true); } }); editEBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub editItem(); } }); nBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub updateOrInsert(event); } }); newBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub newItem(); } }); } protected void newItem() { // TODO Auto-generated method stub if (editAccountCode.getSqlFormatText().equals("")) { new Message().alert("类型代码不能为空!"); editAccountCode.setFocus(true); return; } HashMap<String, Object> newUser = new HashMap<String, Object>(); Home.putParam(newUser); newUser.put("ctc", editAccountTypeName.getValue()); newUser.put("cc", editAccountCode.getSqlFormatText()); newUser.put("cn", editAccountName.getSqlFormatText()); newUser.put("isEnabled", editIsEnabled.getValue()); newUser.put("cdisplay", editDisplayOrder.getSqlFormatText()); newUser.put("fromClass", this.getClass().toString()); newUser.put("className", "fb.dyAccount"); newUser.put("methodName", "newAccount"); Home.greetingService.greetServer(newUser, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { SearchResult(resultGrid.getPageStart()); editDialogBox.hide(); editAccountCode.setText(""); editAccountName.setText(""); editIsEnabled.setSelectValue("Y"); } else { if (result.getLevel() == 1) { editAccountCode.selectAll(); editAccountCode.setFocus(true); } procResultData.proc(result); } } }); } protected void editItem() { // TODO Auto-generated method stub HashMap<String, Object> editUser = new HashMap<String, Object>(); Home.putParam(editUser); editUser.put("ctc", editAccountTypeName.getValue()); editUser.put("cc", editAccountCode.getSqlFormatText()); editUser.put("cn", editAccountName.getSqlFormatText()); editUser.put("isEnabled", editIsEnabled.getValue()); editUser.put("cdisplay", editDisplayOrder.getSqlFormatText()); editUser.put("fromClass", this.getClass().toString()); editUser.put("className", "fb.dyAccount"); editUser.put("methodName", "editAccount"); Home.greetingService.greetServer(editUser, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { SearchResult(resultGrid.getPageStart()); } else { procResultData.proc(result); } editDialogBox.hide(); } }); } /** * 修改或新增 * * @param event */ protected void updateOrInsert(ClickEvent event) { // TODO Auto-generated method stub String[] selectedObject = resultGrid.getSingleSelectedObject(); boolean isEdit = true; if (event.getSource().equals(eBtn.getSource())) { isEdit = true; } else { isEdit = false; } if (selectedObject != null) { editAccountTypeName.setSelectValue(selectedObject[resultGrid.getColumnIndex("账户类型代码")]); editAccountCode.setText(selectedObject[resultGrid.getColumnIndex("账户代码")]); editAccountName.setText(selectedObject[resultGrid.getColumnIndex("账户名称")]); editIsEnabled.setSelectValue(selectedObject[resultGrid.getColumnIndex("可用")]); editDisplayOrder.setText(selectedObject[resultGrid.getColumnIndex("显示顺序")]); if (isEdit) { if (newBtn.isVisible()) { newBtn.setVisible(false); editAccountCode.setEnabled(false); editEBtn.setVisible(true); editDialogBox.setText("修改账户"); } editDialogBox.setVisible(true); editDialogBox.center(); editAccountName.setFocus(true); } } else if (!isEdit) { editAccountCode.setText(""); editAccountName.setText(""); editDisplayOrder.setText(""); editIsEnabled.setSelectValue("Y"); } if (!isEdit) { if (editEBtn.isVisible()) { editEBtn.setVisible(false); editAccountCode.setEnabled(true); editAccountTypeName.setEnabled(true); newBtn.setVisible(true); editDialogBox.setText("新增账户"); } editDialogBox.setVisible(true); editDialogBox.center(); editAccountCode.setFocus(true); } } /** * 重置 */ protected void resetItem() { // TODO Auto-generated method stub slAccountTypeName.reset(); slIsCredit.reset(); slIsEnabled.reset(); slAccountTypeName.setFocus(true); } /** * 设置是否可用 * * @param enabled */ void setEnabled(boolean enabled) { sBtn.setEnabled(enabled); slAccountTypeName.setEnabled(enabled); slIsEnabled.setEnabled(enabled); slIsCredit.setEnabled(enabled); slAccountTypeName.setFocus(true); } /** * 刷新结果 */ public void SearchResult(final int pageStart) { setEnabled(false); HashMap<String, Object> param = new HashMap<String, Object>(); Home.putParam(param); param.put("ctc", slAccountTypeName.getValue()); param.put("cic", slIsCredit.getValue()); param.put("isEnabled", slIsEnabled.getValue()); param.put("fromClass", this.getClass().toString()); param.put("className", "fb.dyAccount"); param.put("methodName", "getAccount"); Home.greetingService.greetServer(param, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { resultGrid.setResultData(result, pageStart); } else { procResultData.proc(result); } } }); setEnabled(true); } }
UTF-8
Java
11,165
java
DyAccount.java
Java
[]
null
[]
package com.ltsznh.gwt.client.fb; import java.util.HashMap; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; import com.ltsznh.gwt.client.Home; import com.ltsznh.gwt.client.procResultData; import com.ltsznh.gwt.shared.grid.GDataGrid; import com.ltsznh.gwt.shared.model.ResultData; import com.ltsznh.gwt.shared.util.Message; import com.ltsznh.gwt.shared.util.NextFocus; import com.ltsznh.gwt.shared.widget.AddButton; import com.ltsznh.gwt.shared.widget.CancelButton; import com.ltsznh.gwt.shared.widget.EditButton; import com.ltsznh.gwt.shared.widget.ResetButton0; import com.ltsznh.gwt.shared.widget.SearchButton; import com.ltsznh.gwt.shared.widget.SelectBox; import com.ltsznh.gwt.shared.widget.SelectListBox; public class DyAccount extends Composite { private static Function0ManagePanelUiBinder uiBinder = GWT.create(Function0ManagePanelUiBinder.class); @UiField FlexTable selectTable; @UiField GDataGrid resultGrid; @UiField SelectListBox slIsEnabled; @UiField SearchButton sBtn; @UiField ResetButton0 rBtn; @UiField EditButton eBtn; @UiField VerticalPanel editPanel; @UiField SelectBox editAccountCode; @UiField SelectBox editAccountName; @UiField SelectListBox editIsEnabled; @UiField CancelButton editCBtn; @UiField EditButton editEBtn; @UiField SelectListBox slAccountTypeName; @UiField AddButton nBtn; @UiField AddButton newBtn; @UiField SelectBox editDisplayOrder; @UiField SelectListBox slIsCredit; @UiField SelectListBox editAccountTypeName; private DialogBox editDialogBox; interface Function0ManagePanelUiBinder extends UiBinder<Widget, DyAccount> { } public DyAccount() { initWidget(uiBinder.createAndBindUi(this)); selectTable.setWidget(0, 0, slAccountTypeName); selectTable.setWidget(0, 1, slIsEnabled); selectTable.setWidget(1, 0, slIsCredit); selectTable.setWidget(0, 3, sBtn); selectTable.setWidget(0, 4, rBtn); selectTable.setWidget(1, 3, eBtn); selectTable.setWidget(1, 4, nBtn); NextFocus.next(slAccountTypeName, slIsCredit); NextFocus.next(slIsCredit, slIsEnabled); NextFocus.next(slIsEnabled, sBtn); NextFocus.next(editAccountCode, editAccountName); NextFocus.next(editAccountName, editIsEnabled); NextFocus.next(editIsEnabled, editDisplayOrder); slIsCredit.setValue(new String[][] { { "", "" }, { "是", "Y" }, { "否", "N" } }); slIsEnabled.setValue(new String[][] { { "", "" }, { "是", "Y" }, { "否", "N" } }); editIsEnabled.setValue(new String[][] { { "是", "Y" }, { "否", "N" } }); slAccountTypeName.addBlank(); HashMap<String, Object> param = new HashMap<String, Object>(); Home.putParam(param); param.put("fromClass", this.getClass().toString()); param.put("className", "fb.dyAccount"); param.put("methodName", "getAccountType"); Home.greetingService.greetServer(param, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { slAccountTypeName.setValue(result, 1, 0, 0); editAccountTypeName.setValue(result, 1, 0, 0); } else { procResultData.proc(result); } } }); resultGrid.setSingleSelectionModel(); SearchResult(0); editDialogBox = new DialogBox(true, true); editDialogBox.setWidget(editPanel); editDialogBox.setGlassEnabled(true); sBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub SearchResult(0); } }); rBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub resetItem(); } }); eBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub updateOrInsert(event); } }); editCBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub editDialogBox.hide(); slAccountTypeName.setFocus(true); } }); editEBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub editItem(); } }); nBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub updateOrInsert(event); } }); newBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub newItem(); } }); } protected void newItem() { // TODO Auto-generated method stub if (editAccountCode.getSqlFormatText().equals("")) { new Message().alert("类型代码不能为空!"); editAccountCode.setFocus(true); return; } HashMap<String, Object> newUser = new HashMap<String, Object>(); Home.putParam(newUser); newUser.put("ctc", editAccountTypeName.getValue()); newUser.put("cc", editAccountCode.getSqlFormatText()); newUser.put("cn", editAccountName.getSqlFormatText()); newUser.put("isEnabled", editIsEnabled.getValue()); newUser.put("cdisplay", editDisplayOrder.getSqlFormatText()); newUser.put("fromClass", this.getClass().toString()); newUser.put("className", "fb.dyAccount"); newUser.put("methodName", "newAccount"); Home.greetingService.greetServer(newUser, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { SearchResult(resultGrid.getPageStart()); editDialogBox.hide(); editAccountCode.setText(""); editAccountName.setText(""); editIsEnabled.setSelectValue("Y"); } else { if (result.getLevel() == 1) { editAccountCode.selectAll(); editAccountCode.setFocus(true); } procResultData.proc(result); } } }); } protected void editItem() { // TODO Auto-generated method stub HashMap<String, Object> editUser = new HashMap<String, Object>(); Home.putParam(editUser); editUser.put("ctc", editAccountTypeName.getValue()); editUser.put("cc", editAccountCode.getSqlFormatText()); editUser.put("cn", editAccountName.getSqlFormatText()); editUser.put("isEnabled", editIsEnabled.getValue()); editUser.put("cdisplay", editDisplayOrder.getSqlFormatText()); editUser.put("fromClass", this.getClass().toString()); editUser.put("className", "fb.dyAccount"); editUser.put("methodName", "editAccount"); Home.greetingService.greetServer(editUser, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { SearchResult(resultGrid.getPageStart()); } else { procResultData.proc(result); } editDialogBox.hide(); } }); } /** * 修改或新增 * * @param event */ protected void updateOrInsert(ClickEvent event) { // TODO Auto-generated method stub String[] selectedObject = resultGrid.getSingleSelectedObject(); boolean isEdit = true; if (event.getSource().equals(eBtn.getSource())) { isEdit = true; } else { isEdit = false; } if (selectedObject != null) { editAccountTypeName.setSelectValue(selectedObject[resultGrid.getColumnIndex("账户类型代码")]); editAccountCode.setText(selectedObject[resultGrid.getColumnIndex("账户代码")]); editAccountName.setText(selectedObject[resultGrid.getColumnIndex("账户名称")]); editIsEnabled.setSelectValue(selectedObject[resultGrid.getColumnIndex("可用")]); editDisplayOrder.setText(selectedObject[resultGrid.getColumnIndex("显示顺序")]); if (isEdit) { if (newBtn.isVisible()) { newBtn.setVisible(false); editAccountCode.setEnabled(false); editEBtn.setVisible(true); editDialogBox.setText("修改账户"); } editDialogBox.setVisible(true); editDialogBox.center(); editAccountName.setFocus(true); } } else if (!isEdit) { editAccountCode.setText(""); editAccountName.setText(""); editDisplayOrder.setText(""); editIsEnabled.setSelectValue("Y"); } if (!isEdit) { if (editEBtn.isVisible()) { editEBtn.setVisible(false); editAccountCode.setEnabled(true); editAccountTypeName.setEnabled(true); newBtn.setVisible(true); editDialogBox.setText("新增账户"); } editDialogBox.setVisible(true); editDialogBox.center(); editAccountCode.setFocus(true); } } /** * 重置 */ protected void resetItem() { // TODO Auto-generated method stub slAccountTypeName.reset(); slIsCredit.reset(); slIsEnabled.reset(); slAccountTypeName.setFocus(true); } /** * 设置是否可用 * * @param enabled */ void setEnabled(boolean enabled) { sBtn.setEnabled(enabled); slAccountTypeName.setEnabled(enabled); slIsEnabled.setEnabled(enabled); slIsCredit.setEnabled(enabled); slAccountTypeName.setFocus(true); } /** * 刷新结果 */ public void SearchResult(final int pageStart) { setEnabled(false); HashMap<String, Object> param = new HashMap<String, Object>(); Home.putParam(param); param.put("ctc", slAccountTypeName.getValue()); param.put("cic", slIsCredit.getValue()); param.put("isEnabled", slIsEnabled.getValue()); param.put("fromClass", this.getClass().toString()); param.put("className", "fb.dyAccount"); param.put("methodName", "getAccount"); Home.greetingService.greetServer(param, new AsyncCallback<ResultData>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub procResultData.proc(caught); } @Override public void onSuccess(ResultData result) { // TODO Auto-generated method stub if (result.getStatus()) { resultGrid.setResultData(result, pageStart); } else { procResultData.proc(result); } } }); setEnabled(true); } }
11,165
0.689
0.686464
379
27.142481
20.908161
103
false
false
0
0
0
0
0
0
2.762533
false
false
6
e7ea588a2cb9f20905d626aceaabd0852cc0fa1d
4,904,852,698,532
2b7e637d7ef45049fc06a12dc2173352713d9aef
/src/test/java/org/boon/IOTest.java
e05e99784cab4f8818630d8ac619f58ff98cee3e
[ "Apache-2.0" ]
permissive
crohrbaugh/boon
https://github.com/crohrbaugh/boon
68885dc1869e64bc5a8426415dcea894042272d3
f88350253d67465418e38ed9620d8e71b1d48c0d
refs/heads/master
2020-04-05T23:28:16.550000
2013-12-16T19:15:03
2013-12-16T19:15:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.boon; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; import org.boon.core.Sys; import org.junit.Before; import org.junit.Test; import java.io.*; import java.net.InetSocketAddress; import java.net.URI; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.regex.Pattern; import static javax.xml.bind.DatatypeConverter.parseInt; import static org.boon.Boon.puts; import static org.boon.Exceptions.die; import static org.boon.Lists.idx; import static org.boon.Lists.len; import static org.boon.Lists.list; import static org.junit.Assert.assertEquals; public class IOTest { File testDir ; File testFile ; @Before public void init() { //move testFile and testDir up here for all of the other tests if (Sys.isWindows()) { testDir = new File("src\\test\\resources"); } else { testDir = new File("src/test/resources"); } testFile = new File(testDir, "testfile.txt"); } @Test public void testReadLinesFromFileAsBufferedReader() throws Exception { List<String> lines = IO.readLines(new BufferedReader(new FileReader(testFile))); assertLines(lines); } @Test public void testReadLinesFromFileAsInputStream() throws Exception { List<String> lines = IO.readLines(new FileInputStream(testFile)); assertLines(lines); } // @Test //TODO Test breaks under windows, probably an issue with split line. //public void testReadFromFileAsInputStreamCharSet() throws Exception { // File testDir = new File("src/test/resources"); // File testFile = new File(testDir, "testfile.txt"); // String buf = IO.read(new FileInputStream(testFile), "UTF-8"); // assertLines( list ( Str.splitLines(buf) ) ); //} @Test public void testReadLines() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); List<String> lines = IO.readLines(testFile); assertLines(lines); } @Test public void testReadEachLine() { IO.eachLine("src/test/resources/testfile.txt", new IO.EachLine() { @Override public boolean line(String line, int index) { System.out.println(index + " " + line); if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadEachLineByURI() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); IO.eachLine(testFile.toURI().toString(), new IO.EachLine() { @Override public boolean line(String line, int index) { System.out.println(index + " " + line); if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadFromHttp() throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(9666), 0); server.createContext("/test", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); Thread.sleep(10); List<String> lines = IO.readLines("http://localhost:9666/test"); assertLines(lines); } @Test public void testReadEachLineHttp() throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(9668), 0); server.createContext("/test", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); Thread.sleep(10); IO.eachLine( "http://localhost:9668/test", new IO.EachLine() { @Override public boolean line(String line, int index) { if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); } @Test public void testReadEachLineReader() throws Exception { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); IO.eachLine( new FileReader( testFile ), new IO.EachLine() { @Override public boolean line(String line, int index) { if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadEachLineInputStream() throws Exception { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); IO.eachLine( new FileInputStream( testFile ), new IO.EachLine() { @Override public boolean line(String line, int index) { if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadAll() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); String content = IO.read(testFile); List<String> lines = IO.readLines(new StringReader(content)); assertLines(lines); } private void assertLines(List<String> lines) { assertEquals( 4, len(lines) ); assertEquals( "line 1", idx(lines, 0) ); assertEquals( "grapes", idx(lines, 3) ); } @Test public void testReadLinesFromPath() { //changed "src/test/resources/testfile.txt" to testFile.toString List<String> lines = IO.readLines(testFile.toString()); assertLines(lines); } @Test public void testReadAllFromPath() { String content = IO.read(testFile.toString()); List<String> lines = IO.readLines( new StringReader(content) ); assertLines(lines); } @Test public void testReadWriteLines() { ByteArrayOutputStream bos = new ByteArrayOutputStream(); IO.write(bos, "line 1\n"); IO.write(bos, "apple\n"); IO.write(bos, "pear\n"); IO.write(bos, "grapes\n"); List<String> lines = IO.readLines(new ByteArrayInputStream(bos.toByteArray())); assertLines(lines); } @Test public void testReadWriteLinesCharSet() { ByteArrayOutputStream bos = new ByteArrayOutputStream(); IO.write(bos, "line 1\n", Charset.forName("UTF-8")); IO.write(bos, "apple\n", IO.DEFAULT_CHARSET); IO.write(bos, "pear\n", IO.DEFAULT_CHARSET); IO.write(bos, "grapes\n", IO.DEFAULT_CHARSET); List<String> lines = IO.readLines(new ByteArrayInputStream(bos.toByteArray())); assertLines(lines); } @Test public void testReadLinesURI() { URI uri = testFile.toURI(); System.out.println(uri); //"file:///....src/test/resources/testfile.txt" List<String> lines = IO.readLines(uri.toString()); assertLines(lines); } @Test public void testReadAllLinesURI() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); URI uri = testFile.toURI(); System.out.println(uri); String content = IO.read(uri.toString()); List<String> lines = IO.readLines( new StringReader(content) ); assertLines(lines); } static class MyHandler implements HttpHandler { public void handle(HttpExchange t) throws IOException { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); String body = IO.read(testFile); t.sendResponseHeaders(200, body.length()); OutputStream os = t.getResponseBody(); os.write(body.getBytes(StandardCharsets.UTF_8.displayName())); os.close(); } } @Test public void testReadAllFromHttp() throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(9777), 0); server.createContext("/test", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); Thread.sleep(10); String content = IO.read("http://localhost:9777/test"); List<String> lines = IO.readLines(new StringReader(content)); assertLines(lines); } @SuppressWarnings("unchecked") public static class ProxyLoader { private static final String DATA_FILE = "./files/proxy.txt"; private List<Proxy> proxyList = Collections.EMPTY_LIST; private final String dataFile; public ProxyLoader() { this.dataFile = DATA_FILE; init(); } public ProxyLoader(String dataFile) { this.dataFile = DATA_FILE; init(); } private void init() { List <String> lines = IO.readLines(dataFile); proxyList = new ArrayList<>(lines.size()); for (String line : lines) { proxyList.add(Proxy.createProxy(line)); } } public String getDataFile() { return this.dataFile; } public static List<Proxy> loadProxies() { return new ProxyLoader().getProxyList(); } public List<Proxy> getProxyList() { return proxyList; } } public static class Proxy { private final String address; private final int port; public Proxy(String address, int port) { this.address = address; this.port = port; } public static Proxy createProxy(String line) { String[] lineSplit = line.split(":"); String address = lineSplit[0]; int port = parseInt(lineSplit[1]); return new Proxy(address, port); } public String getAddress() { return address; } public int getPort() { return port; } } public static final class Proxy2 { private final String address; private final int port; private static final String DATA_FILE = "./files/proxy.txt"; private static final Pattern addressPattern = Pattern.compile("^(\\d{1,3}[.]{1}){3}[0-9]{1,3}$"); private Proxy2(String address, int port) { /* Validate address in not null.*/ Objects.requireNonNull(address, "address should not be null"); /* Validate port is in range. */ if (port < 1 || port > 65535) { throw new IllegalArgumentException("Port is not in range port=" + port); } /* Validate address is of the form 123.12.1.5 .*/ if (!addressPattern.matcher(address).matches()) { throw new IllegalArgumentException("Invalid Inet address"); } /* Now initialize our address and port. */ this.address = address; this.port = port; } private static Proxy2 createProxy(String line) { String[] lineSplit = line.split(":"); String address = lineSplit[0]; int port = parseInt(lineSplit[1]); return new Proxy2(address, port); } public final String getAddress() { return address; } public final int getPort() { return port; } public static List<Proxy2> loadProxies() { List <String> lines = IO.readLines(DATA_FILE); List<Proxy2> proxyList = new ArrayList<>(lines.size()); for (String line : lines) { proxyList.add(createProxy(line)); } return proxyList; } } @Test public void proxyTest() { List<Proxy> proxyList = ProxyLoader.loadProxies(); assertEquals( 5, len(proxyList) ); assertEquals( "127.0.0.1", idx(proxyList, 0).getAddress() ); assertEquals( 8080, idx(proxyList, 0).getPort() ); //192.55.55.57:9091 assertEquals( "192.55.55.57", idx(proxyList, -1).getAddress() ); assertEquals( 9091, idx(proxyList, -1).getPort() ); } @Test public void proxyTest2() { List<Proxy2> proxyList = Proxy2.loadProxies(); assertEquals( 5, len(proxyList) ); assertEquals( "127.0.0.1", idx(proxyList, 0).getAddress() ); assertEquals( 8080, idx(proxyList, 0).getPort() ); //192.55.55.57:9091 assertEquals( "192.55.55.57", idx(proxyList, -1).getAddress() ); assertEquals( 9091, idx(proxyList, -1).getPort() ); } @Test public void readClasspathResource() { // I added classpath reading, listing to IO. // // This allows you to easily search a classpath (which is not included with the JDK). // // Reading resources from the classpath is included in the JDK, but treating it like a file system (listing directories, etc.) is not. // // Also a common problem with loading resources is that the resource path has different rules so if you are reading from a jar file, you need to specify clz.getResource("org/foo/foo.txt") where org is in the root, but if you are reading from the actual classpath you can specify clz.getResource("/org/foo/foo.txt");. IO utils don't care, it finds it either way. // // (I have run into this one about 1 million times, and it throws me for a loop each time. It is on stackoverflow a lot). // // Here is some sample code to check out. // // Test file is on the classpath and contains this content: // // line 1 // apple // pear // grapes boolean ok = true; ok |= Str.in ("apple", IO.read ( "classpath://testfile.txt" )) || die( "two slashes should work" ); //Proper URL ok |= Str.in ("apple", IO.read ( "classpath:///testfile.txt" )) || die( "three slashes should work" ); //Not proper URL ok |= Str.in ("apple", IO.read ( "classpath:testfile.txt" )) || die( "no slashes should work" ); //No URL ok |= Str.in ("apple", IO.readFromClasspath ( this.getClass (), "testfile.txt" )) || die( "you don't have to use classpath scheme" ); //Slash or no slash, it just works ok |= Str.in ("apple", IO.readFromClasspath ( this.getClass (), "/testfile.txt" )) || die( "on slash works" ); //You can do a listing of a directory inside of a jar file or anywhere on the classpath //this also handles duplicate entries as in two jar files having identical file locations. puts(IO.list ( "classpath:/org/node" )) ; //Proper URL ok |= Lists.idx (IO.list ( "classpath:/org/node" ), 0).endsWith ( "org" + File.separator + "node" + File.separator + "file1.txt" ) || die( ); } }
UTF-8
Java
17,084
java
IOTest.java
Java
[ { "context": "}\n\n /* Validate address is of the form 123.12.1.5 .*/\n if (!addressPattern.matcher(addre", "end": 12629, "score": 0.9945160746574402, "start": 12619, "tag": "IP_ADDRESS", "value": "123.12.1.5" }, { "context": " );\n\n\n assertEquals(\n \"127.0.0.1\", idx(proxyList, 0).getAddress()\n );\n\n\n\n ", "end": 13873, "score": 0.9997202754020691, "start": 13864, "tag": "IP_ADDRESS", "value": "127.0.0.1" }, { "context": "dx(proxyList, 0).getPort()\n );\n\n\n //192.55.55.57:9091\n assertEquals(\n \"192.5", "end": 14028, "score": 0.9996933937072754, "start": 14016, "tag": "IP_ADDRESS", "value": "192.55.55.57" }, { "context": "55.57:9091\n assertEquals(\n \"192.55.55.57\", idx(proxyList, -1).getAddress()\n );\n\n\n\n ", "end": 14085, "score": 0.9996788501739502, "start": 14073, "tag": "IP_ADDRESS", "value": "192.55.55.57" }, { "context": " );\n\n\n assertEquals(\n \"127.0.0.1\", idx(proxyList, 0).getAddress()\n );\n\n\n\n ", "end": 14436, "score": 0.9997199177742004, "start": 14427, "tag": "IP_ADDRESS", "value": "127.0.0.1" }, { "context": "dx(proxyList, 0).getPort()\n );\n\n\n //192.55.55.57:9091\n assertEquals(\n \"192.5", "end": 14591, "score": 0.9996848702430725, "start": 14579, "tag": "IP_ADDRESS", "value": "192.55.55.57" }, { "context": "55.57:9091\n assertEquals(\n \"192.55.55.57\", idx(proxyList, -1).getAddress()\n );\n\n\n\n ", "end": 14648, "score": 0.9996793866157532, "start": 14636, "tag": "IP_ADDRESS", "value": "192.55.55.57" } ]
null
[]
package org.boon; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; import org.boon.core.Sys; import org.junit.Before; import org.junit.Test; import java.io.*; import java.net.InetSocketAddress; import java.net.URI; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.regex.Pattern; import static javax.xml.bind.DatatypeConverter.parseInt; import static org.boon.Boon.puts; import static org.boon.Exceptions.die; import static org.boon.Lists.idx; import static org.boon.Lists.len; import static org.boon.Lists.list; import static org.junit.Assert.assertEquals; public class IOTest { File testDir ; File testFile ; @Before public void init() { //move testFile and testDir up here for all of the other tests if (Sys.isWindows()) { testDir = new File("src\\test\\resources"); } else { testDir = new File("src/test/resources"); } testFile = new File(testDir, "testfile.txt"); } @Test public void testReadLinesFromFileAsBufferedReader() throws Exception { List<String> lines = IO.readLines(new BufferedReader(new FileReader(testFile))); assertLines(lines); } @Test public void testReadLinesFromFileAsInputStream() throws Exception { List<String> lines = IO.readLines(new FileInputStream(testFile)); assertLines(lines); } // @Test //TODO Test breaks under windows, probably an issue with split line. //public void testReadFromFileAsInputStreamCharSet() throws Exception { // File testDir = new File("src/test/resources"); // File testFile = new File(testDir, "testfile.txt"); // String buf = IO.read(new FileInputStream(testFile), "UTF-8"); // assertLines( list ( Str.splitLines(buf) ) ); //} @Test public void testReadLines() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); List<String> lines = IO.readLines(testFile); assertLines(lines); } @Test public void testReadEachLine() { IO.eachLine("src/test/resources/testfile.txt", new IO.EachLine() { @Override public boolean line(String line, int index) { System.out.println(index + " " + line); if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadEachLineByURI() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); IO.eachLine(testFile.toURI().toString(), new IO.EachLine() { @Override public boolean line(String line, int index) { System.out.println(index + " " + line); if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadFromHttp() throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(9666), 0); server.createContext("/test", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); Thread.sleep(10); List<String> lines = IO.readLines("http://localhost:9666/test"); assertLines(lines); } @Test public void testReadEachLineHttp() throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(9668), 0); server.createContext("/test", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); Thread.sleep(10); IO.eachLine( "http://localhost:9668/test", new IO.EachLine() { @Override public boolean line(String line, int index) { if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); } @Test public void testReadEachLineReader() throws Exception { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); IO.eachLine( new FileReader( testFile ), new IO.EachLine() { @Override public boolean line(String line, int index) { if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadEachLineInputStream() throws Exception { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); IO.eachLine( new FileInputStream( testFile ), new IO.EachLine() { @Override public boolean line(String line, int index) { if (index == 0) { assertEquals( "line 1", line ); } else if (index == 3) { assertEquals( "grapes", line ); } return true; } }); //assertLines(lines); } @Test public void testReadAll() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); String content = IO.read(testFile); List<String> lines = IO.readLines(new StringReader(content)); assertLines(lines); } private void assertLines(List<String> lines) { assertEquals( 4, len(lines) ); assertEquals( "line 1", idx(lines, 0) ); assertEquals( "grapes", idx(lines, 3) ); } @Test public void testReadLinesFromPath() { //changed "src/test/resources/testfile.txt" to testFile.toString List<String> lines = IO.readLines(testFile.toString()); assertLines(lines); } @Test public void testReadAllFromPath() { String content = IO.read(testFile.toString()); List<String> lines = IO.readLines( new StringReader(content) ); assertLines(lines); } @Test public void testReadWriteLines() { ByteArrayOutputStream bos = new ByteArrayOutputStream(); IO.write(bos, "line 1\n"); IO.write(bos, "apple\n"); IO.write(bos, "pear\n"); IO.write(bos, "grapes\n"); List<String> lines = IO.readLines(new ByteArrayInputStream(bos.toByteArray())); assertLines(lines); } @Test public void testReadWriteLinesCharSet() { ByteArrayOutputStream bos = new ByteArrayOutputStream(); IO.write(bos, "line 1\n", Charset.forName("UTF-8")); IO.write(bos, "apple\n", IO.DEFAULT_CHARSET); IO.write(bos, "pear\n", IO.DEFAULT_CHARSET); IO.write(bos, "grapes\n", IO.DEFAULT_CHARSET); List<String> lines = IO.readLines(new ByteArrayInputStream(bos.toByteArray())); assertLines(lines); } @Test public void testReadLinesURI() { URI uri = testFile.toURI(); System.out.println(uri); //"file:///....src/test/resources/testfile.txt" List<String> lines = IO.readLines(uri.toString()); assertLines(lines); } @Test public void testReadAllLinesURI() { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); URI uri = testFile.toURI(); System.out.println(uri); String content = IO.read(uri.toString()); List<String> lines = IO.readLines( new StringReader(content) ); assertLines(lines); } static class MyHandler implements HttpHandler { public void handle(HttpExchange t) throws IOException { File testDir = new File("src/test/resources"); File testFile = new File(testDir, "testfile.txt"); String body = IO.read(testFile); t.sendResponseHeaders(200, body.length()); OutputStream os = t.getResponseBody(); os.write(body.getBytes(StandardCharsets.UTF_8.displayName())); os.close(); } } @Test public void testReadAllFromHttp() throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(9777), 0); server.createContext("/test", new MyHandler()); server.setExecutor(null); // creates a default executor server.start(); Thread.sleep(10); String content = IO.read("http://localhost:9777/test"); List<String> lines = IO.readLines(new StringReader(content)); assertLines(lines); } @SuppressWarnings("unchecked") public static class ProxyLoader { private static final String DATA_FILE = "./files/proxy.txt"; private List<Proxy> proxyList = Collections.EMPTY_LIST; private final String dataFile; public ProxyLoader() { this.dataFile = DATA_FILE; init(); } public ProxyLoader(String dataFile) { this.dataFile = DATA_FILE; init(); } private void init() { List <String> lines = IO.readLines(dataFile); proxyList = new ArrayList<>(lines.size()); for (String line : lines) { proxyList.add(Proxy.createProxy(line)); } } public String getDataFile() { return this.dataFile; } public static List<Proxy> loadProxies() { return new ProxyLoader().getProxyList(); } public List<Proxy> getProxyList() { return proxyList; } } public static class Proxy { private final String address; private final int port; public Proxy(String address, int port) { this.address = address; this.port = port; } public static Proxy createProxy(String line) { String[] lineSplit = line.split(":"); String address = lineSplit[0]; int port = parseInt(lineSplit[1]); return new Proxy(address, port); } public String getAddress() { return address; } public int getPort() { return port; } } public static final class Proxy2 { private final String address; private final int port; private static final String DATA_FILE = "./files/proxy.txt"; private static final Pattern addressPattern = Pattern.compile("^(\\d{1,3}[.]{1}){3}[0-9]{1,3}$"); private Proxy2(String address, int port) { /* Validate address in not null.*/ Objects.requireNonNull(address, "address should not be null"); /* Validate port is in range. */ if (port < 1 || port > 65535) { throw new IllegalArgumentException("Port is not in range port=" + port); } /* Validate address is of the form 172.16.31.10 .*/ if (!addressPattern.matcher(address).matches()) { throw new IllegalArgumentException("Invalid Inet address"); } /* Now initialize our address and port. */ this.address = address; this.port = port; } private static Proxy2 createProxy(String line) { String[] lineSplit = line.split(":"); String address = lineSplit[0]; int port = parseInt(lineSplit[1]); return new Proxy2(address, port); } public final String getAddress() { return address; } public final int getPort() { return port; } public static List<Proxy2> loadProxies() { List <String> lines = IO.readLines(DATA_FILE); List<Proxy2> proxyList = new ArrayList<>(lines.size()); for (String line : lines) { proxyList.add(createProxy(line)); } return proxyList; } } @Test public void proxyTest() { List<Proxy> proxyList = ProxyLoader.loadProxies(); assertEquals( 5, len(proxyList) ); assertEquals( "127.0.0.1", idx(proxyList, 0).getAddress() ); assertEquals( 8080, idx(proxyList, 0).getPort() ); //192.168.3.11:9091 assertEquals( "192.168.3.11", idx(proxyList, -1).getAddress() ); assertEquals( 9091, idx(proxyList, -1).getPort() ); } @Test public void proxyTest2() { List<Proxy2> proxyList = Proxy2.loadProxies(); assertEquals( 5, len(proxyList) ); assertEquals( "127.0.0.1", idx(proxyList, 0).getAddress() ); assertEquals( 8080, idx(proxyList, 0).getPort() ); //192.168.3.11:9091 assertEquals( "192.168.3.11", idx(proxyList, -1).getAddress() ); assertEquals( 9091, idx(proxyList, -1).getPort() ); } @Test public void readClasspathResource() { // I added classpath reading, listing to IO. // // This allows you to easily search a classpath (which is not included with the JDK). // // Reading resources from the classpath is included in the JDK, but treating it like a file system (listing directories, etc.) is not. // // Also a common problem with loading resources is that the resource path has different rules so if you are reading from a jar file, you need to specify clz.getResource("org/foo/foo.txt") where org is in the root, but if you are reading from the actual classpath you can specify clz.getResource("/org/foo/foo.txt");. IO utils don't care, it finds it either way. // // (I have run into this one about 1 million times, and it throws me for a loop each time. It is on stackoverflow a lot). // // Here is some sample code to check out. // // Test file is on the classpath and contains this content: // // line 1 // apple // pear // grapes boolean ok = true; ok |= Str.in ("apple", IO.read ( "classpath://testfile.txt" )) || die( "two slashes should work" ); //Proper URL ok |= Str.in ("apple", IO.read ( "classpath:///testfile.txt" )) || die( "three slashes should work" ); //Not proper URL ok |= Str.in ("apple", IO.read ( "classpath:testfile.txt" )) || die( "no slashes should work" ); //No URL ok |= Str.in ("apple", IO.readFromClasspath ( this.getClass (), "testfile.txt" )) || die( "you don't have to use classpath scheme" ); //Slash or no slash, it just works ok |= Str.in ("apple", IO.readFromClasspath ( this.getClass (), "/testfile.txt" )) || die( "on slash works" ); //You can do a listing of a directory inside of a jar file or anywhere on the classpath //this also handles duplicate entries as in two jar files having identical file locations. puts(IO.list ( "classpath:/org/node" )) ; //Proper URL ok |= Lists.idx (IO.list ( "classpath:/org/node" ), 0).endsWith ( "org" + File.separator + "node" + File.separator + "file1.txt" ) || die( ); } }
17,086
0.529267
0.518731
671
24.461996
28.708847
369
false
false
0
0
0
0
0
0
0.467958
false
false
6
4dda4cd637629dd9e421767347f73cb18acbcb83
32,495,722,600,746
b6d08cd67f6b46aa8a17ba409e1428bfde0ee53c
/app/src/main/java/com/xmrbi/warehouse/data/entity/check/RfidUpdateAutoCheckingEntity.java
e27284d135d542adcc4a517a30611a51f255f0ed
[]
no_license
ghit700/warehouse
https://github.com/ghit700/warehouse
6424f297939a7b5deca7cf80209874716e14d825
afbff2cc5765a5b1648244ed1669561327c83c06
refs/heads/master
2020-03-07T22:40:11.104000
2018-07-09T00:48:50
2018-07-09T00:48:50
127,760,348
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xmrbi.warehouse.data.entity.check; public class RfidUpdateAutoCheckingEntity { private String rfids; private boolean success; private int checkCount; private int unCheckCount; private String errorMsg; public int getUnCheckCount() { return unCheckCount; } public void setUnCheckCount(int unCheckCount) { this.unCheckCount = unCheckCount; } public String getRfids() { return rfids; } public void setRfids(String rfids) { this.rfids = rfids; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public int getCheckCount() { return checkCount; } public void setCheckCount(int checkCount) { this.checkCount = checkCount; } public String getErrorMsg() { return errorMsg; } public void setErrorMsg(String errorMsg) { this.errorMsg = errorMsg; } }
UTF-8
Java
872
java
RfidUpdateAutoCheckingEntity.java
Java
[]
null
[]
package com.xmrbi.warehouse.data.entity.check; public class RfidUpdateAutoCheckingEntity { private String rfids; private boolean success; private int checkCount; private int unCheckCount; private String errorMsg; public int getUnCheckCount() { return unCheckCount; } public void setUnCheckCount(int unCheckCount) { this.unCheckCount = unCheckCount; } public String getRfids() { return rfids; } public void setRfids(String rfids) { this.rfids = rfids; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public int getCheckCount() { return checkCount; } public void setCheckCount(int checkCount) { this.checkCount = checkCount; } public String getErrorMsg() { return errorMsg; } public void setErrorMsg(String errorMsg) { this.errorMsg = errorMsg; } }
872
0.735092
0.735092
49
16.795918
15.886047
48
false
false
0
0
0
0
0
0
1.244898
false
false
6
8b6aed35c6773c01d28a09787c051cb1f04e5ee1
13,108,240,246,045
9beca14e4556fe9b39d987f04157f42bef2c9fa9
/ls-system/ejb/src/main/java/com/ebschool/ejb/repo/GenericRepositoryImpl.java
a5209885b5cc312bf86bf3f5fac5acb2592f4585
[ "Apache-2.0" ]
permissive
michaupl/ebschool
https://github.com/michaupl/ebschool
08b41ba26ade035943aaff3ded9a0194233f887e
c0a40b21d04ae72e2d2773902deb5194f159450e
refs/heads/master
2021-01-20T06:56:46.377000
2014-02-15T20:14:08
2014-02-15T20:14:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ebschool.ejb.repo; import com.ebschool.ejb.utils.Identifiable; import org.apache.commons.lang.ArrayUtils; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.persistence.criteria.*; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; /** * User: michau * Date: 4/13/13 * Time: 2:49 PM */ @Stateless @LocalBean //@RolesAllowed({"RegisteredUsers"}) @TransactionAttribute(TransactionAttributeType.MANDATORY) public class GenericRepositoryImpl<T extends Identifiable, PK> implements GenericRepository<T, PK> { @PersistenceContext protected EntityManager entityManager; private Class<T> clazz; // needed for DI public GenericRepositoryImpl(){ } public GenericRepositoryImpl(Class<T> clazz){ this.clazz = clazz; } @Override public T getById(PK id) { return entityManager.find(clazz, id); } // yes, yes, it's Long instead of PK and non type safe root.get("id") // but it only can be as generic public T getByIdWithRelated(Long id, Enum... related){ CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> query = builder.createQuery(clazz); Root<T> root = query.from(clazz); for (Enum relation : related){ root.fetch(relation.toString(), JoinType.LEFT); } ParameterExpression<Long> p = builder.parameter(Long.class); query.select(root).where(builder.equal(root.get("id"), p)); TypedQuery<T> q = entityManager.createQuery(query); q.setParameter(p, id); return q.getSingleResult(); } @Override public T create(T object) { entityManager.persist(object); return object; } @Override public T update(T object) { return entityManager.merge(object); } @Override public void delete(T... objects) { if (ArrayUtils.isEmpty(objects)){ throw new IllegalArgumentException("At least one object to delete must be specified"); } for (T object : objects){ entityManager.remove(object); } } @Override public void deleteAll(){ if ((Long)entityManager.createQuery("SELECT COUNT(e) FROM " + clazz.getSimpleName() + " e").getSingleResult() > 0){ Set<T> entities = getAll(); // delete((T[])entities.toArray()); for (T entity : entities){ delete(entity); } // entityManager.createQuery("DELETE FROM " + clazz.getSimpleName()).executeUpdate(); } } @Override public Set<T> getAll() { return new HashSet<T>(entityManager.createQuery("From " + clazz.getSimpleName() + " c").getResultList()); } public Set<T> getAllWithRelated(Enum... related){ CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> query = builder.createQuery(clazz); Root<T> root = query.from(clazz); for (Enum relation : related){ root.fetch(relation.toString(), JoinType.LEFT); } query.select(root); TypedQuery<T> q = entityManager.createQuery(query); return new HashSet(q.getResultList()); } @Override public <T> List<T> findWithNamedQuery(Class T, String namedQueryName, Map<String, Object> parameters){ return findWithNamedQuery(T, namedQueryName, parameters, 0); } @Override public <T> List<T> findWithNamedQuery(Class T, String namedQueryName, Map<String, Object> parameters, int resultLimit){ Set<Map.Entry<String, Object>> rawParameters = parameters.entrySet(); TypedQuery<T> query = entityManager.createNamedQuery(namedQueryName, T); if(resultLimit > 0) query.setMaxResults(resultLimit); for (Map.Entry<String, Object> entry : rawParameters) { query.setParameter(entry.getKey(), entry.getValue()); } return query.getResultList(); } }
UTF-8
Java
4,214
java
GenericRepositoryImpl.java
Java
[ { "context": "java.util.Map;\nimport java.util.Set;\n\n/**\n * User: michau\n * Date: 4/13/13\n * Time: 2:49 PM\n */\n@Stateless\n", "end": 530, "score": 0.9996318817138672, "start": 524, "tag": "USERNAME", "value": "michau" } ]
null
[]
package com.ebschool.ejb.repo; import com.ebschool.ejb.utils.Identifiable; import org.apache.commons.lang.ArrayUtils; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.persistence.criteria.*; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; /** * User: michau * Date: 4/13/13 * Time: 2:49 PM */ @Stateless @LocalBean //@RolesAllowed({"RegisteredUsers"}) @TransactionAttribute(TransactionAttributeType.MANDATORY) public class GenericRepositoryImpl<T extends Identifiable, PK> implements GenericRepository<T, PK> { @PersistenceContext protected EntityManager entityManager; private Class<T> clazz; // needed for DI public GenericRepositoryImpl(){ } public GenericRepositoryImpl(Class<T> clazz){ this.clazz = clazz; } @Override public T getById(PK id) { return entityManager.find(clazz, id); } // yes, yes, it's Long instead of PK and non type safe root.get("id") // but it only can be as generic public T getByIdWithRelated(Long id, Enum... related){ CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> query = builder.createQuery(clazz); Root<T> root = query.from(clazz); for (Enum relation : related){ root.fetch(relation.toString(), JoinType.LEFT); } ParameterExpression<Long> p = builder.parameter(Long.class); query.select(root).where(builder.equal(root.get("id"), p)); TypedQuery<T> q = entityManager.createQuery(query); q.setParameter(p, id); return q.getSingleResult(); } @Override public T create(T object) { entityManager.persist(object); return object; } @Override public T update(T object) { return entityManager.merge(object); } @Override public void delete(T... objects) { if (ArrayUtils.isEmpty(objects)){ throw new IllegalArgumentException("At least one object to delete must be specified"); } for (T object : objects){ entityManager.remove(object); } } @Override public void deleteAll(){ if ((Long)entityManager.createQuery("SELECT COUNT(e) FROM " + clazz.getSimpleName() + " e").getSingleResult() > 0){ Set<T> entities = getAll(); // delete((T[])entities.toArray()); for (T entity : entities){ delete(entity); } // entityManager.createQuery("DELETE FROM " + clazz.getSimpleName()).executeUpdate(); } } @Override public Set<T> getAll() { return new HashSet<T>(entityManager.createQuery("From " + clazz.getSimpleName() + " c").getResultList()); } public Set<T> getAllWithRelated(Enum... related){ CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> query = builder.createQuery(clazz); Root<T> root = query.from(clazz); for (Enum relation : related){ root.fetch(relation.toString(), JoinType.LEFT); } query.select(root); TypedQuery<T> q = entityManager.createQuery(query); return new HashSet(q.getResultList()); } @Override public <T> List<T> findWithNamedQuery(Class T, String namedQueryName, Map<String, Object> parameters){ return findWithNamedQuery(T, namedQueryName, parameters, 0); } @Override public <T> List<T> findWithNamedQuery(Class T, String namedQueryName, Map<String, Object> parameters, int resultLimit){ Set<Map.Entry<String, Object>> rawParameters = parameters.entrySet(); TypedQuery<T> query = entityManager.createNamedQuery(namedQueryName, T); if(resultLimit > 0) query.setMaxResults(resultLimit); for (Map.Entry<String, Object> entry : rawParameters) { query.setParameter(entry.getKey(), entry.getValue()); } return query.getResultList(); } }
4,214
0.654248
0.651637
132
30.924242
28.173063
123
false
false
0
0
0
0
0
0
0.568182
false
false
6
10130c7e0d8b807d317ac3018f7b8ddcd331f8d9
30,185,030,164,592
db788c62c7e90e051b70e447345e2966c6d79e76
/statistics/src/main/java/org/osivia/services/statistics/portlet/model/StatisticsForm.java
6fca4ea60aedaee7e6715629518d30d417e124bd
[]
no_license
osivia/osivia-collaboration
https://github.com/osivia/osivia-collaboration
225648f6458b1dfd6aeb651a980ed4891920e8e3
20d0b9e8cc5c1fa3ac8d824ac3fa195a15f86e7f
refs/heads/master
2023-08-29T07:05:41.108000
2020-12-07T10:59:12
2020-12-07T10:59:12
133,329,550
0
0
null
false
2019-11-02T05:21:29
2018-05-14T08:31:31
2019-10-30T17:02:45
2019-11-02T05:21:27
4,453
0
0
1
Java
false
false
package org.osivia.services.statistics.portlet.model; import java.util.Arrays; import java.util.List; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; /** * Statistics form java-bean * * @author Cédric Krommenhoek */ @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class StatisticsForm { /** Creations view. */ private CreationsView creationsView; /** Visits view. */ private VisitsView visitsView; /** Creations views. */ private final List<CreationsView> creationsViews; /** Visits views. */ private final List<VisitsView> visitsViews; /** * Constructor. */ public StatisticsForm() { super(); this.creationsViews = Arrays.asList(CreationsView.values()); this.visitsViews = Arrays.asList(VisitsView.values()); } /** * Getter for creationsView. * * @return the creationsView */ public CreationsView getCreationsView() { return creationsView; } /** * Setter for creationsView. * * @param creationsView the creationsView to set */ public void setCreationsView(CreationsView creationsView) { this.creationsView = creationsView; } /** * Getter for visitsView. * * @return the visitsView */ public VisitsView getVisitsView() { return visitsView; } /** * Setter for visitsView. * * @param visitsView the visitsView to set */ public void setVisitsView(VisitsView visitsView) { this.visitsView = visitsView; } /** * Getter for creationsViews. * * @return the creationsViews */ public List<CreationsView> getCreationsViews() { return creationsViews; } /** * Getter for visitsViews. * * @return the visitsViews */ public List<VisitsView> getVisitsViews() { return visitsViews; } }
UTF-8
Java
2,060
java
StatisticsForm.java
Java
[ { "context": ";\n\n/**\n * Statistics form java-bean\n * \n * @author Cédric Krommenhoek\n */\n@Component\n@Scope(ConfigurableBeanFactory.SCO", "end": 346, "score": 0.999863862991333, "start": 328, "tag": "NAME", "value": "Cédric Krommenhoek" } ]
null
[]
package org.osivia.services.statistics.portlet.model; import java.util.Arrays; import java.util.List; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; /** * Statistics form java-bean * * @author <NAME> */ @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class StatisticsForm { /** Creations view. */ private CreationsView creationsView; /** Visits view. */ private VisitsView visitsView; /** Creations views. */ private final List<CreationsView> creationsViews; /** Visits views. */ private final List<VisitsView> visitsViews; /** * Constructor. */ public StatisticsForm() { super(); this.creationsViews = Arrays.asList(CreationsView.values()); this.visitsViews = Arrays.asList(VisitsView.values()); } /** * Getter for creationsView. * * @return the creationsView */ public CreationsView getCreationsView() { return creationsView; } /** * Setter for creationsView. * * @param creationsView the creationsView to set */ public void setCreationsView(CreationsView creationsView) { this.creationsView = creationsView; } /** * Getter for visitsView. * * @return the visitsView */ public VisitsView getVisitsView() { return visitsView; } /** * Setter for visitsView. * * @param visitsView the visitsView to set */ public void setVisitsView(VisitsView visitsView) { this.visitsView = visitsView; } /** * Getter for creationsViews. * * @return the creationsViews */ public List<CreationsView> getCreationsViews() { return creationsViews; } /** * Getter for visitsViews. * * @return the visitsViews */ public List<VisitsView> getVisitsViews() { return visitsViews; } }
2,047
0.63866
0.63866
94
20.904255
19.340218
72
false
false
0
0
0
0
0
0
0.202128
false
false
6
0af0fd48e08f40bda07dcce08fa855512330cc22
12,438,225,311,668
060398f2baf788e97c3fb935ee747d4c6e49d290
/web/src/main/java/ro/finsiel/eunis/jrfTables/Chm62edtSpeciesStatusDomain.java
7cb57c07f4a6bf3892d0f2ff868d3aebb5e54f24
[]
no_license
eea/eea.eunis
https://github.com/eea/eea.eunis
4dce02047c149a2a4b18e48331cf5dca86f242e0
8e1d3f97a1dba8ef8d52714a51cd44e244a4a673
refs/heads/master
2023-09-02T22:32:26.785000
2022-12-22T14:14:11
2023-02-27T13:03:53
13,385,456
0
4
null
false
2023-02-22T08:47:16
2013-10-07T14:07:58
2021-10-28T14:36:04
2023-02-22T08:47:16
147,862
0
5
17
Java
false
false
package ro.finsiel.eunis.jrfTables; import net.sf.jrf.column.columnspecs.IntegerColumnSpec; import net.sf.jrf.column.columnspecs.StringColumnSpec; import net.sf.jrf.domain.AbstractDomain; import net.sf.jrf.domain.PersistentObject; /** * JRF table for chm62edt_species_status. * @author finsiel **/ public class Chm62edtSpeciesStatusDomain extends AbstractDomain { /** * Implements newPersistentObject from AbstractDomain. * @return New persistent object (table row). */ public PersistentObject newPersistentObject() { return new Chm62edtSpeciesStatusPersist(); } /** * Implements setup from AbstractDomain. */ public void setup() { // These setters could be used to override the default. // this.setDatabasePolicy(new null()); // this.setJDBCHelper(JDBCHelperFactory.create()); this.setTableName("chm62edt_species_status"); this.setReadOnly(true); this.addColumnSpec( new IntegerColumnSpec("ID_SPECIES_STATUS", "getIdSpeciesStatus", "setIdSpeciesStatus", DEFAULT_TO_ZERO, NATURAL_PRIMARY_KEY)); this.addColumnSpec( new StringColumnSpec("DESCRIPTION", "getDescription", "setDescription", DEFAULT_TO_EMPTY_STRING, REQUIRED)); this.addColumnSpec( new StringColumnSpec("SHORT_DEFINITION", "getShortDefinition", "setShortDefinition", DEFAULT_TO_NULL)); this.addColumnSpec( new StringColumnSpec("STATUS_CODE", "getStatusCode", "setStatusCode", DEFAULT_TO_NULL)); } }
UTF-8
Java
1,675
java
Chm62edtSpeciesStatusDomain.java
Java
[ { "context": "JRF table for chm62edt_species_status.\r\n * @author finsiel\r\n **/\r\npublic class Chm62edtSpeciesStatusDomain e", "end": 310, "score": 0.9952149391174316, "start": 303, "tag": "USERNAME", "value": "finsiel" } ]
null
[]
package ro.finsiel.eunis.jrfTables; import net.sf.jrf.column.columnspecs.IntegerColumnSpec; import net.sf.jrf.column.columnspecs.StringColumnSpec; import net.sf.jrf.domain.AbstractDomain; import net.sf.jrf.domain.PersistentObject; /** * JRF table for chm62edt_species_status. * @author finsiel **/ public class Chm62edtSpeciesStatusDomain extends AbstractDomain { /** * Implements newPersistentObject from AbstractDomain. * @return New persistent object (table row). */ public PersistentObject newPersistentObject() { return new Chm62edtSpeciesStatusPersist(); } /** * Implements setup from AbstractDomain. */ public void setup() { // These setters could be used to override the default. // this.setDatabasePolicy(new null()); // this.setJDBCHelper(JDBCHelperFactory.create()); this.setTableName("chm62edt_species_status"); this.setReadOnly(true); this.addColumnSpec( new IntegerColumnSpec("ID_SPECIES_STATUS", "getIdSpeciesStatus", "setIdSpeciesStatus", DEFAULT_TO_ZERO, NATURAL_PRIMARY_KEY)); this.addColumnSpec( new StringColumnSpec("DESCRIPTION", "getDescription", "setDescription", DEFAULT_TO_EMPTY_STRING, REQUIRED)); this.addColumnSpec( new StringColumnSpec("SHORT_DEFINITION", "getShortDefinition", "setShortDefinition", DEFAULT_TO_NULL)); this.addColumnSpec( new StringColumnSpec("STATUS_CODE", "getStatusCode", "setStatusCode", DEFAULT_TO_NULL)); } }
1,675
0.643582
0.638806
47
33.638298
26.030609
80
false
false
0
0
0
0
0
0
0.595745
false
false
6
1246ea57a88ab9da071925b9c1d4229fa4357651
7,224,135,014,634
f35c699dd89380b79e2b1ec09848441167ebb490
/WiiGestureX/src/wiiGestureX/testPrograms/DataTracer.java
93f23afbe30dd7cb6074284420b09f545ca09686
[ "MIT" ]
permissive
sigh0829/Wii
https://github.com/sigh0829/Wii
96b441ec41737f070beb44502f3c045a347bea66
effc75f61113137aaf5d7afc03187f6d58423153
refs/heads/master
2021-01-18T02:15:37.910000
2013-12-12T20:17:48
2013-12-12T20:17:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package wiiGestureX.testPrograms; import javax.swing.JFrame; import motej.Mote; import motej.demos.common.SimpleMoteFinder; import motej.event.CoreButtonEvent; import motej.event.CoreButtonListener; import motej.request.ReportModeRequest; import wiiGestureX.events.GestureAccelerationListener; import wiiGestureX.util.Log; public class DataTracer{ private static Mote mote; private static boolean stopped=false; public static void main(String[] args) throws InterruptedException{ Log.level=Log.DEBUG; final JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DataGraph graph=new DataGraph(); f.add(graph); f.setSize(1024,400); f.setLocation(0,0); f.setVisible(true); TraceGesture gesture=new TraceGesture(graph); final GestureAccelerationListener listener=new GestureAccelerationListener(gesture); SimpleMoteFinder simpleMoteFinder = new SimpleMoteFinder(); System.out.println("- Press 1 and 2 simultaneously to connect your Wiimote -"); mote = simpleMoteFinder.findMote(); mote.setPlayerLeds(new boolean[] {true,false,false,false}); mote.setReportMode(ReportModeRequest.DATA_REPORT_0x31); mote.addAccelerometerListener(listener); mote.addCoreButtonListener(new CoreButtonListener() { public void buttonPressed(CoreButtonEvent evt) { if (evt.isButtonHomePressed()) { mote.setPlayerLeds(new boolean[] {false,false,false,false}); mote.removeAccelerometerListener(listener); mote.setReportMode(ReportModeRequest.DATA_REPORT_0x30); mote.disconnect(); f.dispose(); stopped=true; } } }); while(!stopped){ Thread.sleep(1000L); } } }
UTF-8
Java
1,715
java
DataTracer.java
Java
[]
null
[]
package wiiGestureX.testPrograms; import javax.swing.JFrame; import motej.Mote; import motej.demos.common.SimpleMoteFinder; import motej.event.CoreButtonEvent; import motej.event.CoreButtonListener; import motej.request.ReportModeRequest; import wiiGestureX.events.GestureAccelerationListener; import wiiGestureX.util.Log; public class DataTracer{ private static Mote mote; private static boolean stopped=false; public static void main(String[] args) throws InterruptedException{ Log.level=Log.DEBUG; final JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DataGraph graph=new DataGraph(); f.add(graph); f.setSize(1024,400); f.setLocation(0,0); f.setVisible(true); TraceGesture gesture=new TraceGesture(graph); final GestureAccelerationListener listener=new GestureAccelerationListener(gesture); SimpleMoteFinder simpleMoteFinder = new SimpleMoteFinder(); System.out.println("- Press 1 and 2 simultaneously to connect your Wiimote -"); mote = simpleMoteFinder.findMote(); mote.setPlayerLeds(new boolean[] {true,false,false,false}); mote.setReportMode(ReportModeRequest.DATA_REPORT_0x31); mote.addAccelerometerListener(listener); mote.addCoreButtonListener(new CoreButtonListener() { public void buttonPressed(CoreButtonEvent evt) { if (evt.isButtonHomePressed()) { mote.setPlayerLeds(new boolean[] {false,false,false,false}); mote.removeAccelerometerListener(listener); mote.setReportMode(ReportModeRequest.DATA_REPORT_0x30); mote.disconnect(); f.dispose(); stopped=true; } } }); while(!stopped){ Thread.sleep(1000L); } } }
1,715
0.733528
0.721283
54
30.75926
22.498507
86
false
false
0
0
0
0
0
0
2.537037
false
false
6
63671732192b4e1b604efbb5dede8221118559e6
29,094,108,504,847
943cc158455c030c5c7ba2083aae8f87316a7d7f
/MedSavantClient/src/main/java/org/ut/biolab/medsavant/client/view/LoginView.java
dace98d7fa51dda0765fc2b8eb43719d60f1b534
[]
no_license
bvancea/medsavant
https://github.com/bvancea/medsavant
c5b39e9120286a333a77bde63eec163b212325be
e109e4ffa4f0f3114a82282d92ae4720ad7c26aa
refs/heads/master
2020-12-25T09:09:28.818000
2013-08-27T22:33:39
2013-08-27T22:33:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2011-2012 University of Toronto * * 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.ut.biolab.medsavant.client.view; import java.awt.*; import java.awt.event.KeyEvent; import java.sql.SQLException; import javax.swing.Box; import javax.swing.JPanel; import javax.swing.SwingUtilities; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.ut.biolab.medsavant.client.api.Listener; import org.ut.biolab.medsavant.client.controller.SettingsController; import org.ut.biolab.medsavant.client.login.LoginController; import org.ut.biolab.medsavant.client.login.LoginEvent; import org.ut.biolab.medsavant.shared.serverapi.MedSavantProgramInformation; import org.ut.biolab.medsavant.client.util.ClientMiscUtils; import org.ut.biolab.medsavant.client.util.MedSavantWorker; import org.ut.biolab.medsavant.client.view.manage.AddRemoveDatabaseDialog; import org.ut.biolab.medsavant.client.view.images.IconFactory; import org.ut.biolab.medsavant.client.view.util.DialogUtils; import org.ut.biolab.medsavant.client.view.util.ViewUtil; /** * * @author mfiume */ public class LoginView extends JPanel implements Listener<LoginEvent> { private static final Log LOG = LogFactory.getLog(LoginView.class); private LoginController controller = LoginController.getInstance(); private static class SpiralPanel extends JPanel { private final Image img; public SpiralPanel() { img = IconFactory.getInstance().getIcon(IconFactory.StandardIcon.LOGO).getImage(); } @Override public void paintComponent(Graphics g) { //g.setColor(Color.black); //g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.drawImage(img, this.getWidth()/2-img.getWidth(null)/2, this.getHeight()/2-img.getHeight(null)/2, null); } } /** Creates new form LoginForm */ public LoginView() { initComponents(); if (ClientMiscUtils.MAC) { this.progressSigningIn.putClientProperty("JProgressBar.style", "circular"); } this.progressSigningIn.setVisible(false); titlePanel.setBackground(ViewUtil.getBGColor()); loginButton.setOpaque(false); userField.setText(controller.getUserName()); passwordField.setText(controller.getPassword()); SettingsController settings = SettingsController.getInstance(); userField.setText(settings.getUsername()); if (settings.getRememberPassword()) { passwordField.setText(settings.getPassword()); } versionLabel.setText("MedSavant " + MedSavantProgramInformation.getVersion()); titlePanel.add(Box.createVerticalGlue(),0); spiralPanel.setLayout(new BorderLayout()); spiralPanel.add(new SpiralPanel(),BorderLayout.CENTER); detailsPanel.setVisible(false); databaseField.setText(settings.getDBName()); portField.setText(settings.getServerPort()); hostField.setText(settings.getServerAddress()); setOpaque(false); setMaximumSize(new Dimension(400, 400)); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; titlePanel = new javax.swing.JPanel(); userField = new javax.swing.JTextField(); passwordField = new javax.swing.JPasswordField(); spiralPanel = new javax.swing.JPanel(); versionLabel = new javax.swing.JLabel(); javax.swing.JLabel userLabel = new javax.swing.JLabel(); javax.swing.JLabel passwordLabel = new javax.swing.JLabel(); javax.swing.JToggleButton button_settings = new javax.swing.JToggleButton(); detailsPanel = new javax.swing.JPanel(); javax.swing.JLabel hostLabel = new javax.swing.JLabel(); hostField = new javax.swing.JTextField(); javax.swing.JLabel portLabel = new javax.swing.JLabel(); portField = new javax.swing.JTextField(); javax.swing.JButton dbCreateButton = new javax.swing.JButton(); databaseField = new javax.swing.JTextField(); javax.swing.JLabel databaseLabel = new javax.swing.JLabel(); javax.swing.JButton dbRemoveButton = new javax.swing.JButton(); loginButton = new javax.swing.JButton(); progressSigningIn = new javax.swing.JProgressBar(); setLayout(new java.awt.GridBagLayout()); titlePanel.setBackground(new java.awt.Color(255, 255, 255)); titlePanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(6, 6, 6, 6)); titlePanel.setMaximumSize(new java.awt.Dimension(400, 32767)); titlePanel.setMinimumSize(new java.awt.Dimension(400, 800)); titlePanel.setOpaque(false); userField.setColumns(25); userField.setHorizontalAlignment(javax.swing.JTextField.CENTER); userField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { userFieldKeyPressed(evt); } }); passwordField.setColumns(25); passwordField.setHorizontalAlignment(javax.swing.JTextField.CENTER); passwordField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { passwordFieldKeyPressed(evt); } }); spiralPanel.setPreferredSize(new java.awt.Dimension(150, 150)); javax.swing.GroupLayout spiralPanelLayout = new javax.swing.GroupLayout(spiralPanel); spiralPanel.setLayout(spiralPanelLayout); spiralPanelLayout.setHorizontalGroup( spiralPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); spiralPanelLayout.setVerticalGroup( spiralPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 150, Short.MAX_VALUE) ); versionLabel.setFont(versionLabel.getFont()); versionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); versionLabel.setText("version information"); userLabel.setFont(new java.awt.Font("Helvetica", 0, 12)); // NOI18N userLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); userLabel.setText("USERNAME"); passwordLabel.setFont(new java.awt.Font("Helvetica", 0, 12)); // NOI18N passwordLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); passwordLabel.setText("PASSWORD"); button_settings.setText("Connection Settings"); button_settings.putClientProperty("JButton.buttonType", "textured"); button_settings.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button_settingsActionPerformed(evt); } }); detailsPanel.setBackground(new java.awt.Color(204, 204, 204)); detailsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Connection Settings", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION)); detailsPanel.setName("Connection Settings"); // NOI18N detailsPanel.setOpaque(false); hostLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); hostLabel.setText("SERVER ADDRESS"); hostField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N hostField.setHorizontalAlignment(javax.swing.JTextField.CENTER); hostField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { hostFieldKeyPressed(evt); } }); portLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); portLabel.setText("SERVER PORT"); portField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N portField.setHorizontalAlignment(javax.swing.JTextField.CENTER); portField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { portFieldKeyPressed(evt); } }); dbCreateButton.setText("Create Database"); dbCreateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dbCreateButtonActionPerformed(evt); } }); databaseField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N databaseField.setHorizontalAlignment(javax.swing.JTextField.CENTER); databaseField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { databaseFieldKeyPressed(evt); } }); databaseLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); databaseLabel.setText("DATABASE NAME"); dbRemoveButton.setText("Remove Database"); dbRemoveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dbRemoveButtonActionPerformed(evt); } }); javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel); detailsPanel.setLayout(detailsPanelLayout); detailsPanelLayout.setHorizontalGroup( detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(databaseLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(detailsPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(hostLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(hostField) .addComponent(portField) .addComponent(portLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailsPanelLayout.createSequentialGroup() .addComponent(dbRemoveButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(dbCreateButton)) .addComponent(databaseField, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap()) ); detailsPanelLayout.setVerticalGroup( detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(detailsPanelLayout.createSequentialGroup() .addComponent(hostLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hostField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(portLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(portField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(databaseLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(databaseField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(dbCreateButton) .addComponent(dbRemoveButton))) ); loginButton.setBackground(new java.awt.Color(0, 0, 0)); loginButton.setText("Log In"); loginButton.putClientProperty("JButton.buttonType", "textured"); loginButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loginButtonActionPerformed(evt); } }); progressSigningIn.setIndeterminate(true); javax.swing.GroupLayout titlePanelLayout = new javax.swing.GroupLayout(titlePanel); titlePanel.setLayout(titlePanelLayout); titlePanelLayout.setHorizontalGroup( titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(versionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(spiralPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) .addComponent(detailsPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createSequentialGroup() .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(userLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createSequentialGroup() .addContainerGap() .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(button_settings) .addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titlePanelLayout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(passwordLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addComponent(progressSigningIn, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(loginButton)) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()))) ); titlePanelLayout.setVerticalGroup( titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addComponent(spiralPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(versionLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userLabel) .addComponent(passwordLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(loginButton) .addComponent(progressSigningIn, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(button_settings)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(detailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(45, 45, 45, 45); add(titlePanel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed this.loginUsingEnteredUsernameAndPassword(); }//GEN-LAST:event_loginButtonActionPerformed private void dbRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbRemoveButtonActionPerformed new AddRemoveDatabaseDialog(hostField.getText(), portField.getText(), databaseField.getText(), userField.getText(), passwordField.getPassword(), true).setVisible(true); }//GEN-LAST:event_dbRemoveButtonActionPerformed private void databaseFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_databaseFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_databaseFieldKeyPressed private void dbCreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbCreateButtonActionPerformed AddRemoveDatabaseDialog dlg = new AddRemoveDatabaseDialog(hostField.getText(), portField.getText(), databaseField.getText(), userField.getText(), passwordField.getPassword(), false); dlg.setVisible(true); hostField.setText(dlg.getHost()); portField.setText(Integer.toString(dlg.getPort())); databaseField.setText(dlg.getDatabase()); }//GEN-LAST:event_dbCreateButtonActionPerformed private void portFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_portFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_portFieldKeyPressed private void hostFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_hostFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_hostFieldKeyPressed private void button_settingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_settingsActionPerformed detailsPanel.setVisible(!detailsPanel.isVisible()); }//GEN-LAST:event_button_settingsActionPerformed private void passwordFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_passwordFieldKeyPressed private void userFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_userFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_userFieldKeyPressed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField databaseField; private javax.swing.JPanel detailsPanel; private javax.swing.JTextField hostField; private javax.swing.JButton loginButton; private javax.swing.JPasswordField passwordField; private javax.swing.JTextField portField; private javax.swing.JProgressBar progressSigningIn; private javax.swing.JPanel spiralPanel; private javax.swing.JPanel titlePanel; private javax.swing.JTextField userField; private javax.swing.JLabel versionLabel; // End of variables declaration//GEN-END:variables private void loginUsingEnteredUsernameAndPassword() { try { Integer.parseInt(portField.getText()); } catch (Exception e) { portField.requestFocus(); return; } SettingsController settings = SettingsController.getInstance(); settings.setDBName(databaseField.getText()); settings.setServerAddress(hostField.getText()); settings.setServerPort(portField.getText()); this.loginButton.setText("Logging in..."); //statusLabel.setText("Logging In..."); this.progressSigningIn.setVisible(true); loginButton.setEnabled(false); new MedSavantWorker<Void>("LoginView") { @Override protected void showProgress(double fract) { } @Override protected void showSuccess(Void result) { } @Override protected Void doInBackground() throws Exception { LoginController.getInstance().login(userField.getText(), passwordField.getText(), databaseField.getText(), hostField.getText(), portField.getText()); return null; } }.execute(); /*SwingUtilities.invokeLater(new Runnable() { @Override public void run() { } });*/ } private void notifyOfUnsuccessfulLogin(Exception ex) { userField.requestFocus(); loginButton.setEnabled(true); this.progressSigningIn.setVisible(false); this.loginButton.setText("Log In"); // Exception may be null if we got here as a result of a failed version check. if (ex != null) { //statusLabel.setText("login error"); LOG.error("Problem contacting server.", ex); if (ex instanceof SQLException) { if (ex.getMessage().contains("Access denied")) { DialogUtils.displayError("Login Error","<html>Incorrect username and password combination entered.<br><br>Please try again.</html>"); //statusLabel.setText("access denied"); } else { DialogUtils.displayError("Login Error","<html>Problem contacting server.<br><br>Please contact your administrator.</html>"); //statusLabel.setText("problem contacting server"); } } else if (ex instanceof java.rmi.UnknownHostException) { DialogUtils.displayError("Login Error","<html>Problem contacting server.<br><br>Please contact your administrator.</html>"); } } } @Override public void handleEvent(LoginEvent event) { switch (event.getType()) { case LOGGED_IN: break; case LOGGED_OUT: break; case LOGIN_FAILED: notifyOfUnsuccessfulLogin(event.getException()); break; } } }
UTF-8
Java
25,547
java
LoginView.java
Java
[ { "context": "vant.client.view.util.ViewUtil;\n\n/**\n *\n * @author mfiume\n */\npublic class LoginView extends JPanel impleme", "end": 1658, "score": 0.9995169639587402, "start": 1652, "tag": "USERNAME", "value": "mfiume" }, { "context": "wingConstants.CENTER);\n userLabel.setText(\"USERNAME\");\n\n passwordLabel.setFont(new java.awt.Fo", "end": 7239, "score": 0.9989477396011353, "start": 7231, "tag": "USERNAME", "value": "USERNAME" }, { "context": "Constants.CENTER);\n passwordLabel.setText(\"PASSWORD\");\n\n button_settings.setText(\"Connection S", "end": 7444, "score": 0.999424397945404, "start": 7436, "tag": "PASSWORD", "value": "PASSWORD" } ]
null
[]
/* * Copyright 2011-2012 University of Toronto * * 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.ut.biolab.medsavant.client.view; import java.awt.*; import java.awt.event.KeyEvent; import java.sql.SQLException; import javax.swing.Box; import javax.swing.JPanel; import javax.swing.SwingUtilities; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.ut.biolab.medsavant.client.api.Listener; import org.ut.biolab.medsavant.client.controller.SettingsController; import org.ut.biolab.medsavant.client.login.LoginController; import org.ut.biolab.medsavant.client.login.LoginEvent; import org.ut.biolab.medsavant.shared.serverapi.MedSavantProgramInformation; import org.ut.biolab.medsavant.client.util.ClientMiscUtils; import org.ut.biolab.medsavant.client.util.MedSavantWorker; import org.ut.biolab.medsavant.client.view.manage.AddRemoveDatabaseDialog; import org.ut.biolab.medsavant.client.view.images.IconFactory; import org.ut.biolab.medsavant.client.view.util.DialogUtils; import org.ut.biolab.medsavant.client.view.util.ViewUtil; /** * * @author mfiume */ public class LoginView extends JPanel implements Listener<LoginEvent> { private static final Log LOG = LogFactory.getLog(LoginView.class); private LoginController controller = LoginController.getInstance(); private static class SpiralPanel extends JPanel { private final Image img; public SpiralPanel() { img = IconFactory.getInstance().getIcon(IconFactory.StandardIcon.LOGO).getImage(); } @Override public void paintComponent(Graphics g) { //g.setColor(Color.black); //g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.drawImage(img, this.getWidth()/2-img.getWidth(null)/2, this.getHeight()/2-img.getHeight(null)/2, null); } } /** Creates new form LoginForm */ public LoginView() { initComponents(); if (ClientMiscUtils.MAC) { this.progressSigningIn.putClientProperty("JProgressBar.style", "circular"); } this.progressSigningIn.setVisible(false); titlePanel.setBackground(ViewUtil.getBGColor()); loginButton.setOpaque(false); userField.setText(controller.getUserName()); passwordField.setText(controller.getPassword()); SettingsController settings = SettingsController.getInstance(); userField.setText(settings.getUsername()); if (settings.getRememberPassword()) { passwordField.setText(settings.getPassword()); } versionLabel.setText("MedSavant " + MedSavantProgramInformation.getVersion()); titlePanel.add(Box.createVerticalGlue(),0); spiralPanel.setLayout(new BorderLayout()); spiralPanel.add(new SpiralPanel(),BorderLayout.CENTER); detailsPanel.setVisible(false); databaseField.setText(settings.getDBName()); portField.setText(settings.getServerPort()); hostField.setText(settings.getServerAddress()); setOpaque(false); setMaximumSize(new Dimension(400, 400)); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; titlePanel = new javax.swing.JPanel(); userField = new javax.swing.JTextField(); passwordField = new javax.swing.JPasswordField(); spiralPanel = new javax.swing.JPanel(); versionLabel = new javax.swing.JLabel(); javax.swing.JLabel userLabel = new javax.swing.JLabel(); javax.swing.JLabel passwordLabel = new javax.swing.JLabel(); javax.swing.JToggleButton button_settings = new javax.swing.JToggleButton(); detailsPanel = new javax.swing.JPanel(); javax.swing.JLabel hostLabel = new javax.swing.JLabel(); hostField = new javax.swing.JTextField(); javax.swing.JLabel portLabel = new javax.swing.JLabel(); portField = new javax.swing.JTextField(); javax.swing.JButton dbCreateButton = new javax.swing.JButton(); databaseField = new javax.swing.JTextField(); javax.swing.JLabel databaseLabel = new javax.swing.JLabel(); javax.swing.JButton dbRemoveButton = new javax.swing.JButton(); loginButton = new javax.swing.JButton(); progressSigningIn = new javax.swing.JProgressBar(); setLayout(new java.awt.GridBagLayout()); titlePanel.setBackground(new java.awt.Color(255, 255, 255)); titlePanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(6, 6, 6, 6)); titlePanel.setMaximumSize(new java.awt.Dimension(400, 32767)); titlePanel.setMinimumSize(new java.awt.Dimension(400, 800)); titlePanel.setOpaque(false); userField.setColumns(25); userField.setHorizontalAlignment(javax.swing.JTextField.CENTER); userField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { userFieldKeyPressed(evt); } }); passwordField.setColumns(25); passwordField.setHorizontalAlignment(javax.swing.JTextField.CENTER); passwordField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { passwordFieldKeyPressed(evt); } }); spiralPanel.setPreferredSize(new java.awt.Dimension(150, 150)); javax.swing.GroupLayout spiralPanelLayout = new javax.swing.GroupLayout(spiralPanel); spiralPanel.setLayout(spiralPanelLayout); spiralPanelLayout.setHorizontalGroup( spiralPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); spiralPanelLayout.setVerticalGroup( spiralPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 150, Short.MAX_VALUE) ); versionLabel.setFont(versionLabel.getFont()); versionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); versionLabel.setText("version information"); userLabel.setFont(new java.awt.Font("Helvetica", 0, 12)); // NOI18N userLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); userLabel.setText("USERNAME"); passwordLabel.setFont(new java.awt.Font("Helvetica", 0, 12)); // NOI18N passwordLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); passwordLabel.setText("<PASSWORD>"); button_settings.setText("Connection Settings"); button_settings.putClientProperty("JButton.buttonType", "textured"); button_settings.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button_settingsActionPerformed(evt); } }); detailsPanel.setBackground(new java.awt.Color(204, 204, 204)); detailsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Connection Settings", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION)); detailsPanel.setName("Connection Settings"); // NOI18N detailsPanel.setOpaque(false); hostLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); hostLabel.setText("SERVER ADDRESS"); hostField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N hostField.setHorizontalAlignment(javax.swing.JTextField.CENTER); hostField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { hostFieldKeyPressed(evt); } }); portLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); portLabel.setText("SERVER PORT"); portField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N portField.setHorizontalAlignment(javax.swing.JTextField.CENTER); portField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { portFieldKeyPressed(evt); } }); dbCreateButton.setText("Create Database"); dbCreateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dbCreateButtonActionPerformed(evt); } }); databaseField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N databaseField.setHorizontalAlignment(javax.swing.JTextField.CENTER); databaseField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { databaseFieldKeyPressed(evt); } }); databaseLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); databaseLabel.setText("DATABASE NAME"); dbRemoveButton.setText("Remove Database"); dbRemoveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dbRemoveButtonActionPerformed(evt); } }); javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel); detailsPanel.setLayout(detailsPanelLayout); detailsPanelLayout.setHorizontalGroup( detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(databaseLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(detailsPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(hostLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(hostField) .addComponent(portField) .addComponent(portLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailsPanelLayout.createSequentialGroup() .addComponent(dbRemoveButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(dbCreateButton)) .addComponent(databaseField, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap()) ); detailsPanelLayout.setVerticalGroup( detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(detailsPanelLayout.createSequentialGroup() .addComponent(hostLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hostField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(portLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(portField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(databaseLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(databaseField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(dbCreateButton) .addComponent(dbRemoveButton))) ); loginButton.setBackground(new java.awt.Color(0, 0, 0)); loginButton.setText("Log In"); loginButton.putClientProperty("JButton.buttonType", "textured"); loginButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loginButtonActionPerformed(evt); } }); progressSigningIn.setIndeterminate(true); javax.swing.GroupLayout titlePanelLayout = new javax.swing.GroupLayout(titlePanel); titlePanel.setLayout(titlePanelLayout); titlePanelLayout.setHorizontalGroup( titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(versionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(spiralPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) .addComponent(detailsPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createSequentialGroup() .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(userLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createSequentialGroup() .addContainerGap() .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(button_settings) .addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titlePanelLayout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(passwordLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addComponent(progressSigningIn, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(loginButton)) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()))) ); titlePanelLayout.setVerticalGroup( titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addComponent(spiralPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(versionLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userLabel) .addComponent(passwordLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(loginButton) .addComponent(progressSigningIn, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(button_settings)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(detailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(45, 45, 45, 45); add(titlePanel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed this.loginUsingEnteredUsernameAndPassword(); }//GEN-LAST:event_loginButtonActionPerformed private void dbRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbRemoveButtonActionPerformed new AddRemoveDatabaseDialog(hostField.getText(), portField.getText(), databaseField.getText(), userField.getText(), passwordField.getPassword(), true).setVisible(true); }//GEN-LAST:event_dbRemoveButtonActionPerformed private void databaseFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_databaseFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_databaseFieldKeyPressed private void dbCreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbCreateButtonActionPerformed AddRemoveDatabaseDialog dlg = new AddRemoveDatabaseDialog(hostField.getText(), portField.getText(), databaseField.getText(), userField.getText(), passwordField.getPassword(), false); dlg.setVisible(true); hostField.setText(dlg.getHost()); portField.setText(Integer.toString(dlg.getPort())); databaseField.setText(dlg.getDatabase()); }//GEN-LAST:event_dbCreateButtonActionPerformed private void portFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_portFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_portFieldKeyPressed private void hostFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_hostFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_hostFieldKeyPressed private void button_settingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_settingsActionPerformed detailsPanel.setVisible(!detailsPanel.isVisible()); }//GEN-LAST:event_button_settingsActionPerformed private void passwordFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_passwordFieldKeyPressed private void userFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_userFieldKeyPressed int key = evt.getKeyCode(); if (key == KeyEvent.VK_ENTER) { loginUsingEnteredUsernameAndPassword(); } }//GEN-LAST:event_userFieldKeyPressed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField databaseField; private javax.swing.JPanel detailsPanel; private javax.swing.JTextField hostField; private javax.swing.JButton loginButton; private javax.swing.JPasswordField passwordField; private javax.swing.JTextField portField; private javax.swing.JProgressBar progressSigningIn; private javax.swing.JPanel spiralPanel; private javax.swing.JPanel titlePanel; private javax.swing.JTextField userField; private javax.swing.JLabel versionLabel; // End of variables declaration//GEN-END:variables private void loginUsingEnteredUsernameAndPassword() { try { Integer.parseInt(portField.getText()); } catch (Exception e) { portField.requestFocus(); return; } SettingsController settings = SettingsController.getInstance(); settings.setDBName(databaseField.getText()); settings.setServerAddress(hostField.getText()); settings.setServerPort(portField.getText()); this.loginButton.setText("Logging in..."); //statusLabel.setText("Logging In..."); this.progressSigningIn.setVisible(true); loginButton.setEnabled(false); new MedSavantWorker<Void>("LoginView") { @Override protected void showProgress(double fract) { } @Override protected void showSuccess(Void result) { } @Override protected Void doInBackground() throws Exception { LoginController.getInstance().login(userField.getText(), passwordField.getText(), databaseField.getText(), hostField.getText(), portField.getText()); return null; } }.execute(); /*SwingUtilities.invokeLater(new Runnable() { @Override public void run() { } });*/ } private void notifyOfUnsuccessfulLogin(Exception ex) { userField.requestFocus(); loginButton.setEnabled(true); this.progressSigningIn.setVisible(false); this.loginButton.setText("Log In"); // Exception may be null if we got here as a result of a failed version check. if (ex != null) { //statusLabel.setText("login error"); LOG.error("Problem contacting server.", ex); if (ex instanceof SQLException) { if (ex.getMessage().contains("Access denied")) { DialogUtils.displayError("Login Error","<html>Incorrect username and password combination entered.<br><br>Please try again.</html>"); //statusLabel.setText("access denied"); } else { DialogUtils.displayError("Login Error","<html>Problem contacting server.<br><br>Please contact your administrator.</html>"); //statusLabel.setText("problem contacting server"); } } else if (ex instanceof java.rmi.UnknownHostException) { DialogUtils.displayError("Login Error","<html>Problem contacting server.<br><br>Please contact your administrator.</html>"); } } } @Override public void handleEvent(LoginEvent event) { switch (event.getType()) { case LOGGED_IN: break; case LOGGED_OUT: break; case LOGIN_FAILED: notifyOfUnsuccessfulLogin(event.getException()); break; } } }
25,549
0.680745
0.675265
510
49.092155
39.705994
196
false
false
0
0
0
0
0
0
0.684314
false
false
6
173ae61a5f4c00e54911d3574c03ca59db829bd1
24,395,414,294,198
9fe34ef307e460fd379d547fce2ddb94b2b082e5
/spring-demos/spring-data-ebean/src/test/java/net/osnz/module/user/UserRepositoryTest.java
0a9eade493ebcbfcbddb9591a8fbb8bc858a3e41
[ "MIT" ]
permissive
kdeng/java-collections
https://github.com/kdeng/java-collections
e07dda99ac998ef20f85a18e2b8af6f3e898c945
ae6f9f9cb31df4fbc9a9326bbd5d451f38fa3796
refs/heads/master
2023-06-07T18:16:49.942000
2021-06-27T00:45:16
2021-06-27T00:45:16
103,331,990
0
0
MIT
false
2021-03-31T21:59:03
2017-09-12T23:54:53
2021-03-09T20:07:27
2021-03-31T21:59:03
753
0
0
1
Java
false
false
package net.osnz.module.user; import net.osnz.module.user.domain.User; import net.osnz.module.user.repository.UserRepository; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.math.BigDecimal; import java.util.Date; import java.util.List; @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @ContextConfiguration(classes = {TestConfig.class}) public class UserRepositoryTest { protected final static Logger log = LoggerFactory.getLogger(UserRepositoryTest.class); @Autowired private UserRepository userRepository; @Before public void init() { Assert.assertNotNull(userRepository); } @Test public void shouldInstantiatedUserRepositoryProperly() { Assert.assertNotNull(userRepository); } @Test public void testFindAll() { List<User> users = userRepository.findAll(); Assert.assertNotNull(users); Assert.assertEquals(4, users.size()); } @Test public void testGet() { log.debug("staring testGet"); User user = userRepository.get(1L); assert user != null; assert user.getMobile().equals("012345678"); } @Test public void testSave() { log.debug("starting testSave"); User user = new User(); user.setCreditPoint(111); user.setDateVerifiedEmail(new Date()); user.setEmail("eee@eee.com"); user.setMobile("87654321"); user.setPassword("12323"); user.setPendingExpense(new BigDecimal(0)); user.setTotalExpense(new BigDecimal("12.33")); userRepository.save(user); List<User> allUsers = userRepository.findAll(); Assert.assertEquals(5, allUsers.size()); } }
UTF-8
Java
2,028
java
UserRepositoryTest.java
Java
[ { "context": "DateVerifiedEmail(new Date());\n user.setEmail(\"eee@eee.com\");\n user.setMobile(\"87654321\");\n user.setPa", "end": 1724, "score": 0.9998974800109863, "start": 1713, "tag": "EMAIL", "value": "eee@eee.com" }, { "context": "user.setMobile(\"87654321\");\n user.setPassword(\"12323\");\n user.setPendingExpense(new BigDecimal(0));", "end": 1787, "score": 0.9993130564689636, "start": 1782, "tag": "PASSWORD", "value": "12323" } ]
null
[]
package net.osnz.module.user; import net.osnz.module.user.domain.User; import net.osnz.module.user.repository.UserRepository; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.math.BigDecimal; import java.util.Date; import java.util.List; @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @ContextConfiguration(classes = {TestConfig.class}) public class UserRepositoryTest { protected final static Logger log = LoggerFactory.getLogger(UserRepositoryTest.class); @Autowired private UserRepository userRepository; @Before public void init() { Assert.assertNotNull(userRepository); } @Test public void shouldInstantiatedUserRepositoryProperly() { Assert.assertNotNull(userRepository); } @Test public void testFindAll() { List<User> users = userRepository.findAll(); Assert.assertNotNull(users); Assert.assertEquals(4, users.size()); } @Test public void testGet() { log.debug("staring testGet"); User user = userRepository.get(1L); assert user != null; assert user.getMobile().equals("012345678"); } @Test public void testSave() { log.debug("starting testSave"); User user = new User(); user.setCreditPoint(111); user.setDateVerifiedEmail(new Date()); user.setEmail("<EMAIL>"); user.setMobile("87654321"); user.setPassword("<PASSWORD>"); user.setPendingExpense(new BigDecimal(0)); user.setTotalExpense(new BigDecimal("12.33")); userRepository.save(user); List<User> allUsers = userRepository.findAll(); Assert.assertEquals(5, allUsers.size()); } }
2,029
0.747535
0.728797
77
25.337662
21.638475
88
false
false
0
0
0
0
0
0
0.532468
false
false
6
4063307526608c7f1ef94874ea7ce22de154a726
17,978,733,164,270
0a51e9e2207a1b1793fd31a79f879b24e7e27ddd
/src/main/java/com/jorgma/homeapp/alarm/rest/AlarmGroupController.java
358e1c1cf5fc376cb4dac5d5cf8e1daa90d91564
[]
no_license
jnlmiro/HomeApp2
https://github.com/jnlmiro/HomeApp2
5121e4bca2a7a7bf40e3f636316062fecc7bd7f4
3af5ec583cc0dbb0d661e4a8cceecc3f34d9538b
refs/heads/master
2021-01-25T14:55:43.248000
2018-11-19T22:00:37
2018-11-19T22:00:37
123,735,193
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jorgma.homeapp.alarm.rest; import com.jorgma.homeapp.alarm.domain.AlarmGroup; import com.jorgma.homeapp.alarm.service.AlarmGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * Created by jorgma on 2018-09-07. */ @RestController @RequestMapping("/api/alarm-groups") public class AlarmGroupController { @Autowired private AlarmGroupService alarmGroupService; @RequestMapping(value = "", method = RequestMethod.GET) public List<AlarmGroup> getAlarmGroups() { return alarmGroupService.getAlarmGroups(); } @RequestMapping(value = "", method = RequestMethod.POST) public AlarmGroup createAlarmGroup(@RequestBody AlarmGroup alarmGroup) { return alarmGroupService.createAlarmGroup(alarmGroup); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public AlarmGroup updateAlarmGroup(@PathVariable int id, @RequestBody AlarmGroup alarmGroup) { return alarmGroupService.updateAlarmGroup(id, alarmGroup); } }
UTF-8
Java
1,106
java
AlarmGroupController.java
Java
[ { "context": "tion.*;\n\nimport java.util.List;\n\n/**\n * Created by jorgma on 2018-09-07.\n */\n\n\n@RestController\n@RequestMapp", "end": 312, "score": 0.999704897403717, "start": 306, "tag": "USERNAME", "value": "jorgma" } ]
null
[]
package com.jorgma.homeapp.alarm.rest; import com.jorgma.homeapp.alarm.domain.AlarmGroup; import com.jorgma.homeapp.alarm.service.AlarmGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * Created by jorgma on 2018-09-07. */ @RestController @RequestMapping("/api/alarm-groups") public class AlarmGroupController { @Autowired private AlarmGroupService alarmGroupService; @RequestMapping(value = "", method = RequestMethod.GET) public List<AlarmGroup> getAlarmGroups() { return alarmGroupService.getAlarmGroups(); } @RequestMapping(value = "", method = RequestMethod.POST) public AlarmGroup createAlarmGroup(@RequestBody AlarmGroup alarmGroup) { return alarmGroupService.createAlarmGroup(alarmGroup); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public AlarmGroup updateAlarmGroup(@PathVariable int id, @RequestBody AlarmGroup alarmGroup) { return alarmGroupService.updateAlarmGroup(id, alarmGroup); } }
1,106
0.748644
0.74141
38
28.105263
28.250561
98
false
false
0
0
0
0
0
0
0.394737
false
false
6
5d6495a07bd8533f5d180a1f2a9e98e25c6ffe49
30,683,246,406,536
3498a0a0228223765b4dec28d717c4c7e08562c2
/app/src/main/java/com/example/hq/extadapter/MainActivity.java
b8c863db340ba5243c7cb5621c49d2f4451f58aa
[]
no_license
beyondbycyx/ExtAdapter
https://github.com/beyondbycyx/ExtAdapter
02bccce521cefab99d7f7a717ad6fad314dc5814
6ce6b0384b0b69b97a08c125b926302aa6f8a01a
refs/heads/master
2021-01-21T12:27:02.199000
2015-06-19T08:40:53
2015-06-19T08:40:53
37,710,751
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.hq.extadapter; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import com.example.hq.extadapter.Vu.MainVu; import com.example.hq.extadapter.adapters.Adapter; import com.example.hq.extadapter.adapters.ControlAdapter; import com.example.hq.extadapter.constant.ViewTag; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; public class MainActivity extends AppCompatActivity implements MainVu<Map> { @InjectView(R.id.lv) ListView lv; @InjectView(R.id.addBt) Button addBt; private List<Map<String, String>> datas; @Override public void addItem(@NonNull ControlAdapter controlAdapter,@NonNull Map model) { controlAdapter.addItem(model); } @Override public void delItem(@NonNull ControlAdapter controlAdapter,@NonNull int position) { controlAdapter.removeItem(position); } @Override public void initVu(@NonNull Context mcontext, @LayoutRes int layoutResId) { } @Override public View getView() { return null; } @InjectView(R.id.delBt) Button delBt; private Adapter myAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.inject(this); final Map<String, String> m1 = new HashMap<String, String>() {{ put("Title", "标题一"); put("Content", "内容一"); }}; final Map<String, String> m2 = new HashMap<String, String>() {{ put("Title", "标题二"); put("Content", "内容二"); }}; final Map<String, String> m3 = new HashMap<String, String>() {{ put("Title", "标题三"); put("Content", "内容三"); }}; datas = new ArrayList<Map<String, String>>() {{ add(m1); add(m2); add(m3); }}; //添加监听 myAdapter = new Adapter<Map<String, String>>(this, datas, R.layout.item_list) { @Override public void setListener(ViewHolder viewHolder) { ((TextView) viewHolder.getView(R.id.content)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } //绑定数据 @Override public void bindData(Map<String, String> map, ViewHolder viewHolder) { ((TextView) viewHolder.getView(R.id.title)).setText(map.get("Title")); ((TextView) viewHolder.getView(R.id.content)).setText(map.get("Content")); } }; lv.setAdapter(myAdapter); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.v("Tag---",position+""); AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); final int pos=position; builder.setMessage("确定删除吗?"); builder.setPositiveButton("确认", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); //删除操作 delItem(myAdapter,pos); } }); builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } }); } @OnClick(R.id.addBt) public void onClickAdd(View v) { Map map=new HashMap(); map.put("Title","add"); map.put("Content","add"); addItem(myAdapter, map); } @OnClick(R.id.delBt) public void onClickDel(View v) { delItem(myAdapter, datas.size() - 1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
5,551
java
MainActivity.java
Java
[]
null
[]
package com.example.hq.extadapter; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import com.example.hq.extadapter.Vu.MainVu; import com.example.hq.extadapter.adapters.Adapter; import com.example.hq.extadapter.adapters.ControlAdapter; import com.example.hq.extadapter.constant.ViewTag; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; public class MainActivity extends AppCompatActivity implements MainVu<Map> { @InjectView(R.id.lv) ListView lv; @InjectView(R.id.addBt) Button addBt; private List<Map<String, String>> datas; @Override public void addItem(@NonNull ControlAdapter controlAdapter,@NonNull Map model) { controlAdapter.addItem(model); } @Override public void delItem(@NonNull ControlAdapter controlAdapter,@NonNull int position) { controlAdapter.removeItem(position); } @Override public void initVu(@NonNull Context mcontext, @LayoutRes int layoutResId) { } @Override public View getView() { return null; } @InjectView(R.id.delBt) Button delBt; private Adapter myAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.inject(this); final Map<String, String> m1 = new HashMap<String, String>() {{ put("Title", "标题一"); put("Content", "内容一"); }}; final Map<String, String> m2 = new HashMap<String, String>() {{ put("Title", "标题二"); put("Content", "内容二"); }}; final Map<String, String> m3 = new HashMap<String, String>() {{ put("Title", "标题三"); put("Content", "内容三"); }}; datas = new ArrayList<Map<String, String>>() {{ add(m1); add(m2); add(m3); }}; //添加监听 myAdapter = new Adapter<Map<String, String>>(this, datas, R.layout.item_list) { @Override public void setListener(ViewHolder viewHolder) { ((TextView) viewHolder.getView(R.id.content)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } //绑定数据 @Override public void bindData(Map<String, String> map, ViewHolder viewHolder) { ((TextView) viewHolder.getView(R.id.title)).setText(map.get("Title")); ((TextView) viewHolder.getView(R.id.content)).setText(map.get("Content")); } }; lv.setAdapter(myAdapter); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.v("Tag---",position+""); AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); final int pos=position; builder.setMessage("确定删除吗?"); builder.setPositiveButton("确认", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); //删除操作 delItem(myAdapter,pos); } }); builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } }); } @OnClick(R.id.addBt) public void onClickAdd(View v) { Map map=new HashMap(); map.put("Title","add"); map.put("Content","add"); addItem(myAdapter, map); } @OnClick(R.id.delBt) public void onClickDel(View v) { delItem(myAdapter, datas.size() - 1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
5,551
0.598611
0.597149
174
30.44253
25.29878
110
false
false
0
0
0
0
0
0
0.66092
false
false
6
2174ddcebb6c1888392e1355f801f49b5fc80ad7
31,920,197,002,478
04724f586de50fa16652f47a1df9d80100891498
/DeMaSoftWeb/src/java/models/Almacen.java
540c2d32c1617f4bec35a4aed9696aee223457e6
[]
no_license
fernandomv3/DeMaSoftWeb
https://github.com/fernandomv3/DeMaSoftWeb
7df1b25ab55be9f981246a3dfab54bfbe9edcd99
344fdba3c9ad1425cafdc27613c2ce5c72890b89
refs/heads/master
2020-05-20T03:45:03.821000
2013-07-22T20:45:01
2013-07-22T20:45:01
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package models; import DeMaSoft.GestorConexion; import java.sql.Connection; import java.sql.PreparedStatement; /** * * @author Fernando */ public class Almacen { private String _direccion; private Punto _ubicacion; public Almacen(Punto punto){ _ubicacion =punto; } public String getDireccion() { return _direccion; } public void setDireccion(String direccion) { this._direccion = direccion; } public Punto getUbicacion() { return _ubicacion; } public void setUbicacion(Punto ubicación) { this._ubicacion = ubicación; } public void grabarAlmacen(int codSimulacion){ PreparedStatement pstmt= null; StringBuffer query = new StringBuffer(""); query.append("INSERT INTO inf2260981g2.ALMACEN(idSIMULACION,posX,posY) VALUES (?,?,?) "); try{ Connection con = GestorConexion.getConexion(); pstmt= con.prepareStatement(query.toString()); pstmt.setInt(1, codSimulacion); pstmt.setInt(2, this._ubicacion.getPosX()); pstmt.setInt(3, this._ubicacion.getPosY()); pstmt.executeUpdate(); }catch(Exception e){ int a=0; }finally{ try{ if (pstmt!=null)pstmt.close(); }catch(Exception e){ } } } }
UTF-8
Java
1,635
java
Almacen.java
Java
[ { "context": "ort java.sql.PreparedStatement;\n\n/**\n *\n * @author Fernando\n */\npublic class Almacen {\n private String _di", "end": 239, "score": 0.9997826218605042, "start": 231, "tag": "NAME", "value": "Fernando" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package models; import DeMaSoft.GestorConexion; import java.sql.Connection; import java.sql.PreparedStatement; /** * * @author Fernando */ public class Almacen { private String _direccion; private Punto _ubicacion; public Almacen(Punto punto){ _ubicacion =punto; } public String getDireccion() { return _direccion; } public void setDireccion(String direccion) { this._direccion = direccion; } public Punto getUbicacion() { return _ubicacion; } public void setUbicacion(Punto ubicación) { this._ubicacion = ubicación; } public void grabarAlmacen(int codSimulacion){ PreparedStatement pstmt= null; StringBuffer query = new StringBuffer(""); query.append("INSERT INTO inf2260981g2.ALMACEN(idSIMULACION,posX,posY) VALUES (?,?,?) "); try{ Connection con = GestorConexion.getConexion(); pstmt= con.prepareStatement(query.toString()); pstmt.setInt(1, codSimulacion); pstmt.setInt(2, this._ubicacion.getPosX()); pstmt.setInt(3, this._ubicacion.getPosY()); pstmt.executeUpdate(); }catch(Exception e){ int a=0; }finally{ try{ if (pstmt!=null)pstmt.close(); }catch(Exception e){ } } } }
1,635
0.540723
0.533374
69
22.666666
19.864517
97
false
false
0
0
0
0
0
0
0.449275
false
false
6
0fbafcc88c27b0390d3ffb945a02d386608ed49c
19,404,662,310,681
6ad7f2266ce14e9556a98ae8a919c268d5ec2f01
/dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/service/PtTrainAlgorithmService.java
95bb9c7244726b59dff1f7d69f96b768432b8cfb
[ "Apache-2.0" ]
permissive
Gouzhong1223/Dubhe
https://github.com/Gouzhong1223/Dubhe
3fc3fbb259e71013c2ddc12c27dbd39b98e56534
8959a51704410dc38b595a0926646b9928451c9a
refs/heads/master
2022-07-26T23:24:54.295000
2021-12-27T05:58:18
2021-12-27T05:58:18
442,334,231
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright 2020 Tianshu AI Platform. All Rights Reserved. * * 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.dubhe.algorithm.service; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmCreateDTO; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmDeleteDTO; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmQueryDTO; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmUpdateDTO; import org.dubhe.algorithm.domain.vo.PtTrainAlgorithmQueryVO; import org.dubhe.biz.base.dto.ModelOptAlgorithmCreateDTO; import org.dubhe.biz.base.dto.TrainAlgorithmSelectAllBatchIdDTO; import org.dubhe.biz.base.dto.TrainAlgorithmSelectAllByIdDTO; import org.dubhe.biz.base.dto.TrainAlgorithmSelectByIdDTO; import org.dubhe.biz.base.vo.ModelOptAlgorithmQureyVO; import org.dubhe.biz.base.vo.TrainAlgorithmQureyVO; import org.dubhe.recycle.domain.dto.RecycleCreateDTO; import java.util.List; import java.util.Map; /** * @description 训练算法 服务类 * @date 2020-04-27 */ public interface PtTrainAlgorithmService { /** * 查询数据分页 * * @param ptTrainAlgorithmQueryDTO 分页参数条件 * @return Map<String, Object> map */ Map<String, Object> queryAll(PtTrainAlgorithmQueryDTO ptTrainAlgorithmQueryDTO); /** * 新增算法 * * @param ptTrainAlgorithmCreateDTO 新增算法条件 * @return PtTrainAlgorithmCreateVO 新建训练算法 */ List<Long> create(PtTrainAlgorithmCreateDTO ptTrainAlgorithmCreateDTO); /** * 修改算法 * * @param ptTrainAlgorithmUpdateDTO 修改算法条件 * @return PtTrainAlgorithmUpdateVO 修改训练算法 */ List<Long> update(PtTrainAlgorithmUpdateDTO ptTrainAlgorithmUpdateDTO); /** * 删除算法 * * @param ptTrainAlgorithmDeleteDTO 删除算法条件 */ void deleteAll(PtTrainAlgorithmDeleteDTO ptTrainAlgorithmDeleteDTO); /** * 查询当前用户的算法个数 */ Map<String, Object> getAlgorithmCount(); /** * 根据Id查询所有数据(包含已被软删除的数据) * * @param trainAlgorithmSelectAllByIdDTO 算法id * @return PtTrainAlgorithm 根据Id查询所有数据 */ TrainAlgorithmQureyVO selectAllById(TrainAlgorithmSelectAllByIdDTO trainAlgorithmSelectAllByIdDTO); /** * 根据Id查询 * * @param trainAlgorithmSelectByIdDTO 算法id * @return PtTrainAlgorithm 根据Id查询 */ TrainAlgorithmQureyVO selectById(TrainAlgorithmSelectByIdDTO trainAlgorithmSelectByIdDTO); /** * 批量查询 * * @param trainAlgorithmSelectAllBatchIdDTO 算法ids * @return List<PtTrainAlgorithm> 批量查询 */ List<TrainAlgorithmQureyVO> selectAllBatchIds(TrainAlgorithmSelectAllBatchIdDTO trainAlgorithmSelectAllBatchIdDTO); /** * 模型优化上传算法 * * @param modelOptAlgorithmCreateDTO 模型优化上传算法入参 * @return ModelOptAlgorithmQureyVO 新增算法信息 */ ModelOptAlgorithmQureyVO modelOptimizationUploadAlgorithm(ModelOptAlgorithmCreateDTO modelOptAlgorithmCreateDTO); /** * 算法删除文件还原 * @param dto 还原实体 */ void algorithmRecycleFileRollback(RecycleCreateDTO dto); /** * 查询可推理算法 * @return List<PtTrainAlgorithmQueryVO> 返回可推理算法集合 */ List<PtTrainAlgorithmQueryVO> getInferenceAlgorithm(); }
UTF-8
Java
4,044
java
PtTrainAlgorithmService.java
Java
[]
null
[]
/** * Copyright 2020 Tianshu AI Platform. All Rights Reserved. * * 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.dubhe.algorithm.service; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmCreateDTO; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmDeleteDTO; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmQueryDTO; import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmUpdateDTO; import org.dubhe.algorithm.domain.vo.PtTrainAlgorithmQueryVO; import org.dubhe.biz.base.dto.ModelOptAlgorithmCreateDTO; import org.dubhe.biz.base.dto.TrainAlgorithmSelectAllBatchIdDTO; import org.dubhe.biz.base.dto.TrainAlgorithmSelectAllByIdDTO; import org.dubhe.biz.base.dto.TrainAlgorithmSelectByIdDTO; import org.dubhe.biz.base.vo.ModelOptAlgorithmQureyVO; import org.dubhe.biz.base.vo.TrainAlgorithmQureyVO; import org.dubhe.recycle.domain.dto.RecycleCreateDTO; import java.util.List; import java.util.Map; /** * @description 训练算法 服务类 * @date 2020-04-27 */ public interface PtTrainAlgorithmService { /** * 查询数据分页 * * @param ptTrainAlgorithmQueryDTO 分页参数条件 * @return Map<String, Object> map */ Map<String, Object> queryAll(PtTrainAlgorithmQueryDTO ptTrainAlgorithmQueryDTO); /** * 新增算法 * * @param ptTrainAlgorithmCreateDTO 新增算法条件 * @return PtTrainAlgorithmCreateVO 新建训练算法 */ List<Long> create(PtTrainAlgorithmCreateDTO ptTrainAlgorithmCreateDTO); /** * 修改算法 * * @param ptTrainAlgorithmUpdateDTO 修改算法条件 * @return PtTrainAlgorithmUpdateVO 修改训练算法 */ List<Long> update(PtTrainAlgorithmUpdateDTO ptTrainAlgorithmUpdateDTO); /** * 删除算法 * * @param ptTrainAlgorithmDeleteDTO 删除算法条件 */ void deleteAll(PtTrainAlgorithmDeleteDTO ptTrainAlgorithmDeleteDTO); /** * 查询当前用户的算法个数 */ Map<String, Object> getAlgorithmCount(); /** * 根据Id查询所有数据(包含已被软删除的数据) * * @param trainAlgorithmSelectAllByIdDTO 算法id * @return PtTrainAlgorithm 根据Id查询所有数据 */ TrainAlgorithmQureyVO selectAllById(TrainAlgorithmSelectAllByIdDTO trainAlgorithmSelectAllByIdDTO); /** * 根据Id查询 * * @param trainAlgorithmSelectByIdDTO 算法id * @return PtTrainAlgorithm 根据Id查询 */ TrainAlgorithmQureyVO selectById(TrainAlgorithmSelectByIdDTO trainAlgorithmSelectByIdDTO); /** * 批量查询 * * @param trainAlgorithmSelectAllBatchIdDTO 算法ids * @return List<PtTrainAlgorithm> 批量查询 */ List<TrainAlgorithmQureyVO> selectAllBatchIds(TrainAlgorithmSelectAllBatchIdDTO trainAlgorithmSelectAllBatchIdDTO); /** * 模型优化上传算法 * * @param modelOptAlgorithmCreateDTO 模型优化上传算法入参 * @return ModelOptAlgorithmQureyVO 新增算法信息 */ ModelOptAlgorithmQureyVO modelOptimizationUploadAlgorithm(ModelOptAlgorithmCreateDTO modelOptAlgorithmCreateDTO); /** * 算法删除文件还原 * @param dto 还原实体 */ void algorithmRecycleFileRollback(RecycleCreateDTO dto); /** * 查询可推理算法 * @return List<PtTrainAlgorithmQueryVO> 返回可推理算法集合 */ List<PtTrainAlgorithmQueryVO> getInferenceAlgorithm(); }
4,044
0.722973
0.718649
121
29.578512
28.977551
119
false
false
0
0
0
0
0
0
0.280992
false
false
6
b12df20ba866ed20550ed9ee2fbde59380061832
10,651,518,925,151
13cffd8606254469df9c6fadcf968fcef71f8497
/backend/src/main/java/com/ognjengaric/demo/service/impl/RouteServiceImpl.java
c6e278683f4feab2e4272540607ef04e1c8ad06e
[]
no_license
ognjengaric/driving-school
https://github.com/ognjengaric/driving-school
40197bca8f2571556704cfe64b58d524221de8a8
4f380d01540d8ddb85416bdaa5fa76abd5a5b90f
refs/heads/master
2023-01-24T12:21:45.114000
2020-11-26T17:59:49
2020-11-26T17:59:49
267,680,508
0
0
null
false
2020-11-26T17:59:53
2020-05-28T19:40:12
2020-10-12T13:35:57
2020-11-26T17:59:50
1,515
0
0
0
Java
false
false
package com.ognjengaric.demo.service.impl; import com.ognjengaric.demo.domain.Route; import com.ognjengaric.demo.domain.Street; import com.ognjengaric.demo.dto.NewRouteDTO; import com.ognjengaric.demo.enums.LicenceCategory; import com.ognjengaric.demo.repository.RouteRepository; import com.ognjengaric.demo.service.RouteService; import com.ognjengaric.demo.service.StreetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.HashSet; import java.util.List; import java.util.Set; @Service public class RouteServiceImpl implements RouteService { @Autowired RouteRepository routeRepository; @Autowired StreetService streetService; @Override public Integer save(NewRouteDTO newRouteDTO) { Route route = new Route(newRouteDTO); streetService.createAndUpdateMultiple(newRouteDTO.getStreets(), route); Route saved = routeRepository.saveAndFlush(route); return saved.getId(); } @Override public List<Route> findAll() { return routeRepository.findAll(); } @Override public List<Route> findByCategory(LicenceCategory category) { return routeRepository.findByCategory(category); } @Override public Route findById(Integer id){ return routeRepository.findById(id).orElse(null); } @Override public Page<Route> getPageable(int page, int size) { Pageable pageable = PageRequest.of(page, size); return routeRepository.findAll(pageable); } }
UTF-8
Java
1,756
java
RouteServiceImpl.java
Java
[]
null
[]
package com.ognjengaric.demo.service.impl; import com.ognjengaric.demo.domain.Route; import com.ognjengaric.demo.domain.Street; import com.ognjengaric.demo.dto.NewRouteDTO; import com.ognjengaric.demo.enums.LicenceCategory; import com.ognjengaric.demo.repository.RouteRepository; import com.ognjengaric.demo.service.RouteService; import com.ognjengaric.demo.service.StreetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.HashSet; import java.util.List; import java.util.Set; @Service public class RouteServiceImpl implements RouteService { @Autowired RouteRepository routeRepository; @Autowired StreetService streetService; @Override public Integer save(NewRouteDTO newRouteDTO) { Route route = new Route(newRouteDTO); streetService.createAndUpdateMultiple(newRouteDTO.getStreets(), route); Route saved = routeRepository.saveAndFlush(route); return saved.getId(); } @Override public List<Route> findAll() { return routeRepository.findAll(); } @Override public List<Route> findByCategory(LicenceCategory category) { return routeRepository.findByCategory(category); } @Override public Route findById(Integer id){ return routeRepository.findById(id).orElse(null); } @Override public Page<Route> getPageable(int page, int size) { Pageable pageable = PageRequest.of(page, size); return routeRepository.findAll(pageable); } }
1,756
0.754556
0.754556
59
28.762712
22.619431
79
false
false
0
0
0
0
0
0
0.525424
false
false
6
a28b7208d890cc25beb6a62c90d15eb07e208cbd
8,761,733,299,897
189685ef3593581c2c9fb1ad147075419ce0ed3e
/titus-server-master/src/test/java/com/netflix/titus/master/integration/v3/job/JobTestUtils.java
74712094d7bf6509d8352ffbcb62cd05f5c63000
[ "Apache-2.0" ]
permissive
joshi-keyur/titus-control-plane
https://github.com/joshi-keyur/titus-control-plane
32af8c09a1a5d6e7a7f8da888ec3fafc3edca31f
52c752fbe1b58121a802388e40d68e93fe0f9466
refs/heads/master
2022-05-18T19:46:41.325000
2022-04-07T23:33:02
2022-04-07T23:33:02
217,126,269
0
0
Apache-2.0
true
2020-04-17T21:44:56
2019-10-23T18:27:39
2020-04-14T19:46:07
2020-04-17T21:44:55
34,210
0
0
0
Java
false
false
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.master.integration.v3.job; import java.util.Collections; import java.util.HashSet; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import com.google.rpc.BadRequest; import com.netflix.titus.runtime.common.grpc.GrpcClientErrorUtils; import com.netflix.titus.grpc.protogen.JobDescriptor; import com.netflix.titus.grpc.protogen.JobManagementServiceGrpc; import io.grpc.StatusRuntimeException; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; public class JobTestUtils { public static void submitBadJob(JobManagementServiceGrpc.JobManagementServiceBlockingStub client, JobDescriptor badJobDescriptor, String... expectedFields) { Set<String> expectedFieldSet = new HashSet<>(); Collections.addAll(expectedFieldSet, expectedFields); try { client.createJob(badJobDescriptor).getId(); fail("Expected test to fail"); } catch (StatusRuntimeException e) { System.out.println("Received StatusRuntimeException: " + e.getMessage()); Optional<BadRequest> badRequestOpt = GrpcClientErrorUtils.getDetail(e, BadRequest.class); // Print validation messages for visual inspection badRequestOpt.ifPresent(System.out::println); Set<String> badFields = badRequestOpt.map(badRequest -> badRequest.getFieldViolationsList().stream().map(BadRequest.FieldViolation::getField).collect(Collectors.toSet()) ).orElse(Collections.emptySet()); assertThat(badFields).containsAll(expectedFieldSet); assertThat(badFields.size()).isEqualTo(expectedFieldSet.size()); } } }
UTF-8
Java
2,413
java
JobTestUtils.java
Java
[ { "context": "/*\n * Copyright 2019 Netflix, Inc.\n *\n * Licensed under the Apache License, Ve", "end": 28, "score": 0.857585072517395, "start": 21, "tag": "NAME", "value": "Netflix" } ]
null
[]
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.titus.master.integration.v3.job; import java.util.Collections; import java.util.HashSet; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import com.google.rpc.BadRequest; import com.netflix.titus.runtime.common.grpc.GrpcClientErrorUtils; import com.netflix.titus.grpc.protogen.JobDescriptor; import com.netflix.titus.grpc.protogen.JobManagementServiceGrpc; import io.grpc.StatusRuntimeException; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; public class JobTestUtils { public static void submitBadJob(JobManagementServiceGrpc.JobManagementServiceBlockingStub client, JobDescriptor badJobDescriptor, String... expectedFields) { Set<String> expectedFieldSet = new HashSet<>(); Collections.addAll(expectedFieldSet, expectedFields); try { client.createJob(badJobDescriptor).getId(); fail("Expected test to fail"); } catch (StatusRuntimeException e) { System.out.println("Received StatusRuntimeException: " + e.getMessage()); Optional<BadRequest> badRequestOpt = GrpcClientErrorUtils.getDetail(e, BadRequest.class); // Print validation messages for visual inspection badRequestOpt.ifPresent(System.out::println); Set<String> badFields = badRequestOpt.map(badRequest -> badRequest.getFieldViolationsList().stream().map(BadRequest.FieldViolation::getField).collect(Collectors.toSet()) ).orElse(Collections.emptySet()); assertThat(badFields).containsAll(expectedFieldSet); assertThat(badFields.size()).isEqualTo(expectedFieldSet.size()); } } }
2,413
0.707833
0.704103
61
38.557377
31.697611
133
false
false
0
0
0
0
0
0
0.540984
false
false
6
35e964d297485d8329298d4e763fe813362727fb
21,912,923,168,182
b48967d5c9898bd9819c499dc63e5cf16f418d6e
/DSLCommon/source/dk/tdc/iht/util/sync/exec/FireExecutableListener.java
5d659d88c86c7fb118d2d1d6acefcb5adcdbd583
[]
no_license
ayanch/DSLMON
https://github.com/ayanch/DSLMON
f245f7db16aa433792b7ff1351c5cb2ab71a0da5
039fd1188cea25d8bf1c885bc6671c8e10461004
refs/heads/master
2016-09-06T17:52:49.572000
2015-09-07T23:12:09
2015-09-07T23:12:09
42,077,295
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*** FILE "FireExecutableListener.java" ***************************************/ /******************************************************************************/ /** **/ /** TDC Network Automation Tools - DSL Monitor. **/ /** **/ /******************************************************************************/ /* * $Log: FireExecutableListener.java,v $ * Revision 1.1 2008/04/15 12:23:54 momor * Modified Synchronizer implementations. * Modified time-model used by Synchronizer. * Added "lock"-listener to Synchronizer. * Added getExecutionTimeTotal() to interfaces Task, Executable and their implementations. * Removed occurrences of "synchronized" from Task-implementations. * Modified test-programs of Synchronizer. * */ package dk.tdc.iht.util.sync.exec; /*** FireExecutableListener: **************************************************/ /** * * * @author <a href="mailto:Morten.Mortensen@yelstream.org" * >Morten Sabroe Mortensen</a> * @version $Id: FireExecutableListener.java,v 1.1 2008/04/15 12:23:54 momor Exp $ */ public interface FireExecutableListener extends ExecutableListener { /** * */ void addExecutableListener(ExecutableListener l); /** * */ void removeExecutableListener(ExecutableListener l); /** * Disposes this. */ void dispose(); } /******** "FireExecutableListener.java" ***************************************/
UTF-8
Java
1,633
java
FireExecutableListener.java
Java
[ { "context": "*****/\r\n\r\n/**\r\n *\r\n *\r\n * @author <a href=\"mailto:Morten.Mortensen@yelstream.org\"\r\n * >Morten Sabroe Mortensen</a>\r\n * @ve", "end": 1127, "score": 0.9998610019683838, "start": 1097, "tag": "EMAIL", "value": "Morten.Mortensen@yelstream.org" }, { "context": "ilto:Morten.Mortensen@yelstream.org\"\r\n * >Morten Sabroe Mortensen</a>\r\n * @version $Id: FireExecutableListener.java", "end": 1165, "score": 0.999899685382843, "start": 1142, "tag": "NAME", "value": "Morten Sabroe Mortensen" } ]
null
[]
/*** FILE "FireExecutableListener.java" ***************************************/ /******************************************************************************/ /** **/ /** TDC Network Automation Tools - DSL Monitor. **/ /** **/ /******************************************************************************/ /* * $Log: FireExecutableListener.java,v $ * Revision 1.1 2008/04/15 12:23:54 momor * Modified Synchronizer implementations. * Modified time-model used by Synchronizer. * Added "lock"-listener to Synchronizer. * Added getExecutionTimeTotal() to interfaces Task, Executable and their implementations. * Removed occurrences of "synchronized" from Task-implementations. * Modified test-programs of Synchronizer. * */ package dk.tdc.iht.util.sync.exec; /*** FireExecutableListener: **************************************************/ /** * * * @author <a href="mailto:<EMAIL>" * ><NAME></a> * @version $Id: FireExecutableListener.java,v 1.1 2008/04/15 12:23:54 momor Exp $ */ public interface FireExecutableListener extends ExecutableListener { /** * */ void addExecutableListener(ExecutableListener l); /** * */ void removeExecutableListener(ExecutableListener l); /** * Disposes this. */ void dispose(); } /******** "FireExecutableListener.java" ***************************************/
1,593
0.469075
0.449479
52
29.403847
31.190025
90
false
false
0
0
0
0
0
0
0.134615
false
false
6
1edb4e9ae8bbfcdb2c5378440406bd0a056f164a
23,132,693,922,445
470d422b96e176c97ad12d02b56771e8a56f7a7e
/app/src/main/java/com/yunwei/wetlandpark/widget/FormCheckBoxSelectorView.java
7ae08bf0ef1e308856a2a4d619861ea26f1a98cb
[]
no_license
HopeSeebok/WetlandPark
https://github.com/HopeSeebok/WetlandPark
3e7c5b7bf61d8d1e90f22390b4c278350e729ca1
ddd884fb385bdcd7cbca3aa0078eeccc9a60f421
refs/heads/master
2020-04-06T05:48:08.516000
2017-06-30T07:40:48
2017-06-30T07:40:48
95,423,479
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yunwei.wetlandpark.widget; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.TextView; import com.yunwei.wetlandpark.R; import butterknife.BindView; import butterknife.ButterKnife; /** * @author huangyue * @version V1.0 * @Package com.yunwei.cmcc.widget * @Description: * @date 2016/11/30 09:19 */ public class FormCheckBoxSelectorView extends LinearLayout{ @BindView(R.id.formCheckBoxSelector_title_tv) TextView formCheckBoxSelectorTitleTv; @BindView(R.id.formCheckBoxSelector_title_tv_note) TextView formCheckBoxSelectorTitleTvNote; @BindView(R.id.formCheckBoxSelector_checkBox) SwitchButtonV2 formCheckBoxSelectorCheckBox; private String mProperName; private String mProperNote; private String mCheckBoxName; private String textOn; private String textOff; private boolean mChecked; public FormCheckBoxSelectorView(Context context) { this(context, null); } public FormCheckBoxSelectorView(Context context, AttributeSet attrs) { super(context, attrs); initAttributeSet(context, attrs); View view = LayoutInflater.from(context).inflate(R.layout.form_checkbox_selector_layout, null); ButterKnife.bind(this, view); mProperName += getResources().getString(R.string.colon_breaker); formCheckBoxSelectorTitleTv.setText(mProperName); formCheckBoxSelectorTitleTvNote.setText(mProperNote); formCheckBoxSelectorCheckBox.setText(mCheckBoxName); formCheckBoxSelectorCheckBox.setChecked(mChecked); formCheckBoxSelectorCheckBox.setText(textOn, textOff); formCheckBoxSelectorCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mChecked = isChecked; } }); addView(view); } private void initAttributeSet(Context context, AttributeSet attrs){ TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FormCheckBoxSelectorView); mProperName = typedArray.getString(R.styleable.FormCheckBoxSelectorView_checkBoxSelectorName); mProperNote = typedArray.getString(R.styleable.FormCheckBoxSelectorView_checkBoxSelectorNote); mCheckBoxName = typedArray.getString(R.styleable.FormCheckBoxSelectorView_checkBoxName); mChecked = typedArray.getBoolean(R.styleable.FormCheckBoxSelectorView_checked, false); textOn = typedArray.getString(R.styleable.FormCheckBoxSelectorView_textOn); textOff = typedArray.getString(R.styleable.FormCheckBoxSelectorView_textOff); typedArray.recycle(); } /** * 返回是否打钩 * @return */ public boolean isChecked(){ return mChecked; } /** * 返回是否打钩 * @return */ public String getChecked(){ if (mChecked){ return "1"; }else{ return "0"; } } }
UTF-8
Java
3,248
java
FormCheckBoxSelectorView.java
Java
[ { "context": "w;\nimport butterknife.ButterKnife;\n\n/**\n * @author huangyue\n * @version V1.0\n * @Package com.yunwei.cmcc.widg", "end": 433, "score": 0.9995532631874084, "start": 425, "tag": "USERNAME", "value": "huangyue" } ]
null
[]
package com.yunwei.wetlandpark.widget; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.TextView; import com.yunwei.wetlandpark.R; import butterknife.BindView; import butterknife.ButterKnife; /** * @author huangyue * @version V1.0 * @Package com.yunwei.cmcc.widget * @Description: * @date 2016/11/30 09:19 */ public class FormCheckBoxSelectorView extends LinearLayout{ @BindView(R.id.formCheckBoxSelector_title_tv) TextView formCheckBoxSelectorTitleTv; @BindView(R.id.formCheckBoxSelector_title_tv_note) TextView formCheckBoxSelectorTitleTvNote; @BindView(R.id.formCheckBoxSelector_checkBox) SwitchButtonV2 formCheckBoxSelectorCheckBox; private String mProperName; private String mProperNote; private String mCheckBoxName; private String textOn; private String textOff; private boolean mChecked; public FormCheckBoxSelectorView(Context context) { this(context, null); } public FormCheckBoxSelectorView(Context context, AttributeSet attrs) { super(context, attrs); initAttributeSet(context, attrs); View view = LayoutInflater.from(context).inflate(R.layout.form_checkbox_selector_layout, null); ButterKnife.bind(this, view); mProperName += getResources().getString(R.string.colon_breaker); formCheckBoxSelectorTitleTv.setText(mProperName); formCheckBoxSelectorTitleTvNote.setText(mProperNote); formCheckBoxSelectorCheckBox.setText(mCheckBoxName); formCheckBoxSelectorCheckBox.setChecked(mChecked); formCheckBoxSelectorCheckBox.setText(textOn, textOff); formCheckBoxSelectorCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mChecked = isChecked; } }); addView(view); } private void initAttributeSet(Context context, AttributeSet attrs){ TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FormCheckBoxSelectorView); mProperName = typedArray.getString(R.styleable.FormCheckBoxSelectorView_checkBoxSelectorName); mProperNote = typedArray.getString(R.styleable.FormCheckBoxSelectorView_checkBoxSelectorNote); mCheckBoxName = typedArray.getString(R.styleable.FormCheckBoxSelectorView_checkBoxName); mChecked = typedArray.getBoolean(R.styleable.FormCheckBoxSelectorView_checked, false); textOn = typedArray.getString(R.styleable.FormCheckBoxSelectorView_textOn); textOff = typedArray.getString(R.styleable.FormCheckBoxSelectorView_textOff); typedArray.recycle(); } /** * 返回是否打钩 * @return */ public boolean isChecked(){ return mChecked; } /** * 返回是否打钩 * @return */ public String getChecked(){ if (mChecked){ return "1"; }else{ return "0"; } } }
3,248
0.719293
0.71402
98
31.897959
29.198648
110
false
false
0
0
0
0
0
0
0.581633
false
false
6
434edf987faf8297a9ff7212cdd3dc743cf719ab
27,290,222,230,504
8f77684b031660bc5a2f0def85b9b1be49f43386
/src/com/yocalist/shared/ByteReader.java
d8ee3e804c48c475c8abb4a15988315dfc5acfe6
[]
no_license
cretz/yocalist
https://github.com/cretz/yocalist
5eb38c30fbb1f501308d63b2ff7570921aab239d
24cd02ea4b55582bd976593957e24819caf3501c
refs/heads/master
2020-05-07T12:09:34.142000
2011-11-05T08:13:06
2011-11-05T08:13:06
2,714,054
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2011 Chad Retz * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.yocalist.shared; import java.io.IOException; /** * Simple byte reader interface * * @author Chad Retz */ public interface ByteReader { int getLength(); int getIndex(); Byte read() throws IOException; void read(byte[] bytes) throws IOException; void readAndMask(byte[] bytes, int mask) throws IOException; void skip() throws IOException; void skip(int count) throws IOException; void close() throws IOException; }
UTF-8
Java
1,134
java
ByteReader.java
Java
[ { "context": "/*\r\n * Copyright 2011 Chad Retz\r\n * \r\n * Licensed under the Apache License, Versi", "end": 31, "score": 0.9998438954353333, "start": 22, "tag": "NAME", "value": "Chad Retz" }, { "context": "\r\n * Simple byte reader interface\r\n * \r\n * @author Chad Retz\r\n */\r\npublic interface ByteReader {\r\n\r\n int ge", "end": 733, "score": 0.9998478889465332, "start": 724, "tag": "NAME", "value": "Chad Retz" } ]
null
[]
/* * Copyright 2011 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.yocalist.shared; import java.io.IOException; /** * Simple byte reader interface * * @author <NAME> */ public interface ByteReader { int getLength(); int getIndex(); Byte read() throws IOException; void read(byte[] bytes) throws IOException; void readAndMask(byte[] bytes, int mask) throws IOException; void skip() throws IOException; void skip(int count) throws IOException; void close() throws IOException; }
1,128
0.671958
0.664903
42
25
26.20705
80
false
false
0
0
0
0
0
0
0.380952
false
false
6
2e71d17f6beeb9a9dd7bf4276e021f02c3bbb981
2,568,390,456,986
4a2b9560117872584ce1cc54be190c9fb640eeb4
/MKLApp/src/main/java/com/majorkiekkoleague/android/activities/MainActivity.java
101b302fa06b8b09906239b976dcf2a2ba9422e6
[]
no_license
andrewgiang/MKLApp
https://github.com/andrewgiang/MKLApp
f3733175ceb463e0bf32006fefac4e1158bf606b
69fdfa37770f52adec1acf1cfe051514dfb3c3e9
refs/heads/master
2018-12-28T00:53:18.231000
2013-08-26T17:04:36
2013-08-26T17:04:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.majorkiekkoleague.android.activities; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com.majorkiekkoleague.android.R; /** * This example illustrates a common usage of the DrawerLayout widget * in the Android support library. * <p/> * <p>When a navigation (left) drawer is present, the host activity should detect presses of * the action bar's Up affordance as a signal to open and close the navigation drawer. The * ActionBarDrawerToggle facilitates this behavior. * Items within the drawer should fall into one of two categories:</p> * <p/> * <ul> * <li><strong>View switches</strong>. A view switch follows the same basic policies as * list or tab navigation in that a view switch does not create navigation history. * This pattern should only be used at the root activity of a task, leaving some form * of Up navigation active for activities further down the navigation hierarchy.</li> * <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate * parent for Up navigation. This allows a user to jump across an app's navigation * hierarchy at will. The application should treat this as it treats Up navigation from * a different task, replacing the current task stack using TaskStackBuilder or similar. * This is the only form of navigation drawer that should be used outside of the root * activity of a task.</li> * </ul> * <p/> * <p>Right side drawers should be used for actions, not navigation. This follows the pattern * established by the Action Bar that navigation should be to the left and actions to the right. * An action should be an operation performed on the current contents of the window, * for example enabling or disabling a data overlay on top of the current content.</p> */ public class MainActivity extends DrawerActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } /* Called whenever we call invalidateOptionsMenu() */ @Override public boolean onPrepareOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content view boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); // menu.findItem(R.id.action_websearch).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch (item.getItemId()) { default: return super.onOptionsItemSelected(item); } } }
UTF-8
Java
3,569
java
MainActivity.java
Java
[]
null
[]
/* * Copyright 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.majorkiekkoleague.android.activities; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com.majorkiekkoleague.android.R; /** * This example illustrates a common usage of the DrawerLayout widget * in the Android support library. * <p/> * <p>When a navigation (left) drawer is present, the host activity should detect presses of * the action bar's Up affordance as a signal to open and close the navigation drawer. The * ActionBarDrawerToggle facilitates this behavior. * Items within the drawer should fall into one of two categories:</p> * <p/> * <ul> * <li><strong>View switches</strong>. A view switch follows the same basic policies as * list or tab navigation in that a view switch does not create navigation history. * This pattern should only be used at the root activity of a task, leaving some form * of Up navigation active for activities further down the navigation hierarchy.</li> * <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate * parent for Up navigation. This allows a user to jump across an app's navigation * hierarchy at will. The application should treat this as it treats Up navigation from * a different task, replacing the current task stack using TaskStackBuilder or similar. * This is the only form of navigation drawer that should be used outside of the root * activity of a task.</li> * </ul> * <p/> * <p>Right side drawers should be used for actions, not navigation. This follows the pattern * established by the Action Bar that navigation should be to the left and actions to the right. * An action should be an operation performed on the current contents of the window, * for example enabling or disabling a data overlay on top of the current content.</p> */ public class MainActivity extends DrawerActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } /* Called whenever we call invalidateOptionsMenu() */ @Override public boolean onPrepareOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content view boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); // menu.findItem(R.id.action_websearch).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch (item.getItemId()) { default: return super.onOptionsItemSelected(item); } } }
3,569
0.725693
0.723452
86
40.511627
32.32457
96
false
false
0
0
0
0
0
0
0.290698
false
false
6
1422534a7cf73ecd181c9d1d374c78d75bdc8a47
12,257,836,733,850
8e7bcc5c382333ae9374de9966cc2342d768e949
/app/src/main/java/com/nanodegree/boyan/popularmovies/data/ReviewsResponse.java
ba3723e2e5a55aeb0b8614580f13997872b39976
[]
no_license
btsochev/popular-movies
https://github.com/btsochev/popular-movies
9786b48766f0899f7b22fecef3c014b73fd16f1c
4c2b6563548c21af95ccd5a844b59d111095f14a
refs/heads/master
2021-04-29T17:49:58.568000
2018-02-20T07:59:34
2018-02-20T07:59:34
121,679,437
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nanodegree.boyan.popularmovies.data; import com.nanodegree.boyan.popularmovies.utilities.IJsonDeserialize; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class ReviewsResponse implements IJsonDeserialize { private int id; private int page; private int totalResults; private int totalPages; private List<Review> results; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getTotalResults() { return totalResults; } public void setTotalResults(int totalResults) { this.totalResults = totalResults; } public int getTotalPages() { return totalPages; } public void setTotalPages(int totalPages) { this.totalPages = totalPages; } public List<Review> getResults() { return results; } public void setResults(List<Review> results) { this.results = results; } @Override public void getByJsonObject(JSONObject jsonObject) { id = jsonObject.optInt("id"); page = jsonObject.optInt("page"); totalResults = jsonObject.optInt("total_results"); totalPages = jsonObject.optInt("total_pages"); results = new ArrayList<>(); JSONArray resultsJsonArray = jsonObject.optJSONArray("results"); if (resultsJsonArray == null || resultsJsonArray.length() == 0) return; for (int i = 0; i < resultsJsonArray.length(); i++) { JSONObject resultJsonObject = resultsJsonArray.optJSONObject(i); if (resultJsonObject == null) continue; Review review = new Review(); review.getByJsonObject(resultJsonObject); results.add(review); } } }
UTF-8
Java
1,977
java
ReviewsResponse.java
Java
[]
null
[]
package com.nanodegree.boyan.popularmovies.data; import com.nanodegree.boyan.popularmovies.utilities.IJsonDeserialize; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class ReviewsResponse implements IJsonDeserialize { private int id; private int page; private int totalResults; private int totalPages; private List<Review> results; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getTotalResults() { return totalResults; } public void setTotalResults(int totalResults) { this.totalResults = totalResults; } public int getTotalPages() { return totalPages; } public void setTotalPages(int totalPages) { this.totalPages = totalPages; } public List<Review> getResults() { return results; } public void setResults(List<Review> results) { this.results = results; } @Override public void getByJsonObject(JSONObject jsonObject) { id = jsonObject.optInt("id"); page = jsonObject.optInt("page"); totalResults = jsonObject.optInt("total_results"); totalPages = jsonObject.optInt("total_pages"); results = new ArrayList<>(); JSONArray resultsJsonArray = jsonObject.optJSONArray("results"); if (resultsJsonArray == null || resultsJsonArray.length() == 0) return; for (int i = 0; i < resultsJsonArray.length(); i++) { JSONObject resultJsonObject = resultsJsonArray.optJSONObject(i); if (resultJsonObject == null) continue; Review review = new Review(); review.getByJsonObject(resultJsonObject); results.add(review); } } }
1,977
0.625696
0.624684
82
23.109756
21.261442
76
false
false
0
0
0
0
0
0
0.451219
false
false
6
f3213e4e219991de6735e36b6a6f41d7bc6488fc
12,266,426,601,233
1da59c980e0f5689a7c711988d562a355fa64820
/factory-pattern/src/NYPizzaStore.java
f7341c2f57df402349b255602d375f9f5d45eaca
[]
no_license
ye-geeee/headfirst-designpattern-practice
https://github.com/ye-geeee/headfirst-designpattern-practice
b8b39aa93c6d5c0dd21b619614f894ef7409bffa
b060bdc8412aaefff14b21ae27ada92651701748
refs/heads/master
2023-06-09T07:00:16.962000
2021-07-06T20:31:40
2021-07-06T20:31:40
371,192,159
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
public class NYPizzaStore extends PizzaStore { @Override public Pizza createPizza(String type) { Pizza pizza = null; PizzaIngredientFactory pizzaIngredientFactory = new NYPizzaIngredientFactory(); if (type.equals("cheese")) { pizza = new CheesePizza(pizzaIngredientFactory); pizza.setName("New York Style Cheese Pizza"); } else if (type.equals("greek")) { pizza = new GreekPizza(pizzaIngredientFactory); pizza.setName("New York Style Greek Pizza"); } else if (type.equals("pepperoni")) { pizza = new PepperoniPizza(pizzaIngredientFactory); pizza.setName("New York Style Pepperoni Pizza"); } return pizza; } }
UTF-8
Java
752
java
NYPizzaStore.java
Java
[]
null
[]
public class NYPizzaStore extends PizzaStore { @Override public Pizza createPizza(String type) { Pizza pizza = null; PizzaIngredientFactory pizzaIngredientFactory = new NYPizzaIngredientFactory(); if (type.equals("cheese")) { pizza = new CheesePizza(pizzaIngredientFactory); pizza.setName("New York Style Cheese Pizza"); } else if (type.equals("greek")) { pizza = new GreekPizza(pizzaIngredientFactory); pizza.setName("New York Style Greek Pizza"); } else if (type.equals("pepperoni")) { pizza = new PepperoniPizza(pizzaIngredientFactory); pizza.setName("New York Style Pepperoni Pizza"); } return pizza; } }
752
0.62766
0.62766
21
34.809525
25.583885
87
false
false
0
0
0
0
0
0
0.428571
false
false
6
c1c12cce36889edbcf47c7d806f00b83a211f707
13,838,384,646,974
ad610e417f8e2612acfe84549dffddc91f96e585
/arithmetic/src/main/java/com/kevin/arithmetic/mi/Solution5.java
ad44bc31c86d9310ba2e05f6493bc15a0f0cf0db
[]
no_license
tuchuantao/ArithmeticExercise
https://github.com/tuchuantao/ArithmeticExercise
0ea1d57b6964c5bd1e5f978729f16308ca537639
484764934d9d1e7d1d438868770a9a6ab8758de4
refs/heads/master
2022-05-17T07:09:37.316000
2022-04-28T02:54:45
2022-04-28T02:54:45
133,036,326
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kevin.arithmetic.mi; /** * Kevin-Tu on 2018/5/14. */ public class Solution5 { public static void main(String[] args) { String result = solution("12,13,14,5,6,7,8,9,10"); System.out.print(result); } private static String solution(String line) { String[] array = line.split(","); int beginIndex = 0; int length = array.length; for (int i = 0; i < length - 1; i++) { if (Integer.valueOf(array[i]) > Integer.valueOf(array[i + 1])) { beginIndex = i + 1; break; } } int result = beginIndex + (length - 1) / 2; result = result >= length ? result - length : result; return String.valueOf(array[result]); } }
UTF-8
Java
713
java
Solution5.java
Java
[ { "context": "package com.kevin.arithmetic.mi;\n\n/**\n * Kevin-Tu on 2018/5/14.\n */\npublic class Solution5 {\n\n p", "end": 49, "score": 0.9685471653938293, "start": 41, "tag": "NAME", "value": "Kevin-Tu" } ]
null
[]
package com.kevin.arithmetic.mi; /** * Kevin-Tu on 2018/5/14. */ public class Solution5 { public static void main(String[] args) { String result = solution("12,13,14,5,6,7,8,9,10"); System.out.print(result); } private static String solution(String line) { String[] array = line.split(","); int beginIndex = 0; int length = array.length; for (int i = 0; i < length - 1; i++) { if (Integer.valueOf(array[i]) > Integer.valueOf(array[i + 1])) { beginIndex = i + 1; break; } } int result = beginIndex + (length - 1) / 2; result = result >= length ? result - length : result; return String.valueOf(array[result]); } }
713
0.570827
0.531557
27
25.407408
20.665339
72
false
false
0
0
0
0
0
0
0.814815
false
false
6
e618bb86540d48763081cf1a611d2a41273c26fd
14,199,161,951,223
814bdc049abb96f02ad7858d5fc9c6126ff5462f
/src/com/leetr/ui/TabLayout.java
c176146fa37a4f14b9c95c3e5e4e6dd5d205ed33
[]
no_license
deesaster/leetr-android
https://github.com/deesaster/leetr-android
3995753aff43fad6fac8f94a78fced8953b2c5c6
51d7448e2fb12017cdf6b47f32fc70dc28aeec36
refs/heads/master
2016-09-05T22:33:43.593000
2011-10-16T21:25:48
2011-10-16T21:25:48
2,060,640
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.leetr.ui; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import com.leetr.R; import com.leetr.ui.base.ITab; import java.util.ArrayList; public class TabLayout extends LinearLayout { private Context mContext; private OnTabSelectedListener mTabListener; private OnClickListener mTabOnClickListener; private ArrayList<View> mTabs; private int mTabSelectorResId; private LayoutParams mTabLayoutParams; public static final View makeImageTab(Context context, int tabId, Drawable unpressed, Drawable pressed) { TabImageButton tab = new TabImageButton(context, tabId, unpressed, pressed); return tab; } public static final View makeImageTab(Context context, int tabId, int unpressedDrawableResourceId, int pressedDrawableResourceId) { return makeImageTab(context, tabId, context.getResources().getDrawable(unpressedDrawableResourceId), context.getResources().getDrawable(pressedDrawableResourceId)); } public static final View makeTextTab(Context context, int tabId, String text) { TabTextButton tab = new TabTextButton(context, tabId, text); return tab; } public TabLayout(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; mTabs = new ArrayList<View>(); initListeners(); initUiComponents(attrs); } private void initListeners() { mTabOnClickListener = new OnClickListener() { public void onClick(View view) { handleTabPress(view, true); } }; } private void initUiComponents(AttributeSet attrs) { mTabLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); mTabLayoutParams.weight = 1; TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.TabLayout); mTabSelectorResId = a.getResourceId(R.styleable.TabLayout_tabSelector, 0); a.recycle(); } public void setTabSelector(int selectorResId) { mTabSelectorResId = selectorResId; } public void setOnTabSelectedListener(OnTabSelectedListener listener) { mTabListener = listener; } @Override public void onFinishInflate() { int numChildren = getChildCount(); int firstTabId = -1; //for setting first selected tab for (int i = 0; i < numChildren; i++) { View child = getChildAt(i); if (child instanceof ITab) { child = setTabParameters(child); if (child.getId() > 0) { int tabId = child.getId(); ((ITab) child).setTabId(tabId); if (firstTabId == -1) { firstTabId = tabId; } mTabs.add(child); } } } if (firstTabId > -1) { setSelectedTab(firstTabId); } super.onFinishInflate(); } public void setSelectedTab(int tabId) { for (View tab : mTabs) { tab.setEnabled(((ITab) tab).getTabId() != tabId); } } public void addTextTab(int tabId, String text) { TabTextButton tab = new TabTextButton(mContext, tabId, text); addTab(tab); } private View setTabParameters(View tab) { tab.setLayoutParams(mTabLayoutParams); tab.setOnClickListener(mTabOnClickListener); tab.setBackgroundResource(mTabSelectorResId); return tab; } public void addTab(View tab) { tab = setTabParameters(tab); mTabs.add(tab); addView(tab); } public void addImageTab(int tabId, Drawable unpressed, Drawable pressed) { TabImageButton tab = new TabImageButton(mContext, tabId, unpressed, pressed); addTab(tab); } public void addImageTab(int tabId, int unpressedDrawableResourceId, int pressedDrawableResourceId) { addImageTab(tabId, mContext.getResources().getDrawable(unpressedDrawableResourceId), mContext.getResources().getDrawable(pressedDrawableResourceId)); } private void handleTabPress(View pressedTab, boolean notifyListener) { for (View tab : mTabs) { tab.setEnabled(tab != pressedTab); } if (notifyListener && mTabListener != null) { mTabListener.onTabSelected(pressedTab, ((ITab) pressedTab).getTabId()); } } public interface OnTabSelectedListener { public void onTabSelected(View v, int tabId); } }
UTF-8
Java
4,725
java
TabLayout.java
Java
[]
null
[]
package com.leetr.ui; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import com.leetr.R; import com.leetr.ui.base.ITab; import java.util.ArrayList; public class TabLayout extends LinearLayout { private Context mContext; private OnTabSelectedListener mTabListener; private OnClickListener mTabOnClickListener; private ArrayList<View> mTabs; private int mTabSelectorResId; private LayoutParams mTabLayoutParams; public static final View makeImageTab(Context context, int tabId, Drawable unpressed, Drawable pressed) { TabImageButton tab = new TabImageButton(context, tabId, unpressed, pressed); return tab; } public static final View makeImageTab(Context context, int tabId, int unpressedDrawableResourceId, int pressedDrawableResourceId) { return makeImageTab(context, tabId, context.getResources().getDrawable(unpressedDrawableResourceId), context.getResources().getDrawable(pressedDrawableResourceId)); } public static final View makeTextTab(Context context, int tabId, String text) { TabTextButton tab = new TabTextButton(context, tabId, text); return tab; } public TabLayout(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; mTabs = new ArrayList<View>(); initListeners(); initUiComponents(attrs); } private void initListeners() { mTabOnClickListener = new OnClickListener() { public void onClick(View view) { handleTabPress(view, true); } }; } private void initUiComponents(AttributeSet attrs) { mTabLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); mTabLayoutParams.weight = 1; TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.TabLayout); mTabSelectorResId = a.getResourceId(R.styleable.TabLayout_tabSelector, 0); a.recycle(); } public void setTabSelector(int selectorResId) { mTabSelectorResId = selectorResId; } public void setOnTabSelectedListener(OnTabSelectedListener listener) { mTabListener = listener; } @Override public void onFinishInflate() { int numChildren = getChildCount(); int firstTabId = -1; //for setting first selected tab for (int i = 0; i < numChildren; i++) { View child = getChildAt(i); if (child instanceof ITab) { child = setTabParameters(child); if (child.getId() > 0) { int tabId = child.getId(); ((ITab) child).setTabId(tabId); if (firstTabId == -1) { firstTabId = tabId; } mTabs.add(child); } } } if (firstTabId > -1) { setSelectedTab(firstTabId); } super.onFinishInflate(); } public void setSelectedTab(int tabId) { for (View tab : mTabs) { tab.setEnabled(((ITab) tab).getTabId() != tabId); } } public void addTextTab(int tabId, String text) { TabTextButton tab = new TabTextButton(mContext, tabId, text); addTab(tab); } private View setTabParameters(View tab) { tab.setLayoutParams(mTabLayoutParams); tab.setOnClickListener(mTabOnClickListener); tab.setBackgroundResource(mTabSelectorResId); return tab; } public void addTab(View tab) { tab = setTabParameters(tab); mTabs.add(tab); addView(tab); } public void addImageTab(int tabId, Drawable unpressed, Drawable pressed) { TabImageButton tab = new TabImageButton(mContext, tabId, unpressed, pressed); addTab(tab); } public void addImageTab(int tabId, int unpressedDrawableResourceId, int pressedDrawableResourceId) { addImageTab(tabId, mContext.getResources().getDrawable(unpressedDrawableResourceId), mContext.getResources().getDrawable(pressedDrawableResourceId)); } private void handleTabPress(View pressedTab, boolean notifyListener) { for (View tab : mTabs) { tab.setEnabled(tab != pressedTab); } if (notifyListener && mTabListener != null) { mTabListener.onTabSelected(pressedTab, ((ITab) pressedTab).getTabId()); } } public interface OnTabSelectedListener { public void onTabSelected(View v, int tabId); } }
4,725
0.644444
0.642963
153
29.882353
30.312305
172
false
false
0
0
0
0
0
0
0.653595
false
false
6
04f11a13ae3853210cc2555d0173cc151134473a
14,199,161,947,045
c5ce810e0188beab0be828f2921a1c9e3800968c
/src/main/java/com/example/housewareshop/repository/SubCategoryRepository.java
4d272541ba480e01ad6d32995ae33cc884f9f780
[]
no_license
KietDT1912/Project_HousewareShop_SE140777
https://github.com/KietDT1912/Project_HousewareShop_SE140777
46bd5b6144e0dfed4e4f8a7bc651136675459146
05397b7ab16dbb0fab90283bc237ded21a5c68f2
refs/heads/main
2023-07-05T02:39:35.475000
2021-08-30T12:10:35
2021-08-30T12:10:35
401,208,379
0
0
null
false
2021-08-30T12:04:35
2021-08-30T03:48:02
2021-08-30T11:04:10
2021-08-30T12:04:34
9,751
0
0
0
HTML
false
false
package com.example.housewareshop.repository; import com.example.housewareshop.entity.SubCategory; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface SubCategoryRepository extends JpaRepository<SubCategory,Integer> { }
UTF-8
Java
311
java
SubCategoryRepository.java
Java
[]
null
[]
package com.example.housewareshop.repository; import com.example.housewareshop.entity.SubCategory; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface SubCategoryRepository extends JpaRepository<SubCategory,Integer> { }
311
0.861736
0.861736
9
33.555557
29.303436
83
false
false
0
0
0
0
0
0
0.555556
false
false
6
7f83df7bddc328ea5c80f51a3b5733a5e95b59e8
19,602,230,760,666
28abe1a1e3eed36cc1aa3aaeb400251150b00d93
/src/com/barefoot/distill/Distill.java
8ada96eec2f9686833c91cca69b814d4b31b4bad
[]
no_license
priyaaank/distill
https://github.com/priyaaank/distill
0ee45b5101589bac46e2ab702ac89a055c55784c
7ca4c424f69a8dccd0c329fc6af9a0f6b6522c9a
refs/heads/master
2020-05-21T11:36:53.128000
2014-04-25T16:03:14
2014-04-25T16:03:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.barefoot.distill; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Distill extends Activity { public static final String APP_ENABLED_CONFIG_KEY = "distill_enabled"; private SharedPreferences preferences; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); preferences = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()); updateButtonStateBasedOnStoredData(); attachClickListenerToButton(); } private void attachClickListenerToButton() { Button configButton = (Button) this.findViewById(R.id.distill_config); configButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String passcode = ((EditText)Distill.this.findViewById(R.id.passcode)).getText().toString().trim(); if("240782".equalsIgnoreCase(passcode)) updateConfig(); else Toast.makeText(Distill.this.getApplicationContext(), "Passcode invalid", Toast.LENGTH_SHORT); } }); } private void updateConfig() { preferences.edit().putBoolean(APP_ENABLED_CONFIG_KEY, !isConfigEnabled()).commit(); updateButtonStateBasedOnStoredData(); } private void updateButtonStateBasedOnStoredData() { boolean isAppEnabled = isConfigEnabled(); Button appEnabledConfigButton = (Button) findViewById(R.id.distill_config); if(isAppEnabled) { appEnabledConfigButton.setText("Disable"); appEnabledConfigButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.enabled_button)); } else { appEnabledConfigButton.setText("Enable"); appEnabledConfigButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.disabled_button)); } } private boolean isConfigEnabled() { return preferences.getBoolean(APP_ENABLED_CONFIG_KEY, true); } }
UTF-8
Java
2,168
java
Distill.java
Java
[]
null
[]
package com.barefoot.distill; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Distill extends Activity { public static final String APP_ENABLED_CONFIG_KEY = "distill_enabled"; private SharedPreferences preferences; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); preferences = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()); updateButtonStateBasedOnStoredData(); attachClickListenerToButton(); } private void attachClickListenerToButton() { Button configButton = (Button) this.findViewById(R.id.distill_config); configButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String passcode = ((EditText)Distill.this.findViewById(R.id.passcode)).getText().toString().trim(); if("240782".equalsIgnoreCase(passcode)) updateConfig(); else Toast.makeText(Distill.this.getApplicationContext(), "Passcode invalid", Toast.LENGTH_SHORT); } }); } private void updateConfig() { preferences.edit().putBoolean(APP_ENABLED_CONFIG_KEY, !isConfigEnabled()).commit(); updateButtonStateBasedOnStoredData(); } private void updateButtonStateBasedOnStoredData() { boolean isAppEnabled = isConfigEnabled(); Button appEnabledConfigButton = (Button) findViewById(R.id.distill_config); if(isAppEnabled) { appEnabledConfigButton.setText("Disable"); appEnabledConfigButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.enabled_button)); } else { appEnabledConfigButton.setText("Enable"); appEnabledConfigButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.disabled_button)); } } private boolean isConfigEnabled() { return preferences.getBoolean(APP_ENABLED_CONFIG_KEY, true); } }
2,168
0.738469
0.735701
62
33.967743
30.87277
109
false
false
0
0
0
0
0
0
0.548387
false
false
6
c389d72503c10246026eb3c18d0d54aa56943ab3
20,340,965,132,355
09beda33f9511cdd1280ee99bab4e44c98fa81be
/egitFinal/src/main/java/foo/Branch01.java
4ad49ab14bde0811eb7d741268a7d3bb6bd82607
[]
no_license
jianfengsuozhi/egitFinal
https://github.com/jianfengsuozhi/egitFinal
fd8a93e13f69daf44fd7e61d1c8599f4228aa8bf
5e36dcb60cd2f9467b36b18662e2d968957a0a21
refs/heads/master
2020-09-16T09:07:39.303000
2016-08-23T05:45:48
2016-08-23T05:47:29
66,335,982
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package foo; public class Branch01 { }
UTF-8
Java
46
java
Branch01.java
Java
[]
null
[]
package foo; public class Branch01 { }
46
0.630435
0.586957
5
7.2
9.108238
23
false
false
0
0
0
0
0
0
0.2
false
false
6
24bb7cbe7abd9f2e0a1af22676ac6542abbf8486
223,338,316,309
190179fd5f0041d7f8aec3a9b1a12f9d36ab5ef3
/app/src/main/java/blacklinden/com/servicetest/Constants.java
00ed9c9acf96c863134638e57f72329c51403134
[]
no_license
BlackLINDEN/SRVC
https://github.com/BlackLINDEN/SRVC
fa4ee293956c68e6239d14993e94558a5d6782f0
76b290754aa7e50945bf1d951f733b02c413852d
refs/heads/master
2020-03-23T08:28:18.823000
2018-08-02T14:42:06
2018-08-02T14:42:06
141,328,526
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package blacklinden.com.servicetest; public class Constants { public interface ACTION { public static String MAIN_ACTION = "blacklinden.com.servicetest.action.main"; public static String INIT_ACTION = "blacklinden.com.servicetest.action.init"; public static String PREV_ACTION = "blacklinden.com.servicetest.action.prev"; public static String PLAY_ACTION = "blacklinden.com.servicetest.action.play"; public static String NEXT_ACTION = "blacklinden.com.servicetest.action.next"; public static String STARTFOREGROUND_ACTION = "blacklinden.com.servicetest.action.startforeground"; public static String STOPFOREGROUND_ACTION = "blacklinden.com.servicetest.action.stopforeground"; } public interface NOTIFICATION_ID { int FOREGROUND_SERVICE = 101; } }
UTF-8
Java
829
java
Constants.java
Java
[]
null
[]
package blacklinden.com.servicetest; public class Constants { public interface ACTION { public static String MAIN_ACTION = "blacklinden.com.servicetest.action.main"; public static String INIT_ACTION = "blacklinden.com.servicetest.action.init"; public static String PREV_ACTION = "blacklinden.com.servicetest.action.prev"; public static String PLAY_ACTION = "blacklinden.com.servicetest.action.play"; public static String NEXT_ACTION = "blacklinden.com.servicetest.action.next"; public static String STARTFOREGROUND_ACTION = "blacklinden.com.servicetest.action.startforeground"; public static String STOPFOREGROUND_ACTION = "blacklinden.com.servicetest.action.stopforeground"; } public interface NOTIFICATION_ID { int FOREGROUND_SERVICE = 101; } }
829
0.733414
0.729795
19
42.63158
39.403728
107
false
false
0
0
0
0
0
0
0.473684
false
false
6
f93dff02aec5594411353db1aeee8afe0efc109a
16,140,487,102,560
9a83df95a52b14a5330dcb894b2f3c0fc84af026
/src/main/java/com/wally/hiread/model/product/UserProduct.java
8b9e5eb69ccbbcf107033f6a649d6c156341ebc5
[]
no_license
wallyhung/hiread
https://github.com/wallyhung/hiread
21f5d520881a0cd588cd944c40bc60e57350dadb
16bf4e1e2b946c696d220656aa161e6e54fdd68e
refs/heads/master
2021-07-15T00:16:15.936000
2017-10-19T11:24:54
2017-10-19T11:24:54
107,536,869
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wally.hiread.model.product; import java.util.Date; import java.util.List; public class UserProduct { /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String id; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.dateCreated * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private Date datecreated; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.dateModified * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private Date datemodified; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_user_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String userId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_product_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String productId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_prod_order_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String prodOrderId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_videoTime * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String videoTime; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_unit_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String unitId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_status * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String status; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.id * * @return the value of app_fd_ec_user_product.id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.id * * @param id the value for app_fd_ec_user_product.id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setId(String id) { this.id = id; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.dateCreated * * @return the value of app_fd_ec_user_product.dateCreated * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public Date getDatecreated() { return datecreated; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.dateCreated * * @param datecreated the value for app_fd_ec_user_product.dateCreated * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setDatecreated(Date datecreated) { this.datecreated = datecreated; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.dateModified * * @return the value of app_fd_ec_user_product.dateModified * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public Date getDatemodified() { return datemodified; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.dateModified * * @param datemodified the value for app_fd_ec_user_product.dateModified * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setDatemodified(Date datemodified) { this.datemodified = datemodified; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_user_id * * @return the value of app_fd_ec_user_product.c_user_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getUserId() { return userId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_user_id * * @param userId the value for app_fd_ec_user_product.c_user_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setUserId(String userId) { this.userId = userId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_product_id * * @return the value of app_fd_ec_user_product.c_product_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getProductId() { return productId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_product_id * * @param productId the value for app_fd_ec_user_product.c_product_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setProductId(String productId) { this.productId = productId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_prod_order_id * * @return the value of app_fd_ec_user_product.c_prod_order_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getProdOrderId() { return prodOrderId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_prod_order_id * * @param prodOrderId the value for app_fd_ec_user_product.c_prod_order_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setProdOrderId(String prodOrderId) { this.prodOrderId = prodOrderId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_videoTime * * @return the value of app_fd_ec_user_product.c_videoTime * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getVideoTime() { return videoTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_videoTime * * @param videoTime the value for app_fd_ec_user_product.c_videoTime * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setVideoTime(String videoTime) { this.videoTime = videoTime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_unit_id * * @return the value of app_fd_ec_user_product.c_unit_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getUnitId() { return unitId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_unit_id * * @param unitId the value for app_fd_ec_user_product.c_unit_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setUnitId(String unitId) { this.unitId = unitId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_status * * @return the value of app_fd_ec_user_product.c_status * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getStatus() { return status; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_status * * @param status the value for app_fd_ec_user_product.c_status * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setStatus(String status) { this.status = status; } private Product product; public static final String STATUS_VIDEO="video"; public static final String STATUS_PREVIEW="preview"; public static final String STATUS_PREVIEW_HW="previewHW"; public static final String STATUS_REVIEW_HW="reviewHW"; public static final String STATUS_PRETEST_PRACTISE="preTestPractise"; public static final String STATUS_PRETEST_FREE_TALK="preTestFreeTalk"; public static final String STATUS_POSTTEST_PRACTISE="postTestPractise"; public static final String STATUS_POSTTEST_FREE_TALK="postTestFreeTalk"; private String unitIdForUpdate; private String statusForUpdate; private List<Unit> done; private List<Unit> undone; private String percent; private long totalTime; private long totalTimeHour; private long totalTimeMin; private int unitIdForUpdateIndex; private boolean preTestFreeTalkLocked; private boolean postTestLocked; private boolean postTestPractiseLocked; private boolean postTestFreeTalkLocked; public boolean isPostTestFreeTalkLocked() { return postTestFreeTalkLocked; } public void setPostTestFreeTalkLocked(boolean postTestFreeTalkLocked) { this.postTestFreeTalkLocked = postTestFreeTalkLocked; } public boolean isPreTestFreeTalkLocked() { return preTestFreeTalkLocked; } public void setPreTestFreeTalkLocked(boolean preTestFreeTalkLocked) { this.preTestFreeTalkLocked = preTestFreeTalkLocked; } public boolean isPostTestLocked() { return postTestLocked; } public void setPostTestLocked(boolean postTestLocked) { this.postTestLocked = postTestLocked; } public boolean isPostTestPractiseLocked() { return postTestPractiseLocked; } public void setPostTestPractiseLocked(boolean postTestPractiseLocked) { this.postTestPractiseLocked = postTestPractiseLocked; } public int getUnitIdForUpdateIndex() { return unitIdForUpdateIndex; } public void setUnitIdForUpdateIndex(int unitIdForUpdateIndex) { this.unitIdForUpdateIndex = unitIdForUpdateIndex; } public long getTotalTimeHour() { return totalTimeHour; } public void setTotalTimeHour(long totalTimeHour) { this.totalTimeHour = totalTimeHour; } public long getTotalTimeMin() { return totalTimeMin; } public void setTotalTimeMin(long totalTimeMin) { this.totalTimeMin = totalTimeMin; } public long getTotalTime() { return totalTime; } public void setTotalTime(long totalTime) { this.totalTime = totalTime; } public String getPercent() { return percent; } public void setPercent(String percent) { this.percent = percent; } public List<Unit> getDone() { return done; } public void setDone(List<Unit> done) { this.done = done; } public List<Unit> getUndone() { return undone; } public void setUndone(List<Unit> undone) { this.undone = undone; } public String getUnitIdForUpdate() { return unitIdForUpdate; } public void setUnitIdForUpdate(String unitIdForUpdate) { this.unitIdForUpdate = unitIdForUpdate; } public String getStatusForUpdate() { return statusForUpdate; } public void setStatusForUpdate(String statusForUpdate) { this.statusForUpdate = statusForUpdate; } public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } }
UTF-8
Java
12,604
java
UserProduct.java
Java
[]
null
[]
package com.wally.hiread.model.product; import java.util.Date; import java.util.List; public class UserProduct { /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String id; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.dateCreated * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private Date datecreated; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.dateModified * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private Date datemodified; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_user_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String userId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_product_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String productId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_prod_order_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String prodOrderId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_videoTime * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String videoTime; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_unit_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String unitId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column app_fd_ec_user_product.c_status * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ private String status; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.id * * @return the value of app_fd_ec_user_product.id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.id * * @param id the value for app_fd_ec_user_product.id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setId(String id) { this.id = id; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.dateCreated * * @return the value of app_fd_ec_user_product.dateCreated * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public Date getDatecreated() { return datecreated; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.dateCreated * * @param datecreated the value for app_fd_ec_user_product.dateCreated * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setDatecreated(Date datecreated) { this.datecreated = datecreated; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.dateModified * * @return the value of app_fd_ec_user_product.dateModified * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public Date getDatemodified() { return datemodified; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.dateModified * * @param datemodified the value for app_fd_ec_user_product.dateModified * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setDatemodified(Date datemodified) { this.datemodified = datemodified; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_user_id * * @return the value of app_fd_ec_user_product.c_user_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getUserId() { return userId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_user_id * * @param userId the value for app_fd_ec_user_product.c_user_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setUserId(String userId) { this.userId = userId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_product_id * * @return the value of app_fd_ec_user_product.c_product_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getProductId() { return productId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_product_id * * @param productId the value for app_fd_ec_user_product.c_product_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setProductId(String productId) { this.productId = productId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_prod_order_id * * @return the value of app_fd_ec_user_product.c_prod_order_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getProdOrderId() { return prodOrderId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_prod_order_id * * @param prodOrderId the value for app_fd_ec_user_product.c_prod_order_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setProdOrderId(String prodOrderId) { this.prodOrderId = prodOrderId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_videoTime * * @return the value of app_fd_ec_user_product.c_videoTime * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getVideoTime() { return videoTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_videoTime * * @param videoTime the value for app_fd_ec_user_product.c_videoTime * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setVideoTime(String videoTime) { this.videoTime = videoTime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_unit_id * * @return the value of app_fd_ec_user_product.c_unit_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getUnitId() { return unitId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_unit_id * * @param unitId the value for app_fd_ec_user_product.c_unit_id * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setUnitId(String unitId) { this.unitId = unitId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column app_fd_ec_user_product.c_status * * @return the value of app_fd_ec_user_product.c_status * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public String getStatus() { return status; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column app_fd_ec_user_product.c_status * * @param status the value for app_fd_ec_user_product.c_status * * @mbggenerated Mon May 22 16:27:55 CST 2017 */ public void setStatus(String status) { this.status = status; } private Product product; public static final String STATUS_VIDEO="video"; public static final String STATUS_PREVIEW="preview"; public static final String STATUS_PREVIEW_HW="previewHW"; public static final String STATUS_REVIEW_HW="reviewHW"; public static final String STATUS_PRETEST_PRACTISE="preTestPractise"; public static final String STATUS_PRETEST_FREE_TALK="preTestFreeTalk"; public static final String STATUS_POSTTEST_PRACTISE="postTestPractise"; public static final String STATUS_POSTTEST_FREE_TALK="postTestFreeTalk"; private String unitIdForUpdate; private String statusForUpdate; private List<Unit> done; private List<Unit> undone; private String percent; private long totalTime; private long totalTimeHour; private long totalTimeMin; private int unitIdForUpdateIndex; private boolean preTestFreeTalkLocked; private boolean postTestLocked; private boolean postTestPractiseLocked; private boolean postTestFreeTalkLocked; public boolean isPostTestFreeTalkLocked() { return postTestFreeTalkLocked; } public void setPostTestFreeTalkLocked(boolean postTestFreeTalkLocked) { this.postTestFreeTalkLocked = postTestFreeTalkLocked; } public boolean isPreTestFreeTalkLocked() { return preTestFreeTalkLocked; } public void setPreTestFreeTalkLocked(boolean preTestFreeTalkLocked) { this.preTestFreeTalkLocked = preTestFreeTalkLocked; } public boolean isPostTestLocked() { return postTestLocked; } public void setPostTestLocked(boolean postTestLocked) { this.postTestLocked = postTestLocked; } public boolean isPostTestPractiseLocked() { return postTestPractiseLocked; } public void setPostTestPractiseLocked(boolean postTestPractiseLocked) { this.postTestPractiseLocked = postTestPractiseLocked; } public int getUnitIdForUpdateIndex() { return unitIdForUpdateIndex; } public void setUnitIdForUpdateIndex(int unitIdForUpdateIndex) { this.unitIdForUpdateIndex = unitIdForUpdateIndex; } public long getTotalTimeHour() { return totalTimeHour; } public void setTotalTimeHour(long totalTimeHour) { this.totalTimeHour = totalTimeHour; } public long getTotalTimeMin() { return totalTimeMin; } public void setTotalTimeMin(long totalTimeMin) { this.totalTimeMin = totalTimeMin; } public long getTotalTime() { return totalTime; } public void setTotalTime(long totalTime) { this.totalTime = totalTime; } public String getPercent() { return percent; } public void setPercent(String percent) { this.percent = percent; } public List<Unit> getDone() { return done; } public void setDone(List<Unit> done) { this.done = done; } public List<Unit> getUndone() { return undone; } public void setUndone(List<Unit> undone) { this.undone = undone; } public String getUnitIdForUpdate() { return unitIdForUpdate; } public void setUnitIdForUpdate(String unitIdForUpdate) { this.unitIdForUpdate = unitIdForUpdate; } public String getStatusForUpdate() { return statusForUpdate; } public void setStatusForUpdate(String statusForUpdate) { this.statusForUpdate = statusForUpdate; } public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } }
12,604
0.654633
0.628927
431
28.245939
27.001501
98
false
false
0
0
0
0
0
0
0.185615
false
false
6
5cfc72ba54d12f7e36b0cb9addf124969bc5b4bf
18,983,755,482,812
f257d161c22116f933a1002ccf03ac7eb6427be9
/app/src/main/java/com/wallet/bo/wallets/ui/activity/AddBankActivity.java
96ac0aebf2826c12887abe3636d2197c2161926e
[]
no_license
lifuyuan123/Walletes
https://github.com/lifuyuan123/Walletes
98bb34f29d737fc38b4709dd14fd9b3f764f021f
964a199e7595bf5984006e8640981f85668ac4d6
refs/heads/master
2021-04-26T22:20:10.444000
2018-03-06T13:01:46
2018-03-06T13:01:46
123,859,463
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wallet.bo.wallets.ui.activity; import android.app.Activity; import android.content.Intent; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.wallet.bo.wallets.R; import com.wallet.bo.wallets.Utils.AddSpaceTextWatcher; import com.wallet.bo.wallets.Utils.GsonUtils; import com.wallet.bo.wallets.Utils.TextUtils; import com.wallet.bo.wallets.Utils.dedclick.AntiShake; import com.wallet.bo.wallets.http.ApiBaseResponseCallback; import com.wallet.bo.wallets.lianlianpay.AuthActivity; import com.wallet.bo.wallets.lianlianpay.BaseHelper; import com.wallet.bo.wallets.lianlianpay.Constants; import com.wallet.bo.wallets.lianlianpay.MobileSecurePayer; import com.wallet.bo.wallets.lianlianpay.PayOrder; import com.wallet.bo.wallets.pojo.Card; import com.wallet.bo.wallets.pojo.Login; import com.wallet.bo.wallets.pojo.Navagation; import com.wallet.bo.wallets.ui.weiget.EaseTitleBar; import org.greenrobot.eventbus.EventBus; import org.json.JSONObject; import java.util.HashMap; import java.util.Map; import butterknife.BindView; import butterknife.OnClick; import io.card.payment.CardIOActivity; import io.card.payment.CreditCard; /** * author:ggband * date:2017/7/28 14:26 * email:ggband520@163.com * desc:添加银行卡 */ public class AddBankActivity extends BaseSwipeActivity { @BindView(R.id.ease_titlebar) EaseTitleBar easeTitlebar; @BindView(R.id.et_card) EditText etCard; @BindView(R.id.tv_cardType) TextView tvCardType; @BindView(R.id.et_tel) EditText etTel; @BindView(R.id.tv_name) TextView tvName; @BindView(R.id.tv_card) TextView tvCard; @BindView(R.id.bt_open) TextView btOpen; @BindView(R.id.ll_alert) LinearLayout llAlert; @BindView(R.id.bt_goto) Button btGoto; private Login login; private int MY_SCAN_REQUEST_CODE = 100; @Override protected int getContentView() { return R.layout.activity_addbank; } @Override protected void initView() { AddSpaceTextWatcher[] asEditTexts = new AddSpaceTextWatcher[2]; asEditTexts[1] = new AddSpaceTextWatcher(etCard, 48); asEditTexts[1].setSpaceType(AddSpaceTextWatcher.SpaceType.bankCardNumberType); easeTitlebar.setLeftLayoutClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } @Override protected void setUpView() { login = MyApplication.getLogin(); if (MyApplication.isOpen()) { llAlert.setVisibility(View.VISIBLE); Login login = MyApplication.getLogin(); tvName.setText(login.getName()); tvCard.setText(TextUtils.dosubtext424(login.getCard())); } else { btOpen.setVisibility(View.VISIBLE); } } @OnClick({R.id.bt_goto, R.id.bt_open, R.id.bt_toScan}) public void onClick(View view) { if (AntiShake.check(view.getId())) { //判断是否多次点击 return; } switch (view.getId()) { case R.id.bt_toScan://扫描银行卡号 toScanBank(); break; case R.id.bt_goto: // String tel = TextUtils.repaceTrim(etTel.getText().toString().trim()); // String card = TextUtils.repaceTrim(etCard.getText().toString().trim()); // if (!AccountValidatorUtil.isMobile(tel)) { // toastShow("手机号格式不正确"); // return; // } // Intent intent = new Intent(this, AddBankMesckActivity.class); // Card addBank = new Card(); // addBank.setAccount(card); // addBank.setPhone(tel); // addBank.setBankname("招商银行"); // intent.putExtra("bank", addBank); // startActivity(intent); // finish(); requestAddBank(); break; case R.id.bt_open: Intent intentLoan = new Intent(new Intent(activity, OpenLoanActivity.class)); intentLoan.addFlags(1); activity.startActivityForResult(intentLoan, Activity.RESULT_FIRST_USER); break; } } private void toScanBank() { Intent scanIntent = new Intent(this, CardIOActivity.class); // customize these values to suit your needs. scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false // MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity. startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE); } private void requestAddBank() { String card = TextUtils.repaceTrim(etCard.getText().toString().trim()); Log.i("ggband", "card:" + card); Map<String, String> stringStringMap = new HashMap<String, String>(); stringStringMap.put("uid", login.getUserid()); stringStringMap.put("account", card); httpLoader.addBankLianLianSign(stringStringMap, new ApiBaseResponseCallback<PayOrder>() { @Override public void onSuccessful(PayOrder order) { String content4Pay = BaseHelper.toJSONString(order); // 关键 content4Pay 用于提交到支付SDK的订单支付串,如遇到签名错误的情况,请将该信息帖给我们的技术支持 Log.i(AuthActivity.class.getSimpleName() + "给连连:", content4Pay); MobileSecurePayer msp = new MobileSecurePayer(); boolean bRet = msp.paySign(content4Pay, mHandler, Constants.RQF_PAY, activity, false); } @Override public void onFailure(String msg) { if (msg!=null) toastShow(msg.toString()); } @Override public void onFinish() { } }); } private Handler mHandler = createHandler(); private Handler createHandler() { return new Handler() { public void handleMessage(Message msg) { String strRet = (String) msg.obj; switch (msg.what) { case Constants.RQF_PAY: { JSONObject objContent = BaseHelper.string2JSON(strRet); String retCode = objContent.optString("ret_code"); String retMsg = objContent.optString("ret_msg"); // 成功 if (Constants.RET_CODE_SUCCESS.equals(retCode)) { // objContent.put(RequestHelpr.KEYKEY, RequestHelpr.getInstance().getKey()); // Map<String, String> stringMap = new HashMap<>(); // stringMap.put("sign", new String(Base64.encodeBase64(objContent.toString().getBytes()))); // stringMap.put(RequestHelpr.APPIDKEY, RequestHelpr.APPID); Map<String, String> stringMap = GsonUtils.GsonToMaps(objContent.toString()); httpLoader.returnBank(stringMap, new ApiBaseResponseCallback<Object>() { @Override public void onSuccessful(Object o) { toastShow("添加成功"); EventBus.getDefault().post(new Card());//添加成功返回LoanActivity activity.startActivity(new Intent(activity, UpdateTransactionpasswordActivity.class)); activity.finish(); } @Override public void onFinish() { } @Override public void onFailure(String msg) { toastShow(msg); } }); break; } else if (Constants.RET_CODE_PROCESS.equals(retCode)) { // TODO 处理中,掉单的情形 String resulPay = objContent.optString("result_pay"); if (Constants.RESULT_PAY_PROCESSING .equalsIgnoreCase(resulPay)) { BaseHelper.showDialog(activity, "提示", objContent.optString("ret_msg") + "交易状态码:" + retCode + " 返回报文:" + strRet, android.R.drawable.ic_dialog_alert); } } else { // TODO 失败 BaseHelper.showDialog(activity, "提示", retMsg + ",交易状态码:" + retCode + " 返回报文:" + strRet, android.R.drawable.ic_dialog_alert); // strRet = "{\"no_agree\":\"2017090139530692\",\"oid_partner\" : \"201708090000781882\",\"result_sign\" : \"SUCCESS\", \"ret_code\" :\"0000\",\"ret_msg\" :\"交易成功\",\"sign\" : \"iGmVERse6g1KU4MEQ+riV4DfsAED7ybl8PzM9aD/iIpsevA8SkxuVnvKpQeyNa6t18rWFqLIBU9JHYeIS6bXHNXPNWgdootS33+ginRYHzBEDocEZcEtgjhBRj1OVmc6+IT9C0v/yM8j3xL206Y6xDclk6hMa0O20Lop21qNyoA=\",\"sign_type\" :\"RSA\",\"user_id\": \"60064697\"}"; } } break; } super.handleMessage(msg); } }; } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == MY_SCAN_REQUEST_CODE) { String resultDisplayStr; if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) { CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT); resultDisplayStr = "Card Number: " + scanResult.getRedactedCardNumber() + "\n"; etCard.setText(TextUtils.addTrim4(scanResult.cardNumber)); if (scanResult.isExpiryValid()) { resultDisplayStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n"; } if (scanResult.cvv != null) { // Never log or display a CVV resultDisplayStr += "CVV has " + scanResult.cvv.length() + " digits.\n"; } if (scanResult.postalCode != null) { resultDisplayStr += "Postal Code: " + scanResult.postalCode + "\n"; } // etCard.setText(resultDisplayStr); } else { resultDisplayStr = "Scan was canceled."; } } } }
UTF-8
Java
11,529
java
AddBankActivity.java
Java
[ { "context": "import io.card.payment.CreditCard;\n\n/**\n * author:ggband\n * date:2017/7/28 14:26\n * email:ggband520@163.co", "end": 1357, "score": 0.9996644854545593, "start": 1351, "tag": "USERNAME", "value": "ggband" }, { "context": " * author:ggband\n * date:2017/7/28 14:26\n * email:ggband520@163.com\n * desc:添加银行卡\n */\n\npublic class AddBankActivity e", "end": 1408, "score": 0.9999204277992249, "start": 1391, "tag": "EMAIL", "value": "ggband520@163.com" } ]
null
[]
package com.wallet.bo.wallets.ui.activity; import android.app.Activity; import android.content.Intent; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.wallet.bo.wallets.R; import com.wallet.bo.wallets.Utils.AddSpaceTextWatcher; import com.wallet.bo.wallets.Utils.GsonUtils; import com.wallet.bo.wallets.Utils.TextUtils; import com.wallet.bo.wallets.Utils.dedclick.AntiShake; import com.wallet.bo.wallets.http.ApiBaseResponseCallback; import com.wallet.bo.wallets.lianlianpay.AuthActivity; import com.wallet.bo.wallets.lianlianpay.BaseHelper; import com.wallet.bo.wallets.lianlianpay.Constants; import com.wallet.bo.wallets.lianlianpay.MobileSecurePayer; import com.wallet.bo.wallets.lianlianpay.PayOrder; import com.wallet.bo.wallets.pojo.Card; import com.wallet.bo.wallets.pojo.Login; import com.wallet.bo.wallets.pojo.Navagation; import com.wallet.bo.wallets.ui.weiget.EaseTitleBar; import org.greenrobot.eventbus.EventBus; import org.json.JSONObject; import java.util.HashMap; import java.util.Map; import butterknife.BindView; import butterknife.OnClick; import io.card.payment.CardIOActivity; import io.card.payment.CreditCard; /** * author:ggband * date:2017/7/28 14:26 * email:<EMAIL> * desc:添加银行卡 */ public class AddBankActivity extends BaseSwipeActivity { @BindView(R.id.ease_titlebar) EaseTitleBar easeTitlebar; @BindView(R.id.et_card) EditText etCard; @BindView(R.id.tv_cardType) TextView tvCardType; @BindView(R.id.et_tel) EditText etTel; @BindView(R.id.tv_name) TextView tvName; @BindView(R.id.tv_card) TextView tvCard; @BindView(R.id.bt_open) TextView btOpen; @BindView(R.id.ll_alert) LinearLayout llAlert; @BindView(R.id.bt_goto) Button btGoto; private Login login; private int MY_SCAN_REQUEST_CODE = 100; @Override protected int getContentView() { return R.layout.activity_addbank; } @Override protected void initView() { AddSpaceTextWatcher[] asEditTexts = new AddSpaceTextWatcher[2]; asEditTexts[1] = new AddSpaceTextWatcher(etCard, 48); asEditTexts[1].setSpaceType(AddSpaceTextWatcher.SpaceType.bankCardNumberType); easeTitlebar.setLeftLayoutClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } @Override protected void setUpView() { login = MyApplication.getLogin(); if (MyApplication.isOpen()) { llAlert.setVisibility(View.VISIBLE); Login login = MyApplication.getLogin(); tvName.setText(login.getName()); tvCard.setText(TextUtils.dosubtext424(login.getCard())); } else { btOpen.setVisibility(View.VISIBLE); } } @OnClick({R.id.bt_goto, R.id.bt_open, R.id.bt_toScan}) public void onClick(View view) { if (AntiShake.check(view.getId())) { //判断是否多次点击 return; } switch (view.getId()) { case R.id.bt_toScan://扫描银行卡号 toScanBank(); break; case R.id.bt_goto: // String tel = TextUtils.repaceTrim(etTel.getText().toString().trim()); // String card = TextUtils.repaceTrim(etCard.getText().toString().trim()); // if (!AccountValidatorUtil.isMobile(tel)) { // toastShow("手机号格式不正确"); // return; // } // Intent intent = new Intent(this, AddBankMesckActivity.class); // Card addBank = new Card(); // addBank.setAccount(card); // addBank.setPhone(tel); // addBank.setBankname("招商银行"); // intent.putExtra("bank", addBank); // startActivity(intent); // finish(); requestAddBank(); break; case R.id.bt_open: Intent intentLoan = new Intent(new Intent(activity, OpenLoanActivity.class)); intentLoan.addFlags(1); activity.startActivityForResult(intentLoan, Activity.RESULT_FIRST_USER); break; } } private void toScanBank() { Intent scanIntent = new Intent(this, CardIOActivity.class); // customize these values to suit your needs. scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false // MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity. startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE); } private void requestAddBank() { String card = TextUtils.repaceTrim(etCard.getText().toString().trim()); Log.i("ggband", "card:" + card); Map<String, String> stringStringMap = new HashMap<String, String>(); stringStringMap.put("uid", login.getUserid()); stringStringMap.put("account", card); httpLoader.addBankLianLianSign(stringStringMap, new ApiBaseResponseCallback<PayOrder>() { @Override public void onSuccessful(PayOrder order) { String content4Pay = BaseHelper.toJSONString(order); // 关键 content4Pay 用于提交到支付SDK的订单支付串,如遇到签名错误的情况,请将该信息帖给我们的技术支持 Log.i(AuthActivity.class.getSimpleName() + "给连连:", content4Pay); MobileSecurePayer msp = new MobileSecurePayer(); boolean bRet = msp.paySign(content4Pay, mHandler, Constants.RQF_PAY, activity, false); } @Override public void onFailure(String msg) { if (msg!=null) toastShow(msg.toString()); } @Override public void onFinish() { } }); } private Handler mHandler = createHandler(); private Handler createHandler() { return new Handler() { public void handleMessage(Message msg) { String strRet = (String) msg.obj; switch (msg.what) { case Constants.RQF_PAY: { JSONObject objContent = BaseHelper.string2JSON(strRet); String retCode = objContent.optString("ret_code"); String retMsg = objContent.optString("ret_msg"); // 成功 if (Constants.RET_CODE_SUCCESS.equals(retCode)) { // objContent.put(RequestHelpr.KEYKEY, RequestHelpr.getInstance().getKey()); // Map<String, String> stringMap = new HashMap<>(); // stringMap.put("sign", new String(Base64.encodeBase64(objContent.toString().getBytes()))); // stringMap.put(RequestHelpr.APPIDKEY, RequestHelpr.APPID); Map<String, String> stringMap = GsonUtils.GsonToMaps(objContent.toString()); httpLoader.returnBank(stringMap, new ApiBaseResponseCallback<Object>() { @Override public void onSuccessful(Object o) { toastShow("添加成功"); EventBus.getDefault().post(new Card());//添加成功返回LoanActivity activity.startActivity(new Intent(activity, UpdateTransactionpasswordActivity.class)); activity.finish(); } @Override public void onFinish() { } @Override public void onFailure(String msg) { toastShow(msg); } }); break; } else if (Constants.RET_CODE_PROCESS.equals(retCode)) { // TODO 处理中,掉单的情形 String resulPay = objContent.optString("result_pay"); if (Constants.RESULT_PAY_PROCESSING .equalsIgnoreCase(resulPay)) { BaseHelper.showDialog(activity, "提示", objContent.optString("ret_msg") + "交易状态码:" + retCode + " 返回报文:" + strRet, android.R.drawable.ic_dialog_alert); } } else { // TODO 失败 BaseHelper.showDialog(activity, "提示", retMsg + ",交易状态码:" + retCode + " 返回报文:" + strRet, android.R.drawable.ic_dialog_alert); // strRet = "{\"no_agree\":\"2017090139530692\",\"oid_partner\" : \"201708090000781882\",\"result_sign\" : \"SUCCESS\", \"ret_code\" :\"0000\",\"ret_msg\" :\"交易成功\",\"sign\" : \"iGmVERse6g1KU4MEQ+riV4DfsAED7ybl8PzM9aD/iIpsevA8SkxuVnvKpQeyNa6t18rWFqLIBU9JHYeIS6bXHNXPNWgdootS33+ginRYHzBEDocEZcEtgjhBRj1OVmc6+IT9C0v/yM8j3xL206Y6xDclk6hMa0O20Lop21qNyoA=\",\"sign_type\" :\"RSA\",\"user_id\": \"60064697\"}"; } } break; } super.handleMessage(msg); } }; } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == MY_SCAN_REQUEST_CODE) { String resultDisplayStr; if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) { CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT); resultDisplayStr = "Card Number: " + scanResult.getRedactedCardNumber() + "\n"; etCard.setText(TextUtils.addTrim4(scanResult.cardNumber)); if (scanResult.isExpiryValid()) { resultDisplayStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n"; } if (scanResult.cvv != null) { // Never log or display a CVV resultDisplayStr += "CVV has " + scanResult.cvv.length() + " digits.\n"; } if (scanResult.postalCode != null) { resultDisplayStr += "Postal Code: " + scanResult.postalCode + "\n"; } // etCard.setText(resultDisplayStr); } else { resultDisplayStr = "Scan was canceled."; } } } }
11,519
0.556009
0.545721
295
37.220341
37.269913
436
false
false
0
0
0
0
172
0.015255
0.59322
false
false
6
65063cbe6e10db21e88a9cc26013f23905b4c532
5,351,529,266,878
bcbfb601a5a60628c5df816fa7782cb868dd1b97
/pacman_deel2/src/pacman/FoodItem.java
6777f8ece6398e5d663b2206987671caaf870fa6
[]
no_license
williamdedeyn/pacman_deel2
https://github.com/williamdedeyn/pacman_deel2
63ec3329a5e6bf49db8d814a1db858c6adbe8757
373209d36f93671da3c882bee71c8084cfcb4068
refs/heads/master
2023-04-02T13:22:55.289000
2021-04-04T11:12:05
2021-04-04T11:12:05
354,385,579
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pacman; public abstract class FoodItem { public abstract Square getSquare(); public abstract int getSize(); public abstract void eatenByPacman(Maze maze); }
UTF-8
Java
184
java
FoodItem.java
Java
[]
null
[]
package pacman; public abstract class FoodItem { public abstract Square getSquare(); public abstract int getSize(); public abstract void eatenByPacman(Maze maze); }
184
0.717391
0.717391
10
16.4
17.402298
47
false
false
0
0
0
0
0
0
0.9
false
false
6
44d336684a0e6efcbc7ad08cc31d322785097a5b
5,351,529,266,241
e440dd7b232801162f11ffd76b2e79a0d5b9f806
/app/src/main/java/belajar/last/Kontrakan.java
4f39b9ba80fb462ae56b46f5a0330c93f08cd256
[]
no_license
jaymahfudy/UrKost
https://github.com/jaymahfudy/UrKost
e4c248d7b376c0e3c3d27759d89531a9ed5752da
19c52ab43bfb4ab68d9d72d16b5aacf1760b890d
refs/heads/master
2017-12-05T04:01:48.884000
2017-05-21T07:49:51
2017-05-21T07:49:51
72,513,567
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package belajar.last; /** * Created by Mark_28 on 5/21/2017. * @author Jay Mahfudy * @version 1.0 */ public class Kontrakan { }
UTF-8
Java
134
java
Kontrakan.java
Java
[ { "context": "package belajar.last;\n\n/**\n * Created by Mark_28 on 5/21/2017.\n * @author Jay Mahfudy\n * @version ", "end": 48, "score": 0.9995173811912537, "start": 41, "tag": "USERNAME", "value": "Mark_28" }, { "context": "/**\n * Created by Mark_28 on 5/21/2017.\n * @author Jay Mahfudy\n * @version 1.0\n */\n\npublic class Kontrakan {\n}\n", "end": 85, "score": 0.9998909831047058, "start": 74, "tag": "NAME", "value": "Jay Mahfudy" } ]
null
[]
package belajar.last; /** * Created by Mark_28 on 5/21/2017. * @author <NAME> * @version 1.0 */ public class Kontrakan { }
129
0.649254
0.567164
10
12.4
11.968291
35
false
false
0
0
0
0
0
0
0.1
false
false
6
01f3cfdea5036323ff50ccf8bf9fcaa152e8c3dc
5,643,587,028,568
3d2d77b043b60ed0303a8cc9082e5089fbab3e23
/Lcms_fj_file/src/main/java/com/lcms/model/TcAttachment.java
1552a921917566bc6f03f302f0f93c0f0af1b3a6
[]
no_license
dreamAfar/inspectionFileServer
https://github.com/dreamAfar/inspectionFileServer
2c3ffff4dd28791a7c2825b4652a0336d4c5fb3e
ba13ed94b26c8ed9d5d21a4c48fc9a7a05d71467
refs/heads/master
2018-03-28T01:45:10
2017-04-06T13:37:08
2017-04-06T13:37:08
87,433,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lcms.model; import java.util.Date; public class TcAttachment { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.FILEID * * @mbggenerated */ private String fileid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.FILEPATH * * @mbggenerated */ private String filepath; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.HOST * * @mbggenerated */ private String host; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.PORT * * @mbggenerated */ private String port; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.FILETYPE * * @mbggenerated */ private String filetype; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.UPLOADTIME * * @mbggenerated */ private Date uploadtime; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.UPLOADER * * @mbggenerated */ private String uploader; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.ORIGINALNAME * * @mbggenerated */ private String originalname; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.MODULE * * @mbggenerated */ private String module; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.MODULEID * * @mbggenerated */ private String moduleid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.SEQUENCE * * @mbggenerated */ private Long sequence; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.FILEID * * @return the value of TC_ATTACHMENT.FILEID * * @mbggenerated */ public String getFileid() { return fileid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.FILEID * * @param fileid the value for TC_ATTACHMENT.FILEID * * @mbggenerated */ public void setFileid(String fileid) { this.fileid = fileid == null ? null : fileid.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.FILEPATH * * @return the value of TC_ATTACHMENT.FILEPATH * * @mbggenerated */ public String getFilepath() { return filepath; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.FILEPATH * * @param filepath the value for TC_ATTACHMENT.FILEPATH * * @mbggenerated */ public void setFilepath(String filepath) { this.filepath = filepath == null ? null : filepath.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.HOST * * @return the value of TC_ATTACHMENT.HOST * * @mbggenerated */ public String getHost() { return host; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.HOST * * @param host the value for TC_ATTACHMENT.HOST * * @mbggenerated */ public void setHost(String host) { this.host = host == null ? null : host.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.PORT * * @return the value of TC_ATTACHMENT.PORT * * @mbggenerated */ public String getPort() { return port; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.PORT * * @param port the value for TC_ATTACHMENT.PORT * * @mbggenerated */ public void setPort(String port) { this.port = port == null ? null : port.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.FILETYPE * * @return the value of TC_ATTACHMENT.FILETYPE * * @mbggenerated */ public String getFiletype() { return filetype; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.FILETYPE * * @param filetype the value for TC_ATTACHMENT.FILETYPE * * @mbggenerated */ public void setFiletype(String filetype) { this.filetype = filetype == null ? null : filetype.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.UPLOADTIME * * @return the value of TC_ATTACHMENT.UPLOADTIME * * @mbggenerated */ public Date getUploadtime() { return uploadtime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.UPLOADTIME * * @param uploadtime the value for TC_ATTACHMENT.UPLOADTIME * * @mbggenerated */ public void setUploadtime(Date uploadtime) { this.uploadtime = uploadtime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.UPLOADER * * @return the value of TC_ATTACHMENT.UPLOADER * * @mbggenerated */ public String getUploader() { return uploader; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.UPLOADER * * @param uploader the value for TC_ATTACHMENT.UPLOADER * * @mbggenerated */ public void setUploader(String uploader) { this.uploader = uploader == null ? null : uploader.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.ORIGINALNAME * * @return the value of TC_ATTACHMENT.ORIGINALNAME * * @mbggenerated */ public String getOriginalname() { return originalname; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.ORIGINALNAME * * @param originalname the value for TC_ATTACHMENT.ORIGINALNAME * * @mbggenerated */ public void setOriginalname(String originalname) { this.originalname = originalname == null ? null : originalname.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.MODULE * * @return the value of TC_ATTACHMENT.MODULE * * @mbggenerated */ public String getModule() { return module; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.MODULE * * @param module the value for TC_ATTACHMENT.MODULE * * @mbggenerated */ public void setModule(String module) { this.module = module == null ? null : module.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.MODULEID * * @return the value of TC_ATTACHMENT.MODULEID * * @mbggenerated */ public String getModuleid() { return moduleid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.MODULEID * * @param moduleid the value for TC_ATTACHMENT.MODULEID * * @mbggenerated */ public void setModuleid(String moduleid) { this.moduleid = moduleid == null ? null : moduleid.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.SEQUENCE * * @return the value of TC_ATTACHMENT.SEQUENCE * * @mbggenerated */ public Long getSequence() { return sequence; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.SEQUENCE * * @param sequence the value for TC_ATTACHMENT.SEQUENCE * * @mbggenerated */ public void setSequence(Long sequence) { this.sequence = sequence; } }
UTF-8
Java
9,637
java
TcAttachment.java
Java
[]
null
[]
package com.lcms.model; import java.util.Date; public class TcAttachment { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.FILEID * * @mbggenerated */ private String fileid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.FILEPATH * * @mbggenerated */ private String filepath; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.HOST * * @mbggenerated */ private String host; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.PORT * * @mbggenerated */ private String port; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.FILETYPE * * @mbggenerated */ private String filetype; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.UPLOADTIME * * @mbggenerated */ private Date uploadtime; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.UPLOADER * * @mbggenerated */ private String uploader; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.ORIGINALNAME * * @mbggenerated */ private String originalname; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.MODULE * * @mbggenerated */ private String module; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.MODULEID * * @mbggenerated */ private String moduleid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column TC_ATTACHMENT.SEQUENCE * * @mbggenerated */ private Long sequence; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.FILEID * * @return the value of TC_ATTACHMENT.FILEID * * @mbggenerated */ public String getFileid() { return fileid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.FILEID * * @param fileid the value for TC_ATTACHMENT.FILEID * * @mbggenerated */ public void setFileid(String fileid) { this.fileid = fileid == null ? null : fileid.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.FILEPATH * * @return the value of TC_ATTACHMENT.FILEPATH * * @mbggenerated */ public String getFilepath() { return filepath; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.FILEPATH * * @param filepath the value for TC_ATTACHMENT.FILEPATH * * @mbggenerated */ public void setFilepath(String filepath) { this.filepath = filepath == null ? null : filepath.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.HOST * * @return the value of TC_ATTACHMENT.HOST * * @mbggenerated */ public String getHost() { return host; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.HOST * * @param host the value for TC_ATTACHMENT.HOST * * @mbggenerated */ public void setHost(String host) { this.host = host == null ? null : host.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.PORT * * @return the value of TC_ATTACHMENT.PORT * * @mbggenerated */ public String getPort() { return port; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.PORT * * @param port the value for TC_ATTACHMENT.PORT * * @mbggenerated */ public void setPort(String port) { this.port = port == null ? null : port.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.FILETYPE * * @return the value of TC_ATTACHMENT.FILETYPE * * @mbggenerated */ public String getFiletype() { return filetype; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.FILETYPE * * @param filetype the value for TC_ATTACHMENT.FILETYPE * * @mbggenerated */ public void setFiletype(String filetype) { this.filetype = filetype == null ? null : filetype.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.UPLOADTIME * * @return the value of TC_ATTACHMENT.UPLOADTIME * * @mbggenerated */ public Date getUploadtime() { return uploadtime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.UPLOADTIME * * @param uploadtime the value for TC_ATTACHMENT.UPLOADTIME * * @mbggenerated */ public void setUploadtime(Date uploadtime) { this.uploadtime = uploadtime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.UPLOADER * * @return the value of TC_ATTACHMENT.UPLOADER * * @mbggenerated */ public String getUploader() { return uploader; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.UPLOADER * * @param uploader the value for TC_ATTACHMENT.UPLOADER * * @mbggenerated */ public void setUploader(String uploader) { this.uploader = uploader == null ? null : uploader.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.ORIGINALNAME * * @return the value of TC_ATTACHMENT.ORIGINALNAME * * @mbggenerated */ public String getOriginalname() { return originalname; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.ORIGINALNAME * * @param originalname the value for TC_ATTACHMENT.ORIGINALNAME * * @mbggenerated */ public void setOriginalname(String originalname) { this.originalname = originalname == null ? null : originalname.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.MODULE * * @return the value of TC_ATTACHMENT.MODULE * * @mbggenerated */ public String getModule() { return module; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.MODULE * * @param module the value for TC_ATTACHMENT.MODULE * * @mbggenerated */ public void setModule(String module) { this.module = module == null ? null : module.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.MODULEID * * @return the value of TC_ATTACHMENT.MODULEID * * @mbggenerated */ public String getModuleid() { return moduleid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.MODULEID * * @param moduleid the value for TC_ATTACHMENT.MODULEID * * @mbggenerated */ public void setModuleid(String moduleid) { this.moduleid = moduleid == null ? null : moduleid.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column TC_ATTACHMENT.SEQUENCE * * @return the value of TC_ATTACHMENT.SEQUENCE * * @mbggenerated */ public Long getSequence() { return sequence; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column TC_ATTACHMENT.SEQUENCE * * @param sequence the value for TC_ATTACHMENT.SEQUENCE * * @mbggenerated */ public void setSequence(Long sequence) { this.sequence = sequence; } }
9,637
0.621978
0.621978
368
25.190218
25.280958
86
false
false
0
0
0
0
0
0
0.095109
false
false
6
32b959fe00f01f06aa626e881dcc82e345ec4d81
11,029,476,035,060
0d6695d19e6bee09acdac344ea337fd117ae4dbc
/proj/src/com/sanzibb/proj/UploaderServlet.java
aea4caf3245e98238ea6884b11b0500cd7ba0c12
[]
no_license
sanjeevsaha/my-wcd-preparation
https://github.com/sanjeevsaha/my-wcd-preparation
ea6b1b55b0559a30d76ab8b244c7d22593c80ecb
826fecc860b36a4b28389e5060699327e22a14e2
refs/heads/master
2021-01-01T06:33:33.054000
2012-12-31T03:08:35
2012-12-31T03:08:35
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sanzibb.proj; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collection; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; @WebServlet(urlPatterns = "/fileUpload") @MultipartConfig public class UploaderServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public UploaderServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Collection<Part> parts = request.getParts(); for (Part part : parts) { String contentDisposition = part.getHeader("content-disposition"); String fileName= getFileName(contentDisposition); System.out.println("contentDisposition: " + contentDisposition); System.out.println("fileName: " + fileName); File dir=new File("E:\\JAVA_EE6_PROJECTS\\downloads"); FileOutputStream outStream=new FileOutputStream(new File(dir,fileName)); InputStream inStream = part.getInputStream(); byte[] bytes=new byte[1024]; int bytesRead=-1; while(true){ bytesRead=inStream.read(bytes); if(bytesRead==-1){ break; }else{ outStream.write(bytes, 0, bytesRead); } } inStream.close(); outStream.close(); System.out.println(fileName+" has been uploaded to "+dir.getAbsolutePath()); } } private String getFileName(String contentDisposition) { String[] arr = contentDisposition.split(";"); for (String part : arr) { if(part.trim().startsWith("filename")){ String filePath=part.substring(part.indexOf("=")+1).trim().replaceAll("\"", ""); System.out.println(filePath); if(filePath.contains("/")){ return filePath.substring(filePath.lastIndexOf("/")+1); }else if(filePath.contains("\\")){ return filePath.substring(filePath.lastIndexOf("\\")+1); }else{ return filePath; } } } return null; } }
UTF-8
Java
2,796
java
UploaderServlet.java
Java
[]
null
[]
package com.sanzibb.proj; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collection; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; @WebServlet(urlPatterns = "/fileUpload") @MultipartConfig public class UploaderServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public UploaderServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Collection<Part> parts = request.getParts(); for (Part part : parts) { String contentDisposition = part.getHeader("content-disposition"); String fileName= getFileName(contentDisposition); System.out.println("contentDisposition: " + contentDisposition); System.out.println("fileName: " + fileName); File dir=new File("E:\\JAVA_EE6_PROJECTS\\downloads"); FileOutputStream outStream=new FileOutputStream(new File(dir,fileName)); InputStream inStream = part.getInputStream(); byte[] bytes=new byte[1024]; int bytesRead=-1; while(true){ bytesRead=inStream.read(bytes); if(bytesRead==-1){ break; }else{ outStream.write(bytes, 0, bytesRead); } } inStream.close(); outStream.close(); System.out.println(fileName+" has been uploaded to "+dir.getAbsolutePath()); } } private String getFileName(String contentDisposition) { String[] arr = contentDisposition.split(";"); for (String part : arr) { if(part.trim().startsWith("filename")){ String filePath=part.substring(part.indexOf("=")+1).trim().replaceAll("\"", ""); System.out.println(filePath); if(filePath.contains("/")){ return filePath.substring(filePath.lastIndexOf("/")+1); }else if(filePath.contains("\\")){ return filePath.substring(filePath.lastIndexOf("\\")+1); }else{ return filePath; } } } return null; } }
2,796
0.673104
0.668813
89
29.41573
26.99555
119
false
false
0
0
0
0
0
0
2.011236
false
false
6
de1c522ef28eeadf634f7b2bcdc7dd7af33db735
2,482,491,110,500
913f3778994d47b8e545296f1f136e5a413e36c2
/klondike/src/main/java/de/clayntech/klondike/impl/exec/LogStep.java
d83279b4a85b4dc31c620a8f3dadaea46c410987
[]
no_license
Clayn/klondike
https://github.com/Clayn/klondike
448a99611845ee52a1809bbd038f17739f8057db
a3d7ef842dc0c354b3209f44ddb399d75601cde1
refs/heads/master
2023-03-19T19:29:32.766000
2021-03-23T20:05:48
2021-03-23T20:05:48
344,832,724
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.clayntech.klondike.impl.exec; import de.clayntech.klondike.impl.i18n.KlondikeTranslator; import de.clayntech.klondike.sdk.exec.ExecutionContext; import de.clayntech.klondike.sdk.exec.Step; import de.clayntech.klondike.sdk.exec.StepDefinition; import de.clayntech.klondike.sdk.param.ParameterDefinition; @StepDefinition(name = "klondike.impl.log",translator = KlondikeTranslator.class,parameter = { @ParameterDefinition(type= String.class, name =LogStep.MESSAGE_PARAMETER,optional = false) }) public class LogStep extends Step { public static final String MESSAGE_PARAMETER="log.message"; @Override public void execute(ExecutionContext context) { String message=context.getParameter().get(MESSAGE_PARAMETER,String.class); if(message==null) { message=context.getSharedParameter().get(MESSAGE_PARAMETER,String.class); } LOG.debug(message); } }
UTF-8
Java
924
java
LogStep.java
Java
[]
null
[]
package de.clayntech.klondike.impl.exec; import de.clayntech.klondike.impl.i18n.KlondikeTranslator; import de.clayntech.klondike.sdk.exec.ExecutionContext; import de.clayntech.klondike.sdk.exec.Step; import de.clayntech.klondike.sdk.exec.StepDefinition; import de.clayntech.klondike.sdk.param.ParameterDefinition; @StepDefinition(name = "klondike.impl.log",translator = KlondikeTranslator.class,parameter = { @ParameterDefinition(type= String.class, name =LogStep.MESSAGE_PARAMETER,optional = false) }) public class LogStep extends Step { public static final String MESSAGE_PARAMETER="log.message"; @Override public void execute(ExecutionContext context) { String message=context.getParameter().get(MESSAGE_PARAMETER,String.class); if(message==null) { message=context.getSharedParameter().get(MESSAGE_PARAMETER,String.class); } LOG.debug(message); } }
924
0.751082
0.748918
24
37.5
31.819805
98
false
false
0
0
0
0
0
0
0.666667
false
false
6
b9eca57125fc32bede3c75d5f3303647128a1b5b
2,508,260,972,208
f5114187be8db941e27574929453928974fd439e
/kneesapp/dao/src/main/java/br/com/kneesapp/criteria/EventCriteria.java
b92662dfa84af601377f5e7feb7188c4583334d7
[ "MIT" ]
permissive
andrereisandrade/Java-KneesApp
https://github.com/andrereisandrade/Java-KneesApp
3e49681133a14a68ae37529dee62adb51e270a21
4a2abd5fd60d780e23416143db83ee4001ace559
refs/heads/master
2022-12-27T11:56:34.497000
2020-10-10T03:33:29
2020-10-10T03:33:29
302,806,994
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.kneesapp.criteria; /** * * @author andre.andrade */ public class EventCriteria extends BaseCriteria{ public final static String EVENT = "evento"; public final static String ADDRESS = "endereco"; public final static String CITY = "cidade"; public final static String COUNTRY = "pais"; public final static String STATE = "estado"; public final static String NEIGBORHOOD = "bairro"; public final static String NUMBER = "numero"; public final static String STREET = "logradouro"; public final static Long NAME_IL = 1L; public final static Long DESCRIPTION_IL = 2L; public final static Long CATEGORY_IL = 3L; public final static Long ADVERTISER_IL = 4L; public final static Long ADDRESS_IL = 5L; public final static Long DATE_IL = 6L; public final static Long LIMIT_IL = 98L; public final static Long OFFSET_IL = 99L; public final static Long ADVERTISER_ID_EQ = 7L; }
UTF-8
Java
959
java
EventCriteria.java
Java
[ { "context": "age br.com.kneesapp.criteria;\n\n\n\n/**\n *\n * @author andre.andrade\n */\npublic class EventCriteria extends BaseCriter", "end": 68, "score": 0.9940183162689209, "start": 55, "tag": "NAME", "value": "andre.andrade" } ]
null
[]
package br.com.kneesapp.criteria; /** * * @author andre.andrade */ public class EventCriteria extends BaseCriteria{ public final static String EVENT = "evento"; public final static String ADDRESS = "endereco"; public final static String CITY = "cidade"; public final static String COUNTRY = "pais"; public final static String STATE = "estado"; public final static String NEIGBORHOOD = "bairro"; public final static String NUMBER = "numero"; public final static String STREET = "logradouro"; public final static Long NAME_IL = 1L; public final static Long DESCRIPTION_IL = 2L; public final static Long CATEGORY_IL = 3L; public final static Long ADVERTISER_IL = 4L; public final static Long ADDRESS_IL = 5L; public final static Long DATE_IL = 6L; public final static Long LIMIT_IL = 98L; public final static Long OFFSET_IL = 99L; public final static Long ADVERTISER_ID_EQ = 7L; }
959
0.698644
0.687174
30
30.966667
21.700205
54
false
false
0
0
0
0
0
0
0.6
false
false
6
51a02dea39c7f0f8cdda93b447b0e4b6ca1be192
833,223,689,834
99d0c545f88dd4a92f114a5156299da32304daed
/src/main/java/com/d3v4/tasks/web/rest/package-info.java
dc04f24558a3e7f90529346ef986b597ed311069
[]
no_license
k-mendza/JHipster-Tasks
https://github.com/k-mendza/JHipster-Tasks
10c447ea77498d3bb6b60b77a1bc03447685eb5d
b2a8eeebdc8a8abadd4b669c0063aa697c4ec538
refs/heads/master
2020-05-15T17:50:13.246000
2019-04-23T21:33:49
2019-04-23T21:33:49
182,411,685
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Spring MVC REST controllers. */ package com.d3v4.tasks.web.rest;
UTF-8
Java
73
java
package-info.java
Java
[]
null
[]
/** * Spring MVC REST controllers. */ package com.d3v4.tasks.web.rest;
73
0.684932
0.657534
4
17.25
14.254385
32
false
false
0
0
0
0
0
0
0.25
false
false
6