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
27af1a7f8bd5272657f7998640af2bba9faf3cca
26,852,135,590,843
d70480d0f57b8cfdcdfa5ab6050d8345b19658f6
/src/main/java/cn/com/atnc/teleCircuitBill/project/customerInfo/customers/controller/CustomerController.java
bbf364fcb33ef50a7e3d809ae5601187ecbf0fbf
[]
no_license
Parzivalee/TeleCircuitBill
https://github.com/Parzivalee/TeleCircuitBill
c8d6b9fd99fdbce2d6c7e2490e1d86037bda3491
08d105df4e6742db7f90356eed472bdc699d3bc0
refs/heads/master
2022-09-10T20:45:49.510000
2019-09-18T01:18:58
2019-09-18T01:18:58
194,023,026
1
1
null
false
2022-09-01T23:09:14
2019-06-27T04:32:07
2019-12-16T08:11:19
2022-09-01T23:09:12
55,957
1
1
6
JavaScript
false
false
package cn.com.atnc.teleCircuitBill.project.customerInfo.customers.controller; import cn.com.atnc.teleCircuitBill.common.utils.poi.ExcelUtil; import cn.com.atnc.teleCircuitBill.framework.aspectj.lang.annotation.Log; import cn.com.atnc.teleCircuitBill.framework.aspectj.lang.constant.BusinessType; import cn.com.atnc.teleCircuitBill.framework.web.controller.BaseController; import cn.com.atnc.teleCircuitBill.framework.web.domain.AjaxResult; import cn.com.atnc.teleCircuitBill.framework.web.page.TableDataInfo; import cn.com.atnc.teleCircuitBill.project.customerInfo.customers.domain.Customer; import cn.com.atnc.teleCircuitBill.project.customerInfo.customers.domain.CustomerExportModel; import cn.com.atnc.teleCircuitBill.project.customerInfo.customers.service.CustomerService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; /** * 客户信息Controller类 * @author liwenjie * @Date 2018-08-20 */ @Controller @RequestMapping("customerInfo/customers") public class CustomerController extends BaseController { private String prefix = "customerInfo/customers"; @Autowired private CustomerService customerService; /** * 获取客户信息-GET * @return */ @RequiresPermissions("customerInfo:customers:view") @GetMapping() public String user() { return prefix + "/customer"; } /** * 获取客户信息-POST * @param customer * @return */ @RequiresPermissions("customerInfo:customers:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(Customer customer) { startPage(); List<Customer> list = customerService.selectCustomerList(customer); return getDataTable(list); } /** * 客户新增-get */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 客户新增-post */ @RequiresPermissions("customerInfo:customers:add") @Log(title = "客户管理", action = BusinessType.INSERT) @PostMapping("/add") @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult addSave(Customer customer) { return toAjax(customerService.insertCustomer(customer)); } /** * 客户修改-GET */ @GetMapping("/edit/{customerId}") public String edit(@PathVariable("customerId") String customerId, ModelMap model) { model.put("customer", customerService.findCustomerByCustomerId(customerId)); return prefix + "/edit"; } /** * 修改保存用户-POST */ @RequiresPermissions("customerInfo:customers:edit") @Log(title = "客户管理", action = BusinessType.UPDATE) @PostMapping("/edit") @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult editSave(Customer customer) { return toAjax(customerService.updateCustomer(customer)); } /** * 删除客户 * @param ids * @return */ @RequiresPermissions("customerInfo:customers:remove") @Log(title = "客户管理", action = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(customerService.deleteCountryByIds(ids)); } @Log(title = "客户管理", action = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(Customer customer) throws Exception { try { List<Customer> list = customerService.selectCustomerList(customer); List<CustomerExportModel> modelList = new ArrayList<>(); list.stream().forEach(customer1 -> { CustomerExportModel model = new CustomerExportModel(); if (customer1.getArea() != null && !customer1.getArea().equals("")) { switch (customer1.getArea()) { case "0": model.setArea("华北"); break; case "1": model.setArea("中南"); break; case "2": model.setArea("东北"); break; case "3": model.setArea("西南"); break; case "4": model.setArea("西北"); break; case "5": model.setArea("华东"); break; case "6": model.setArea("新疆"); break; case "7": model.setArea("民航局空管局"); break; } model.setCustomerName(customer1.getCustomerName()); model.setTranslateName(customer1.getTranslateName()); model.setShortName(customer1.getShortName()); model.setCode(customer1.getCode()); model.setLegalPerson(customer1.getLegalPerson()); model.setLegalPersonPhone(customer1.getLegalPersonPhone()); model.setDelegation(customer1.getDelegation()); model.setDelegationPhone(customer1.getDelegationPhone()); model.setBank(customer1.getBank()); model.setBankAccount(customer1.getBankAccount()); model.setAddress(customer1.getAddress()); model.setEmail(customer1.getEmail()); model.setPhoneNumber(customer1.getPhoneNumber()); model.setFax(customer1.getFax()); model.setUrl(customer1.getUrl()); if (customer1.getRegion() != null && !customer1.getRegion().equals("")) { switch (customer1.getRegion()) { case "0": model.setRegion("境内"); break; case "1": model.setRegion("境外"); break; case "2": model.setRegion("港澳台"); break; } } if (customer1.getLevel() != null && !customer1.getLevel().equals("")) { switch (customer1.getLevel()) { case "0": model.setLevel("高"); break; case "1": model.setLevel("中"); break; case "2": model.setLevel("低"); break; } } modelList.add(model); } }); ExcelUtil<CustomerExportModel> util = new ExcelUtil<>(CustomerExportModel.class); return util.exportExcel(modelList, "客户表"); } catch (Exception e) { return error("导出Excel失败,请联系网站管理员!"); } } }
UTF-8
Java
7,755
java
CustomerController.java
Java
[ { "context": "java.util.List;\n\n/**\n * 客户信息Controller类\n * @author liwenjie\n * @Date 2018-08-20\n */\n@Controller\n@RequestMappi", "end": 1204, "score": 0.999140739440918, "start": 1196, "tag": "USERNAME", "value": "liwenjie" } ]
null
[]
package cn.com.atnc.teleCircuitBill.project.customerInfo.customers.controller; import cn.com.atnc.teleCircuitBill.common.utils.poi.ExcelUtil; import cn.com.atnc.teleCircuitBill.framework.aspectj.lang.annotation.Log; import cn.com.atnc.teleCircuitBill.framework.aspectj.lang.constant.BusinessType; import cn.com.atnc.teleCircuitBill.framework.web.controller.BaseController; import cn.com.atnc.teleCircuitBill.framework.web.domain.AjaxResult; import cn.com.atnc.teleCircuitBill.framework.web.page.TableDataInfo; import cn.com.atnc.teleCircuitBill.project.customerInfo.customers.domain.Customer; import cn.com.atnc.teleCircuitBill.project.customerInfo.customers.domain.CustomerExportModel; import cn.com.atnc.teleCircuitBill.project.customerInfo.customers.service.CustomerService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; /** * 客户信息Controller类 * @author liwenjie * @Date 2018-08-20 */ @Controller @RequestMapping("customerInfo/customers") public class CustomerController extends BaseController { private String prefix = "customerInfo/customers"; @Autowired private CustomerService customerService; /** * 获取客户信息-GET * @return */ @RequiresPermissions("customerInfo:customers:view") @GetMapping() public String user() { return prefix + "/customer"; } /** * 获取客户信息-POST * @param customer * @return */ @RequiresPermissions("customerInfo:customers:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(Customer customer) { startPage(); List<Customer> list = customerService.selectCustomerList(customer); return getDataTable(list); } /** * 客户新增-get */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 客户新增-post */ @RequiresPermissions("customerInfo:customers:add") @Log(title = "客户管理", action = BusinessType.INSERT) @PostMapping("/add") @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult addSave(Customer customer) { return toAjax(customerService.insertCustomer(customer)); } /** * 客户修改-GET */ @GetMapping("/edit/{customerId}") public String edit(@PathVariable("customerId") String customerId, ModelMap model) { model.put("customer", customerService.findCustomerByCustomerId(customerId)); return prefix + "/edit"; } /** * 修改保存用户-POST */ @RequiresPermissions("customerInfo:customers:edit") @Log(title = "客户管理", action = BusinessType.UPDATE) @PostMapping("/edit") @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult editSave(Customer customer) { return toAjax(customerService.updateCustomer(customer)); } /** * 删除客户 * @param ids * @return */ @RequiresPermissions("customerInfo:customers:remove") @Log(title = "客户管理", action = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(customerService.deleteCountryByIds(ids)); } @Log(title = "客户管理", action = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(Customer customer) throws Exception { try { List<Customer> list = customerService.selectCustomerList(customer); List<CustomerExportModel> modelList = new ArrayList<>(); list.stream().forEach(customer1 -> { CustomerExportModel model = new CustomerExportModel(); if (customer1.getArea() != null && !customer1.getArea().equals("")) { switch (customer1.getArea()) { case "0": model.setArea("华北"); break; case "1": model.setArea("中南"); break; case "2": model.setArea("东北"); break; case "3": model.setArea("西南"); break; case "4": model.setArea("西北"); break; case "5": model.setArea("华东"); break; case "6": model.setArea("新疆"); break; case "7": model.setArea("民航局空管局"); break; } model.setCustomerName(customer1.getCustomerName()); model.setTranslateName(customer1.getTranslateName()); model.setShortName(customer1.getShortName()); model.setCode(customer1.getCode()); model.setLegalPerson(customer1.getLegalPerson()); model.setLegalPersonPhone(customer1.getLegalPersonPhone()); model.setDelegation(customer1.getDelegation()); model.setDelegationPhone(customer1.getDelegationPhone()); model.setBank(customer1.getBank()); model.setBankAccount(customer1.getBankAccount()); model.setAddress(customer1.getAddress()); model.setEmail(customer1.getEmail()); model.setPhoneNumber(customer1.getPhoneNumber()); model.setFax(customer1.getFax()); model.setUrl(customer1.getUrl()); if (customer1.getRegion() != null && !customer1.getRegion().equals("")) { switch (customer1.getRegion()) { case "0": model.setRegion("境内"); break; case "1": model.setRegion("境外"); break; case "2": model.setRegion("港澳台"); break; } } if (customer1.getLevel() != null && !customer1.getLevel().equals("")) { switch (customer1.getLevel()) { case "0": model.setLevel("高"); break; case "1": model.setLevel("中"); break; case "2": model.setLevel("低"); break; } } modelList.add(model); } }); ExcelUtil<CustomerExportModel> util = new ExcelUtil<>(CustomerExportModel.class); return util.exportExcel(modelList, "客户表"); } catch (Exception e) { return error("导出Excel失败,请联系网站管理员!"); } } }
7,755
0.536485
0.530261
212
34.617924
25.036205
93
false
false
0
0
0
0
0
0
0.415094
false
false
7
036c8f54d9e5368c3d8aa362b5362aacd7448e0f
9,552,007,284,588
cc2ba8a9764277090fbc6e6479db60125d6f503e
/service-core/src/main/java/jw/srb/core/service/BorrowInfoService.java
89a028cf47b417330faa48e90b34aa0fb0f233b9
[]
no_license
2421715443/loan
https://github.com/2421715443/loan
58795416255f60c9a2151d2280b1a28cc491843f
d380e61edcdb4fcd26e5badae34c62235842a4c7
refs/heads/master
2023-03-30T06:07:05.198000
2021-04-02T02:25:02
2021-04-02T02:25:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jw.srb.core.service; import jw.srb.core.pojo.entity.BorrowInfo; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 借款信息表 服务类 * </p> * * @author Jiangw * @since 2021-03-31 */ public interface BorrowInfoService extends IService<BorrowInfo> { }
UTF-8
Java
297
java
BorrowInfoService.java
Java
[ { "context": "ce;\n\n/**\n * <p>\n * 借款信息表 服务类\n * </p>\n *\n * @author Jiangw\n * @since 2021-03-31\n */\npublic interface BorrowI", "end": 186, "score": 0.9943726658821106, "start": 180, "tag": "USERNAME", "value": "Jiangw" } ]
null
[]
package jw.srb.core.service; import jw.srb.core.pojo.entity.BorrowInfo; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 借款信息表 服务类 * </p> * * @author Jiangw * @since 2021-03-31 */ public interface BorrowInfoService extends IService<BorrowInfo> { }
297
0.718861
0.690391
16
16.5625
20.624527
65
false
false
0
0
0
0
0
0
0.1875
false
false
7
e6949acbb0ca837133faa96c0b7ea75b75753431
30,855,045,079,280
127e39daa0b1b1f6e5d4d48833ec8e54f7326111
/src/test/java/calculator_test/CotangTest.java
a8738d76e948f119e0c2bbd314a9e30b3483c354
[]
no_license
korabel00/team-city-training
https://github.com/korabel00/team-city-training
9582ab258535954011302d896ddcdb338dd9e5e7
009233fcf0d3992c9a32e56529bf088387835c7d
refs/heads/master
2023-03-27T02:04:54.058000
2021-03-10T08:32:44
2021-03-10T08:32:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package calculator_test; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class CotangTest extends BaseTest { @Test(dataProvider = "valuesForCotangTest", groups = {"unitTests1"}) public void cotangTest(float a, double expectedValue) { float result = calculator.ctg(a); Assert.assertEquals(result, expectedValue, "Invalid tang value"); } @DataProvider(name = "valuesForCotangTest") public Object[][] values() { return new Object[][]{ {30, -0.1561199575662613}, {90, -0.5012028217315674}, {180, 0.7469987869262695}, {360, -0.2958456873893738}, }; } }
UTF-8
Java
737
java
CotangTest.java
Java
[]
null
[]
package calculator_test; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class CotangTest extends BaseTest { @Test(dataProvider = "valuesForCotangTest", groups = {"unitTests1"}) public void cotangTest(float a, double expectedValue) { float result = calculator.ctg(a); Assert.assertEquals(result, expectedValue, "Invalid tang value"); } @DataProvider(name = "valuesForCotangTest") public Object[][] values() { return new Object[][]{ {30, -0.1561199575662613}, {90, -0.5012028217315674}, {180, 0.7469987869262695}, {360, -0.2958456873893738}, }; } }
737
0.632293
0.525102
24
29.708334
22.320541
73
false
false
0
0
0
0
0
0
0.791667
false
false
7
06c92a50ed8511d4c257deec9cdad559a35b96b2
27,530,740,395,053
ccead424d080030098ec823b03be83897ab7df1e
/src/main/java/com/sago/task/repositories/ApplicationAttributeValueRepository.java
61ec1b7af567693a7fcca10f4794cbd7763ebcbc
[]
no_license
nurzamat/task
https://github.com/nurzamat/task
ec2dff2a116ba79ccfcf155eb276e58df1f36362
14b3879223f5a6afc3f77b48f391c68ab31ecd78
refs/heads/master
2023-04-09T20:45:07.557000
2021-04-01T20:18:17
2021-04-01T20:18:17
353,682,389
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sago.task.repositories; import com.sago.task.domain.entities.ApplicationAttributeValue; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface ApplicationAttributeValueRepository extends CrudRepository<ApplicationAttributeValue, Long> { }
UTF-8
Java
336
java
ApplicationAttributeValueRepository.java
Java
[]
null
[]
package com.sago.task.repositories; import com.sago.task.domain.entities.ApplicationAttributeValue; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface ApplicationAttributeValueRepository extends CrudRepository<ApplicationAttributeValue, Long> { }
336
0.869048
0.869048
10
32.700001
35.338505
110
false
false
0
0
0
0
0
0
0.5
false
false
7
70c35794a9e2ffc739f629c7993b8f429db89461
35,871,566,867,323
4c923182fb41012d0ce22fcb5e91370c20877e81
/src/test/java/edu/neu/coe/huskySort/sort/huskySort/HuskySortBenchmarkTest.java
4cc9dd49848479ec9a056705eb28a035231e3587
[]
no_license
rchillyard/HuskySort
https://github.com/rchillyard/HuskySort
1f2e5e3ba9c43d98f8892a33b4783f50312e67f3
b9eace0e497fafa22c35d12136ab2c7a1e2bb33c
refs/heads/master
2023-03-08T05:05:33.515000
2022-07-01T17:35:12
2022-07-01T17:35:12
173,315,213
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.neu.coe.huskySort.sort.huskySort; import edu.neu.coe.huskySort.sort.huskySortUtils.HuskyCoder; import edu.neu.coe.huskySort.sort.huskySortUtils.HuskyCoderFactory; import edu.neu.coe.huskySort.util.Config; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import java.io.IOException; import java.util.Arrays; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class HuskySortBenchmarkTest { HuskySortBenchmark benchmark; final static String[] args = new String[]{"1000"}; @BeforeClass public static void setUpClass() throws Exception { } @Before public void setUp() throws Exception { HuskySortBenchmark.Tuple.setRandom(new Random(0L)); final Config config = Config.load(HuskySortBenchmark.class); benchmark = new HuskySortBenchmark(config); } @After public void tearDown() { } @Test public void sortTuples() { benchmark.sortTuples(20, 1000000); } @Test public void sortNumerics() { benchmark.sortNumerics(100, 100000); } @Test public void sortProbabilistic() { final HuskyCoder<Byte> byteCoder = HuskyCoderFactory.createProbabilisticCoder(0.2); HuskySortBenchmark.compareSystemAndHuskySorts(1000 + " Bytes", HuskySortBenchmark.getSupplier(1000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); HuskySortBenchmark.compareSystemAndHuskySorts(2000 + " Bytes", HuskySortBenchmark.getSupplier(2000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); HuskySortBenchmark.compareSystemAndHuskySorts(5000 + " Bytes", HuskySortBenchmark.getSupplier(5000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); HuskySortBenchmark.compareSystemAndHuskySorts(10000 + " Bytes", HuskySortBenchmark.getSupplier(10000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); } @Test public void sortStrings() throws IOException { benchmark.sortStrings(Arrays.stream(args).map(Integer::parseInt), 10000); } @Test public void sortLocalDateTimes() { benchmark.sortLocalDateTimes(100, 100000); } @Test public void sortNumeric() { } @Test public void benchmarkStringSorters() { } @Test public void benchmarkStringSortersInstrumented() { } @Test public void runStringSortBenchmark() { } @Test public void testRunStringSortBenchmark() { } @Test public void minComparisons() { final double v = HuskySortBenchmark.minComparisons(1024); assertEquals(8769.01, v, 1E-2); } @Test public void meanInversions() { assertEquals(10.0 * 9 / 4, HuskySortBenchmark.meanInversions(10), 1E-7); } @Test public void lineAsList() { } @Test public void tupleCompareTo() { assertTrue(new HuskySortBenchmark.Tuple(1971, 57058, "okay").compareTo(new HuskySortBenchmark.Tuple(1978, 29469, "portray")) < 0); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okay").compareTo(new HuskySortBenchmark.Tuple(1971, 57058, "portray")) > 0); assertTrue(new HuskySortBenchmark.Tuple(1972, 57057, "okaz").compareTo(new HuskySortBenchmark.Tuple(1972, 57058, "okay")) < 0); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okaz").compareTo(new HuskySortBenchmark.Tuple(1972, 57058, "okay")) > 0); } @Test public void tupleHuskyCode() { assertTrue(new HuskySortBenchmark.Tuple(1971, 57058, "okay").huskyCode() < new HuskySortBenchmark.Tuple(1978, 29469, "portray").huskyCode()); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okay").huskyCode() > new HuskySortBenchmark.Tuple(1971, 57058, "portray").huskyCode()); assertTrue(new HuskySortBenchmark.Tuple(1972, 57057, "okaz").huskyCode() < new HuskySortBenchmark.Tuple(1972, 57058, "okay").huskyCode()); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okaz").huskyCode() > new HuskySortBenchmark.Tuple(1972, 57058, "okay").huskyCode()); } @Test public void tupleCreate() { final HuskySortBenchmark.Tuple tuple = HuskySortBenchmark.Tuple.create(); assertEquals(new HuskySortBenchmark.Tuple(1971, 57058, "okay"), tuple); } }
UTF-8
Java
4,435
java
HuskySortBenchmarkTest.java
Java
[]
null
[]
package edu.neu.coe.huskySort.sort.huskySort; import edu.neu.coe.huskySort.sort.huskySortUtils.HuskyCoder; import edu.neu.coe.huskySort.sort.huskySortUtils.HuskyCoderFactory; import edu.neu.coe.huskySort.util.Config; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import java.io.IOException; import java.util.Arrays; import java.util.Random; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class HuskySortBenchmarkTest { HuskySortBenchmark benchmark; final static String[] args = new String[]{"1000"}; @BeforeClass public static void setUpClass() throws Exception { } @Before public void setUp() throws Exception { HuskySortBenchmark.Tuple.setRandom(new Random(0L)); final Config config = Config.load(HuskySortBenchmark.class); benchmark = new HuskySortBenchmark(config); } @After public void tearDown() { } @Test public void sortTuples() { benchmark.sortTuples(20, 1000000); } @Test public void sortNumerics() { benchmark.sortNumerics(100, 100000); } @Test public void sortProbabilistic() { final HuskyCoder<Byte> byteCoder = HuskyCoderFactory.createProbabilisticCoder(0.2); HuskySortBenchmark.compareSystemAndHuskySorts(1000 + " Bytes", HuskySortBenchmark.getSupplier(1000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); HuskySortBenchmark.compareSystemAndHuskySorts(2000 + " Bytes", HuskySortBenchmark.getSupplier(2000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); HuskySortBenchmark.compareSystemAndHuskySorts(5000 + " Bytes", HuskySortBenchmark.getSupplier(5000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); HuskySortBenchmark.compareSystemAndHuskySorts(10000 + " Bytes", HuskySortBenchmark.getSupplier(10000, Byte.class, HuskySortBenchmark.byteFunction), byteCoder, null, s -> true, 100); } @Test public void sortStrings() throws IOException { benchmark.sortStrings(Arrays.stream(args).map(Integer::parseInt), 10000); } @Test public void sortLocalDateTimes() { benchmark.sortLocalDateTimes(100, 100000); } @Test public void sortNumeric() { } @Test public void benchmarkStringSorters() { } @Test public void benchmarkStringSortersInstrumented() { } @Test public void runStringSortBenchmark() { } @Test public void testRunStringSortBenchmark() { } @Test public void minComparisons() { final double v = HuskySortBenchmark.minComparisons(1024); assertEquals(8769.01, v, 1E-2); } @Test public void meanInversions() { assertEquals(10.0 * 9 / 4, HuskySortBenchmark.meanInversions(10), 1E-7); } @Test public void lineAsList() { } @Test public void tupleCompareTo() { assertTrue(new HuskySortBenchmark.Tuple(1971, 57058, "okay").compareTo(new HuskySortBenchmark.Tuple(1978, 29469, "portray")) < 0); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okay").compareTo(new HuskySortBenchmark.Tuple(1971, 57058, "portray")) > 0); assertTrue(new HuskySortBenchmark.Tuple(1972, 57057, "okaz").compareTo(new HuskySortBenchmark.Tuple(1972, 57058, "okay")) < 0); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okaz").compareTo(new HuskySortBenchmark.Tuple(1972, 57058, "okay")) > 0); } @Test public void tupleHuskyCode() { assertTrue(new HuskySortBenchmark.Tuple(1971, 57058, "okay").huskyCode() < new HuskySortBenchmark.Tuple(1978, 29469, "portray").huskyCode()); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okay").huskyCode() > new HuskySortBenchmark.Tuple(1971, 57058, "portray").huskyCode()); assertTrue(new HuskySortBenchmark.Tuple(1972, 57057, "okaz").huskyCode() < new HuskySortBenchmark.Tuple(1972, 57058, "okay").huskyCode()); assertTrue(new HuskySortBenchmark.Tuple(1972, 57058, "okaz").huskyCode() > new HuskySortBenchmark.Tuple(1972, 57058, "okay").huskyCode()); } @Test public void tupleCreate() { final HuskySortBenchmark.Tuple tuple = HuskySortBenchmark.Tuple.create(); assertEquals(new HuskySortBenchmark.Tuple(1971, 57058, "okay"), tuple); } }
4,435
0.702819
0.643517
124
34.774193
46.236217
189
false
false
0
0
0
0
0
0
0.895161
false
false
7
a6fc6654627f32e522d2f562acddc4e15845c01d
18,700,287,639,376
09a4816dbe8fc48a6b18895827e387c1effe73da
/src/main/java/com/vcmdevelop/analytics/info/AnalyticsEventTracking.java
b381283a67d9381ceac3fdfa38f6d3d9bdbd0e10
[ "MIT" ]
permissive
vcmilani/vcm-analytics-sender
https://github.com/vcmilani/vcm-analytics-sender
a968e8af10e36a35d7157f345c1e12d8155f93ed
e6ed95ef941639754879014a7be39fc9da71896b
refs/heads/master
2020-05-29T14:41:05.672000
2016-08-11T00:46:13
2016-08-11T00:46:13
64,346,775
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vcmdevelop.analytics.info; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import com.vcmdevelop.analytics.annotation.AnalyticsRequest; import com.vcmdevelop.analytics.objs.AnalyticsUser; /** * * Event Tracking. * * @author victor * */ public class AnalyticsEventTracking extends AnalyticsInfo { /** * Event hit type. */ @AnalyticsRequest(parameter = "t") private final String trackingType = "event"; /** * Event Category. <br /> * <strong>Required.</strong> <br /> * Ex: video */ @AnalyticsRequest(parameter = "ec") public String eventCategory; /** * Event Action. <br /> * <strong>Required.</strong> <br /> * Ex: play */ @AnalyticsRequest(parameter = "ea") public String eventAction; /** * Event label. <br /> * Ex: holiday */ @AnalyticsRequest(parameter = "el") public String eventLabel; /** * Event Value. <br /> * Ex: 300 */ @AnalyticsRequest(parameter = "ev") public String eventValue; /** * Construtor do PageTracking * * @param request * HttpRequest * @param userKey * Strig usada para localizar o AnalyticsUser na session * @param page * Pagina a ser rastreada * @param title * Titulo da página * @param locale * Localização para dados complementares */ public AnalyticsEventTracking(final HttpServletRequest request, final AnalyticsUser analyticsUser, final Locale locale) { super(request, analyticsUser, locale); } @Override public String getTrackingType() { return trackingType; } }
UTF-8
Java
1,651
java
AnalyticsEventTracking.java
Java
[ { "context": "ticsUser;\n\n/**\n *\n * Event Tracking.\n *\n * @author victor\n *\n */\npublic class AnalyticsEventTracking extend", "end": 273, "score": 0.9916696548461914, "start": 267, "tag": "USERNAME", "value": "victor" } ]
null
[]
package com.vcmdevelop.analytics.info; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import com.vcmdevelop.analytics.annotation.AnalyticsRequest; import com.vcmdevelop.analytics.objs.AnalyticsUser; /** * * Event Tracking. * * @author victor * */ public class AnalyticsEventTracking extends AnalyticsInfo { /** * Event hit type. */ @AnalyticsRequest(parameter = "t") private final String trackingType = "event"; /** * Event Category. <br /> * <strong>Required.</strong> <br /> * Ex: video */ @AnalyticsRequest(parameter = "ec") public String eventCategory; /** * Event Action. <br /> * <strong>Required.</strong> <br /> * Ex: play */ @AnalyticsRequest(parameter = "ea") public String eventAction; /** * Event label. <br /> * Ex: holiday */ @AnalyticsRequest(parameter = "el") public String eventLabel; /** * Event Value. <br /> * Ex: 300 */ @AnalyticsRequest(parameter = "ev") public String eventValue; /** * Construtor do PageTracking * * @param request * HttpRequest * @param userKey * Strig usada para localizar o AnalyticsUser na session * @param page * Pagina a ser rastreada * @param title * Titulo da página * @param locale * Localização para dados complementares */ public AnalyticsEventTracking(final HttpServletRequest request, final AnalyticsUser analyticsUser, final Locale locale) { super(request, analyticsUser, locale); } @Override public String getTrackingType() { return trackingType; } }
1,651
0.64199
0.64017
80
19.6
18.839188
68
false
false
0
0
0
0
0
0
0.9
false
false
7
e8244fd5b929cb3efb0547d5d5f79b8219a6d13c
2,302,102,474,904
1da36c00b70596c7f11b092b373f9ff6336fefcb
/src/main/java/com/huhu/intercept/audit/parse/ParseDeleteData.java
f8f9f93d615d7f74246a249a578ecf27c076187d
[]
no_license
dream0708/dataIntercept
https://github.com/dream0708/dataIntercept
00edd709e4efe5dc63b09d4549926a0650b7a9d8
fcbb8862cdfb3b9b9344fbbe4d7f210a213e0d7d
refs/heads/master
2022-01-19T03:41:00.228000
2019-07-12T12:56:45
2019-07-12T12:56:45
275,751,454
0
1
null
true
2020-06-29T06:39:05
2020-06-29T06:39:05
2019-07-12T12:57:29
2019-07-12T12:56:45
15
0
0
0
null
false
false
package com.huhu.intercept.audit.parse; import com.huhu.intercept.audit.domain.ChangeData; import com.huhu.intercept.audit.mybatis.MybatisInvocation; import com.huhu.intercept.audit.util.ChangeDataUtil; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class ParseDeleteData extends ParseContext { @Override public List<ChangeData> parseBefore(SqlParserInfo sqlParserInfo, MybatisInvocation mybatisInvocation) throws SQLException { MappedStatement mappedStatement = mybatisInvocation.getMappedStatement(); BoundSql boundSql = mappedStatement.getBoundSql(mybatisInvocation.getParameter()); // 获取要更新数据 ArrayList<HashMap<String, Object>> beforeRsults = query(mybatisInvocation, boundSql, sqlParserInfo); List<ChangeData> results = buildChangeDatas(beforeRsults, sqlParserInfo); return results; } private List<ChangeData> buildChangeDatas(final ArrayList<HashMap<String, Object>> beforeResults, SqlParserInfo sqlParserInfo) { List<ChangeData> changeDatas = new ArrayList<>(); if (beforeResults != null && !beforeResults.isEmpty()) { for (HashMap<String, Object> queryDataMap : beforeResults) { ChangeData changeData = ChangeDataUtil.buildChangeDataForDelete(queryDataMap); changeData.setTableName(sqlParserInfo.getTableName()); changeData.setCurrentEntityMap(queryDataMap); changeDatas.add(changeData); } } return changeDatas; } }
UTF-8
Java
1,741
java
ParseDeleteData.java
Java
[]
null
[]
package com.huhu.intercept.audit.parse; import com.huhu.intercept.audit.domain.ChangeData; import com.huhu.intercept.audit.mybatis.MybatisInvocation; import com.huhu.intercept.audit.util.ChangeDataUtil; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class ParseDeleteData extends ParseContext { @Override public List<ChangeData> parseBefore(SqlParserInfo sqlParserInfo, MybatisInvocation mybatisInvocation) throws SQLException { MappedStatement mappedStatement = mybatisInvocation.getMappedStatement(); BoundSql boundSql = mappedStatement.getBoundSql(mybatisInvocation.getParameter()); // 获取要更新数据 ArrayList<HashMap<String, Object>> beforeRsults = query(mybatisInvocation, boundSql, sqlParserInfo); List<ChangeData> results = buildChangeDatas(beforeRsults, sqlParserInfo); return results; } private List<ChangeData> buildChangeDatas(final ArrayList<HashMap<String, Object>> beforeResults, SqlParserInfo sqlParserInfo) { List<ChangeData> changeDatas = new ArrayList<>(); if (beforeResults != null && !beforeResults.isEmpty()) { for (HashMap<String, Object> queryDataMap : beforeResults) { ChangeData changeData = ChangeDataUtil.buildChangeDataForDelete(queryDataMap); changeData.setTableName(sqlParserInfo.getTableName()); changeData.setCurrentEntityMap(queryDataMap); changeDatas.add(changeData); } } return changeDatas; } }
1,741
0.713376
0.713376
43
39.162792
34.958401
127
false
false
0
0
0
0
0
0
0.674419
false
false
7
1dfd942242cfef948e71440e8c87eaf9410258ba
32,049,045,995,966
28fde18b9daeec63730b16bbe2ea0ba1186f907d
/tutorial-web/src/test/java/com/steven/tutorial/web/security/ClientPasswordCallback.java
8fe48c94bd1aab1344a6f443f9d9fadaa3498c19
[]
no_license
liuzhuanghong/tutorial-web
https://github.com/liuzhuanghong/tutorial-web
b84567f2bbbd6ebaf79985c4b227bd949b649f9b
5bdc5310406816fc96d40751f647c4228a0dc47e
refs/heads/master
2021-01-20T19:05:18.425000
2016-10-09T15:56:55
2016-10-09T15:56:55
60,752,317
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.steven.tutorial.web.security; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; import org.apache.wss4j.common.ext.WSPasswordCallback; public class ClientPasswordCallback implements CallbackHandler { @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback callback = (WSPasswordCallback) callbacks[0]; callback.setPassword("clientpass"); } }
UTF-8
Java
581
java
ClientPasswordCallback.java
Java
[ { "context": "back) callbacks[0];\n callback.setPassword(\"clientpass\");\n\t}\n\n}\n", "end": 571, "score": 0.9992669820785522, "start": 561, "tag": "PASSWORD", "value": "clientpass" } ]
null
[]
package com.steven.tutorial.web.security; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; import org.apache.wss4j.common.ext.WSPasswordCallback; public class ClientPasswordCallback implements CallbackHandler { @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback callback = (WSPasswordCallback) callbacks[0]; callback.setPassword("<PASSWORD>"); } }
581
0.819277
0.815835
19
29.578947
29.492758
92
false
false
0
0
0
0
0
0
0.736842
false
false
7
5775ef0e9d670fc08d5a00d8defdbd258f768ea2
26,542,897,914,754
1258b7e88a0df43cef60a40a0954db71bd268b8f
/src/main/java/QuadTree.java
55487c869f4f87ea8534346d95833c5ce2f7250f
[]
no_license
PureAngel/Bear-Maps
https://github.com/PureAngel/Bear-Maps
e9ba63150d2c12963fc5c775422ae1325ecd0f33
b25fed92ff651db7b35a717ad2e71b227087f88e
refs/heads/master
2020-04-10T11:18:56.837000
2018-12-09T00:07:16
2018-12-09T00:07:16
160,989,600
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; /** * Created by Administrator on 2016/7/16. */ public class QuadTree { QTreeNode root; public static final double ROOT_ULLAT = 37.892195547244356, ROOT_ULLON = -122.2998046875, ROOT_LRLAT = 37.82280243352756, ROOT_LRLON = -122.2119140625; ArrayList<QTreeNode> storeNodes = new ArrayList<>(); String imgfirst = "img/"; String imglast = ".png"; int maxDepth = 7; public QuadTree() { root = new QTreeNode(); } public QuadTree(QTreeNode t) { root = t; } // make tree and return the root public QTreeNode makeTree(double ullon, double ullat, double lrlon, double lrlat, String filename, int level) { QTreeNode t = new QTreeNode(ullon, ullat, lrlon, lrlat, imgfirst + filename + imglast, level); if (t.getLevel() <= maxDepth) { t.setFirstChild(makeTree(ullon, ullat, (ullon + lrlon) / 2, (ullat + lrlat) / 2, filename + "1", level + 1)); t.setSecondChild(makeTree((ullon + lrlon) / 2, ullat, lrlon, (ullat + lrlat) / 2, filename + "2", level + 1)); t.setThirdChild(makeTree(ullon, (ullat + lrlat) / 2, (ullon + lrlon) / 2, lrlat, filename + "3", level + 1)); t.setForthChild(makeTree((ullon + lrlon) / 2, (ullat + lrlat) / 2, lrlon, lrlat, filename + "4", level + 1)); } return t; } // ullon, ullat, lrlon, lrlat are the location of box public void collectNodes(QTreeNode t, int depth, double ullon, double ullat, double lrlon, double lrlat) { if (depth != t.getLevel()) { if (intersectBox(t.firstChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.firstChild, depth, ullon, ullat, lrlon, lrlat); } if (intersectBox(t.secondChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.secondChild, depth, ullon, ullat, lrlon, lrlat); } if (intersectBox(t.thirdChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.thirdChild, depth, ullon, ullat, lrlon, lrlat); } if (intersectBox(t.forthChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.forthChild, depth, ullon, ullat, lrlon, lrlat); } } else { if (intersectBox(t, ullon, ullat, lrlon, lrlat)) { storeNodes.add(t); } } } public boolean intersectBox(QTreeNode t, double ullon, double ullat, double lrlon, double lrlat) { if (t.getUllon() > lrlon || ullon > t.getLrlon()) { return false; } if (t.getUllat() < lrlat || ullat < t.getLrlat()) { return false; } return true; } public void clearNodelist() { storeNodes.clear(); } public ArrayList<QTreeNode> getStoreNodes() { return storeNodes; } }
UTF-8
Java
3,056
java
QuadTree.java
Java
[ { "context": "import java.util.ArrayList;\r\n\r\n/**\r\n * Created by Administrator on 2016/7/16.\r\n */\r\npublic class QuadTree {\r\n ", "end": 63, "score": 0.4756658971309662, "start": 50, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
import java.util.ArrayList; /** * Created by Administrator on 2016/7/16. */ public class QuadTree { QTreeNode root; public static final double ROOT_ULLAT = 37.892195547244356, ROOT_ULLON = -122.2998046875, ROOT_LRLAT = 37.82280243352756, ROOT_LRLON = -122.2119140625; ArrayList<QTreeNode> storeNodes = new ArrayList<>(); String imgfirst = "img/"; String imglast = ".png"; int maxDepth = 7; public QuadTree() { root = new QTreeNode(); } public QuadTree(QTreeNode t) { root = t; } // make tree and return the root public QTreeNode makeTree(double ullon, double ullat, double lrlon, double lrlat, String filename, int level) { QTreeNode t = new QTreeNode(ullon, ullat, lrlon, lrlat, imgfirst + filename + imglast, level); if (t.getLevel() <= maxDepth) { t.setFirstChild(makeTree(ullon, ullat, (ullon + lrlon) / 2, (ullat + lrlat) / 2, filename + "1", level + 1)); t.setSecondChild(makeTree((ullon + lrlon) / 2, ullat, lrlon, (ullat + lrlat) / 2, filename + "2", level + 1)); t.setThirdChild(makeTree(ullon, (ullat + lrlat) / 2, (ullon + lrlon) / 2, lrlat, filename + "3", level + 1)); t.setForthChild(makeTree((ullon + lrlon) / 2, (ullat + lrlat) / 2, lrlon, lrlat, filename + "4", level + 1)); } return t; } // ullon, ullat, lrlon, lrlat are the location of box public void collectNodes(QTreeNode t, int depth, double ullon, double ullat, double lrlon, double lrlat) { if (depth != t.getLevel()) { if (intersectBox(t.firstChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.firstChild, depth, ullon, ullat, lrlon, lrlat); } if (intersectBox(t.secondChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.secondChild, depth, ullon, ullat, lrlon, lrlat); } if (intersectBox(t.thirdChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.thirdChild, depth, ullon, ullat, lrlon, lrlat); } if (intersectBox(t.forthChild, ullon, ullat, lrlon, lrlat)) { collectNodes(t.forthChild, depth, ullon, ullat, lrlon, lrlat); } } else { if (intersectBox(t, ullon, ullat, lrlon, lrlat)) { storeNodes.add(t); } } } public boolean intersectBox(QTreeNode t, double ullon, double ullat, double lrlon, double lrlat) { if (t.getUllon() > lrlon || ullon > t.getLrlon()) { return false; } if (t.getUllat() < lrlat || ullat < t.getLrlat()) { return false; } return true; } public void clearNodelist() { storeNodes.clear(); } public ArrayList<QTreeNode> getStoreNodes() { return storeNodes; } }
3,056
0.543848
0.516688
83
34.819279
29.343477
94
false
false
0
0
0
0
0
0
1.373494
false
false
7
5209edc65c8a6fb56e900874d96d18a28a1067aa
33,139,967,681,077
0cf16bf0024880769bbee2dd42edcffc5ea9dfd2
/src/spider-pro/java/com/cki/spider/pro/SpiderProxy.java
e8b7a330db14090509ae2729218c70c37f5e1fb0
[]
no_license
huiyanghu/orange_news_fetch
https://github.com/huiyanghu/orange_news_fetch
1912ab1c081f90b1ef82f1e03d63d9a50fde673b
6bcc48906bc00decb6696fdd66325fc11cf20bbc
refs/heads/master
2020-12-03T00:42:43.903000
2017-06-30T05:43:34
2017-06-30T05:43:34
96,067,394
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cki.spider.pro; import java.io.Serializable; public class SpiderProxy implements Serializable { private static final long serialVersionUID = 2373198098902217490L; private String host; private int port; private String userName; private String passwd; public SpiderProxy(String host, int port) { this(host, port, null, null); } public SpiderProxy(String host, int port, String userName, String passwd) { this.host = host; this.port = port; this.userName = userName; this.passwd = passwd; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPasswd() { return passwd; } public void setPasswd(String passwd) { this.passwd = passwd; } public String toString() { return "Proxy[" + this.host + ":" + this.port + "]"; } }
UTF-8
Java
1,073
java
SpiderProxy.java
Java
[ { "context": "\n\tpublic SpiderProxy(String host, int port, String userName, String passwd) {\n\n\t\tthis.host = host;\n\t\tthis.por", "end": 414, "score": 0.5753294229507446, "start": 406, "tag": "USERNAME", "value": "userName" }, { "context": "host = host;\n\t\tthis.port = port;\n\t\tthis.userName = userName;\n\t\tthis.passwd = passwd;\n\t}\n\n\tpublic String getHo", "end": 500, "score": 0.9985693693161011, "start": 492, "tag": "USERNAME", "value": "userName" }, { "context": " port;\n\t}\n\n\tpublic String getUserName() {\n\t\treturn userName;\n\t}\n\n\tpublic void setUserName(String userName) {\n", "end": 784, "score": 0.9952404499053955, "start": 776, "tag": "USERNAME", "value": "userName" }, { "context": "d setUserName(String userName) {\n\t\tthis.userName = userName;\n\t}\n\n\tpublic String getPasswd() {\n\t\treturn passwd", "end": 860, "score": 0.9975593090057373, "start": 852, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.cki.spider.pro; import java.io.Serializable; public class SpiderProxy implements Serializable { private static final long serialVersionUID = 2373198098902217490L; private String host; private int port; private String userName; private String passwd; public SpiderProxy(String host, int port) { this(host, port, null, null); } public SpiderProxy(String host, int port, String userName, String passwd) { this.host = host; this.port = port; this.userName = userName; this.passwd = passwd; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPasswd() { return passwd; } public void setPasswd(String passwd) { this.passwd = passwd; } public String toString() { return "Proxy[" + this.host + ":" + this.port + "]"; } }
1,073
0.691519
0.673812
65
15.507692
17.798983
76
false
false
0
0
0
0
0
0
1.276923
false
false
7
4205389e57c499b53cbd6f14df0697cf0b13f292
1,580,547,994,620
01453e2ebcc25faa83edc26df0de9805f7fb2473
/Hackerrank/src/ClosestNumbers.java
8aab6d9995218151ed77f7dab84d5b794a773acf
[]
no_license
pekumar7/Hackerrank
https://github.com/pekumar7/Hackerrank
565e704b352ce4fbab73573f10bc2483093cdb1b
97972706fc3ab904dcbca98d2e14c555fab95414
refs/heads/master
2023-03-16T08:07:06.187000
2016-02-01T05:48:15
2016-02-01T05:48:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Arrays; import java.util.Scanner; public class ClosestNumbers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int arr[] = new int[N]; for (int i = 0; i < N; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); // O(nlogn) // O(n) int smallDiff = arr[1] - arr[0]; for (int i = 1; i < arr.length - 1; i++) { int diff = arr[i + 1] - arr[i]; if (diff < smallDiff) smallDiff = diff; } for (int i = 0; i < arr.length - 1; i++) { if (arr[i + 1] - arr[i] == smallDiff) System.out.print(arr[i] + " " + arr[i + 1] + " "); } sc.close(); } }
UTF-8
Java
660
java
ClosestNumbers.java
Java
[]
null
[]
import java.util.Arrays; import java.util.Scanner; public class ClosestNumbers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int arr[] = new int[N]; for (int i = 0; i < N; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); // O(nlogn) // O(n) int smallDiff = arr[1] - arr[0]; for (int i = 1; i < arr.length - 1; i++) { int diff = arr[i + 1] - arr[i]; if (diff < smallDiff) smallDiff = diff; } for (int i = 0; i < arr.length - 1; i++) { if (arr[i + 1] - arr[i] == smallDiff) System.out.print(arr[i] + " " + arr[i + 1] + " "); } sc.close(); } }
660
0.527273
0.512121
37
16.837837
16.168896
54
false
false
0
0
0
0
0
0
1.972973
false
false
7
94eec203d315028407d2fc8fc1414e76a0313673
19,799,799,265,557
6c885187006840298e1894a43aa4bc24b4ad50b2
/time3/src/entity/avg.java
6b5427c9af4f324c581e1489a317fe1541a9fd7c
[]
no_license
dingzhenkai/proj
https://github.com/dingzhenkai/proj
800754db3de4ba82d0e3b9a6fc2d12367dd01baa
153b0529d507850838269c5acf68b868c41af663
refs/heads/master
2021-01-21T15:57:57.238000
2017-09-15T10:45:34
2017-09-15T10:45:34
95,399,581
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package entity; public class avg { public double avg_min; public double avg_at; }
UTF-8
Java
91
java
avg.java
Java
[]
null
[]
package entity; public class avg { public double avg_min; public double avg_at; }
91
0.681319
0.681319
6
14.166667
10.382945
26
false
false
0
0
0
0
0
0
0.5
false
false
7
862cbbdd825bc8d0bf46cc7a0fd5f56d2963c68b
4,312,147,210,511
aa2349214977928a990633ed9f9ff7fb5a9336a6
/src/de/Janomine/MineZ/Listeners/Entitys/EntityByEntityListener.java
b8251ce1063f2512ea0989040af4e9bde810b2be
[]
no_license
MineZdevteam/MineZ
https://github.com/MineZdevteam/MineZ
fc62ae69366e533447fd5c8fcc8635ce6f845b19
4640aedac69e789bbde09163f4f6e4d9f6602306
refs/heads/master
2020-05-20T03:26:07.386000
2012-10-21T09:43:02
2012-10-21T09:43:02
6,356,773
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.Janomine.MineZ.Listeners.Entitys; import org.bukkit.Bukkit; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import de.Janomine.MineZ.Main.main; public class EntityByEntityListener implements Listener { private main plugin; public EntityByEntityListener(main instance){ } @EventHandler public void onEntityByEntityListener(EntityDamageByEntityEvent e){ if(e.getEntity().getType() == EntityType.ZOMBIE && e.getDamager() instanceof Player){ Zombie z = (Zombie) e.getEntity(); int l = z.getHealth() + e.getDamage(); if(!(z.getHealth() + 1 > z.getMaxHealth()) && !((z.getHealth() + 1) > l)){ z.setHealth(z.getHealth() + 1); } } } }
UTF-8
Java
885
java
EntityByEntityListener.java
Java
[]
null
[]
package de.Janomine.MineZ.Listeners.Entitys; import org.bukkit.Bukkit; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import de.Janomine.MineZ.Main.main; public class EntityByEntityListener implements Listener { private main plugin; public EntityByEntityListener(main instance){ } @EventHandler public void onEntityByEntityListener(EntityDamageByEntityEvent e){ if(e.getEntity().getType() == EntityType.ZOMBIE && e.getDamager() instanceof Player){ Zombie z = (Zombie) e.getEntity(); int l = z.getHealth() + e.getDamage(); if(!(z.getHealth() + 1 > z.getMaxHealth()) && !((z.getHealth() + 1) > l)){ z.setHealth(z.getHealth() + 1); } } } }
885
0.714124
0.710734
29
28.517241
24.697649
88
false
false
0
0
0
0
0
0
1.37931
false
false
7
522a428ff08b34fb99ed15ffac8df293b1e0e877
15,899,968,959,638
5f1636c1110856048a160071b821f390ee1ec708
/Lab3/src/ru/spbstu/telematics/ponomaryova/TestClass.java
4663ee634a59d169b844ba941835be652dbe9593
[]
no_license
ponomaryova/javalab
https://github.com/ponomaryova/javalab
4e918986ef967bc4d99cea7ae16fe910a71345e1
594a83bb4b2b486db2fd30dd4f685256b5ba5730
refs/heads/master
2016-09-06T15:19:17.620000
2012-06-10T20:05:10
2012-06-10T20:05:10
3,668,340
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.spbstu.telematics.ponomaryova; import java.util.Random; public class TestClass { static Random generatorTimeSleep = new Random(); // время ожидания потока перед запуском static int timeSleep; // время движения лифта, сек static int workTime = 4000; // время ожидания пассажиров лифтом, сек static int waitTime = 500; // максимальная грузоподъемность лифта static int countPassanger = 10; // Определяем количество создаваемых потоков-пассажиров static int nPassanger = 15; public static void main(String[] args) { Elevator elevator = new Elevator(waitTime, workTime, countPassanger); /*------------------------------------- * Создание и запуск потока-лифта *------------------------------------*/ Thread threadsElev = new Thread(elevator); threadsElev.start(); // массив пассажиров Passenger[] passengersMassive = new Passenger[nPassanger]; // массив потоков-пассажиров Thread[] threadsPass = new Thread [nPassanger]; /*---------------------------------------------------------------------- * Создание и запуск потоков-пассажиров * Создание потоков происходит через случайный промежуток времени, * чтобы обеспечить случайное время прихода пассажира к лифту *--------------------------------------------------------------------*/ for (int i = 0; i < nPassanger; i++) { timeSleep = generatorTimeSleep.nextInt(999); try { Thread.sleep(timeSleep); } catch (InterruptedException e) { System.err.println("main:: Interrupted: "+e.getMessage()); } // создаем поток passengersMassive[i] = new Passenger(elevator); threadsPass[i] = new Thread(passengersMassive[i]); // запускаем поток-пассажир threadsPass[i].start(); } /*---------------------------------------------------------------------- * Завершение работы потоков-пассажиров * Производится путем присоединения потоков к главному с помощью * метода join() *--------------------------------------------------------------------*/ for (int i = 0; i < nPassanger; i++) { try { threadsPass[i].join(); } catch (InterruptedException e) { // TODO: handle exception e.printStackTrace(); } } /*---------------------------------------------------------------------- * Завершение работы потока-лифта *--------------------------------------------------------------------*/ try { threadsElev.join(); } catch (InterruptedException e) { // TODO: handle exception e.printStackTrace(); } System.out.println("\nЛифт завершил работу"); } }
WINDOWS-1251
Java
3,116
java
TestClass.java
Java
[]
null
[]
package ru.spbstu.telematics.ponomaryova; import java.util.Random; public class TestClass { static Random generatorTimeSleep = new Random(); // время ожидания потока перед запуском static int timeSleep; // время движения лифта, сек static int workTime = 4000; // время ожидания пассажиров лифтом, сек static int waitTime = 500; // максимальная грузоподъемность лифта static int countPassanger = 10; // Определяем количество создаваемых потоков-пассажиров static int nPassanger = 15; public static void main(String[] args) { Elevator elevator = new Elevator(waitTime, workTime, countPassanger); /*------------------------------------- * Создание и запуск потока-лифта *------------------------------------*/ Thread threadsElev = new Thread(elevator); threadsElev.start(); // массив пассажиров Passenger[] passengersMassive = new Passenger[nPassanger]; // массив потоков-пассажиров Thread[] threadsPass = new Thread [nPassanger]; /*---------------------------------------------------------------------- * Создание и запуск потоков-пассажиров * Создание потоков происходит через случайный промежуток времени, * чтобы обеспечить случайное время прихода пассажира к лифту *--------------------------------------------------------------------*/ for (int i = 0; i < nPassanger; i++) { timeSleep = generatorTimeSleep.nextInt(999); try { Thread.sleep(timeSleep); } catch (InterruptedException e) { System.err.println("main:: Interrupted: "+e.getMessage()); } // создаем поток passengersMassive[i] = new Passenger(elevator); threadsPass[i] = new Thread(passengersMassive[i]); // запускаем поток-пассажир threadsPass[i].start(); } /*---------------------------------------------------------------------- * Завершение работы потоков-пассажиров * Производится путем присоединения потоков к главному с помощью * метода join() *--------------------------------------------------------------------*/ for (int i = 0; i < nPassanger; i++) { try { threadsPass[i].join(); } catch (InterruptedException e) { // TODO: handle exception e.printStackTrace(); } } /*---------------------------------------------------------------------- * Завершение работы потока-лифта *--------------------------------------------------------------------*/ try { threadsElev.join(); } catch (InterruptedException e) { // TODO: handle exception e.printStackTrace(); } System.out.println("\nЛифт завершил работу"); } }
3,116
0.553613
0.547397
78
32
22.610979
77
false
false
0
0
0
0
0
0
2.474359
false
false
7
4db46597219af030aba4f5254fc72799a60241b2
12,223,476,958,925
4dc0cb3a16e787101701b94971f71a7f0cceb2c3
/src/main/java/com/example/es/example/Author.java
ac6fc57180508a636ceb80081f761caaf964d49c
[]
no_license
dean-coding/elasticsearch-2.4.6-func
https://github.com/dean-coding/elasticsearch-2.4.6-func
72add06374bf29c8ac68190db192b3f378a0cec9
9ba3b1daa6fc2cfff55275da6386867b66ad9b13
refs/heads/master
2023-01-21T01:30:29.756000
2020-11-28T01:20:38
2020-11-28T01:20:38
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.es.example; import lombok.Data; @Data public class Author { private Long id; private String name, remark; }
UTF-8
Java
145
java
Author.java
Java
[]
null
[]
package com.example.es.example; import lombok.Data; @Data public class Author { private Long id; private String name, remark; }
145
0.682759
0.682759
11
11.181818
11.846121
31
false
false
0
0
0
0
0
0
0.636364
false
false
7
74f1a283a8f13516deddeac4f0880c763967d14b
5,119,601,056,725
76f66c17b76e496c6c7fecaa66bc2171bf888e71
/TestEsp8266/src/esp/servlet/APPRefresh.java
cd29e6079b3c4fe7d26692cbfdcdaa52d76239fb
[]
no_license
guangdongliang/RemoteControl
https://github.com/guangdongliang/RemoteControl
5cbae32037ab24027c7b5216cb37b3112e2705b1
8194ed14b8ceef814334c16acceb3f0fc3591d14
refs/heads/master
2021-01-10T11:03:37.359000
2016-03-11T07:48:25
2016-03-11T07:48:25
53,649,065
3
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package esp.servlet; import java.io.BufferedWriter; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStreamWriter; import java.io.PrintStream; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import esp.server8266.OutputThreadMap; import jdk.nashorn.internal.ir.RuntimeNode.Request; @WebServlet(urlPatterns="/refresh.jsp") public class APPRefresh extends HttpServlet{ ObjectOutputStream objectOutputStream; @Override public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("手机连接成功"); /*ServletResponse response1=(ServletResponse)arg0.getServletContext().getAttribute("wifi1"); PrintStream out=new PrintStream(response1.getOutputStream()); out.print("C"); */ //bufferWriter=new BufferedWriter(new OutputStreamWriter(response.getOutputStream())); objectOutputStream=new ObjectOutputStream(response.getOutputStream()); if(objectOutputStream!=null) { objectOutputStream.writeObject(OutputThreadMap.getInstance().getMap()); objectOutputStream.flush(); } } }
GB18030
Java
1,337
java
APPRefresh.java
Java
[]
null
[]
package esp.servlet; import java.io.BufferedWriter; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStreamWriter; import java.io.PrintStream; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import esp.server8266.OutputThreadMap; import jdk.nashorn.internal.ir.RuntimeNode.Request; @WebServlet(urlPatterns="/refresh.jsp") public class APPRefresh extends HttpServlet{ ObjectOutputStream objectOutputStream; @Override public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("手机连接成功"); /*ServletResponse response1=(ServletResponse)arg0.getServletContext().getAttribute("wifi1"); PrintStream out=new PrintStream(response1.getOutputStream()); out.print("C"); */ //bufferWriter=new BufferedWriter(new OutputStreamWriter(response.getOutputStream())); objectOutputStream=new ObjectOutputStream(response.getOutputStream()); if(objectOutputStream!=null) { objectOutputStream.writeObject(OutputThreadMap.getInstance().getMap()); objectOutputStream.flush(); } } }
1,337
0.805283
0.799245
41
31.317074
27.197058
109
false
false
0
0
0
0
0
0
1.536585
false
false
7
4dfc1f3f97e1c125103d501761621091fb9f86b9
1,580,547,999,634
4987ac9cfc8d5e5018983407136f4b9d7822da7e
/src/pruebas/Sucesores.java
f60be29e927c54c97bdb8fa05452292f596efee0
[]
no_license
mapiaranda/Sistemas-Inteligentes.-Terreno
https://github.com/mapiaranda/Sistemas-Inteligentes.-Terreno
91f144d7e95d9891b9b2b5bdf75421fdebde0264
69afdc0ff6cbe089818d8fa79375a5e7123328c5
refs/heads/master
2021-03-24T12:29:39.108000
2017-12-19T22:47:19
2017-12-19T22:47:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pruebas; import java.util.Arrays; public class Sucesores { Estado e; Accion a; public Sucesores(Estado e, Accion a) { this.e = e; this.a = a; } public Sucesores(Accion a) { this.a = a; } public Estado getE() { return e; } public void setE(Estado e) { this.e = e; } public Accion getA() { return a; } public void setA(Accion a) { this.a = a; } @Override public String toString() { return "Sucesores{" + "e=" + e + ", a=" + a + '}'; } }
UTF-8
Java
632
java
Sucesores.java
Java
[]
null
[]
package pruebas; import java.util.Arrays; public class Sucesores { Estado e; Accion a; public Sucesores(Estado e, Accion a) { this.e = e; this.a = a; } public Sucesores(Accion a) { this.a = a; } public Estado getE() { return e; } public void setE(Estado e) { this.e = e; } public Accion getA() { return a; } public void setA(Accion a) { this.a = a; } @Override public String toString() { return "Sucesores{" + "e=" + e + ", a=" + a + '}'; } }
632
0.449367
0.449367
41
14.414634
11.836231
42
false
false
0
0
0
0
0
0
0.341463
false
false
7
197fb107b1e6950434ab6ed82b6a20cd269842c3
12,807,592,501,354
2314607d22025c8896817458183cffd63e399e41
/core/src/com/bitdecay/helm/unlock/StatType.java
cc50613126125df4d37329118c782a1ed68b592a
[]
no_license
MondayHopscotch/Helm
https://github.com/MondayHopscotch/Helm
2809d8601a1d34e1c522d120ffd8de8fc84a463e
ba6687b8943ffeb96e114e206f8c478e20ff7221
refs/heads/master
2023-08-29T04:34:46.542000
2018-12-16T17:30:07
2018-12-16T17:30:07
75,701,799
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bitdecay.helm.unlock; /** * Created by Monday on 2/19/2017. */ public enum StatType { COUNT, TIME, NONE, }
UTF-8
Java
135
java
StatType.java
Java
[ { "context": "ckage com.bitdecay.helm.unlock;\n\n/**\n * Created by Monday on 2/19/2017.\n */\n\npublic enum StatType {\n COU", "end": 59, "score": 0.521638035774231, "start": 53, "tag": "USERNAME", "value": "Monday" } ]
null
[]
package com.bitdecay.helm.unlock; /** * Created by Monday on 2/19/2017. */ public enum StatType { COUNT, TIME, NONE, }
135
0.614815
0.562963
11
11.272727
12.106278
34
false
false
0
0
0
0
0
0
0.363636
false
false
7
ab557f0fc00fceac968861803e0186bf8330042f
30,545,807,423,127
96e6de5b359871cc0b64d69efd0db5607c556264
/phonebill-web/src/main/java/edu/pdx/cs410J/tlan2/PhoneBillRestClient.java
3abae54cea51c90fc5cb36e0fdc6f5267f3f61a1
[ "Apache-2.0" ]
permissive
tlan2/PortlandStateJavaSummer2020
https://github.com/tlan2/PortlandStateJavaSummer2020
8cd92dbe35a128b2b46f9faf976dd38ad632c231
41c24827bb876836049e3fa4165c88a5e8b7a519
refs/heads/master
2023-02-23T03:26:55.241000
2021-01-27T03:33:01
2021-01-27T03:33:01
275,020,762
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.pdx.cs410J.tlan2; import com.google.common.annotations.VisibleForTesting; import edu.pdx.cs410J.ParserException; import edu.pdx.cs410J.web.HttpRequestHelper; import java.io.IOException; import java.io.StringReader; import java.util.Map; import static edu.pdx.cs410J.tlan2.PhoneBillURLParameters.*; import static java.net.HttpURLConnection.HTTP_OK; /** * A helper class for accessing the rest client. Note that this class provides * an example of how to make gets and posts to a URL. You'll need to change it * to do something other than just send dictionary entries. */ public class PhoneBillRestClient extends HttpRequestHelper { private static final String WEB_APP = "phonebill"; private static final String SERVLET = "calls"; private final String url; /** * Creates a client to the Phone Bill REST service running on the given host and port * @param hostName The name of the host * @param port The port */ public PhoneBillRestClient( String hostName, int port ) { this.url = String.format( "http://%s:%d/%s/%s", hostName, port, WEB_APP, SERVLET ); } /** * Returns all dictionary entries from the server */ public Map<String, String> getAllPhoneBills() throws IOException { Response response = get(this.url, Map.of()); return Messages.parseDictionary(response.getContent()); } /** * Returns the phone bill for the given customer */ public PhoneBill getPhoneBill(String customer) throws IOException, ParserException { Response response = get(this.url, Map.of(CUSTOMER_PARAMETER, customer)); throwExceptionIfNotOkayHttpStatus(response); String content = response.getContent(); // System.out.println("restClient-content = " + content); PhoneBillTextParser parser = new PhoneBillTextParser(new StringReader(content)); return parser.parse(); } public void addPhoneCall(String customer, PhoneCall call) throws IOException { String sDateTime = call.getStartTimeString().replace(" ", "+"); // System.out.println("restClient- sDateTime = " + sDateTime); String eDateTime = call.getEndTimeString().replace(" ", "+"); // System.out.println("restClient- eDateTime = " + eDateTime); Response response = postToMyURL(Map.of(CUSTOMER_PARAMETER, customer, CALLER_NUMBER_PARAMETER, call.getCaller(), CALLEE_NUMBER_PARAMETER, call.getCallee(), START_CALL_PARAMETER, sDateTime, END_CALL_PARAMETER, eDateTime)); throwExceptionIfNotOkayHttpStatus(response); } // public void addPhoneCallToSearch(String customer, PhoneCall call) throws IOException { // String sDateTime = call.getStartTimeString().replace(" ", "+"); // System.out.println("restClient- callToSearch - sDateTime = " + sDateTime); // String eDateTime = call.getEndTimeString().replace(" ", "+"); // System.out.println("restClient- callToSearch - eDateTime = " + eDateTime); // Response response = postToMyURL(Map.of(CUSTOMER_PARAMETER, customer, // START_CALL_PARAMETER, sDateTime, END_CALL_PARAMETER, eDateTime)); // // throwExceptionIfNotOkayHttpStatus(response); // } @VisibleForTesting Response postToMyURL(Map<String, String> phoneBillEntries) throws IOException { return post(this.url, phoneBillEntries); } public void removeAllPhoneBills() throws IOException { Response response = delete(this.url, Map.of()); throwExceptionIfNotOkayHttpStatus(response); } private Response throwExceptionIfNotOkayHttpStatus(Response response) { int code = response.getCode(); if (code != HTTP_OK) { throw new PhoneBillRestException(code); } return response; } @VisibleForTesting class PhoneBillRestException extends RuntimeException { private final int httpStatusCode; PhoneBillRestException(int httpStatusCode) { super("Got an HTTP Status Code of " + httpStatusCode); this.httpStatusCode = httpStatusCode; } public int getHttpStatusCode() { return this.httpStatusCode; } } }
UTF-8
Java
4,196
java
PhoneBillRestClient.java
Java
[]
null
[]
package edu.pdx.cs410J.tlan2; import com.google.common.annotations.VisibleForTesting; import edu.pdx.cs410J.ParserException; import edu.pdx.cs410J.web.HttpRequestHelper; import java.io.IOException; import java.io.StringReader; import java.util.Map; import static edu.pdx.cs410J.tlan2.PhoneBillURLParameters.*; import static java.net.HttpURLConnection.HTTP_OK; /** * A helper class for accessing the rest client. Note that this class provides * an example of how to make gets and posts to a URL. You'll need to change it * to do something other than just send dictionary entries. */ public class PhoneBillRestClient extends HttpRequestHelper { private static final String WEB_APP = "phonebill"; private static final String SERVLET = "calls"; private final String url; /** * Creates a client to the Phone Bill REST service running on the given host and port * @param hostName The name of the host * @param port The port */ public PhoneBillRestClient( String hostName, int port ) { this.url = String.format( "http://%s:%d/%s/%s", hostName, port, WEB_APP, SERVLET ); } /** * Returns all dictionary entries from the server */ public Map<String, String> getAllPhoneBills() throws IOException { Response response = get(this.url, Map.of()); return Messages.parseDictionary(response.getContent()); } /** * Returns the phone bill for the given customer */ public PhoneBill getPhoneBill(String customer) throws IOException, ParserException { Response response = get(this.url, Map.of(CUSTOMER_PARAMETER, customer)); throwExceptionIfNotOkayHttpStatus(response); String content = response.getContent(); // System.out.println("restClient-content = " + content); PhoneBillTextParser parser = new PhoneBillTextParser(new StringReader(content)); return parser.parse(); } public void addPhoneCall(String customer, PhoneCall call) throws IOException { String sDateTime = call.getStartTimeString().replace(" ", "+"); // System.out.println("restClient- sDateTime = " + sDateTime); String eDateTime = call.getEndTimeString().replace(" ", "+"); // System.out.println("restClient- eDateTime = " + eDateTime); Response response = postToMyURL(Map.of(CUSTOMER_PARAMETER, customer, CALLER_NUMBER_PARAMETER, call.getCaller(), CALLEE_NUMBER_PARAMETER, call.getCallee(), START_CALL_PARAMETER, sDateTime, END_CALL_PARAMETER, eDateTime)); throwExceptionIfNotOkayHttpStatus(response); } // public void addPhoneCallToSearch(String customer, PhoneCall call) throws IOException { // String sDateTime = call.getStartTimeString().replace(" ", "+"); // System.out.println("restClient- callToSearch - sDateTime = " + sDateTime); // String eDateTime = call.getEndTimeString().replace(" ", "+"); // System.out.println("restClient- callToSearch - eDateTime = " + eDateTime); // Response response = postToMyURL(Map.of(CUSTOMER_PARAMETER, customer, // START_CALL_PARAMETER, sDateTime, END_CALL_PARAMETER, eDateTime)); // // throwExceptionIfNotOkayHttpStatus(response); // } @VisibleForTesting Response postToMyURL(Map<String, String> phoneBillEntries) throws IOException { return post(this.url, phoneBillEntries); } public void removeAllPhoneBills() throws IOException { Response response = delete(this.url, Map.of()); throwExceptionIfNotOkayHttpStatus(response); } private Response throwExceptionIfNotOkayHttpStatus(Response response) { int code = response.getCode(); if (code != HTTP_OK) { throw new PhoneBillRestException(code); } return response; } @VisibleForTesting class PhoneBillRestException extends RuntimeException { private final int httpStatusCode; PhoneBillRestException(int httpStatusCode) { super("Got an HTTP Status Code of " + httpStatusCode); this.httpStatusCode = httpStatusCode; } public int getHttpStatusCode() { return this.httpStatusCode; } } }
4,196
0.68756
0.684223
113
36.132744
31.401342
119
false
false
0
0
0
0
0
0
0.672566
false
false
7
677eb50cfc327300da7b2013c4f6c4f4554f783d
9,895,604,664,431
1c26df575aaf50c32c9b134717203e55b4ed95e3
/app/src/main/java/info/camposha/retrofitmysqlcrud/Helpers/Utils.java
95b60ae0653e1958ff1935d94c9dd5a1c829811a
[]
no_license
mondayineme/RetrofitMySQLCRUD
https://github.com/mondayineme/RetrofitMySQLCRUD
4b699032286b91f84aa10f7098423adaa784e32e
333d3013a6ab0c8978b99017c40eb62ded195913
refs/heads/master
2023-03-21T04:48:39.703000
2021-03-11T03:23:05
2021-03-11T03:23:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package info.camposha.retrofitmysqlcrud.Helpers; import android.content.Context; import android.content.Intent; import android.view.Gravity; import android.view.View; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.yarolegovich.lovelydialog.LovelyChoiceDialog; import com.yarolegovich.lovelydialog.LovelyStandardDialog; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import info.camposha.retrofitmysqlcrud.R; import info.camposha.retrofitmysqlcrud.Retrofit.Scientist; import info.camposha.retrofitmysqlcrud.Views.DashboardActivity; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; /** * A Utility class. Contains reusable utility methods we will use throughout our project.This * class will save us from typing lots of repetitive code. */ public class Utils { /** * Let's define some Constants */ //supply your ip address. Type ipconfig while connected to internet to get your //ip address in cmd. Watch video for more details. //private static final String base_url = "http://192.168.43.91/PHP/scientists/"; private static final String base_url = "https://camposha.info/PHP/scientists/"; //private static final String base_url = "http://10.0.2.2/PHP/scientists/"; //private static final String base_url = "http://10.0.3.2/PHP/scientists/"; private static Retrofit retrofit; public static final String DATE_FORMAT = "yyyy-MM-dd"; /** * This method will return us our Retrofit instance which we can use to initiate HTTP calls. */ public static Retrofit getClient(){ if(retrofit == null){ retrofit = new Retrofit.Builder() .baseUrl(base_url) .addConverterFactory(GsonConverterFactory.create()) .build(); } return retrofit; } /** * THis method will allow us show Toast messages throughout all activities */ public static void show(Context c,String message){ Toast.makeText(c, message, Toast.LENGTH_SHORT).show(); } /** * This method will allow us validate edittexts */ public static boolean validate(EditText... editTexts){ EditText nameTxt = editTexts[0]; EditText descriptionTxt = editTexts[1]; EditText galaxyTxt = editTexts[2]; if(nameTxt.getText() == null || nameTxt.getText().toString().isEmpty()){ nameTxt.setError("Name is Required Please!"); return false; } if(descriptionTxt.getText() == null || descriptionTxt.getText().toString().isEmpty()){ descriptionTxt.setError("Description is Required Please!"); return false; } if(galaxyTxt.getText() == null || galaxyTxt.getText().toString().isEmpty()){ galaxyTxt.setError("Galaxy is Required Please!"); return false; } return true; } /** * This utility method will allow us clear arbitrary number of edittexts */ public static void clearEditTexts(EditText... editTexts){ for (EditText editText:editTexts) { editText.setText(""); } } /** * This utility method will allow us open any activity. */ public static void openActivity(Context c,Class clazz){ Intent intent = new Intent(c, clazz); c.startActivity(intent); } /** * This method will allow us show an Info dialog anywhere in our app. */ public static void showInfoDialog(final AppCompatActivity activity, String title, String message) { new LovelyStandardDialog(activity, LovelyStandardDialog.ButtonLayout.HORIZONTAL) .setTopColorRes(R.color.indigo) .setButtonsColorRes(R.color.darkDeepOrange) .setIcon(R.drawable.flip_page) .setTitle(title) .setMessage(message) .setPositiveButton("Relax", v -> {}) .setNeutralButton("Go Home", v -> openActivity(activity, DashboardActivity.class)) .setNegativeButton("Go Back", v -> activity.finish()) .show(); } /** * This method will allow us show a single select dialog where we can select and return a * star to an edittext. */ public static void selectStar(Context c,final EditText starTxt){ String[] stars ={"Rigel","Aldebaran","Arcturus","Betelgeuse","Antares","Deneb", "Wezen","VY Canis Majoris","Sirius","Alpha Pegasi","Vega","Saiph","Polaris", "Canopus","KY Cygni","VV Cephei","Uy Scuti","Bellatrix","Naos","Pollux", "Achernar","Other"}; ArrayAdapter<String> adapter = new ArrayAdapter<String>(c, android.R.layout.simple_list_item_1, stars); new LovelyChoiceDialog(c) .setTopColorRes(R.color.darkGreen) .setTitle("Stars Picker") .setTitleGravity(Gravity.CENTER_HORIZONTAL) .setIcon(R.drawable.m_list) .setMessage("Select the Star where the Scientist was born.") .setMessageGravity(Gravity.CENTER_HORIZONTAL) .setItems(adapter, (position, item) -> starTxt.setText(item)) .show(); } /** * This method will allow us convert a string into a java.util.Date object and * return it. */ public static Date giveMeDate(String stringDate){ try { SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT); return sdf.parse(stringDate); }catch (ParseException e){ e.printStackTrace(); return null; } } /** * This method will allow us show a progressbar */ public static void showProgressBar(ProgressBar pb){ pb.setVisibility(View.VISIBLE); } /** * This method will allow us hide a progressbar */ public static void hideProgressBar(ProgressBar pb){ pb.setVisibility(View.GONE); } /** * This method will allow us send a serialized scientist objec to a specified * activity */ public static void sendScientistToActivity(Context c, Scientist scientist, Class clazz){ Intent i=new Intent(c,clazz); i.putExtra("SCIENTIST_KEY",scientist); c.startActivity(i); } /** * This method will allow us receive a serialized scientist, deserialize it and return it,. */ public static Scientist receiveScientist(Intent intent,Context c){ try { return (Scientist) intent.getSerializableExtra("SCIENTIST_KEY"); }catch (Exception e){ e.printStackTrace(); } return null; } } //end
UTF-8
Java
6,929
java
Utils.java
Java
[ { "context": "/private static final String base_url = \"http://192.168.43.91/PHP/scientists/\";\n private static final Stri", "end": 1247, "score": 0.9460809230804443, "start": 1234, "tag": "IP_ADDRESS", "value": "192.168.43.91" }, { "context": "/private static final String base_url = \"http://10.0.2.2/PHP/scientists/\";\n //private static final St", "end": 1415, "score": 0.8955093026161194, "start": 1407, "tag": "IP_ADDRESS", "value": "10.0.2.2" }, { "context": "/private static final String base_url = \"http://10.0.3.2/PHP/scientists/\";\n private static Retrofit ret", "end": 1497, "score": 0.9294809103012085, "start": 1489, "tag": "IP_ADDRESS", "value": "10.0.3.2" }, { "context": "inal EditText starTxt){\n String[] stars ={\"Rigel\",\"Aldebaran\",\"Arcturus\",\"Betelgeuse\",\"Antares\"", "end": 4598, "score": 0.5763722062110901, "start": 4596, "tag": "NAME", "value": "Ri" } ]
null
[]
package info.camposha.retrofitmysqlcrud.Helpers; import android.content.Context; import android.content.Intent; import android.view.Gravity; import android.view.View; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.yarolegovich.lovelydialog.LovelyChoiceDialog; import com.yarolegovich.lovelydialog.LovelyStandardDialog; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import info.camposha.retrofitmysqlcrud.R; import info.camposha.retrofitmysqlcrud.Retrofit.Scientist; import info.camposha.retrofitmysqlcrud.Views.DashboardActivity; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; /** * A Utility class. Contains reusable utility methods we will use throughout our project.This * class will save us from typing lots of repetitive code. */ public class Utils { /** * Let's define some Constants */ //supply your ip address. Type ipconfig while connected to internet to get your //ip address in cmd. Watch video for more details. //private static final String base_url = "http://192.168.43.91/PHP/scientists/"; private static final String base_url = "https://camposha.info/PHP/scientists/"; //private static final String base_url = "http://10.0.2.2/PHP/scientists/"; //private static final String base_url = "http://10.0.3.2/PHP/scientists/"; private static Retrofit retrofit; public static final String DATE_FORMAT = "yyyy-MM-dd"; /** * This method will return us our Retrofit instance which we can use to initiate HTTP calls. */ public static Retrofit getClient(){ if(retrofit == null){ retrofit = new Retrofit.Builder() .baseUrl(base_url) .addConverterFactory(GsonConverterFactory.create()) .build(); } return retrofit; } /** * THis method will allow us show Toast messages throughout all activities */ public static void show(Context c,String message){ Toast.makeText(c, message, Toast.LENGTH_SHORT).show(); } /** * This method will allow us validate edittexts */ public static boolean validate(EditText... editTexts){ EditText nameTxt = editTexts[0]; EditText descriptionTxt = editTexts[1]; EditText galaxyTxt = editTexts[2]; if(nameTxt.getText() == null || nameTxt.getText().toString().isEmpty()){ nameTxt.setError("Name is Required Please!"); return false; } if(descriptionTxt.getText() == null || descriptionTxt.getText().toString().isEmpty()){ descriptionTxt.setError("Description is Required Please!"); return false; } if(galaxyTxt.getText() == null || galaxyTxt.getText().toString().isEmpty()){ galaxyTxt.setError("Galaxy is Required Please!"); return false; } return true; } /** * This utility method will allow us clear arbitrary number of edittexts */ public static void clearEditTexts(EditText... editTexts){ for (EditText editText:editTexts) { editText.setText(""); } } /** * This utility method will allow us open any activity. */ public static void openActivity(Context c,Class clazz){ Intent intent = new Intent(c, clazz); c.startActivity(intent); } /** * This method will allow us show an Info dialog anywhere in our app. */ public static void showInfoDialog(final AppCompatActivity activity, String title, String message) { new LovelyStandardDialog(activity, LovelyStandardDialog.ButtonLayout.HORIZONTAL) .setTopColorRes(R.color.indigo) .setButtonsColorRes(R.color.darkDeepOrange) .setIcon(R.drawable.flip_page) .setTitle(title) .setMessage(message) .setPositiveButton("Relax", v -> {}) .setNeutralButton("Go Home", v -> openActivity(activity, DashboardActivity.class)) .setNegativeButton("Go Back", v -> activity.finish()) .show(); } /** * This method will allow us show a single select dialog where we can select and return a * star to an edittext. */ public static void selectStar(Context c,final EditText starTxt){ String[] stars ={"Rigel","Aldebaran","Arcturus","Betelgeuse","Antares","Deneb", "Wezen","VY Canis Majoris","Sirius","Alpha Pegasi","Vega","Saiph","Polaris", "Canopus","KY Cygni","VV Cephei","Uy Scuti","Bellatrix","Naos","Pollux", "Achernar","Other"}; ArrayAdapter<String> adapter = new ArrayAdapter<String>(c, android.R.layout.simple_list_item_1, stars); new LovelyChoiceDialog(c) .setTopColorRes(R.color.darkGreen) .setTitle("Stars Picker") .setTitleGravity(Gravity.CENTER_HORIZONTAL) .setIcon(R.drawable.m_list) .setMessage("Select the Star where the Scientist was born.") .setMessageGravity(Gravity.CENTER_HORIZONTAL) .setItems(adapter, (position, item) -> starTxt.setText(item)) .show(); } /** * This method will allow us convert a string into a java.util.Date object and * return it. */ public static Date giveMeDate(String stringDate){ try { SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT); return sdf.parse(stringDate); }catch (ParseException e){ e.printStackTrace(); return null; } } /** * This method will allow us show a progressbar */ public static void showProgressBar(ProgressBar pb){ pb.setVisibility(View.VISIBLE); } /** * This method will allow us hide a progressbar */ public static void hideProgressBar(ProgressBar pb){ pb.setVisibility(View.GONE); } /** * This method will allow us send a serialized scientist objec to a specified * activity */ public static void sendScientistToActivity(Context c, Scientist scientist, Class clazz){ Intent i=new Intent(c,clazz); i.putExtra("SCIENTIST_KEY",scientist); c.startActivity(i); } /** * This method will allow us receive a serialized scientist, deserialize it and return it,. */ public static Scientist receiveScientist(Intent intent,Context c){ try { return (Scientist) intent.getSerializableExtra("SCIENTIST_KEY"); }catch (Exception e){ e.printStackTrace(); } return null; } } //end
6,929
0.633569
0.629817
187
36.053474
28.028391
98
false
false
0
0
0
0
0
0
0.582888
false
false
7
05b76e612d25b53c0393235b6affccfde29d3f11
9,895,604,662,568
28b6e7c633829a5a6b2bf51b00fd36c6e07cb02e
/src/java/com/pracbiz/b2bportal/base/util/ValidationConfigHelper.java
87ef7aa309b1376ace8912a66c95ddffefdffa0b
[]
no_license
OuYangLiang/pracbiz-Ntuc-B2B
https://github.com/OuYangLiang/pracbiz-Ntuc-B2B
db3aa7cc3cbd019b720c97342ffce966d1c4c3da
a6a36fbd0be941c19b9223aab5d0ec129b9752f1
refs/heads/master
2021-01-01T16:55:23.897000
2015-02-17T16:04:03
2015-02-17T16:04:03
30,924,377
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pracbiz.b2bportal.base.util; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.configuration.ConfigurationException; import org.springframework.core.io.Resource; public class ValidationConfigHelper extends BaseXmlConfig { private static final String VLD_PTN_KEY = "VLD_PTN_KEY"; public ValidationConfigHelper(File cfgFile) throws ConfigurationException, MalformedURLException { super(cfgFile); } public static ValidationConfigHelper getBeanInstance(Resource configPath) throws ConfigurationException, MalformedURLException, IOException { ValidationConfigHelper cfg = new ValidationConfigHelper( configPath.getFile()); cfg.initConfigMap(); return cfg; } protected void initConfigMap() { super.initConfigMap(); this.configMap.put(VLD_PTN_KEY, getPatterns()); } @SuppressWarnings("unchecked") public Map<String, String> getCachePatterns() { return (Map<String, String>) this.configMap.get(VLD_PTN_KEY); } public String getCachePattern(String patternKey) { Map<String, String> mapPtn = getCachePatterns(); if (mapPtn.containsKey(patternKey)) { return (String) mapPtn.get(patternKey); } else { return null; } } public String getPattern(String patternKey) { if (patternKey == null) { return null; } List<String> listKeys = this.listValue("validation.patterns.pattern[@key]"); if (listKeys == null || listKeys.size() < 1) { return null; } for (int i = 0; i < listKeys.size(); i++) { String key = (String) listKeys.get(i); if (patternKey.equalsIgnoreCase(key)) { return this.stringValue("validation.patterns.pattern(" + i + ")"); } } return null; } private Map<String, String> getPatterns() { Map<String, String> mapRlt = new HashMap<String, String>(); List<String> listKeys = this.listValue("validation.patterns.pattern[@key]"); if (listKeys == null || listKeys.size() < 1) { return mapRlt; } for (int i = 0; i < listKeys.size(); i++) { String key = (String) listKeys.get(i); String value = this.stringValue("validation.patterns.pattern(" + i + ")"); if (value == null || value.trim().length() < 1) { value = null; } mapRlt.put(key, value); } return mapRlt; } }
UTF-8
Java
2,896
java
ValidationConfigHelper.java
Java
[]
null
[]
package com.pracbiz.b2bportal.base.util; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.configuration.ConfigurationException; import org.springframework.core.io.Resource; public class ValidationConfigHelper extends BaseXmlConfig { private static final String VLD_PTN_KEY = "VLD_PTN_KEY"; public ValidationConfigHelper(File cfgFile) throws ConfigurationException, MalformedURLException { super(cfgFile); } public static ValidationConfigHelper getBeanInstance(Resource configPath) throws ConfigurationException, MalformedURLException, IOException { ValidationConfigHelper cfg = new ValidationConfigHelper( configPath.getFile()); cfg.initConfigMap(); return cfg; } protected void initConfigMap() { super.initConfigMap(); this.configMap.put(VLD_PTN_KEY, getPatterns()); } @SuppressWarnings("unchecked") public Map<String, String> getCachePatterns() { return (Map<String, String>) this.configMap.get(VLD_PTN_KEY); } public String getCachePattern(String patternKey) { Map<String, String> mapPtn = getCachePatterns(); if (mapPtn.containsKey(patternKey)) { return (String) mapPtn.get(patternKey); } else { return null; } } public String getPattern(String patternKey) { if (patternKey == null) { return null; } List<String> listKeys = this.listValue("validation.patterns.pattern[@key]"); if (listKeys == null || listKeys.size() < 1) { return null; } for (int i = 0; i < listKeys.size(); i++) { String key = (String) listKeys.get(i); if (patternKey.equalsIgnoreCase(key)) { return this.stringValue("validation.patterns.pattern(" + i + ")"); } } return null; } private Map<String, String> getPatterns() { Map<String, String> mapRlt = new HashMap<String, String>(); List<String> listKeys = this.listValue("validation.patterns.pattern[@key]"); if (listKeys == null || listKeys.size() < 1) { return mapRlt; } for (int i = 0; i < listKeys.size(); i++) { String key = (String) listKeys.get(i); String value = this.stringValue("validation.patterns.pattern(" + i + ")"); if (value == null || value.trim().length() < 1) { value = null; } mapRlt.put(key, value); } return mapRlt; } }
2,896
0.570097
0.568025
125
22.167999
24.129894
84
false
false
0
0
0
0
0
0
0.44
false
false
7
24f7076518e8eebce2369fc49903cf2fb3e168f3
12,008,728,588,537
94138ba86d0dbf80b387064064d1d86269e927a1
/group02/727171008/src/com/github/HarryHook/coding2017/jvm/print/ConstantPoolPrinter.java
3d6c79118546df249621610a5a38d8d50a5d499d
[]
no_license
DonaldY/coding2017
https://github.com/DonaldY/coding2017
2aa69b8a2c2990b0c0e02c04f50eef6cbeb60d42
0e0c386007ef710cfc90340cbbc4e901e660f01c
refs/heads/master
2021-01-17T20:14:47.101000
2017-06-01T00:19:19
2017-06-01T00:19:19
84,141,024
2
28
null
true
2017-06-01T00:19:20
2017-03-07T01:45:12
2017-03-19T07:29:19
2017-06-01T00:19:19
21,264
2
23
0
Java
null
null
package com.github.HarryHook.coding2017.jvm.print; import com.github.HarryHook.coding2017.jvm.constant.ClassInfo; import com.github.HarryHook.coding2017.jvm.constant.ConstantInfo; import com.github.HarryHook.coding2017.jvm.constant.ConstantPool; import com.github.HarryHook.coding2017.jvm.constant.FieldRefInfo; import com.github.HarryHook.coding2017.jvm.constant.MethodRefInfo; import com.github.HarryHook.coding2017.jvm.constant.NameAndTypeInfo; import com.github.HarryHook.coding2017.jvm.constant.StringInfo; import com.github.HarryHook.coding2017.jvm.constant.UTF8Info; public class ConstantPoolPrinter { ConstantPool pool; ConstantPoolPrinter(ConstantPool pool){ this.pool = pool; } public void print(){ System.out.println("Constant Pool:"); } }
UTF-8
Java
776
java
ConstantPoolPrinter.java
Java
[ { "context": "package com.github.HarryHook.coding2017.jvm.print;\n\nimport com.github.HarryHoo", "end": 28, "score": 0.9691202044487, "start": 19, "tag": "USERNAME", "value": "HarryHook" }, { "context": "arryHook.coding2017.jvm.print;\n\nimport com.github.HarryHook.coding2017.jvm.constant.ClassInfo;\nimport com.git", "end": 79, "score": 0.9847577214241028, "start": 70, "tag": "USERNAME", "value": "HarryHook" }, { "context": "ing2017.jvm.constant.ClassInfo;\nimport com.github.HarryHook.coding2017.jvm.constant.ConstantInfo;\nimport com.", "end": 142, "score": 0.9749631881713867, "start": 133, "tag": "USERNAME", "value": "HarryHook" }, { "context": "2017.jvm.constant.ConstantInfo;\nimport com.github.HarryHook.coding2017.jvm.constant.ConstantPool;\nimport com.", "end": 208, "score": 0.9655451774597168, "start": 199, "tag": "USERNAME", "value": "HarryHook" }, { "context": "2017.jvm.constant.ConstantPool;\nimport com.github.HarryHook.coding2017.jvm.constant.FieldRefInfo;\nimport com.", "end": 274, "score": 0.9627578854560852, "start": 265, "tag": "USERNAME", "value": "HarryHook" }, { "context": "2017.jvm.constant.FieldRefInfo;\nimport com.github.HarryHook.coding2017.jvm.constant.MethodRefInfo;\nimport com", "end": 340, "score": 0.9755627512931824, "start": 331, "tag": "USERNAME", "value": "HarryHook" }, { "context": "017.jvm.constant.MethodRefInfo;\nimport com.github.HarryHook.coding2017.jvm.constant.NameAndTypeInfo;\nimport c", "end": 407, "score": 0.980114221572876, "start": 398, "tag": "USERNAME", "value": "HarryHook" }, { "context": "7.jvm.constant.NameAndTypeInfo;\nimport com.github.HarryHook.coding2017.jvm.constant.StringInfo;\nimport com.gi", "end": 476, "score": 0.9251465201377869, "start": 467, "tag": "USERNAME", "value": "HarryHook" }, { "context": "ng2017.jvm.constant.StringInfo;\nimport com.github.HarryHook.coding2017.jvm.constant.UTF8Info;\n\npublic class C", "end": 540, "score": 0.903182327747345, "start": 531, "tag": "USERNAME", "value": "HarryHook" } ]
null
[]
package com.github.HarryHook.coding2017.jvm.print; import com.github.HarryHook.coding2017.jvm.constant.ClassInfo; import com.github.HarryHook.coding2017.jvm.constant.ConstantInfo; import com.github.HarryHook.coding2017.jvm.constant.ConstantPool; import com.github.HarryHook.coding2017.jvm.constant.FieldRefInfo; import com.github.HarryHook.coding2017.jvm.constant.MethodRefInfo; import com.github.HarryHook.coding2017.jvm.constant.NameAndTypeInfo; import com.github.HarryHook.coding2017.jvm.constant.StringInfo; import com.github.HarryHook.coding2017.jvm.constant.UTF8Info; public class ConstantPoolPrinter { ConstantPool pool; ConstantPoolPrinter(ConstantPool pool){ this.pool = pool; } public void print(){ System.out.println("Constant Pool:"); } }
776
0.811856
0.764175
25
30.08
27.230747
68
false
false
0
0
0
0
0
0
1.24
false
false
7
f915008fc0ac156ad7e2038913581ac00ef8a355
12,008,728,592,419
ccfe23d2eaa4356bebc4117e937277975c43e576
/utils/src/test/java/vip/simplify/utils/JsonUtilTest.java
d4590ea5804436fd7d3888c04e4c51c43bfb1165
[]
no_license
wlzsoft/simplify-framework
https://github.com/wlzsoft/simplify-framework
bb87c7a5345a83fb43300f5af2f8b039f5f89f99
d7cf334fa1492d6f00f04badef10470a3a07ad5e
refs/heads/master
2020-03-19T20:06:37.553000
2017-12-21T01:47:08
2018-06-11T07:23:11
136,888,509
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vip.simplify.utils; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONReader; import com.alibaba.fastjson.JSONWriter; import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.serializer.SerializerFeature; import vip.simplify.utils.entity.Goods; import vip.simplify.utils.entity.User; /** * <p><b>Title:</b><i>测试fastjson基于stream的api对于超大文本的处理速度</i></p> * <p>Desc: TODO</p> * <p>source folder:{@docRoot}</p> * <p>Copyright:Copyright(c)2014</p> * <p>Company:meizu</p> * <p>Create Date:2016年3月31日 下午3:14:56</p> * <p>Modified By:luchuangye-</p> * <p>Modified Date:2016年3月31日 下午3:14:56</p> * @author <a href="mailto:luchuangye@meizu.com" >luchuangye</a> * @version Version 0.1 * */ public class JsonUtilTest { private static String path = null; @BeforeClass public static void init() { path = JsonUtilTest.class.getProtectionDomain().getCodeSource().getLocation().getPath(); } @Test public void testSerialForStreamApi() throws IOException { FileWriter fw = new FileWriter(path+"tmp/huge2.json"); JSONWriter writer = new JSONWriter(fw); writer.startArray(); for (int i = 0; i < 1000 * 1000; ++i) { writer.writeValue(new BigVo(i)); } writer.endArray(); writer.close(); fw.close(); FileUtil.deleteFile(path+"tmp/huge2.json"); } @Test public void testSerialForStreamApi2() throws IOException { FileWriter fw = new FileWriter(path+"tmp/huge2.json"); JSONWriter writer = new JSONWriter(fw); writer.startObject(); for (int i = 0; i < 1000 * 1000; ++i) { writer.writeKey("x" + i); writer.writeValue(new BigVo(i)); } writer.endObject(); writer.close(); fw.close(); FileUtil.deleteFile(path+"tmp/huge2.json"); } @Test public void testUnSerialForStreamApi() throws FileNotFoundException { JSONReader reader = new JSONReader(new FileReader(path+"tmp/huge.json")); reader.startArray(); while(reader.hasNext()) { BigVo vo = reader.readObject(BigVo.class); vo.getAuc(); } reader.endArray(); reader.close(); } /** * 方法用途: 数据格式必须是json对象<br> * 操作步骤: 废弃,huge.json是数组格式<br> * @throws FileNotFoundException */ // @Test public void testUnSerialForStreamApi2() throws FileNotFoundException { JSONReader reader = new JSONReader(new FileReader(path+"tmp/huge.json")); reader.startObject(); while(reader.hasNext()) { // String key = reader.readString(); BigVo vo = reader.readObject(BigVo.class); vo.getAuc(); } reader.endObject(); reader.close(); } @Test public void testArray() { JSONObject jo = new JSONObject(); JSONArray ja = new JSONArray(); ja.add("2016-10-01 10:00:00"); ja.add("2016-10-01 12:00:00"); jo.put("1", ja); JSONArray ja2 = new JSONArray(); ja2.add("2016-10-01 14:00:00"); ja2.add("2016-10-01 15:00:00"); jo.put("2-3", ja2); System.out.println(jo.toJSONString()); JSONObject o = JsonUtil.stringToJSONObject(jo.toJSONString()); System.out.println(o); } @Test public void testUnicode() { User user = new User(); user.setName("卢创业"); System.out.println(JsonUtil.objectToString(user,SerializerFeature.BrowserCompatible)); } @Test public void testByGenric() { User user = new User(); user.setName("卢创业"); Goods<User> goods = new Goods<>(); goods.setT(user); goods.setTitle("哈哈"); goods.setTotalRecord(10); Goods<User> goodsResult = JsonUtil.jsonToObject(JsonUtil.objectToString(goods),new TypeReference<Goods<User>>(){}); Assert.assertEquals("卢创业",goodsResult.getT().getName()); } }
UTF-8
Java
3,970
java
JsonUtilTest.java
Java
[ { "context": "16年3月31日 下午3:14:56</p>\n * @author <a href=\"mailto:luchuangye@meizu.com\" >luchuangye</a>\n * @version Version 0.1\n *\n */\np", "end": 925, "score": 0.9999361038208008, "start": 905, "tag": "EMAIL", "value": "luchuangye@meizu.com" }, { "context": " * @author <a href=\"mailto:luchuangye@meizu.com\" >luchuangye</a>\n * @version Version 0.1\n *\n */\npublic class J", "end": 938, "score": 0.985411524772644, "start": 928, "tag": "USERNAME", "value": "luchuangye" }, { "context": "ode() {\n\t\tUser user = new User();\n\t\tuser.setName(\"卢创业\");\n\t\tSystem.out.println(JsonUtil.objectToString(u", "end": 3371, "score": 0.9314309358596802, "start": 3368, "tag": "USERNAME", "value": "卢创业" }, { "context": "ric() {\n\t\tUser user = new User();\n\t\tuser.setName(\"卢创业\");\n\t\tGoods<User> goods = new Goods<>();\n\t\tgoods.s", "end": 3551, "score": 0.8513420820236206, "start": 3548, "tag": "USERNAME", "value": "卢创业" } ]
null
[]
package vip.simplify.utils; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONReader; import com.alibaba.fastjson.JSONWriter; import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.serializer.SerializerFeature; import vip.simplify.utils.entity.Goods; import vip.simplify.utils.entity.User; /** * <p><b>Title:</b><i>测试fastjson基于stream的api对于超大文本的处理速度</i></p> * <p>Desc: TODO</p> * <p>source folder:{@docRoot}</p> * <p>Copyright:Copyright(c)2014</p> * <p>Company:meizu</p> * <p>Create Date:2016年3月31日 下午3:14:56</p> * <p>Modified By:luchuangye-</p> * <p>Modified Date:2016年3月31日 下午3:14:56</p> * @author <a href="mailto:<EMAIL>" >luchuangye</a> * @version Version 0.1 * */ public class JsonUtilTest { private static String path = null; @BeforeClass public static void init() { path = JsonUtilTest.class.getProtectionDomain().getCodeSource().getLocation().getPath(); } @Test public void testSerialForStreamApi() throws IOException { FileWriter fw = new FileWriter(path+"tmp/huge2.json"); JSONWriter writer = new JSONWriter(fw); writer.startArray(); for (int i = 0; i < 1000 * 1000; ++i) { writer.writeValue(new BigVo(i)); } writer.endArray(); writer.close(); fw.close(); FileUtil.deleteFile(path+"tmp/huge2.json"); } @Test public void testSerialForStreamApi2() throws IOException { FileWriter fw = new FileWriter(path+"tmp/huge2.json"); JSONWriter writer = new JSONWriter(fw); writer.startObject(); for (int i = 0; i < 1000 * 1000; ++i) { writer.writeKey("x" + i); writer.writeValue(new BigVo(i)); } writer.endObject(); writer.close(); fw.close(); FileUtil.deleteFile(path+"tmp/huge2.json"); } @Test public void testUnSerialForStreamApi() throws FileNotFoundException { JSONReader reader = new JSONReader(new FileReader(path+"tmp/huge.json")); reader.startArray(); while(reader.hasNext()) { BigVo vo = reader.readObject(BigVo.class); vo.getAuc(); } reader.endArray(); reader.close(); } /** * 方法用途: 数据格式必须是json对象<br> * 操作步骤: 废弃,huge.json是数组格式<br> * @throws FileNotFoundException */ // @Test public void testUnSerialForStreamApi2() throws FileNotFoundException { JSONReader reader = new JSONReader(new FileReader(path+"tmp/huge.json")); reader.startObject(); while(reader.hasNext()) { // String key = reader.readString(); BigVo vo = reader.readObject(BigVo.class); vo.getAuc(); } reader.endObject(); reader.close(); } @Test public void testArray() { JSONObject jo = new JSONObject(); JSONArray ja = new JSONArray(); ja.add("2016-10-01 10:00:00"); ja.add("2016-10-01 12:00:00"); jo.put("1", ja); JSONArray ja2 = new JSONArray(); ja2.add("2016-10-01 14:00:00"); ja2.add("2016-10-01 15:00:00"); jo.put("2-3", ja2); System.out.println(jo.toJSONString()); JSONObject o = JsonUtil.stringToJSONObject(jo.toJSONString()); System.out.println(o); } @Test public void testUnicode() { User user = new User(); user.setName("卢创业"); System.out.println(JsonUtil.objectToString(user,SerializerFeature.BrowserCompatible)); } @Test public void testByGenric() { User user = new User(); user.setName("卢创业"); Goods<User> goods = new Goods<>(); goods.setT(user); goods.setTitle("哈哈"); goods.setTotalRecord(10); Goods<User> goodsResult = JsonUtil.jsonToObject(JsonUtil.objectToString(goods),new TypeReference<Goods<User>>(){}); Assert.assertEquals("卢创业",goodsResult.getT().getName()); } }
3,957
0.681747
0.650806
135
27.48889
21.666792
117
false
false
0
0
0
0
0
0
1.777778
false
false
7
4009d245e0dba6afb8ad6acf3c26ddec8486dae6
2,576,980,419,530
3a57c3f194bf45ee3cf70122049d96f222911b57
/Example/src/JFrame1.java
188a3aae366d4692ab4f71139b2b123439cdb30c
[]
no_license
Thanhthien0908/QLBHJavaSwing
https://github.com/Thanhthien0908/QLBHJavaSwing
7814111c10eb3faccf496c55d25da92b83dd6b0d
a1711a8c2608f056f2863f09c5e4bfa9e6501a88
refs/heads/master
2022-07-03T03:48:43.434000
2020-05-17T02:44:21
2020-05-17T02:44:21
264,569,738
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. */ import java.sql.DriverManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.swing.JOptionPane; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author thanh */ public class JFrame1 extends javax.swing.JFrame { /** * Creates new form JFrame1 */ public JFrame1() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); btnDangnhap = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); b = new javax.swing.JPasswordField(); a = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Đăng Nhập"); setLocation(new java.awt.Point(400, 200)); setName("Đăng Nhập"); // NOI18N jButton1.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N jButton1.setText("Đăng kí"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); btnDangnhap.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N btnDangnhap.setText("Đăng Nhập"); btnDangnhap.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDangnhapActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Constantia", 0, 24)); // NOI18N jLabel1.setText("ĐĂNG NHẬP"); jLabel2.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N jLabel2.setText("User Name:"); jLabel3.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N jLabel3.setText("PASS Word:"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addGap(139, 139, 139)) .addGroup(layout.createSequentialGroup() .addGap(49, 49, 49) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(btnDangnhap) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE) .addComponent(jButton1) .addGap(16, 16, 16)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(b) .addComponent(a)))) .addGap(69, 69, 69)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(30, 30, 30) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnDangnhap) .addComponent(jButton1)) .addGap(21, 21, 21)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed new JFrame2().setVisible(true); this.setVisible(false); }//GEN-LAST:event_jButton1ActionPerformed private void btnDangnhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDangnhapActionPerformed if("".equals(a.getText()) | "".equals(b.getText())){ JOptionPane.showMessageDialog(this, "Bạn chưa nhập đủ thông tin!","Eror",2); } else{ Connection con; PreparedStatement ps; try { String s = "jdbc:sqlserver://localhost;databaseName=QLBH"; con = DriverManager.getConnection(s,"sa","123"); ps = con.prepareStatement("select * from TaiKhoan where NameDN=? and PassDN=?"); ps.setString(1,a.getText()); ps.setString(2,b.getText()); ResultSet rs = ps.executeQuery(); if(rs.next()){ JOptionPane.showMessageDialog(this, "Đăng Nhập Thành Công!","Thông báo",1); new ExcuteData().setVisible(true); this.setVisible(false); }else{ JOptionPane.showMessageDialog(this, "Nhập sai thông tin hoặc bạn chưa có tài khoản!","Eror",2); a.setText(""); b.setText(""); a.requestFocus(); } } catch (SQLException ex) { Logger.getLogger(JFrame1.class.getName()).log(Level.SEVERE, null, ex); } // TODO add your handling code here: }//GEN-LAST:event_btnDangnhapActionPerformed } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new JFrame1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField a; private javax.swing.JPasswordField b; private javax.swing.JButton btnDangnhap; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; // End of variables declaration//GEN-END:variables }
UTF-8
Java
9,471
java
JFrame1.java
Java
[ { "context": "import java.util.logging.Logger;\n/**\n *\n * @author thanh\n */\npublic class JFrame1 extends javax.swing.JFra", "end": 456, "score": 0.9937063455581665, "start": 451, "tag": "USERNAME", "value": "thanh" }, { "context": "tia\", 0, 24)); // NOI18N\n jLabel1.setText(\"ĐĂNG NHẬP\");\n\n jLabel2.setFont(new java.awt.Font(\"Co", "end": 2082, "score": 0.9965591430664062, "start": 2073, "tag": "NAME", "value": "ĐĂNG NHẬP" } ]
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. */ import java.sql.DriverManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.swing.JOptionPane; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author thanh */ public class JFrame1 extends javax.swing.JFrame { /** * Creates new form JFrame1 */ public JFrame1() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); btnDangnhap = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); b = new javax.swing.JPasswordField(); a = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Đăng Nhập"); setLocation(new java.awt.Point(400, 200)); setName("Đăng Nhập"); // NOI18N jButton1.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N jButton1.setText("Đăng kí"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); btnDangnhap.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N btnDangnhap.setText("Đăng Nhập"); btnDangnhap.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDangnhapActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Constantia", 0, 24)); // NOI18N jLabel1.setText("<NAME>"); jLabel2.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N jLabel2.setText("User Name:"); jLabel3.setFont(new java.awt.Font("Consolas", 0, 18)); // NOI18N jLabel3.setText("PASS Word:"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addGap(139, 139, 139)) .addGroup(layout.createSequentialGroup() .addGap(49, 49, 49) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(btnDangnhap) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE) .addComponent(jButton1) .addGap(16, 16, 16)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(b) .addComponent(a)))) .addGap(69, 69, 69)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(30, 30, 30) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnDangnhap) .addComponent(jButton1)) .addGap(21, 21, 21)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed new JFrame2().setVisible(true); this.setVisible(false); }//GEN-LAST:event_jButton1ActionPerformed private void btnDangnhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDangnhapActionPerformed if("".equals(a.getText()) | "".equals(b.getText())){ JOptionPane.showMessageDialog(this, "Bạn chưa nhập đủ thông tin!","Eror",2); } else{ Connection con; PreparedStatement ps; try { String s = "jdbc:sqlserver://localhost;databaseName=QLBH"; con = DriverManager.getConnection(s,"sa","123"); ps = con.prepareStatement("select * from TaiKhoan where NameDN=? and PassDN=?"); ps.setString(1,a.getText()); ps.setString(2,b.getText()); ResultSet rs = ps.executeQuery(); if(rs.next()){ JOptionPane.showMessageDialog(this, "Đăng Nhập Thành Công!","Thông báo",1); new ExcuteData().setVisible(true); this.setVisible(false); }else{ JOptionPane.showMessageDialog(this, "Nhập sai thông tin hoặc bạn chưa có tài khoản!","Eror",2); a.setText(""); b.setText(""); a.requestFocus(); } } catch (SQLException ex) { Logger.getLogger(JFrame1.class.getName()).log(Level.SEVERE, null, ex); } // TODO add your handling code here: }//GEN-LAST:event_btnDangnhapActionPerformed } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new JFrame1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField a; private javax.swing.JPasswordField b; private javax.swing.JButton btnDangnhap; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; // End of variables declaration//GEN-END:variables }
9,464
0.612332
0.598535
199
46.351757
33.530411
158
false
false
0
0
0
0
0
0
0.713568
false
false
7
9a695cbc83317e196b88c3c404423dd5b30191c1
11,836,929,936,153
a81d2dc78377f09a8098a3b5ed1f33372bc0974e
/programação orientada a objetos/Object-Oriented Design/SOLID_Principles/ocp/GeradorDeArquivo/src/main/java/br/com/robsoncastilho/geradordearquivo/mauexemplo/ArquivoWord.java
2a18e2cefa7dc3aeff804667209fa3ec5d0737b9
[]
no_license
livreprogramacao/workspace
https://github.com/livreprogramacao/workspace
f35b92187717085927aec27838874f697300b9cb
d7e4e0c2a4d2a080f5889a4419bec80aeec720cf
refs/heads/master
2021-01-09T23:40:12.380000
2016-11-26T14:21:55
2016-11-26T14:21:55
55,999,404
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.robsoncastilho.geradordearquivo.mauexemplo; public class ArquivoWord extends Arquivo { public void gerarDocX() { // gerar um docX na pasta. } }
UTF-8
Java
181
java
ArquivoWord.java
Java
[ { "context": "package br.com.robsoncastilho.geradordearquivo.mauexemplo;\n\npublic class Arquiv", "end": 29, "score": 0.9775470495223999, "start": 15, "tag": "USERNAME", "value": "robsoncastilho" } ]
null
[]
package br.com.robsoncastilho.geradordearquivo.mauexemplo; public class ArquivoWord extends Arquivo { public void gerarDocX() { // gerar um docX na pasta. } }
181
0.690608
0.690608
8
21.625
20.693825
58
false
false
0
0
0
0
0
0
0.125
false
false
7
416b5e188b86fc85ca1ce32edd02008e443a255f
5,695,126,635,762
50517bc60a782b26e63ae0dcbb28eb887493ecfd
/estatioapp/app/src/main/java/org/estatio/module/lease/dom/amortisation/AmortisationSchedule.java
b9c6d15cd34ac3b639b9e529b53c54c3e2e1d3b8
[ "Apache-2.0" ]
permissive
AlbinBabuCufa/estatio
https://github.com/AlbinBabuCufa/estatio
2d51a9e984fb2e341649315e2497ed58b191d685
82817ed22d00467e33afd290498d684cacccb3f5
refs/heads/master
2023-03-16T16:33:48.569000
2021-03-17T12:25:51
2021-03-17T12:25:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.estatio.module.lease.dom.amortisation; import java.math.BigDecimal; import java.math.BigInteger; import java.util.SortedSet; import java.util.TreeSet; import javax.inject.Inject; import javax.jdo.annotations.Column; import javax.jdo.annotations.DatastoreIdentity; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.Queries; import javax.jdo.annotations.Query; import javax.jdo.annotations.Unique; import javax.jdo.annotations.Version; import javax.jdo.annotations.VersionStrategy; import com.google.common.collect.Lists; import org.joda.time.LocalDate; import org.apache.isis.applib.annotation.Action; import org.apache.isis.applib.annotation.BookmarkPolicy; import org.apache.isis.applib.annotation.DomainObject; import org.apache.isis.applib.annotation.DomainObjectLayout; import org.apache.isis.applib.annotation.Editing; import org.apache.isis.applib.annotation.Programmatic; import org.apache.isis.applib.annotation.PropertyLayout; import org.apache.isis.applib.annotation.SemanticsOf; import org.apache.isis.applib.annotation.Where; import org.isisaddons.module.security.dom.tenancy.ApplicationTenancy; import org.incode.module.base.dom.types.NotesType; import org.incode.module.base.dom.utils.TitleBuilder; import org.incode.module.base.dom.valuetypes.LocalDateInterval; import org.estatio.module.base.dom.UdoDomainObject2; import org.estatio.module.charge.dom.Charge; import org.estatio.module.lease.dom.Frequency; import org.estatio.module.lease.dom.Lease; import lombok.Getter; import lombok.Setter; @PersistenceCapable( identityType = IdentityType.DATASTORE, schema = "dbo", table = "AmortisationSchedule" ) @DatastoreIdentity( strategy = IdGeneratorStrategy.IDENTITY, column = "id") @Version( strategy = VersionStrategy.VERSION_NUMBER, column = "version") @Queries({ @Query( name = "findByLease", language = "JDOQL", value = "SELECT " + "FROM org.estatio.module.lease.dom.amortisation.AmortisationSchedule " + "WHERE lease == :lease "), @Query( name = "findByLeaseAndChargeAndStartDate", language = "JDOQL", value = "SELECT " + "FROM org.estatio.module.lease.dom.amortisation.AmortisationSchedule " + "WHERE lease == :lease " + "&& charge == :charge " + "&& startDate == :startDate "), @Query( name = "findUnique", language = "JDOQL", value = "SELECT " + "FROM org.estatio.module.lease.dom.amortisation.AmortisationSchedule " + "WHERE lease == :lease " + "&& charge == :charge " + "&& startDate == :startDate " + "&& sequence == :sequence "), }) @Unique(name = "AmortisationSchedule_lease_charge_startDate_sequence_UNQ", members = { "lease", "charge", "startDate", "sequence" }) @DomainObject( editing = Editing.DISABLED, objectType = "amortisation.AmortisationSchedule" ) @DomainObjectLayout( bookmarking = BookmarkPolicy.AS_ROOT ) public class AmortisationSchedule extends UdoDomainObject2<AmortisationSchedule> { public AmortisationSchedule() { super("lease, charge, startDate, sequence"); } public AmortisationSchedule( final Lease lease, final Charge charge, final BigDecimal scheduledValue, final Frequency frequency, final LocalDate startDate, final LocalDate endDate, final BigInteger sequence){ this(); this.lease = lease; this.charge = charge; this.scheduledValue = scheduledValue; this.outstandingValue = scheduledValue; this.frequency = frequency; this.startDate = startDate; this.endDate = endDate; this.sequence = sequence; } public String title() { return TitleBuilder.start() .withParent(getLease()) .withName("schedule ") .withName(getCharge().getReference()) .withName(getInterval()) .toString(); } @Getter @Setter @Column(name = "leaseId", allowsNull = "false") private Lease lease; @Getter @Setter @Column(name = "chargeId", allowsNull = "false") private Charge charge; @Getter @Setter @Column(allowsNull = "false", scale = 2) private BigDecimal scheduledValue; @Getter @Setter @Column(allowsNull = "false", scale = 2) private BigDecimal outstandingValue; @Getter @Setter @Column(allowsNull = "false") private Frequency frequency; @Getter @Setter @Column(allowsNull = "false") private LocalDate startDate; @Getter @Setter @Column(allowsNull = "false") private LocalDate endDate; @Programmatic public LocalDateInterval getInterval() { return LocalDateInterval.including(getStartDate(), getEndDate()); } @Column(allowsNull = "true", length = NotesType.Meta.MAX_LEN) @PropertyLayout(multiLine = 5, hidden = Where.ALL_TABLES) @Getter @Setter private String note; @Persistent(mappedBy = "schedule", dependentElement = "true") @Getter @Setter private SortedSet<AmortisationEntry> entries = new TreeSet<>(); @Action(semantics = SemanticsOf.NON_IDEMPOTENT) public AmortisationSchedule createAndDistributeEntries(){ amortisationScheduleService.createAndDistributeEntries(this); return this; } public boolean hideCreateAndDistributeEntries(){ return !getEntries().isEmpty(); } @Action(semantics = SemanticsOf.NON_IDEMPOTENT) public AmortisationSchedule redistributeEntries(){ amortisationScheduleService.redistributeEntries(this); verifyOutstandingValue(); return this; } public boolean hideRedistributeEntries(){ final BigDecimal totalValueOfEntries = Lists.newArrayList(getEntries()).stream() .map(e -> e.getEntryAmount()) .reduce(BigDecimal.ZERO, BigDecimal::add); return totalValueOfEntries.compareTo(getScheduledValue())==0; } @Action(semantics = SemanticsOf.IDEMPOTENT) public void verifyOutstandingValue() { setOutstandingValue( getScheduledValue().subtract( Lists.newArrayList(getEntries()).stream() .filter(e->e.getDateReported()!=null) .map(e->e.getEntryAmount()) .reduce(BigDecimal.ZERO, BigDecimal::add) ) ); } @Getter @Setter @Column(allowsNull = "true") private CreationStrategy creationStrategyUsed; @Getter @Setter @Column(allowsNull = "false") private BigInteger sequence; @Programmatic public boolean isReported(){ for (AmortisationEntry entry : getEntries()){ if (entry.getDateReported()!=null) return true; } return false; } @Programmatic public AmortisationSchedule appendTextToNote(final String text){ if (getNote()==null || getNote().length()==0){ setNote(text); } else { setNote(getNote() + " | " + text); } return this; } @Override public ApplicationTenancy getApplicationTenancy() { return getLease().getApplicationTenancy(); } @Inject AmortisationScheduleService amortisationScheduleService; }
UTF-8
Java
7,766
java
AmortisationSchedule.java
Java
[]
null
[]
package org.estatio.module.lease.dom.amortisation; import java.math.BigDecimal; import java.math.BigInteger; import java.util.SortedSet; import java.util.TreeSet; import javax.inject.Inject; import javax.jdo.annotations.Column; import javax.jdo.annotations.DatastoreIdentity; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.Queries; import javax.jdo.annotations.Query; import javax.jdo.annotations.Unique; import javax.jdo.annotations.Version; import javax.jdo.annotations.VersionStrategy; import com.google.common.collect.Lists; import org.joda.time.LocalDate; import org.apache.isis.applib.annotation.Action; import org.apache.isis.applib.annotation.BookmarkPolicy; import org.apache.isis.applib.annotation.DomainObject; import org.apache.isis.applib.annotation.DomainObjectLayout; import org.apache.isis.applib.annotation.Editing; import org.apache.isis.applib.annotation.Programmatic; import org.apache.isis.applib.annotation.PropertyLayout; import org.apache.isis.applib.annotation.SemanticsOf; import org.apache.isis.applib.annotation.Where; import org.isisaddons.module.security.dom.tenancy.ApplicationTenancy; import org.incode.module.base.dom.types.NotesType; import org.incode.module.base.dom.utils.TitleBuilder; import org.incode.module.base.dom.valuetypes.LocalDateInterval; import org.estatio.module.base.dom.UdoDomainObject2; import org.estatio.module.charge.dom.Charge; import org.estatio.module.lease.dom.Frequency; import org.estatio.module.lease.dom.Lease; import lombok.Getter; import lombok.Setter; @PersistenceCapable( identityType = IdentityType.DATASTORE, schema = "dbo", table = "AmortisationSchedule" ) @DatastoreIdentity( strategy = IdGeneratorStrategy.IDENTITY, column = "id") @Version( strategy = VersionStrategy.VERSION_NUMBER, column = "version") @Queries({ @Query( name = "findByLease", language = "JDOQL", value = "SELECT " + "FROM org.estatio.module.lease.dom.amortisation.AmortisationSchedule " + "WHERE lease == :lease "), @Query( name = "findByLeaseAndChargeAndStartDate", language = "JDOQL", value = "SELECT " + "FROM org.estatio.module.lease.dom.amortisation.AmortisationSchedule " + "WHERE lease == :lease " + "&& charge == :charge " + "&& startDate == :startDate "), @Query( name = "findUnique", language = "JDOQL", value = "SELECT " + "FROM org.estatio.module.lease.dom.amortisation.AmortisationSchedule " + "WHERE lease == :lease " + "&& charge == :charge " + "&& startDate == :startDate " + "&& sequence == :sequence "), }) @Unique(name = "AmortisationSchedule_lease_charge_startDate_sequence_UNQ", members = { "lease", "charge", "startDate", "sequence" }) @DomainObject( editing = Editing.DISABLED, objectType = "amortisation.AmortisationSchedule" ) @DomainObjectLayout( bookmarking = BookmarkPolicy.AS_ROOT ) public class AmortisationSchedule extends UdoDomainObject2<AmortisationSchedule> { public AmortisationSchedule() { super("lease, charge, startDate, sequence"); } public AmortisationSchedule( final Lease lease, final Charge charge, final BigDecimal scheduledValue, final Frequency frequency, final LocalDate startDate, final LocalDate endDate, final BigInteger sequence){ this(); this.lease = lease; this.charge = charge; this.scheduledValue = scheduledValue; this.outstandingValue = scheduledValue; this.frequency = frequency; this.startDate = startDate; this.endDate = endDate; this.sequence = sequence; } public String title() { return TitleBuilder.start() .withParent(getLease()) .withName("schedule ") .withName(getCharge().getReference()) .withName(getInterval()) .toString(); } @Getter @Setter @Column(name = "leaseId", allowsNull = "false") private Lease lease; @Getter @Setter @Column(name = "chargeId", allowsNull = "false") private Charge charge; @Getter @Setter @Column(allowsNull = "false", scale = 2) private BigDecimal scheduledValue; @Getter @Setter @Column(allowsNull = "false", scale = 2) private BigDecimal outstandingValue; @Getter @Setter @Column(allowsNull = "false") private Frequency frequency; @Getter @Setter @Column(allowsNull = "false") private LocalDate startDate; @Getter @Setter @Column(allowsNull = "false") private LocalDate endDate; @Programmatic public LocalDateInterval getInterval() { return LocalDateInterval.including(getStartDate(), getEndDate()); } @Column(allowsNull = "true", length = NotesType.Meta.MAX_LEN) @PropertyLayout(multiLine = 5, hidden = Where.ALL_TABLES) @Getter @Setter private String note; @Persistent(mappedBy = "schedule", dependentElement = "true") @Getter @Setter private SortedSet<AmortisationEntry> entries = new TreeSet<>(); @Action(semantics = SemanticsOf.NON_IDEMPOTENT) public AmortisationSchedule createAndDistributeEntries(){ amortisationScheduleService.createAndDistributeEntries(this); return this; } public boolean hideCreateAndDistributeEntries(){ return !getEntries().isEmpty(); } @Action(semantics = SemanticsOf.NON_IDEMPOTENT) public AmortisationSchedule redistributeEntries(){ amortisationScheduleService.redistributeEntries(this); verifyOutstandingValue(); return this; } public boolean hideRedistributeEntries(){ final BigDecimal totalValueOfEntries = Lists.newArrayList(getEntries()).stream() .map(e -> e.getEntryAmount()) .reduce(BigDecimal.ZERO, BigDecimal::add); return totalValueOfEntries.compareTo(getScheduledValue())==0; } @Action(semantics = SemanticsOf.IDEMPOTENT) public void verifyOutstandingValue() { setOutstandingValue( getScheduledValue().subtract( Lists.newArrayList(getEntries()).stream() .filter(e->e.getDateReported()!=null) .map(e->e.getEntryAmount()) .reduce(BigDecimal.ZERO, BigDecimal::add) ) ); } @Getter @Setter @Column(allowsNull = "true") private CreationStrategy creationStrategyUsed; @Getter @Setter @Column(allowsNull = "false") private BigInteger sequence; @Programmatic public boolean isReported(){ for (AmortisationEntry entry : getEntries()){ if (entry.getDateReported()!=null) return true; } return false; } @Programmatic public AmortisationSchedule appendTextToNote(final String text){ if (getNote()==null || getNote().length()==0){ setNote(text); } else { setNote(getNote() + " | " + text); } return this; } @Override public ApplicationTenancy getApplicationTenancy() { return getLease().getApplicationTenancy(); } @Inject AmortisationScheduleService amortisationScheduleService; }
7,766
0.65027
0.649369
235
32.04681
23.335342
132
false
false
0
0
0
0
0
0
0.497872
false
false
7
2c85cd01e953aec80e3cb3527e253331f81bba92
21,053,929,700,225
5d1677aca4e218eb8dff2116d0af495d1c08c55a
/main/src/org/korsakow/ide/ui/components/code/CodeTableController.java
4a8b3c35f966d6536f46e43728deeac110cfcbb7
[]
no_license
korsakow/korsakow-editor
https://github.com/korsakow/korsakow-editor
f1cb66d221d26a1852330893b20f5f4a8c98fd94
9ecf14168a5e1c410a56a82a6eeb82515bc24a7f
refs/heads/master
2016-05-24T11:51:08.526000
2016-04-27T14:04:27
2016-04-27T14:04:27
10,722,674
2
4
null
false
2016-06-15T10:32:21
2013-06-16T16:44:38
2016-04-22T00:47:35
2016-06-15T10:32:21
52,101
6
9
4
Java
null
null
/** * */ package org.korsakow.ide.ui.components.code; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import org.korsakow.ide.code.k5.K5Code; public class CodeTableController implements TableModelListener { private final CodeTable table; private boolean isUpdate = false; public CodeTableController(CodeTable table) { this.table = table; table.addPropertyChangeListener("model", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { modelReplaced(); } }); modelReplaced(); } private void modelReplaced() { table.getModel().addTableModelListener(new TableModelRepaintListener()); // might not be necessary (should happen in L&F) table.getModel().addTableModelListener(new SorterListener()); } @Override public void tableChanged(TableModelEvent e) { if (isUpdate) return; isUpdate = true; if (e.getColumn() == CodeTableModel.CODE_COLUMN) ensureExactlyOneEmptyRow(); isUpdate = false; } private void ensureExactlyOneEmptyRow() { List<Integer> toRemove = new ArrayList<Integer>(); CodeTableModel model = table.getModel(); for (int i = 0; i < model.getRowCount(); ++i) { if (model.getCodeAt(i).getRawCode().trim().isEmpty()) { toRemove.add(i); } } model.removeRows(toRemove); model.addRow(null, new K5Code("")); } /** * Maintains the selection when the model is sorted * @author d * */ private class SorterListener implements CodeTableModelListener { public void tableChanged(TableModelEvent e) { // } public void tableSorted(TableModelSortEvent sortEvent) { // the order of rows has changed, but the selection model doesn't know about it // we get those rows which were previously selected by comparing the previousOrdering of rows // against the still out-of-date selection List<CodeRow> previousModelOrdering = sortEvent.getPreviousOrdering(); int[] selectedViewRows = table.getSelectedRows(); Collection<CodeRow> previousSelection = new HashSet<CodeRow>(); for (int row : selectedViewRows) { previousSelection.add(previousModelOrdering.get(table.convertRowIndexToView(row))); } if (previousSelection.isEmpty()) return; // and now update the selection model int viewIndex = table.getModel().indexOfRow(previousSelection.iterator().next()); table.getSelectionModel().setSelectionInterval(viewIndex, viewIndex); } } private class TableModelRepaintListener implements TableModelListener { public void tableChanged(TableModelEvent e) { table.repaint(); } } }
UTF-8
Java
2,794
java
CodeTableController.java
Java
[ { "context": "the selection when the model is sorted\n\t * @author d\n\t *\n\t */\n\tprivate class SorterListener implements", "end": 1640, "score": 0.9244096279144287, "start": 1639, "tag": "USERNAME", "value": "d" } ]
null
[]
/** * */ package org.korsakow.ide.ui.components.code; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import org.korsakow.ide.code.k5.K5Code; public class CodeTableController implements TableModelListener { private final CodeTable table; private boolean isUpdate = false; public CodeTableController(CodeTable table) { this.table = table; table.addPropertyChangeListener("model", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { modelReplaced(); } }); modelReplaced(); } private void modelReplaced() { table.getModel().addTableModelListener(new TableModelRepaintListener()); // might not be necessary (should happen in L&F) table.getModel().addTableModelListener(new SorterListener()); } @Override public void tableChanged(TableModelEvent e) { if (isUpdate) return; isUpdate = true; if (e.getColumn() == CodeTableModel.CODE_COLUMN) ensureExactlyOneEmptyRow(); isUpdate = false; } private void ensureExactlyOneEmptyRow() { List<Integer> toRemove = new ArrayList<Integer>(); CodeTableModel model = table.getModel(); for (int i = 0; i < model.getRowCount(); ++i) { if (model.getCodeAt(i).getRawCode().trim().isEmpty()) { toRemove.add(i); } } model.removeRows(toRemove); model.addRow(null, new K5Code("")); } /** * Maintains the selection when the model is sorted * @author d * */ private class SorterListener implements CodeTableModelListener { public void tableChanged(TableModelEvent e) { // } public void tableSorted(TableModelSortEvent sortEvent) { // the order of rows has changed, but the selection model doesn't know about it // we get those rows which were previously selected by comparing the previousOrdering of rows // against the still out-of-date selection List<CodeRow> previousModelOrdering = sortEvent.getPreviousOrdering(); int[] selectedViewRows = table.getSelectedRows(); Collection<CodeRow> previousSelection = new HashSet<CodeRow>(); for (int row : selectedViewRows) { previousSelection.add(previousModelOrdering.get(table.convertRowIndexToView(row))); } if (previousSelection.isEmpty()) return; // and now update the selection model int viewIndex = table.getModel().indexOfRow(previousSelection.iterator().next()); table.getSelectionModel().setSelectionInterval(viewIndex, viewIndex); } } private class TableModelRepaintListener implements TableModelListener { public void tableChanged(TableModelEvent e) { table.repaint(); } } }
2,794
0.73801
0.736578
98
27.510204
27.261486
126
false
false
0
0
0
0
0
0
1.959184
false
false
7
b6f89c4aa10c91f7769b692615d0c0563dfecbe6
25,357,486,964,622
5d79a80e2fc6dd0424423a6bf6a25f3d2bacacc2
/src/test/java/nl/hu/asd/securityscanner/spider/SpiderTest.java
4487cac4fe2c939ce78815d4233ef59ecb54af3f
[]
no_license
wesleydekraker/security-scanner
https://github.com/wesleydekraker/security-scanner
1c86712e23d12a8acde88aef2a4827000df654ed
19d7ef570d24672de90667b5f7b7145d01768d22
refs/heads/master
2021-04-12T07:51:40.150000
2018-03-22T18:56:32
2018-03-22T18:56:32
125,992,565
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nl.hu.asd.securityscanner.spider; import nl.hu.asd.securityscanner.httpclient.HttpClientStub; import org.junit.Test; import java.net.MalformedURLException; import static org.junit.Assert.assertEquals; public class SpiderTest { @Test public void testStart() throws MalformedURLException { Spider spider = new Spider(); spider.setHttpClient(new HttpClientStub()); spider.addSeed("http://example.com/index.html"); spider.startScan(); assertEquals(10, spider.getVisitedUrls().size()); } @Test public void testStartMaxDepth() throws MalformedURLException { Spider spider = new Spider(); spider.setHttpClient(new HttpClientStub()); spider.setMaxDepth(4); spider.addSeed("http://example.com/index.html"); spider.startScan(); assertEquals(9, spider.getVisitedUrls().size()); } @Test public void testStartMaxChildren() throws MalformedURLException { Spider spider = new Spider(); spider.setHttpClient(new HttpClientStub()); spider.setMaxChildren(1); spider.addSeed("http://example.com/index.html"); spider.startScan(); assertEquals(6, spider.getVisitedUrls().size()); } }
UTF-8
Java
1,252
java
SpiderTest.java
Java
[]
null
[]
package nl.hu.asd.securityscanner.spider; import nl.hu.asd.securityscanner.httpclient.HttpClientStub; import org.junit.Test; import java.net.MalformedURLException; import static org.junit.Assert.assertEquals; public class SpiderTest { @Test public void testStart() throws MalformedURLException { Spider spider = new Spider(); spider.setHttpClient(new HttpClientStub()); spider.addSeed("http://example.com/index.html"); spider.startScan(); assertEquals(10, spider.getVisitedUrls().size()); } @Test public void testStartMaxDepth() throws MalformedURLException { Spider spider = new Spider(); spider.setHttpClient(new HttpClientStub()); spider.setMaxDepth(4); spider.addSeed("http://example.com/index.html"); spider.startScan(); assertEquals(9, spider.getVisitedUrls().size()); } @Test public void testStartMaxChildren() throws MalformedURLException { Spider spider = new Spider(); spider.setHttpClient(new HttpClientStub()); spider.setMaxChildren(1); spider.addSeed("http://example.com/index.html"); spider.startScan(); assertEquals(6, spider.getVisitedUrls().size()); } }
1,252
0.672524
0.667732
43
28.11628
23.317036
69
false
false
0
0
0
0
0
0
0.581395
false
false
7
9b4cb89eaa5704ff4393a3485b28e0975361f4e0
19,662,360,325,480
4b52a527165f7534302935520a6f0ee323bc91af
/src/test/java/com/garethabrahams/repository/impl/ApplicantRepositoryImplTest.java
594615154941856e4007eda22cb038ca5ca46227
[]
no_license
GarethAbrahams/Student_recruitment
https://github.com/GarethAbrahams/Student_recruitment
4e5a4871646fdd1193bff2184a8ff93d46c51301
1f4f472fdc985b9526bd23e1d5b5b4a6ff5fd251
refs/heads/master
2020-05-07T15:20:10.914000
2019-10-02T11:37:56
2019-10-02T11:37:56
180,630,709
0
0
null
false
2019-10-02T11:37:59
2019-04-10T17:26:55
2019-09-17T22:14:52
2019-10-02T11:37:57
733
0
0
0
Java
false
false
package com.garethabrahams.repository.impl; import com.garethabrahams.factory.ApplicantFactory; import com.garethabrahams.model.Applicant; import com.garethabrahams.repository.ApplicantRepository; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import java.util.Set; import static org.junit.Assert.*; public class ApplicantRepositoryImplTest { private static ApplicantRepository repository; private static Applicant applicant; private String applicantID; @Before @Test public void create() { repository = ApplicantRepositoryImpl.getRepository(); applicant = ApplicantFactory.createApplicant("Gareth","Abrahams","1234567890"); applicantID = applicant.getApplicantID(); Applicant result = repository.create(applicant); Assert.assertEquals(applicantID,result.getApplicantID()); } @Test public void read() { Applicant result = repository.read(applicantID); Assert.assertEquals(applicantID,result.getApplicantID()); } @Test public void update() { Applicant result = repository.read(applicantID); String last = "Schipper"; Applicant update = new Applicant.Builder().copy(result).surname(last).build(); Applicant newResult = repository.update(update); Assert.assertEquals(applicantID,newResult.getApplicantID()); Assert.assertEquals(last,newResult.getSurname()); } @Test public void delete() { Applicant result = repository.read(applicantID); repository.delete(applicantID); Applicant newResult = repository.read(applicantID); Assert.assertNull(newResult); } @Test public void getAll() { Set<Applicant> result = repository.getAll(); Assert.assertNotNull(result); } }
UTF-8
Java
1,856
java
ApplicantRepositoryImplTest.java
Java
[ { "context": " applicant = ApplicantFactory.createApplicant(\"Gareth\",\"Abrahams\",\"1234567890\");\n applicantID = ", "end": 700, "score": 0.9998459219932556, "start": 694, "tag": "NAME", "value": "Gareth" }, { "context": "cant = ApplicantFactory.createApplicant(\"Gareth\",\"Abrahams\",\"1234567890\");\n applicantID = applicant.g", "end": 711, "score": 0.9997183084487915, "start": 703, "tag": "NAME", "value": "Abrahams" }, { "context": "ository.read(applicantID);\n String last = \"Schipper\";\n Applicant update = new Applicant.Builde", "end": 1199, "score": 0.9912805557250977, "start": 1191, "tag": "NAME", "value": "Schipper" } ]
null
[]
package com.garethabrahams.repository.impl; import com.garethabrahams.factory.ApplicantFactory; import com.garethabrahams.model.Applicant; import com.garethabrahams.repository.ApplicantRepository; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import java.util.Set; import static org.junit.Assert.*; public class ApplicantRepositoryImplTest { private static ApplicantRepository repository; private static Applicant applicant; private String applicantID; @Before @Test public void create() { repository = ApplicantRepositoryImpl.getRepository(); applicant = ApplicantFactory.createApplicant("Gareth","Abrahams","1234567890"); applicantID = applicant.getApplicantID(); Applicant result = repository.create(applicant); Assert.assertEquals(applicantID,result.getApplicantID()); } @Test public void read() { Applicant result = repository.read(applicantID); Assert.assertEquals(applicantID,result.getApplicantID()); } @Test public void update() { Applicant result = repository.read(applicantID); String last = "Schipper"; Applicant update = new Applicant.Builder().copy(result).surname(last).build(); Applicant newResult = repository.update(update); Assert.assertEquals(applicantID,newResult.getApplicantID()); Assert.assertEquals(last,newResult.getSurname()); } @Test public void delete() { Applicant result = repository.read(applicantID); repository.delete(applicantID); Applicant newResult = repository.read(applicantID); Assert.assertNull(newResult); } @Test public void getAll() { Set<Applicant> result = repository.getAll(); Assert.assertNotNull(result); } }
1,856
0.703125
0.697737
64
28.015625
24.539186
87
false
false
0
0
0
0
0
0
0.59375
false
false
7
893e26ef4b1e6d6d54dd2b33266407816d51df17
28,329,604,339,992
d3e15905e57889baca0748812e4e08a2946b5a4e
/app/src/main/java/edu/byu/cs/superasteroids/model/level/Background.java
613aac61ab387d46e48c4cc36f83711a1a52582d
[]
no_license
jmango22/SuperAsteroids
https://github.com/jmango22/SuperAsteroids
86fdb4d040d02133c82cb2dbfd9318e21990b124
b339e7e36cb1bd32d83cb7927542382a6904866a
refs/heads/master
2021-03-27T15:34:15.890000
2016-11-04T01:00:29
2016-11-04T01:00:29
71,586,805
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.byu.cs.superasteroids.model.level; import edu.byu.cs.superasteroids.content.ContentManager; import edu.byu.cs.superasteroids.drawing.DrawingHelper; /** * Created by jmeng2 on 10/31/16. */ public class Background { String image; int imageId; public Background() { image = "images/space.bmp"; } public void loadImage(ContentManager content) { imageId = content.loadImage(image); } public void unloadImage(ContentManager content) { content.unloadImage(imageId); } public void draw() { DrawingHelper.drawImage(imageId, ViewPort.getSrc(imageId), ViewPort.getDest()); } }
UTF-8
Java
659
java
Background.java
Java
[ { "context": "steroids.drawing.DrawingHelper;\n\n/**\n * Created by jmeng2 on 10/31/16.\n */\npublic class Background {\n St", "end": 186, "score": 0.9996493458747864, "start": 180, "tag": "USERNAME", "value": "jmeng2" } ]
null
[]
package edu.byu.cs.superasteroids.model.level; import edu.byu.cs.superasteroids.content.ContentManager; import edu.byu.cs.superasteroids.drawing.DrawingHelper; /** * Created by jmeng2 on 10/31/16. */ public class Background { String image; int imageId; public Background() { image = "images/space.bmp"; } public void loadImage(ContentManager content) { imageId = content.loadImage(image); } public void unloadImage(ContentManager content) { content.unloadImage(imageId); } public void draw() { DrawingHelper.drawImage(imageId, ViewPort.getSrc(imageId), ViewPort.getDest()); } }
659
0.682853
0.672231
29
21.724138
23.187239
87
false
false
0
0
0
0
0
0
0.37931
false
false
7
ce5e762200ddc8417785588269591e25444d2bb2
19,816,979,146,178
cdf7570dcc0dc21690ae758fbb62a77fa09a09da
/java/设计模式/02_单例模式的多种实现/懒汉/LazySingletonThreadSecure.java
491b62d4aca39ba211880447c95e10ca36434a7c
[]
no_license
chaochao214/javaInterview
https://github.com/chaochao214/javaInterview
7dc3a9a1d1bceb8f6253fd201cdc0d28cc09ea2b
708d379fec76dd3ad8b2d90a80ea7471a3323210
refs/heads/master
2021-07-22T04:47:02.597000
2020-06-17T06:35:14
2020-06-17T06:35:14
223,208,028
4
1
null
false
2020-10-13T20:20:17
2019-11-21T15:43:11
2020-06-17T06:35:40
2020-10-13T20:20:16
47,866
4
1
1
Java
false
false
package 单例模式.懒汉; //支持多线程,也具备懒加载(需要的时候再创建),但是效率很低,99%的情况下不需要同步 public class LazySingletonThreadSecure { private static LazySingletonThreadSecure instance; private LazySingletonThreadSecure(){ } public static synchronized LazySingletonThreadSecure getInstance(){ if (instance == null){ instance = new LazySingletonThreadSecure(); } return instance; } }
UTF-8
Java
497
java
LazySingletonThreadSecure.java
Java
[]
null
[]
package 单例模式.懒汉; //支持多线程,也具备懒加载(需要的时候再创建),但是效率很低,99%的情况下不需要同步 public class LazySingletonThreadSecure { private static LazySingletonThreadSecure instance; private LazySingletonThreadSecure(){ } public static synchronized LazySingletonThreadSecure getInstance(){ if (instance == null){ instance = new LazySingletonThreadSecure(); } return instance; } }
497
0.70516
0.700246
13
30.307692
21.556311
71
false
false
0
0
0
0
0
0
0.307692
false
false
7
cdb2a28c252a38c5efe2329d7f2bf4a9fa556a3f
11,862,699,675,356
0ac258d736d38dfe61f374a0b402cfd5d389c637
/src/main/java/com/yingxy/sys/org/service/impl/OrgServiceImpl.java
b18df875cddfcea02c813e45b452f7f019c28316
[]
no_license
YoYing/sys
https://github.com/YoYing/sys
2efd0e77b3ecbe846fd74f7102d55696cef483b2
8ee3bb95edae2b8e77877c7182976db20ac1d8b3
refs/heads/master
2021-01-10T14:36:14.663000
2015-12-06T15:53:10
2015-12-06T15:53:10
45,829,728
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yingxy.sys.org.service.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.inject.Inject; import org.springframework.stereotype.Service; import com.yingxy.sys.base.tools.SystemConstants; import com.yingxy.sys.org.dao.OrgDao; import com.yingxy.sys.org.dao.OrgRuleDao; import com.yingxy.sys.org.dao.OrgTypeRuleDao; import com.yingxy.sys.org.dto.TreeDTO; import com.yingxy.sys.org.model.Org; import com.yingxy.sys.org.model.OrgRule; import com.yingxy.sys.org.service.OrgService; import com.yingxy.sys.utils.SysException; import com.yingxy.sys.utils.SysUtils; @Service("orgService") public class OrgServiceImpl extends BaseServiceImpl<Org> implements OrgService { @Inject private OrgDao orgDao; @Inject private OrgTypeRuleDao orgTypeRuleDao; @Inject private OrgRuleDao orgRuleDao; @Override public Org add(Org childOrg) { // parent ORG 存在 Org parentOrg = childOrg.getParentOrg(); int orderNum = 0; if (parentOrg == null) { orderNum = orgDao.getMaxOrderNum(null); } else { orderNum = orgDao.getMaxOrderNum(parentOrg.getId()); } checkLTMaxNum(childOrg, parentOrg); childOrg.setOrderNum(orderNum); return super.add(childOrg); } @Override public void add(Org childOrg, Integer parentOrgId) { if (parentOrgId != null && parentOrgId != 0) { Org parentOrg = orgDao.load(parentOrgId); if (parentOrg != null) { checkLTMaxNum(childOrg, parentOrg); } } int orderNum = orgDao.getMaxOrderNum(parentOrgId); childOrg.setOrderNum(orderNum); orgDao.add(childOrg); } @Override public List<Integer> listAllChildrenByOrgId(Integer orgId) { List<Org> orgs = orgDao.list(); Org org = orgDao.load(orgId); int managerType = org.getManagerType(); List<Integer> childListIds = null; switch (managerType) { case SystemConstants.DEFAULT_MANAGER_TYPE: childListIds = org2IdList(getChildOrgByDefault(orgId, orgs)); break; case SystemConstants.NONE_MANAGER_TYPE: childListIds = new ArrayList<Integer>(); break; case SystemConstants.ALL_MANAGER_TYPE: childListIds = orgDao.listAllIds(); break; case SystemConstants.DEFINE_MANAGER_TYPE: childListIds = org2IdList(getDefinedChildOrgIds(orgId, orgs)); break; default: break; } return childListIds; } @Override public List<Org> listAllOrgsByPersonId(Integer orgId) { List<Org> orgs = orgDao.list(); Org org = orgDao.load(orgId); int managerType = org.getManagerType(); List<Org> childList = null; switch (managerType) { case SystemConstants.DEFAULT_MANAGER_TYPE: childList = getChildOrgByDefault(orgId, orgs); break; case SystemConstants.NONE_MANAGER_TYPE: childList = new ArrayList<Org>(); break; case SystemConstants.ALL_MANAGER_TYPE: childList = orgDao.list(); break; case SystemConstants.DEFINE_MANAGER_TYPE: childList = getDefinedChildOrgIds(orgId, orgs); break; default: break; } return childList; } @Override public List<TreeDTO> generateChildTreeByOrgId(Integer orgId) { List<Org> orgs = this.listAllOrgsByPersonId(orgId); orgs.add(orgDao.load(orgId)); TreeDTO dto = null; List<TreeDTO> treeList = new ArrayList<TreeDTO>(); for (Org org : orgs) { dto = new TreeDTO(); dto.setId(org.getId()); dto.setName(org.getOrgName()); Org parentOrg = org.getParentOrg(); if (parentOrg == null) { dto.setParentId(-1); } else { dto.setParentId(parentOrg.getId()); } treeList.add(dto); } return treeList; } /** * 得到自定义管理类型下的所有id * @param orgId * @return */ private List<Org> getDefinedChildOrgIds(Integer orgId, List<Org> orgs) { OrgRule orgRule = orgRuleDao.getByOrgId(orgId); String managerOrgs = orgRule.getManagerOrgs(); List<Integer> orgIds = SysUtils.string2List(managerOrgs, ","); List<Org> childIdList = new ArrayList<Org>(); for (Integer id : orgIds) { childIdList.add(orgDao.load(id)); childIdList.addAll(this.getChildOrgByDefault(id, orgs)); } return childIdList; } /** * 使用递归可能会反复查询数据库。 * 直线型管理 org.managerType = 0 * @param orgId * @return */ private List<Org> getChildOrgByDefault(Integer orgId, List<Org> orgs) { // 确保第一个就是根节点,有更好的办法可以使用 Map<Integer, List<Org>> treeMap = this.generateTreeMap(orgs); List<Org> treeOrgs = new ArrayList<Org>(); generateTreeList(orgId, treeMap, treeOrgs); return treeOrgs; } private List<Integer> org2IdList(List<Org> orgs) { List<Integer> childOrgIds = new ArrayList<Integer>(); for (Org org : orgs) { childOrgIds.add(org.getId()); } return childOrgIds; } private void generateTreeList(Integer orgId, Map<Integer, List<Org>> treeMap, List<Org> treeOrgs) { if (treeMap.containsKey(orgId)) { List<Org> childList = treeMap.get(orgId); for (Org org : childList) { treeOrgs.add(org); generateTreeList(org.getId(), treeMap, treeOrgs); } } else { return; } } private Map<Integer, List<Org>> generateTreeMap(List<Org> orgs) { Map<Integer, List<Org>> treeMap = new HashMap<Integer, List<Org>>(); List<Org> childTreeList = null; for (Org org : orgs) { Org parentOrg = org.getParentOrg(); // 根节点(包含其本身) if (parentOrg == null) { childTreeList = new ArrayList<Org>(); treeMap.put(org.getId(), childTreeList); } else { // 判断 if (treeMap.containsKey(parentOrg.getId())) { treeMap.get(parentOrg.getId()).add(org); } else { childTreeList = new ArrayList<Org>(); childTreeList.add(org); treeMap.put(parentOrg.getId(), childTreeList); } } } return treeMap; } private void checkLTMaxNum(Org childOrg, Org parentOrg) { if (parentOrg == null) { return; } // check exist count int existNum = orgDao.getExistNumByTypeId(parentOrg.getId(), childOrg.getTypeId()); // check specified count int specNum = orgTypeRuleDao.getRuleNum(parentOrg.getTypeId(), childOrg.getTypeId()); if (existNum < specNum) { // 可添加 childOrg.setParentOrg(parentOrg); } else { throw new SysException(parentOrg.getOrgName() + " 下的 " + childOrg.getOrgName() + " 的数量达到最大"); } } }
UTF-8
Java
6,498
java
OrgServiceImpl.java
Java
[]
null
[]
package com.yingxy.sys.org.service.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.inject.Inject; import org.springframework.stereotype.Service; import com.yingxy.sys.base.tools.SystemConstants; import com.yingxy.sys.org.dao.OrgDao; import com.yingxy.sys.org.dao.OrgRuleDao; import com.yingxy.sys.org.dao.OrgTypeRuleDao; import com.yingxy.sys.org.dto.TreeDTO; import com.yingxy.sys.org.model.Org; import com.yingxy.sys.org.model.OrgRule; import com.yingxy.sys.org.service.OrgService; import com.yingxy.sys.utils.SysException; import com.yingxy.sys.utils.SysUtils; @Service("orgService") public class OrgServiceImpl extends BaseServiceImpl<Org> implements OrgService { @Inject private OrgDao orgDao; @Inject private OrgTypeRuleDao orgTypeRuleDao; @Inject private OrgRuleDao orgRuleDao; @Override public Org add(Org childOrg) { // parent ORG 存在 Org parentOrg = childOrg.getParentOrg(); int orderNum = 0; if (parentOrg == null) { orderNum = orgDao.getMaxOrderNum(null); } else { orderNum = orgDao.getMaxOrderNum(parentOrg.getId()); } checkLTMaxNum(childOrg, parentOrg); childOrg.setOrderNum(orderNum); return super.add(childOrg); } @Override public void add(Org childOrg, Integer parentOrgId) { if (parentOrgId != null && parentOrgId != 0) { Org parentOrg = orgDao.load(parentOrgId); if (parentOrg != null) { checkLTMaxNum(childOrg, parentOrg); } } int orderNum = orgDao.getMaxOrderNum(parentOrgId); childOrg.setOrderNum(orderNum); orgDao.add(childOrg); } @Override public List<Integer> listAllChildrenByOrgId(Integer orgId) { List<Org> orgs = orgDao.list(); Org org = orgDao.load(orgId); int managerType = org.getManagerType(); List<Integer> childListIds = null; switch (managerType) { case SystemConstants.DEFAULT_MANAGER_TYPE: childListIds = org2IdList(getChildOrgByDefault(orgId, orgs)); break; case SystemConstants.NONE_MANAGER_TYPE: childListIds = new ArrayList<Integer>(); break; case SystemConstants.ALL_MANAGER_TYPE: childListIds = orgDao.listAllIds(); break; case SystemConstants.DEFINE_MANAGER_TYPE: childListIds = org2IdList(getDefinedChildOrgIds(orgId, orgs)); break; default: break; } return childListIds; } @Override public List<Org> listAllOrgsByPersonId(Integer orgId) { List<Org> orgs = orgDao.list(); Org org = orgDao.load(orgId); int managerType = org.getManagerType(); List<Org> childList = null; switch (managerType) { case SystemConstants.DEFAULT_MANAGER_TYPE: childList = getChildOrgByDefault(orgId, orgs); break; case SystemConstants.NONE_MANAGER_TYPE: childList = new ArrayList<Org>(); break; case SystemConstants.ALL_MANAGER_TYPE: childList = orgDao.list(); break; case SystemConstants.DEFINE_MANAGER_TYPE: childList = getDefinedChildOrgIds(orgId, orgs); break; default: break; } return childList; } @Override public List<TreeDTO> generateChildTreeByOrgId(Integer orgId) { List<Org> orgs = this.listAllOrgsByPersonId(orgId); orgs.add(orgDao.load(orgId)); TreeDTO dto = null; List<TreeDTO> treeList = new ArrayList<TreeDTO>(); for (Org org : orgs) { dto = new TreeDTO(); dto.setId(org.getId()); dto.setName(org.getOrgName()); Org parentOrg = org.getParentOrg(); if (parentOrg == null) { dto.setParentId(-1); } else { dto.setParentId(parentOrg.getId()); } treeList.add(dto); } return treeList; } /** * 得到自定义管理类型下的所有id * @param orgId * @return */ private List<Org> getDefinedChildOrgIds(Integer orgId, List<Org> orgs) { OrgRule orgRule = orgRuleDao.getByOrgId(orgId); String managerOrgs = orgRule.getManagerOrgs(); List<Integer> orgIds = SysUtils.string2List(managerOrgs, ","); List<Org> childIdList = new ArrayList<Org>(); for (Integer id : orgIds) { childIdList.add(orgDao.load(id)); childIdList.addAll(this.getChildOrgByDefault(id, orgs)); } return childIdList; } /** * 使用递归可能会反复查询数据库。 * 直线型管理 org.managerType = 0 * @param orgId * @return */ private List<Org> getChildOrgByDefault(Integer orgId, List<Org> orgs) { // 确保第一个就是根节点,有更好的办法可以使用 Map<Integer, List<Org>> treeMap = this.generateTreeMap(orgs); List<Org> treeOrgs = new ArrayList<Org>(); generateTreeList(orgId, treeMap, treeOrgs); return treeOrgs; } private List<Integer> org2IdList(List<Org> orgs) { List<Integer> childOrgIds = new ArrayList<Integer>(); for (Org org : orgs) { childOrgIds.add(org.getId()); } return childOrgIds; } private void generateTreeList(Integer orgId, Map<Integer, List<Org>> treeMap, List<Org> treeOrgs) { if (treeMap.containsKey(orgId)) { List<Org> childList = treeMap.get(orgId); for (Org org : childList) { treeOrgs.add(org); generateTreeList(org.getId(), treeMap, treeOrgs); } } else { return; } } private Map<Integer, List<Org>> generateTreeMap(List<Org> orgs) { Map<Integer, List<Org>> treeMap = new HashMap<Integer, List<Org>>(); List<Org> childTreeList = null; for (Org org : orgs) { Org parentOrg = org.getParentOrg(); // 根节点(包含其本身) if (parentOrg == null) { childTreeList = new ArrayList<Org>(); treeMap.put(org.getId(), childTreeList); } else { // 判断 if (treeMap.containsKey(parentOrg.getId())) { treeMap.get(parentOrg.getId()).add(org); } else { childTreeList = new ArrayList<Org>(); childTreeList.add(org); treeMap.put(parentOrg.getId(), childTreeList); } } } return treeMap; } private void checkLTMaxNum(Org childOrg, Org parentOrg) { if (parentOrg == null) { return; } // check exist count int existNum = orgDao.getExistNumByTypeId(parentOrg.getId(), childOrg.getTypeId()); // check specified count int specNum = orgTypeRuleDao.getRuleNum(parentOrg.getTypeId(), childOrg.getTypeId()); if (existNum < specNum) { // 可添加 childOrg.setParentOrg(parentOrg); } else { throw new SysException(parentOrg.getOrgName() + " 下的 " + childOrg.getOrgName() + " 的数量达到最大"); } } }
6,498
0.676127
0.674866
228
25.81579
20.888411
97
false
false
0
0
0
0
0
0
2.451754
false
false
7
b6797dbdd922419992b4ecbc61014ac03bec30e5
26,328,149,580,410
0765c22aa4e4626360e1a08b7231d4a01105b662
/src/main/java/com/fh/service/ShopService.java
fde071b0e86e923e7f65c1d930ec6f9f2e8f036d
[]
no_license
lik12123/springBoot
https://github.com/lik12123/springBoot
59a22c2cf4d22838faa6b8c17a59d0b40b5e875a
df4319b55db37bce07a8ae815b9e1c5796fcbc9f
refs/heads/master
2022-11-29T17:23:35.589000
2020-08-05T12:53:35
2020-08-05T12:53:35
285,287,414
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fh.service; import com.fh.entity.Shop; import java.util.List; public interface ShopService { //热销商品 List<Shop> queryShopBySales(); List<Shop> queryShopList(); }
UTF-8
Java
199
java
ShopService.java
Java
[]
null
[]
package com.fh.service; import com.fh.entity.Shop; import java.util.List; public interface ShopService { //热销商品 List<Shop> queryShopBySales(); List<Shop> queryShopList(); }
199
0.696335
0.696335
13
13.692307
13.674146
34
false
false
0
0
0
0
0
0
0.384615
false
false
7
20cd2816327266bebe763e7fc7d98ae73a9b9eb7
1,168,231,134,428
1b7503291a78521d9d98422319747db791c1bd34
/Observer/com/andy/jdk/observer/Test.java
7fb4f3bc4fd37fce8ad020ce8f75fb16b1bdfaa4
[]
no_license
lrh198681/pattern
https://github.com/lrh198681/pattern
a72e9e8794b68b81df43f8f1c4e1d35cf8031e6d
54ac251dbb67d38b0a0269de78706063288c58bf
refs/heads/master
2016-09-05T18:12:30.892000
2014-12-03T07:27:00
2014-12-03T07:27:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.andy.jdk.observer; import java.util.Observable; import java.util.Observer; public class Test { public static void main(String[] args) { ConcreteSubject subject = new ConcreteSubject(); Observer observer1 = new ConcreteObserver(subject); Observer observer2 = new ConcreteObserver(subject); subject.addObserver(observer1); subject.addObserver(observer2); subject.setData("新状态"); } }
UTF-8
Java
448
java
Test.java
Java
[]
null
[]
package com.andy.jdk.observer; import java.util.Observable; import java.util.Observer; public class Test { public static void main(String[] args) { ConcreteSubject subject = new ConcreteSubject(); Observer observer1 = new ConcreteObserver(subject); Observer observer2 = new ConcreteObserver(subject); subject.addObserver(observer1); subject.addObserver(observer2); subject.setData("新状态"); } }
448
0.708145
0.699095
21
19.047619
19.174578
53
false
false
0
0
0
0
0
0
1.380952
false
false
7
55752e69e9e39bed2d94ad8338279ee19a8d225f
11,063,835,825,165
33581ab94e24aeb0c52f85dcb4e36cb484f0608a
/app/src/main/java/com/example/formulario/Empresa.java
7b53529d670dcc63e73b8c1f3eaae485175311a5
[]
no_license
Cgolem/Formulario
https://github.com/Cgolem/Formulario
e07ace5657d13d2f8874951ac3584dde3450e904
fa64fc7d342739bc61a4ee5fae7a74d7ebf38588
refs/heads/master
2020-04-20T19:06:59.940000
2019-02-04T18:22:27
2019-02-04T18:22:27
169,040,354
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.formulario; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import androidx.annotation.NonNull; import androidx.annotation.Nullable; public class Empresa extends AppCompatActivity { ListView listaEmpresas; ArrayList<ClaseEmpresa> datos; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_empresa); listaEmpresas = (ListView) findViewById(R.id.listaEmpresas); datos = new ArrayList<>(); datos.add(new ClaseEmpresa(1,"Stefanini", "Consultora")); datos.add(new ClaseEmpresa(2,"Walmart", "Super mercado")); datos.add(new ClaseEmpresa(3,"Soriana", "Super mercado")); datos.add(new ClaseEmpresa(4,"Albo", "Fintech")); datos.add(new ClaseEmpresa(5,"Praxis", "Consultora")); ArrayAdapter<ClaseEmpresa> adaptador = new ArrayAdapter<ClaseEmpresa>(getApplicationContext(), R.layout.listviewpropio, datos) { @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View vista = super.getView(position, convertView, parent); TextView titulo = (TextView) vista.findViewById(R.id.txtTituloEmpresas); TextView detalle = (TextView) vista.findViewById(R.id.txtDetalleEmpresa); titulo.setText(datos.get(position).getTitulo()); detalle.setText(datos.get(position).getDetalle()); titulo.setTextColor(Color.BLACK); detalle.setTextColor(Color.GREEN); return vista; } }; listaEmpresas.setAdapter(adaptador); listaEmpresas.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ClaseEmpresa retorno = datos.get(position); Intent retornaPais = getIntent(); retornaPais.putExtra("retorno", retorno); setResult(RESULT_OK, retornaPais); finish(); } }); } }
UTF-8
Java
2,529
java
Empresa.java
Java
[]
null
[]
package com.example.formulario; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import androidx.annotation.NonNull; import androidx.annotation.Nullable; public class Empresa extends AppCompatActivity { ListView listaEmpresas; ArrayList<ClaseEmpresa> datos; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_empresa); listaEmpresas = (ListView) findViewById(R.id.listaEmpresas); datos = new ArrayList<>(); datos.add(new ClaseEmpresa(1,"Stefanini", "Consultora")); datos.add(new ClaseEmpresa(2,"Walmart", "Super mercado")); datos.add(new ClaseEmpresa(3,"Soriana", "Super mercado")); datos.add(new ClaseEmpresa(4,"Albo", "Fintech")); datos.add(new ClaseEmpresa(5,"Praxis", "Consultora")); ArrayAdapter<ClaseEmpresa> adaptador = new ArrayAdapter<ClaseEmpresa>(getApplicationContext(), R.layout.listviewpropio, datos) { @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View vista = super.getView(position, convertView, parent); TextView titulo = (TextView) vista.findViewById(R.id.txtTituloEmpresas); TextView detalle = (TextView) vista.findViewById(R.id.txtDetalleEmpresa); titulo.setText(datos.get(position).getTitulo()); detalle.setText(datos.get(position).getDetalle()); titulo.setTextColor(Color.BLACK); detalle.setTextColor(Color.GREEN); return vista; } }; listaEmpresas.setAdapter(adaptador); listaEmpresas.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ClaseEmpresa retorno = datos.get(position); Intent retornaPais = getIntent(); retornaPais.putExtra("retorno", retorno); setResult(RESULT_OK, retornaPais); finish(); } }); } }
2,529
0.661922
0.659549
68
36.191177
29.590467
136
false
false
0
0
0
0
0
0
0.911765
false
false
7
6ee12829c92c26e753d799bef242cf9e4b2759cc
11,072,425,689,109
af2a291a7a95d95528cbdb0719246ebb61b40ef5
/src/main/java/com/onepagecrm/models/User.java
ba8a3ac0bfde5d7c17cba39a8f22f97524b8488f
[]
no_license
OnePageCRM/java-wrapper
https://github.com/OnePageCRM/java-wrapper
53d8bcb28df42b1c66454aced49e1250ef3f5e32
85a0eaed2e3fff2fa906b026439ab559a0c36aee
refs/heads/master
2022-09-18T14:37:38.920000
2022-08-31T17:41:49
2022-08-31T17:41:49
39,438,439
2
2
null
false
2022-08-31T17:41:50
2015-07-21T10:09:22
2021-10-18T11:22:23
2022-08-31T17:41:49
15,601
0
1
0
Java
false
false
package com.onepagecrm.models; import com.onepagecrm.exceptions.OnePageException; import com.onepagecrm.models.internal.Paginator; import com.onepagecrm.models.internal.PredefinedActionList; import com.onepagecrm.models.serializers.BaseSerializer; import com.onepagecrm.models.serializers.CompanyListSerializer; import com.onepagecrm.models.serializers.ContactListSerializer; import com.onepagecrm.models.serializers.DealListSerializer; import com.onepagecrm.models.serializers.UserSerializer; import com.onepagecrm.net.API; import com.onepagecrm.net.ApiResource; import com.onepagecrm.net.Response; import com.onepagecrm.net.request.GetRequest; import com.onepagecrm.net.request.Request; import java.io.Serializable; import java.util.List; import java.util.Map; /** * Created by Cillian Myles on 08/01/2019. * Copyright (c) 2019 OnePageCRM. All rights reserved. */ @SuppressWarnings({"WeakerAccess", "UnusedReturnValue", "unused"}) public class User extends ApiResource implements Serializable { private static final long serialVersionUID = 1383622287570201668L; /* * Member variables. */ public Account account; private String id; private String authKey; private String accountType; private String bccEmail; private String companyName; private String email; private String firstName; private String lastName; private String photoUrl; private String countryCode; private boolean newUser; private Integer allCount; private Integer streamCount; private Integer contactsCount; private List<String> accountRights; /* Auth-related API methods */ public StartupData startup() throws OnePageException { return API.Auth.startup(); } @Deprecated public static User googleLogin(String oauth2Code) throws OnePageException { return API.GoogleOld.login(oauth2Code); } @Deprecated public static User googleSignup(String oauth2Code) throws OnePageException { return API.GoogleOld.signup(oauth2Code); } public User bootstrap() throws OnePageException { return API.Auth.bootstrap(); } /* Other API methods (TO BE MOVED OUT to API.Namespace eventually) */ public ContactList actionStream() throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.queryDefault()); } public ContactList actionStream(Paginator paginator) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.query(paginator)); } public ContactList actionStream(Map<String, Object> params) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.fromParams(params)); } public ContactList actionStream(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getContacts(ACTION_STREAM_ENDPOINT, query); } public ContactList searchActionStream(String search) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.querySearch(search)); } public ContactList searchActionStream(Paginator paginator, String search) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.querySearch(paginator, search)); } public ContactList actionStreamByLetter(String letter) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.queryLetter(letter)); } public ContactList actionStreamByLetter(Paginator paginator, String letter) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.queryLetter(paginator, letter)); } public ContactList contacts() throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.query(true)); } public ContactList contacts(Paginator paginator) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.query(paginator, true)); } public ContactList contacts(Map<String, Object> params) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.fromParams(params)); } public ContactList contacts(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getContacts(CONTACTS_ENDPOINT, query); } public ContactList searchContacts(String search) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.querySearch(search, true)); } public ContactList searchContacts(Paginator paginator, String search) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.querySearch(paginator, search, true)); } public ContactList contactsByCompany(String companyId) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryCompany(companyId)); } public ContactList contactsByCompany(Paginator paginator, String companyId) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryCompany(paginator, companyId)); } public ContactList contactsByLetter(String letter) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryLetter(letter, true)); } public ContactList contactsByLetter(Paginator paginator, String letter) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryLetter(paginator, letter, true)); } public ContactList teamStream(Map<String, Object> params) throws OnePageException { return getContacts(TEAM_STREAM_ENDPOINT, Query.fromParams(params)); } public ContactList teamStream(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getContacts(TEAM_STREAM_ENDPOINT, query); } public DealList pipeline() throws OnePageException { Request request = new GetRequest(DEALS_ENDPOINT, Query.query(true)); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } public DealList pipeline(Paginator paginator) throws OnePageException { Request request = new GetRequest(DEALS_ENDPOINT, Query.query(paginator, true)); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } public DealList pipeline(Map<String, Object> params) throws OnePageException { Request request = new GetRequest(DEALS_ENDPOINT, Query.fromParams(params)); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } public DealList pipeline(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); Request request = new GetRequest(DEALS_ENDPOINT, query); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } private ContactList getContacts(final String endpoint, String query) throws OnePageException { query += "&" + Contact.EXTRA_FIELDS; Request request = new GetRequest(endpoint, query); Response response = request.send(); return ContactListSerializer.fromString(response.getResponseBody()); } public CompanyList companies() throws OnePageException { return getCompanies(Query.queryDefault()); } public CompanyList companies(Paginator paginator) throws OnePageException { return getCompanies(Query.query(paginator)); } public CompanyList companies(Map<String, Object> params) throws OnePageException { return getCompanies(Query.fromParams(params)); } public CompanyList companies(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getCompanies(query); } private CompanyList getCompanies(String query) throws OnePageException { Request request = new GetRequest(COMPANIES_ENDPOINT, query); Response response = request.send(); return CompanyListSerializer.fromString(response.getResponseBody()); } public ActionList actions(Paginator paginator) throws OnePageException { return Action.list(this.id, paginator); } public ActionList actions() throws OnePageException { return Action.list(this.id); } public PredefinedActionList actionsPredefined(Paginator paginator) throws OnePageException { return Action.listPredefined(paginator); } public PredefinedActionList actionsPredefined() throws OnePageException { return Action.listPredefined(); } /* * Utility methods. */ public String getSimpleName() { if (lastName != null && !lastName.equals("")) { if (firstName != null && !firstName.equals("")) { return firstName + " " + lastName.substring(0, 1) + "."; } else { return lastName; } } return null; } public String getFullName() { if (lastName != null && !lastName.equals("")) { if (firstName != null && !firstName.equals("")) { return firstName + " " + lastName; } else { return lastName; } } return null; } public String getFullAlphaName() { if (lastName != null && !lastName.equals("")) { if (firstName != null && !firstName.equals("")) { return lastName + ", " + firstName; } else { return lastName; } } return null; } public boolean hasRight(String right) { return isAdmin() || isOwner() || accountRights != null && accountRights.contains(right); } public boolean isAdmin() { return accountRights != null && accountRights.contains(BaseSerializer.ACCOUNT_OWNER_TAG); } public boolean isOwner() { return accountRights != null && accountRights.contains(BaseSerializer.ADMIN_TAG); } /* * Object methods. */ @Override public String toString() { return UserSerializer.toJsonObject(this); } @Override public boolean equals(Object object) { boolean idsEqual = super.equals(object); boolean authKeysEqual = false; if (object instanceof User) { User toCompare = (User) object; if (this.authKey == null && toCompare.authKey == null) { authKeysEqual = true; } else if (this.authKey != null && toCompare.authKey != null) { authKeysEqual = this.authKey.equals(toCompare.authKey); } } return idsEqual && authKeysEqual; } @Override public boolean isValid() { boolean idValid = super.isValid(); boolean authKeyValid = this.authKey != null && !this.authKey.equals(""); return idValid && authKeyValid; } @Override public String getId() { return this.id; } @Override public User setId(String id) { this.id = id; return this; } public String getAuthKey() { return authKey; } public User setAuthKey(String authKey) { this.authKey = authKey; return this; } public String getAccountType() { return accountType; } public User setAccountType(String accountType) { this.accountType = accountType; return this; } public String getBccEmail() { return bccEmail; } public User setBccEmail(String bccEmail) { this.bccEmail = bccEmail; return this; } public String getCompanyName() { return companyName; } public User setCompanyName(String companyName) { this.companyName = companyName; return this; } public String getEmail() { return email; } public User setEmail(String email) { this.email = email; return this; } public String getFirstName() { return firstName; } public User setFirstName(String firstName) { this.firstName = firstName; return this; } public String getLastName() { return lastName; } public User setLastName(String lastName) { this.lastName = lastName; return this; } public String getPhotoUrl() { return photoUrl; } public User setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; return this; } public Account getAccount() { return account; } public User setAccount(Account account) { this.account = account; return this; } public Integer getAllCount() { return allCount; } public User setAllCount(Integer allCount) { this.allCount = allCount; return this; } public Integer getStreamCount() { return streamCount; } public User setStreamCount(Integer streamCount) { this.streamCount = streamCount; return this; } public Integer getContactsCount() { return contactsCount; } public User setContactsCount(Integer contactsCount) { this.contactsCount = contactsCount; return this; } public List<String> getAccountRights() { return accountRights; } public User setAccountRights(List<String> accountRights) { this.accountRights = accountRights; return this; } public String getCountryCode() { return countryCode; } public User setCountryCode(String countryCode) { this.countryCode = countryCode; return this; } public boolean isNewUser() { return newUser; } public User setNewUser(boolean newUser) { this.newUser = newUser; return this; } }
UTF-8
Java
14,114
java
User.java
Java
[ { "context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by Cillian Myles on 08/01/2019.\n * Copyright (c) 2019 OnePageCRM. ", "end": 797, "score": 0.9998775124549866, "start": 784, "tag": "NAME", "value": "Cillian Myles" } ]
null
[]
package com.onepagecrm.models; import com.onepagecrm.exceptions.OnePageException; import com.onepagecrm.models.internal.Paginator; import com.onepagecrm.models.internal.PredefinedActionList; import com.onepagecrm.models.serializers.BaseSerializer; import com.onepagecrm.models.serializers.CompanyListSerializer; import com.onepagecrm.models.serializers.ContactListSerializer; import com.onepagecrm.models.serializers.DealListSerializer; import com.onepagecrm.models.serializers.UserSerializer; import com.onepagecrm.net.API; import com.onepagecrm.net.ApiResource; import com.onepagecrm.net.Response; import com.onepagecrm.net.request.GetRequest; import com.onepagecrm.net.request.Request; import java.io.Serializable; import java.util.List; import java.util.Map; /** * Created by <NAME> on 08/01/2019. * Copyright (c) 2019 OnePageCRM. All rights reserved. */ @SuppressWarnings({"WeakerAccess", "UnusedReturnValue", "unused"}) public class User extends ApiResource implements Serializable { private static final long serialVersionUID = 1383622287570201668L; /* * Member variables. */ public Account account; private String id; private String authKey; private String accountType; private String bccEmail; private String companyName; private String email; private String firstName; private String lastName; private String photoUrl; private String countryCode; private boolean newUser; private Integer allCount; private Integer streamCount; private Integer contactsCount; private List<String> accountRights; /* Auth-related API methods */ public StartupData startup() throws OnePageException { return API.Auth.startup(); } @Deprecated public static User googleLogin(String oauth2Code) throws OnePageException { return API.GoogleOld.login(oauth2Code); } @Deprecated public static User googleSignup(String oauth2Code) throws OnePageException { return API.GoogleOld.signup(oauth2Code); } public User bootstrap() throws OnePageException { return API.Auth.bootstrap(); } /* Other API methods (TO BE MOVED OUT to API.Namespace eventually) */ public ContactList actionStream() throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.queryDefault()); } public ContactList actionStream(Paginator paginator) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.query(paginator)); } public ContactList actionStream(Map<String, Object> params) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.fromParams(params)); } public ContactList actionStream(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getContacts(ACTION_STREAM_ENDPOINT, query); } public ContactList searchActionStream(String search) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.querySearch(search)); } public ContactList searchActionStream(Paginator paginator, String search) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.querySearch(paginator, search)); } public ContactList actionStreamByLetter(String letter) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.queryLetter(letter)); } public ContactList actionStreamByLetter(Paginator paginator, String letter) throws OnePageException { return getContacts(ACTION_STREAM_ENDPOINT, Query.queryLetter(paginator, letter)); } public ContactList contacts() throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.query(true)); } public ContactList contacts(Paginator paginator) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.query(paginator, true)); } public ContactList contacts(Map<String, Object> params) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.fromParams(params)); } public ContactList contacts(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getContacts(CONTACTS_ENDPOINT, query); } public ContactList searchContacts(String search) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.querySearch(search, true)); } public ContactList searchContacts(Paginator paginator, String search) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.querySearch(paginator, search, true)); } public ContactList contactsByCompany(String companyId) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryCompany(companyId)); } public ContactList contactsByCompany(Paginator paginator, String companyId) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryCompany(paginator, companyId)); } public ContactList contactsByLetter(String letter) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryLetter(letter, true)); } public ContactList contactsByLetter(Paginator paginator, String letter) throws OnePageException { return getContacts(CONTACTS_ENDPOINT, Query.queryLetter(paginator, letter, true)); } public ContactList teamStream(Map<String, Object> params) throws OnePageException { return getContacts(TEAM_STREAM_ENDPOINT, Query.fromParams(params)); } public ContactList teamStream(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getContacts(TEAM_STREAM_ENDPOINT, query); } public DealList pipeline() throws OnePageException { Request request = new GetRequest(DEALS_ENDPOINT, Query.query(true)); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } public DealList pipeline(Paginator paginator) throws OnePageException { Request request = new GetRequest(DEALS_ENDPOINT, Query.query(paginator, true)); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } public DealList pipeline(Map<String, Object> params) throws OnePageException { Request request = new GetRequest(DEALS_ENDPOINT, Query.fromParams(params)); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } public DealList pipeline(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); Request request = new GetRequest(DEALS_ENDPOINT, query); Response response = request.send(); return DealListSerializer.fromString(response.getResponseBody()); } private ContactList getContacts(final String endpoint, String query) throws OnePageException { query += "&" + Contact.EXTRA_FIELDS; Request request = new GetRequest(endpoint, query); Response response = request.send(); return ContactListSerializer.fromString(response.getResponseBody()); } public CompanyList companies() throws OnePageException { return getCompanies(Query.queryDefault()); } public CompanyList companies(Paginator paginator) throws OnePageException { return getCompanies(Query.query(paginator)); } public CompanyList companies(Map<String, Object> params) throws OnePageException { return getCompanies(Query.fromParams(params)); } public CompanyList companies(Map<String, Object> params, Paginator paginator) throws OnePageException { String query = Query.fromMaps(params, Query.params(paginator)); return getCompanies(query); } private CompanyList getCompanies(String query) throws OnePageException { Request request = new GetRequest(COMPANIES_ENDPOINT, query); Response response = request.send(); return CompanyListSerializer.fromString(response.getResponseBody()); } public ActionList actions(Paginator paginator) throws OnePageException { return Action.list(this.id, paginator); } public ActionList actions() throws OnePageException { return Action.list(this.id); } public PredefinedActionList actionsPredefined(Paginator paginator) throws OnePageException { return Action.listPredefined(paginator); } public PredefinedActionList actionsPredefined() throws OnePageException { return Action.listPredefined(); } /* * Utility methods. */ public String getSimpleName() { if (lastName != null && !lastName.equals("")) { if (firstName != null && !firstName.equals("")) { return firstName + " " + lastName.substring(0, 1) + "."; } else { return lastName; } } return null; } public String getFullName() { if (lastName != null && !lastName.equals("")) { if (firstName != null && !firstName.equals("")) { return firstName + " " + lastName; } else { return lastName; } } return null; } public String getFullAlphaName() { if (lastName != null && !lastName.equals("")) { if (firstName != null && !firstName.equals("")) { return lastName + ", " + firstName; } else { return lastName; } } return null; } public boolean hasRight(String right) { return isAdmin() || isOwner() || accountRights != null && accountRights.contains(right); } public boolean isAdmin() { return accountRights != null && accountRights.contains(BaseSerializer.ACCOUNT_OWNER_TAG); } public boolean isOwner() { return accountRights != null && accountRights.contains(BaseSerializer.ADMIN_TAG); } /* * Object methods. */ @Override public String toString() { return UserSerializer.toJsonObject(this); } @Override public boolean equals(Object object) { boolean idsEqual = super.equals(object); boolean authKeysEqual = false; if (object instanceof User) { User toCompare = (User) object; if (this.authKey == null && toCompare.authKey == null) { authKeysEqual = true; } else if (this.authKey != null && toCompare.authKey != null) { authKeysEqual = this.authKey.equals(toCompare.authKey); } } return idsEqual && authKeysEqual; } @Override public boolean isValid() { boolean idValid = super.isValid(); boolean authKeyValid = this.authKey != null && !this.authKey.equals(""); return idValid && authKeyValid; } @Override public String getId() { return this.id; } @Override public User setId(String id) { this.id = id; return this; } public String getAuthKey() { return authKey; } public User setAuthKey(String authKey) { this.authKey = authKey; return this; } public String getAccountType() { return accountType; } public User setAccountType(String accountType) { this.accountType = accountType; return this; } public String getBccEmail() { return bccEmail; } public User setBccEmail(String bccEmail) { this.bccEmail = bccEmail; return this; } public String getCompanyName() { return companyName; } public User setCompanyName(String companyName) { this.companyName = companyName; return this; } public String getEmail() { return email; } public User setEmail(String email) { this.email = email; return this; } public String getFirstName() { return firstName; } public User setFirstName(String firstName) { this.firstName = firstName; return this; } public String getLastName() { return lastName; } public User setLastName(String lastName) { this.lastName = lastName; return this; } public String getPhotoUrl() { return photoUrl; } public User setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; return this; } public Account getAccount() { return account; } public User setAccount(Account account) { this.account = account; return this; } public Integer getAllCount() { return allCount; } public User setAllCount(Integer allCount) { this.allCount = allCount; return this; } public Integer getStreamCount() { return streamCount; } public User setStreamCount(Integer streamCount) { this.streamCount = streamCount; return this; } public Integer getContactsCount() { return contactsCount; } public User setContactsCount(Integer contactsCount) { this.contactsCount = contactsCount; return this; } public List<String> getAccountRights() { return accountRights; } public User setAccountRights(List<String> accountRights) { this.accountRights = accountRights; return this; } public String getCountryCode() { return countryCode; } public User setCountryCode(String countryCode) { this.countryCode = countryCode; return this; } public boolean isNewUser() { return newUser; } public User setNewUser(boolean newUser) { this.newUser = newUser; return this; } }
14,107
0.674437
0.671815
453
30.158941
29.473997
110
false
false
0
0
0
0
0
0
0.512141
false
false
7
fba74a6d5e54ffbf4d3930ffa8d96a954f0091a4
19,189,913,889,225
a403a6c97ebdf3389c1611b28f2055fd20dc6336
/src/model/objects/Room.java
b51ca07b96cbd6f4aac3cf94f39a1fc0ff50617b
[]
no_license
EternalHaru/SystemHygieia
https://github.com/EternalHaru/SystemHygieia
7a2d0012c003860de252939bfce6babd09f67cd4
3342c927d53ea3c198524411ab8913be6ef2b519
refs/heads/master
2019-08-31T09:05:22.971000
2017-07-22T16:42:56
2017-07-22T16:42:56
98,030,872
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.objects; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import javax.persistence.*; import java.util.List; @Entity(name = "rooms") @Table(name = "rooms") public class Room extends AbstractIdentifiableObject { @Column private String number; @OneToMany(fetch = FetchType.EAGER) @Cascade(org.hibernate.annotations.CascadeType.ALL) @Fetch(FetchMode.SELECT) private List<Equipment> equipment; public Room() { } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public List<Equipment> getEquipment() { return equipment; } public void setEquipment(List<Equipment> equipment) { this.equipment = equipment; } }
UTF-8
Java
860
java
Room.java
Java
[]
null
[]
package model.objects; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import javax.persistence.*; import java.util.List; @Entity(name = "rooms") @Table(name = "rooms") public class Room extends AbstractIdentifiableObject { @Column private String number; @OneToMany(fetch = FetchType.EAGER) @Cascade(org.hibernate.annotations.CascadeType.ALL) @Fetch(FetchMode.SELECT) private List<Equipment> equipment; public Room() { } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public List<Equipment> getEquipment() { return equipment; } public void setEquipment(List<Equipment> equipment) { this.equipment = equipment; } }
860
0.688372
0.688372
41
19.975609
18.060181
57
false
false
0
0
0
0
0
0
0.292683
false
false
7
9ae6376b0beb22951a3e127abe7a9713d14d14ac
7,928,509,698,960
538ad2b4100aa1b925a63f6c0ddbc2caaf25b8c2
/src/main/java/xyz/tiny/boot/utils/ReflectionUtils.java
691930e4d7f18427d4a1ef20d42145ede067adb2
[]
no_license
sibmaks/tiny-boot
https://github.com/sibmaks/tiny-boot
26771d9f76dc5f95f74ae0d8df6de57d70b89309
09948f60be3ed1c7863e137171213a6f9cdfc810
refs/heads/master
2020-05-17T01:43:06.014000
2019-07-11T06:36:46
2019-07-11T06:36:46
183,435,042
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package xyz.tiny.boot.utils; import lombok.extern.slf4j.Slf4j; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; import java.net.URL; import java.util.*; import java.util.stream.Collectors; @Slf4j public final class ReflectionUtils { private ReflectionUtils() {} public static List<Class> getClasses(String packageName) throws IOException { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return Collections.list(classLoader.getResources(packageName.replace('.', '/'))) .stream() .map(URL::getFile) .map(File::new) .map(it -> findClasses(it, packageName)) .flatMap(Collection::stream) .collect(Collectors.toList()); } public static List<Field> getFields(Class clazz) { List<Field> fields = new ArrayList<>(Arrays.asList(clazz.getDeclaredFields())); if(clazz.getSuperclass() != Object.class) { fields.addAll(getFields(clazz.getSuperclass())); } return fields; } public static List<Class> getClasses(Set<String> packageNames) throws IOException { List<Class> classes = new ArrayList<>(); for(String packageName : packageNames) { classes.addAll(getClasses(packageName)); } return classes; } private static Set<Class> findClasses(File directory, String packageName) { Set<Class> classes = new HashSet<>(); if (!directory.exists()) { return classes; } packageName = packageName.startsWith(".") ? packageName.substring(1) : packageName; File[] files = directory.listFiles(); if(files == null) { return classes; } for (File file : files) { if (file.isDirectory()) { if(file.getName().contains(".")) { continue; } classes.addAll(findClasses(file, packageName + '.' + file.getName())); } else if (file.getName().endsWith(".class")) { try { classes.add(Class.forName(packageName + '.' + file.getName().substring(0, file.getName().length() - 6))); } catch (ClassNotFoundException e) { log.error("Reflection find class error", e); } } } return classes; } }
UTF-8
Java
2,446
java
ReflectionUtils.java
Java
[]
null
[]
package xyz.tiny.boot.utils; import lombok.extern.slf4j.Slf4j; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; import java.net.URL; import java.util.*; import java.util.stream.Collectors; @Slf4j public final class ReflectionUtils { private ReflectionUtils() {} public static List<Class> getClasses(String packageName) throws IOException { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return Collections.list(classLoader.getResources(packageName.replace('.', '/'))) .stream() .map(URL::getFile) .map(File::new) .map(it -> findClasses(it, packageName)) .flatMap(Collection::stream) .collect(Collectors.toList()); } public static List<Field> getFields(Class clazz) { List<Field> fields = new ArrayList<>(Arrays.asList(clazz.getDeclaredFields())); if(clazz.getSuperclass() != Object.class) { fields.addAll(getFields(clazz.getSuperclass())); } return fields; } public static List<Class> getClasses(Set<String> packageNames) throws IOException { List<Class> classes = new ArrayList<>(); for(String packageName : packageNames) { classes.addAll(getClasses(packageName)); } return classes; } private static Set<Class> findClasses(File directory, String packageName) { Set<Class> classes = new HashSet<>(); if (!directory.exists()) { return classes; } packageName = packageName.startsWith(".") ? packageName.substring(1) : packageName; File[] files = directory.listFiles(); if(files == null) { return classes; } for (File file : files) { if (file.isDirectory()) { if(file.getName().contains(".")) { continue; } classes.addAll(findClasses(file, packageName + '.' + file.getName())); } else if (file.getName().endsWith(".class")) { try { classes.add(Class.forName(packageName + '.' + file.getName().substring(0, file.getName().length() - 6))); } catch (ClassNotFoundException e) { log.error("Reflection find class error", e); } } } return classes; } }
2,446
0.576043
0.57359
73
32.506851
28.172718
125
false
false
0
0
0
0
0
0
0.438356
false
false
7
e6a86629acfa9058088abeaca33a8d5b083a4a50
14,456,859,927,844
0e564b3f82fe34dcebc6f05971440fbd5666911d
/joy/src/com/hijoy/utilcommon/Email.java
b3ce35bacc1910b6df048a2ef257bd903f6530f3
[]
no_license
SigmaO/Joy
https://github.com/SigmaO/Joy
5dd1f3e98c5ef0839e79b61c48bf432c6ac266b0
1920028a7f1588a4e1f17042226f1aac1720c017
refs/heads/master
2020-05-20T00:32:02.892000
2014-09-15T01:42:24
2014-09-15T01:42:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hijoy.utilcommon; import org.apache.commons.mail.SimpleEmail; public class Email { private String content; private String title; private String hostName; private String destination; private String source; private String password; public void send() { SimpleEmail email = new SimpleEmail(); email.setHostName(hostName); email.setAuthentication(source, password); try { System.out.println("in sendEmail send function"); email.addTo(destination); email.setFrom(source); email.setSubject(title); email.setMsg(content); email.send(); } catch (Exception e) { e.printStackTrace(); System.out.println("send email error"); } } /** * @return the content */ public String getContent() { return content; } /** * @param content * the content to set */ public void setContent(String content) { this.content = content; } /** * @return the title */ public String getTitle() { return title; } /** * @param title * the title to set */ public void setTitle(String title) { this.title = title; } /** * @return the hostName */ public String getHostName() { return hostName; } /** * @param hostName * the hostName to set */ public void setHostName(String hostName) { this.hostName = hostName; } /** * @return the destination */ public String getDestination() { return destination; } /** * @param destination * the destination to set */ public void setDestination(String destination) { this.destination = destination; } /** * @return the source */ public String getSource() { return source; } /** * @param source * the source to set */ public void setSource(String source) { this.source = source; } /** * @return the password */ public String getPassword() { return password; } /** * @param password * the password to set */ public void setPassword(String password) { this.password = password; } // public static void main(String args[]) { // Email se = new Email(); // se.setHostName("smtp.163.com"); // se.setSource("xiaobinghu1989@163.com"); // se.setPassword("19890302"); // se.setDestination("vincentmo1989@gmail.com"); // se.setTitle("Welcome from HiJoy"); // se.setContent("Hi," + "mo" + ": welcome to join HiJoy, enjoy your time"); // se.send(); // } }
UTF-8
Java
2,406
java
Email.java
Java
[ { "context": "se.setHostName(\"smtp.163.com\");\n\t// se.setSource(\"xiaobinghu1989@163.com\");\n\t// se.setPassword(\"19890302\");\n\t// se.setDest", "end": 2180, "score": 0.9998785853385925, "start": 2158, "tag": "EMAIL", "value": "xiaobinghu1989@163.com" }, { "context": "ce(\"xiaobinghu1989@163.com\");\n\t// se.setPassword(\"19890302\");\n\t// se.setDestination(\"vincentmo1989@gmail.com", "end": 2212, "score": 0.9989842176437378, "start": 2204, "tag": "PASSWORD", "value": "19890302" }, { "context": "e.setPassword(\"19890302\");\n\t// se.setDestination(\"vincentmo1989@gmail.com\");\n\t// se.setTitle(\"Welcome from HiJoy\");\n\t// se.", "end": 2262, "score": 0.9999242424964905, "start": 2239, "tag": "EMAIL", "value": "vincentmo1989@gmail.com" } ]
null
[]
package com.hijoy.utilcommon; import org.apache.commons.mail.SimpleEmail; public class Email { private String content; private String title; private String hostName; private String destination; private String source; private String password; public void send() { SimpleEmail email = new SimpleEmail(); email.setHostName(hostName); email.setAuthentication(source, password); try { System.out.println("in sendEmail send function"); email.addTo(destination); email.setFrom(source); email.setSubject(title); email.setMsg(content); email.send(); } catch (Exception e) { e.printStackTrace(); System.out.println("send email error"); } } /** * @return the content */ public String getContent() { return content; } /** * @param content * the content to set */ public void setContent(String content) { this.content = content; } /** * @return the title */ public String getTitle() { return title; } /** * @param title * the title to set */ public void setTitle(String title) { this.title = title; } /** * @return the hostName */ public String getHostName() { return hostName; } /** * @param hostName * the hostName to set */ public void setHostName(String hostName) { this.hostName = hostName; } /** * @return the destination */ public String getDestination() { return destination; } /** * @param destination * the destination to set */ public void setDestination(String destination) { this.destination = destination; } /** * @return the source */ public String getSource() { return source; } /** * @param source * the source to set */ public void setSource(String source) { this.source = source; } /** * @return the password */ public String getPassword() { return password; } /** * @param password * the password to set */ public void setPassword(String password) { this.password = password; } // public static void main(String args[]) { // Email se = new Email(); // se.setHostName("smtp.163.com"); // se.setSource("<EMAIL>"); // se.setPassword("<PASSWORD>"); // se.setDestination("<EMAIL>"); // se.setTitle("Welcome from HiJoy"); // se.setContent("Hi," + "mo" + ": welcome to join HiJoy, enjoy your time"); // se.send(); // } }
2,377
0.636326
0.627182
130
17.507692
15.603868
77
false
false
0
0
0
0
0
0
1.430769
false
false
7
19ffe46938398e9dc5c46e7602ad7301969c6c2d
21,320,217,698,312
1332ab47dc110f473915cb0e1b4dc23e797f1e68
/src/main/java/subaraki/rpginventory/item/RpgItems.java
e822beaefaaa6ed81ae66f266a6c174a72c98add
[]
no_license
AbsolemJackdaw/Rpg-Inventory-2016
https://github.com/AbsolemJackdaw/Rpg-Inventory-2016
90e2679d6999c9b368253bc530f1b5fbc9840d91
424a478cef25d613a27ffdcda190219919619808
refs/heads/master
2022-09-04T20:39:29.800000
2018-04-15T11:22:04
2018-04-15T11:22:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package subaraki.rpginventory.item; import static lib.item.ItemRegistry.registerItem; import static lib.item.ItemRegistry.registerRender; import net.minecraft.creativetab.CreativeTabs; import subaraki.rpginventory.enums.JewelTypes; import subaraki.rpginventory.mod.RpgInventory; public class RpgItems { private static String mod = RpgInventory.MODID; public static RpgInventoryItem /* ====jewels==== */ gold_necklace, diamond_necklace, emerald_necklace, lapis_necklace, gold_gloves, diamond_gloves, emerald_gloves, lapis_gloves, gold_ring, diamond_ring, emerald_ring, lapis_ring, /* ====cloaks==== */ cloak ; public static CreativeTabs tab; public static void init(){ tab = new RpgInventoryTab(); gold_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/gold_gloves.png") .setCreativeTab(tab).setRegistryName("gold_glove").setUnlocalizedName(mod+".gold_glove"); diamond_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/diamond_gloves.png") .setCreativeTab(tab).setRegistryName("diamond_glove").setUnlocalizedName(mod+".diamond_glove"); emerald_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/emerald_gloves.png") .setCreativeTab(tab).setRegistryName("emerald_glove").setUnlocalizedName(mod+".emerald_glove"); lapis_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/lapis_gloves.png") .setCreativeTab(tab).setRegistryName("lapis_glove").setUnlocalizedName(mod+".lapis_glove"); emerald_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/emerald_necklace.png") .setCreativeTab(tab).setRegistryName("emerald_necklace").setUnlocalizedName(mod+".emerald_necklace"); diamond_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/diamond_necklace.png") .setCreativeTab(tab).setRegistryName("diamond_necklace").setUnlocalizedName(mod+".diamond_necklace"); lapis_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/lapis_necklace.png") .setCreativeTab(tab).setRegistryName("lapis_necklace").setUnlocalizedName(mod+".lapis_necklace"); gold_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/gold_necklace.png") .setCreativeTab(tab).setRegistryName("gold_necklace").setUnlocalizedName(mod+".gold_necklace"); gold_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("gold_ring").setUnlocalizedName(mod+".gold_ring"); diamond_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("diamond_ring").setUnlocalizedName(mod+".diamond_ring"); emerald_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("emerald_ring").setUnlocalizedName(mod+".emerald_ring"); lapis_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("lapis_ring").setUnlocalizedName(mod+".lapis_ring"); cloak = (ItemCloak) new ItemCloak(JewelTypes.CLOAK) .set3DTexture("blocks/wool_colored_white") .setCreativeTab(tab).setRegistryName("cloak").setUnlocalizedName(mod+".cloak"); register(); } private static void register(){ registerItem(gold_gloves); registerItem(diamond_gloves); registerItem(emerald_gloves); registerItem(lapis_gloves); registerItem(gold_necklace); registerItem(diamond_necklace); registerItem(emerald_necklace); registerItem(lapis_necklace); registerItem(gold_ring); registerItem(diamond_ring); registerItem(emerald_ring); registerItem(lapis_ring); registerItem(cloak); } private static final String NECKLACE = "jewels/endented_necklace"; private static final String NECKLACE_G = "jewels/gold_necklace"; private static final String GLOVE = "jewels/endented_glove"; private static final String GLOVE_G = "jewels/gold_glove"; private static final String RING = "jewels/endented_ring"; private static final String RING_G = "jewels/gold_ring"; public static void registerRenders(){ registerRender(gold_gloves, GLOVE_G, mod); registerRender(diamond_gloves, GLOVE, mod); registerRender(emerald_gloves, GLOVE, mod); registerRender(lapis_gloves, GLOVE, mod); registerRender(gold_necklace, NECKLACE_G, mod); registerRender(diamond_necklace, NECKLACE, mod); registerRender(emerald_necklace, NECKLACE, mod); registerRender(lapis_necklace, NECKLACE, mod); registerRender(gold_ring, RING_G, mod); registerRender(diamond_ring, RING, mod); registerRender(emerald_ring, RING, mod); registerRender(lapis_ring, RING, mod); for(int i=0;i<16;i++) registerRender(cloak, "jewels/cloak", mod, i); } }
UTF-8
Java
5,030
java
RpgItems.java
Java
[]
null
[]
package subaraki.rpginventory.item; import static lib.item.ItemRegistry.registerItem; import static lib.item.ItemRegistry.registerRender; import net.minecraft.creativetab.CreativeTabs; import subaraki.rpginventory.enums.JewelTypes; import subaraki.rpginventory.mod.RpgInventory; public class RpgItems { private static String mod = RpgInventory.MODID; public static RpgInventoryItem /* ====jewels==== */ gold_necklace, diamond_necklace, emerald_necklace, lapis_necklace, gold_gloves, diamond_gloves, emerald_gloves, lapis_gloves, gold_ring, diamond_ring, emerald_ring, lapis_ring, /* ====cloaks==== */ cloak ; public static CreativeTabs tab; public static void init(){ tab = new RpgInventoryTab(); gold_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/gold_gloves.png") .setCreativeTab(tab).setRegistryName("gold_glove").setUnlocalizedName(mod+".gold_glove"); diamond_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/diamond_gloves.png") .setCreativeTab(tab).setRegistryName("diamond_glove").setUnlocalizedName(mod+".diamond_glove"); emerald_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/emerald_gloves.png") .setCreativeTab(tab).setRegistryName("emerald_glove").setUnlocalizedName(mod+".emerald_glove"); lapis_gloves = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.GLOVES) .set3DTexture("armor/jewels/textures/lapis_gloves.png") .setCreativeTab(tab).setRegistryName("lapis_glove").setUnlocalizedName(mod+".lapis_glove"); emerald_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/emerald_necklace.png") .setCreativeTab(tab).setRegistryName("emerald_necklace").setUnlocalizedName(mod+".emerald_necklace"); diamond_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/diamond_necklace.png") .setCreativeTab(tab).setRegistryName("diamond_necklace").setUnlocalizedName(mod+".diamond_necklace"); lapis_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/lapis_necklace.png") .setCreativeTab(tab).setRegistryName("lapis_necklace").setUnlocalizedName(mod+".lapis_necklace"); gold_necklace = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.NECKLACE) .set3DTexture("armor/jewels/textures/gold_necklace.png") .setCreativeTab(tab).setRegistryName("gold_necklace").setUnlocalizedName(mod+".gold_necklace"); gold_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("gold_ring").setUnlocalizedName(mod+".gold_ring"); diamond_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("diamond_ring").setUnlocalizedName(mod+".diamond_ring"); emerald_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("emerald_ring").setUnlocalizedName(mod+".emerald_ring"); lapis_ring = (RpgInventoryItem) new RpgInventoryItem(JewelTypes.RING) .setCreativeTab(tab).setRegistryName("lapis_ring").setUnlocalizedName(mod+".lapis_ring"); cloak = (ItemCloak) new ItemCloak(JewelTypes.CLOAK) .set3DTexture("blocks/wool_colored_white") .setCreativeTab(tab).setRegistryName("cloak").setUnlocalizedName(mod+".cloak"); register(); } private static void register(){ registerItem(gold_gloves); registerItem(diamond_gloves); registerItem(emerald_gloves); registerItem(lapis_gloves); registerItem(gold_necklace); registerItem(diamond_necklace); registerItem(emerald_necklace); registerItem(lapis_necklace); registerItem(gold_ring); registerItem(diamond_ring); registerItem(emerald_ring); registerItem(lapis_ring); registerItem(cloak); } private static final String NECKLACE = "jewels/endented_necklace"; private static final String NECKLACE_G = "jewels/gold_necklace"; private static final String GLOVE = "jewels/endented_glove"; private static final String GLOVE_G = "jewels/gold_glove"; private static final String RING = "jewels/endented_ring"; private static final String RING_G = "jewels/gold_ring"; public static void registerRenders(){ registerRender(gold_gloves, GLOVE_G, mod); registerRender(diamond_gloves, GLOVE, mod); registerRender(emerald_gloves, GLOVE, mod); registerRender(lapis_gloves, GLOVE, mod); registerRender(gold_necklace, NECKLACE_G, mod); registerRender(diamond_necklace, NECKLACE, mod); registerRender(emerald_necklace, NECKLACE, mod); registerRender(lapis_necklace, NECKLACE, mod); registerRender(gold_ring, RING_G, mod); registerRender(diamond_ring, RING, mod); registerRender(emerald_ring, RING, mod); registerRender(lapis_ring, RING, mod); for(int i=0;i<16;i++) registerRender(cloak, "jewels/cloak", mod, i); } }
5,030
0.764215
0.761829
120
40.916668
31.805027
106
false
false
0
0
0
0
0
0
2.591667
false
false
7
0b6a4ca5efb0cd704d1ba497b1518bd74df0a33b
618,475,328,814
dd3c7ef916878f486c5b7f691e67aa60d01e362e
/meuprimeiroprojetojsf/src/main/java/br/com/algaworks/cursojava/PerfilUsuarioAreaBean.java
aef95f3351090133627ae3c562645e908f972b82
[]
no_license
Aderivan/curso-prime-face
https://github.com/Aderivan/curso-prime-face
2e06bcad0174803a364452374dd39ae368357ed3
ec9d355b9b491091b8ca442e157c8f4b5ba010f5
refs/heads/master
2021-07-19T16:11:37.054000
2019-11-13T00:35:10
2019-11-13T00:35:10
221,339,392
0
0
null
false
2020-10-13T17:25:16
2019-11-13T00:33:52
2019-11-13T00:35:33
2020-10-13T17:25:15
6,727
0
0
1
HTML
false
false
package br.com.algaworks.cursojava; import java.io.Serializable; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; @ManagedBean @ViewScoped public class PerfilUsuarioAreaBean implements Serializable { private static final long serialVersionUID = 1L; private String nome; private String sobre; public PerfilUsuarioAreaBean() { } public void atualizar() { System.out.println("Sobre: " + this.sobre); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Perfil atualizado!")); } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getSobre() { return sobre; } public void setSobre(String sobre) { this.sobre = sobre; } }
UTF-8
Java
840
java
PerfilUsuarioAreaBean.java
Java
[]
null
[]
package br.com.algaworks.cursojava; import java.io.Serializable; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; @ManagedBean @ViewScoped public class PerfilUsuarioAreaBean implements Serializable { private static final long serialVersionUID = 1L; private String nome; private String sobre; public PerfilUsuarioAreaBean() { } public void atualizar() { System.out.println("Sobre: " + this.sobre); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Perfil atualizado!")); } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getSobre() { return sobre; } public void setSobre(String sobre) { this.sobre = sobre; } }
840
0.752381
0.75119
42
19
20.576223
93
false
false
0
0
0
0
0
0
1.047619
false
false
7
32bc4c19cb075431a90b4932357edd55ee756181
32,375,463,501,421
32c87439a5d14886b31288fd219f13f7065fc0e8
/src/hfdp_exercises/menu/MenusEnum.java
71c07a37340e7173076889a79539295225b8d943
[]
no_license
alexserravidal/Head-First-Design-Patterns-Book-Exercises
https://github.com/alexserravidal/Head-First-Design-Patterns-Book-Exercises
31c45a1caaf47fa34bf7ddd1209c3dc0efd02eb8
d305257a1971c437f95867df62a145c9b01dac1b
refs/heads/master
2023-03-02T22:40:46.879000
2021-02-12T22:02:31
2021-02-12T22:02:31
338,145,604
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hfdp_exercises.menu; public enum MenusEnum { MAIN_MENU, EX1_MENU, EX2_MENU };
UTF-8
Java
90
java
MenusEnum.java
Java
[]
null
[]
package hfdp_exercises.menu; public enum MenusEnum { MAIN_MENU, EX1_MENU, EX2_MENU };
90
0.722222
0.7
7
11.857142
9.523334
28
false
false
0
0
0
0
0
0
1
false
false
7
14302c4f3741ecaa89d9e8d17584f48cf0b53f62
28,235,115,018,819
7d610133abed6334bc1eef11c089840dd04d12b8
/apg-patch-service-core/src/main/java/com/apgsga/microservice/patch/core/commands/jenkins/curl/JenkinsCurlCommand.java
ccb3169fab722b997f4a28064edfb9ca08ce9bf1
[]
no_license
apgsga-it/piper
https://github.com/apgsga-it/piper
5fae23dca483dd4cfce34a3ed4197915dc724d8c
e7903ddea86ff29a7021ba74721256715d03ed0f
refs/heads/master
2022-05-06T04:13:18.038000
2022-01-17T11:43:42
2022-01-17T11:43:42
122,188,338
1
0
null
false
2022-06-02T05:57:38
2018-02-20T11:14:46
2021-12-07T11:00:14
2022-06-02T05:57:38
3,425
1
0
0
Java
false
false
package com.apgsga.microservice.patch.core.commands.jenkins.curl; import com.apgsga.microservice.patch.core.commands.CommandBaseImpl; import java.util.Arrays; import java.util.stream.Stream; public abstract class JenkinsCurlCommand extends CommandBaseImpl { protected final String JENKINS_SSH_USER; protected final String JENKINS_SSH_USER_PWD; protected final String JENKINS_URL; public JenkinsCurlCommand(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd) { super(); this.JENKINS_URL = jenkinsUrl; this.JENKINS_SSH_USER = jenkinsUserName; this.JENKINS_SSH_USER_PWD = jenkinsUserPwd; } public static JenkinsCurlCommand createJenkinsCurlGetLastBuildCmd(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd, String jobName) { return new JenkinsCurlGetLastBuildCmd(jenkinsUrl,jenkinsUserName,jenkinsUserPwd,jobName); } public static JenkinsCurlCommand createJenkinsCurlGetJobInputStatus(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd, String jobName) { return new JenkinsCurlGetInputStatus(jenkinsUrl,jenkinsUserName,jenkinsUserPwd,jobName); } public static JenkinsCurlCommand createJenkinsCurlSubmitPipelineInput(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd, String jobName, String jobExecutionNumber, String inputId, String action) { return new JenkinsCurlSubmitPipelineInput(jenkinsUrl,jenkinsUserName,jenkinsUserPwd,jobName,jobExecutionNumber,inputId,action); } @Override protected String[] getParameterAsArray() { return Stream.concat(Arrays.stream(getFirstPart()), Arrays.stream(getCurlCmd())) .toArray(String[]::new); } @Override protected String getParameterSpaceSeperated() { String[] processParm = Stream.concat(Arrays.stream(getFirstPart()), Arrays.stream(getCurlCmd())) .toArray(String[]::new); return String.join(" ", processParm); } private String[] getFirstPart() { return new String[]{"curl", "-s", "-u", JENKINS_SSH_USER +":"+ JENKINS_SSH_USER_PWD}; } protected abstract String[] getCurlCmd(); }
UTF-8
Java
2,193
java
JenkinsCurlCommand.java
Java
[ { "context": "ublic JenkinsCurlCommand(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd) {\n super();\n ", "end": 470, "score": 0.5441650152206421, "start": 455, "tag": "USERNAME", "value": "jenkinsUserName" }, { "context": "_URL = jenkinsUrl;\n this.JENKINS_SSH_USER = jenkinsUserName;\n this.JENKINS_SSH_USER_PWD = jenkinsUserP", "end": 600, "score": 0.851852536201477, "start": 585, "tag": "USERNAME", "value": "jenkinsUserName" }, { "context": "nkinsUserName;\n this.JENKINS_SSH_USER_PWD = jenkinsUserPwd;\n }\n\n public static JenkinsCurlCommand crea", "end": 652, "score": 0.7677054405212402, "start": 638, "tag": "PASSWORD", "value": "jenkinsUserPwd" } ]
null
[]
package com.apgsga.microservice.patch.core.commands.jenkins.curl; import com.apgsga.microservice.patch.core.commands.CommandBaseImpl; import java.util.Arrays; import java.util.stream.Stream; public abstract class JenkinsCurlCommand extends CommandBaseImpl { protected final String JENKINS_SSH_USER; protected final String JENKINS_SSH_USER_PWD; protected final String JENKINS_URL; public JenkinsCurlCommand(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd) { super(); this.JENKINS_URL = jenkinsUrl; this.JENKINS_SSH_USER = jenkinsUserName; this.JENKINS_SSH_USER_PWD = <PASSWORD>; } public static JenkinsCurlCommand createJenkinsCurlGetLastBuildCmd(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd, String jobName) { return new JenkinsCurlGetLastBuildCmd(jenkinsUrl,jenkinsUserName,jenkinsUserPwd,jobName); } public static JenkinsCurlCommand createJenkinsCurlGetJobInputStatus(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd, String jobName) { return new JenkinsCurlGetInputStatus(jenkinsUrl,jenkinsUserName,jenkinsUserPwd,jobName); } public static JenkinsCurlCommand createJenkinsCurlSubmitPipelineInput(String jenkinsUrl, String jenkinsUserName, String jenkinsUserPwd, String jobName, String jobExecutionNumber, String inputId, String action) { return new JenkinsCurlSubmitPipelineInput(jenkinsUrl,jenkinsUserName,jenkinsUserPwd,jobName,jobExecutionNumber,inputId,action); } @Override protected String[] getParameterAsArray() { return Stream.concat(Arrays.stream(getFirstPart()), Arrays.stream(getCurlCmd())) .toArray(String[]::new); } @Override protected String getParameterSpaceSeperated() { String[] processParm = Stream.concat(Arrays.stream(getFirstPart()), Arrays.stream(getCurlCmd())) .toArray(String[]::new); return String.join(" ", processParm); } private String[] getFirstPart() { return new String[]{"curl", "-s", "-u", JENKINS_SSH_USER +":"+ JENKINS_SSH_USER_PWD}; } protected abstract String[] getCurlCmd(); }
2,189
0.74145
0.74145
53
40.377357
48.037418
215
false
false
0
0
0
0
0
0
0.962264
false
false
7
16023d89aa9a8471d035ad52091926736998d58e
4,664,334,484,558
be4ebdc2784d9e909e69416dc7c99deca87b5360
/src/main/java/uk/me/webpigeon/behaviour/NDSelectorNode.java
2f60c15d19a3cccfac36f41ea789fb80577f3514
[]
no_license
unitycoders/ai-tools
https://github.com/unitycoders/ai-tools
bca6b1d7fe3b6edd35f6f0f4c0b7d96e1ad736b9
51e26cc2f373166bd3021ee88522236f04eb7672
refs/heads/master
2021-01-19T18:33:04.679000
2015-03-13T15:04:21
2015-03-13T15:04:21
31,600,077
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package uk.me.webpigeon.behaviour; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; /** * Nondeterministic Selector Node * * Evaluate all nodes in order from 0 to random, if any node returns true * stop evaluating and returns true. If all nodes return false then this node * returns false. */ public class NDSelectorNode extends SelectorNode { public Collection<TreeNode> getChildren() { List<TreeNode> collection = new ArrayList<TreeNode>(super.getChildren()); Collections.shuffle(collection); return collection; } }
UTF-8
Java
598
java
NDSelectorNode.java
Java
[]
null
[]
package uk.me.webpigeon.behaviour; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; /** * Nondeterministic Selector Node * * Evaluate all nodes in order from 0 to random, if any node returns true * stop evaluating and returns true. If all nodes return false then this node * returns false. */ public class NDSelectorNode extends SelectorNode { public Collection<TreeNode> getChildren() { List<TreeNode> collection = new ArrayList<TreeNode>(super.getChildren()); Collections.shuffle(collection); return collection; } }
598
0.764214
0.762542
23
25
24.587025
77
false
false
0
0
0
0
0
0
0.73913
false
false
7
18e4e3ca4574cb386e74b08fcfde5a2e171bb0dd
21,174,188,840,431
5da3feba973fe3fe93d7b264bb8be15740837fa3
/module/01.web/src/com/gxx/oa/CloudKnowDeleteAskAction.java
0af2c92b280bee6b8f4fd8542ee5ccf4d80c6204
[]
no_license
GuanXianghui/suncare-oa-ui
https://github.com/GuanXianghui/suncare-oa-ui
29340fe100ab0ac1305a6c3228b3f22469ee2b70
3d046488931e0878b457184f91d45aebea86ae73
refs/heads/master
2016-09-01T21:07:29.824000
2014-07-30T14:36:06
2014-07-30T14:36:06
20,516,105
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gxx.oa; import com.gxx.oa.dao.CloudKnowAnswerDao; import com.gxx.oa.dao.CloudKnowAskDao; import com.gxx.oa.dao.UserDao; import com.gxx.oa.entities.CloudKnowAsk; import com.gxx.oa.entities.User; import com.gxx.oa.interfaces.*; import com.gxx.oa.utils.BaseUtil; import com.gxx.oa.utils.EmailUtils; import org.apache.commons.lang.StringUtils; import java.util.List; /** * 删除提问action * * @author Gxx * @module oa * @datetime 14-4-1 11:22 */ public class CloudKnowDeleteAskAction extends BaseAction implements CloudKnowAskInterface { /** * 提问id */ private String askId; /** * 入口 * @return */ public String execute() throws Exception { logger.info("askId:" + askId); //判提问id不为空 if(StringUtils.isBlank(askId)){ message = "提问id不能为空!"; return ERROR; } // 提问idInt类型 int askIdInt = Integer.parseInt(askId); //判文档存在 CloudKnowAsk cloudKnowAsk = CloudKnowAskDao.getCloudKnowAskById(askIdInt); if(null == cloudKnowAsk || cloudKnowAsk.getUserId() != getUser().getId() || cloudKnowAsk.getState() != STATE_NORMAL){ message = "你的操作有误,请刷新页面重试!"; return ERROR; } //更新申成知道提问 cloudKnowAsk.setState(STATE_DELETE); cloudKnowAsk.setUpdateDate(date); cloudKnowAsk.setUpdateTime(time); cloudKnowAsk.setUpdateIp(getIp()); CloudKnowAskDao.updateCloudKnowAsk(cloudKnowAsk); message = "删除提问成功!"; //创建操作日志 BaseUtil.createOperateLog(getUser().getId(), OperateLogInterface.TYPE_CLOUD_KNOW_DELETE_ASK, message, date, time, getIp()); //申成知道-删除提问 提问者申成币-1,所有回答的人申成币-2 UserDao.updateUserMoney(getUser().getId(), MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ASK); User user = UserDao.getUserById(getUser().getId()); //创建申成币变动日志 BaseUtil.createOperateLog(user.getId(), OperateLogInterface.TYPE_SUNCARE_MONEY_CHANGE, "申成币变动 申成知道-删除提问 提问者" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ASK, date, time, getIp()); //刷新缓存 request.getSession().setAttribute(BaseInterface.USER_KEY, user); //公众账号给用户发一条消息 BaseUtil.createPublicMessage(PublicUserInterface.SUNCARE_OA_MESSAGE, user.getId(), "申成知道-删除提问[" + cloudKnowAsk.getQuestion() + "]成功,提问者申成币" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ASK + "!", getIp()); //根据 提问id 查 申成知道所有回答者id,distinct排除相同的 List<Integer> integerList = CloudKnowAnswerDao.queryCloudKnowAnswerUserIdsByAskId(askIdInt); for(Integer userInteger : integerList){ //申成知道-删除提问 提问者申成币-1,所有回答的人申成币-2 UserDao.updateUserMoney(userInteger.intValue(), MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ANSWER); //创建申成币变动日志 BaseUtil.createOperateLog(userInteger.intValue(), OperateLogInterface.TYPE_SUNCARE_MONEY_CHANGE, "申成币变动 申成知道-删除提问 回答者" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ANSWER, date, time, getIp()); //公众账号给用户发一条消息 BaseUtil.createPublicMessage(PublicUserInterface.SUNCARE_OA_MESSAGE, userInteger.intValue(), getUser().getName() + "申成知道-删除提问[" + cloudKnowAsk.getQuestion() + "]成功,回答者申成币" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ANSWER + "!", getIp()); //不是同一个人则通知 if(getUser().getId() != userInteger){ //普通用户触发给用户发一条消息 BaseUtil.createNormalMessage(getUser().getId(), userInteger, getUser().getName() + "删除了申成知道的提问[" + cloudKnowAsk.getQuestion() + "]", getIp()); //回答用户 User cloudKnowAnswerUser = UserDao.getUserById(userInteger.intValue()); //发邮件 if(StringUtils.isNotBlank(cloudKnowAnswerUser.getEmail())){ //邮件title String title = "申成门窗OA系统-删除了申成知道的提问"; //邮件内容 String content = cloudKnowAnswerUser.getName() + "你好:<br><br>" + getUser().getName() + "在申成门窗OA系统删除了申成知道的提问:[" + cloudKnowAsk.getQuestion() + "]<br><br>" + "祝您工作顺利!<br><br>" + "申成门窗OA系统"; //发送邮件 EmailUtils.sendEmail(title, content, cloudKnowAnswerUser.getEmail()); } } } return SUCCESS; } public String getAskId() { return askId; } public void setAskId(String askId) { this.askId = askId; } }
GB18030
Java
5,273
java
CloudKnowDeleteAskAction.java
Java
[ { "context": "t java.util.List;\n\n/**\n * 删除提问action\n *\n * @author Gxx\n * @module oa\n * @datetime 14-4-1 11:22\n */\npubli", "end": 413, "score": 0.9997044801712036, "start": 410, "tag": "USERNAME", "value": "Gxx" } ]
null
[]
package com.gxx.oa; import com.gxx.oa.dao.CloudKnowAnswerDao; import com.gxx.oa.dao.CloudKnowAskDao; import com.gxx.oa.dao.UserDao; import com.gxx.oa.entities.CloudKnowAsk; import com.gxx.oa.entities.User; import com.gxx.oa.interfaces.*; import com.gxx.oa.utils.BaseUtil; import com.gxx.oa.utils.EmailUtils; import org.apache.commons.lang.StringUtils; import java.util.List; /** * 删除提问action * * @author Gxx * @module oa * @datetime 14-4-1 11:22 */ public class CloudKnowDeleteAskAction extends BaseAction implements CloudKnowAskInterface { /** * 提问id */ private String askId; /** * 入口 * @return */ public String execute() throws Exception { logger.info("askId:" + askId); //判提问id不为空 if(StringUtils.isBlank(askId)){ message = "提问id不能为空!"; return ERROR; } // 提问idInt类型 int askIdInt = Integer.parseInt(askId); //判文档存在 CloudKnowAsk cloudKnowAsk = CloudKnowAskDao.getCloudKnowAskById(askIdInt); if(null == cloudKnowAsk || cloudKnowAsk.getUserId() != getUser().getId() || cloudKnowAsk.getState() != STATE_NORMAL){ message = "你的操作有误,请刷新页面重试!"; return ERROR; } //更新申成知道提问 cloudKnowAsk.setState(STATE_DELETE); cloudKnowAsk.setUpdateDate(date); cloudKnowAsk.setUpdateTime(time); cloudKnowAsk.setUpdateIp(getIp()); CloudKnowAskDao.updateCloudKnowAsk(cloudKnowAsk); message = "删除提问成功!"; //创建操作日志 BaseUtil.createOperateLog(getUser().getId(), OperateLogInterface.TYPE_CLOUD_KNOW_DELETE_ASK, message, date, time, getIp()); //申成知道-删除提问 提问者申成币-1,所有回答的人申成币-2 UserDao.updateUserMoney(getUser().getId(), MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ASK); User user = UserDao.getUserById(getUser().getId()); //创建申成币变动日志 BaseUtil.createOperateLog(user.getId(), OperateLogInterface.TYPE_SUNCARE_MONEY_CHANGE, "申成币变动 申成知道-删除提问 提问者" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ASK, date, time, getIp()); //刷新缓存 request.getSession().setAttribute(BaseInterface.USER_KEY, user); //公众账号给用户发一条消息 BaseUtil.createPublicMessage(PublicUserInterface.SUNCARE_OA_MESSAGE, user.getId(), "申成知道-删除提问[" + cloudKnowAsk.getQuestion() + "]成功,提问者申成币" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ASK + "!", getIp()); //根据 提问id 查 申成知道所有回答者id,distinct排除相同的 List<Integer> integerList = CloudKnowAnswerDao.queryCloudKnowAnswerUserIdsByAskId(askIdInt); for(Integer userInteger : integerList){ //申成知道-删除提问 提问者申成币-1,所有回答的人申成币-2 UserDao.updateUserMoney(userInteger.intValue(), MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ANSWER); //创建申成币变动日志 BaseUtil.createOperateLog(userInteger.intValue(), OperateLogInterface.TYPE_SUNCARE_MONEY_CHANGE, "申成币变动 申成知道-删除提问 回答者" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ANSWER, date, time, getIp()); //公众账号给用户发一条消息 BaseUtil.createPublicMessage(PublicUserInterface.SUNCARE_OA_MESSAGE, userInteger.intValue(), getUser().getName() + "申成知道-删除提问[" + cloudKnowAsk.getQuestion() + "]成功,回答者申成币" + MoneyInterface.ACT_CLOUD_KNOW_DELETE_ASK_TO_ANSWER + "!", getIp()); //不是同一个人则通知 if(getUser().getId() != userInteger){ //普通用户触发给用户发一条消息 BaseUtil.createNormalMessage(getUser().getId(), userInteger, getUser().getName() + "删除了申成知道的提问[" + cloudKnowAsk.getQuestion() + "]", getIp()); //回答用户 User cloudKnowAnswerUser = UserDao.getUserById(userInteger.intValue()); //发邮件 if(StringUtils.isNotBlank(cloudKnowAnswerUser.getEmail())){ //邮件title String title = "申成门窗OA系统-删除了申成知道的提问"; //邮件内容 String content = cloudKnowAnswerUser.getName() + "你好:<br><br>" + getUser().getName() + "在申成门窗OA系统删除了申成知道的提问:[" + cloudKnowAsk.getQuestion() + "]<br><br>" + "祝您工作顺利!<br><br>" + "申成门窗OA系统"; //发送邮件 EmailUtils.sendEmail(title, content, cloudKnowAnswerUser.getEmail()); } } } return SUCCESS; } public String getAskId() { return askId; } public void setAskId(String askId) { this.askId = askId; } }
5,273
0.607946
0.605326
122
36.549179
36.848629
168
false
false
0
0
0
0
0
0
0.622951
false
false
7
851d71a3da1d330fc4d6b388c6d104544ddfd61e
22,024,592,306,196
46d0cb9d4e082a1eae5179a97cfe602181cd4806
/jsweb-septiembre-4/app-domain/src/main/java/ar/com/educacionit/domain/clase4/idioma/IdiomaEspanol.java
31546a660962b8ec3e4e0063216cd447e4510b53
[]
no_license
Hernan1008/Septiembre
https://github.com/Hernan1008/Septiembre
5d154242238b774009de4740696f98a599c3a5af
7efbeb4a045df0bda1eb029c088cffd69e8b341e
refs/heads/main
2023-03-02T08:57:39.774000
2021-02-12T00:13:17
2021-02-12T00:13:17
338,185,917
0
0
null
false
2021-02-12T00:22:13
2021-02-12T00:07:52
2021-02-12T00:13:19
2021-02-12T00:22:13
0
0
0
1
Java
false
false
package ar.com.educacionit.domain.clase4.idioma; public class IdiomaEspanol implements IIdioma { @Override public String hablar() { return "dice hola"; } }
UTF-8
Java
174
java
IdiomaEspanol.java
Java
[]
null
[]
package ar.com.educacionit.domain.clase4.idioma; public class IdiomaEspanol implements IIdioma { @Override public String hablar() { return "dice hola"; } }
174
0.701149
0.695402
10
15.4
18.200001
48
false
false
0
0
0
0
0
0
0.7
false
false
7
83279d7361530a6bc7a7df127dc6098d2b6439f7
31,610,959,334,190
abb9d2f7fb4c424711c156fe2dc8548fb83043f0
/game/Kusinta/automaton/playerActions/ActionTurn.java
259fa00dd694358e589a882041efd5f71bc7bb14
[]
no_license
madebyfik/polytech-game-project-2020
https://github.com/madebyfik/polytech-game-project-2020
8452920503c39b907aec143ac1713a4cc4cd4650
18b02c2ea9596b51bcaa016351880dd25fe31e6e
refs/heads/master
2023-01-13T12:17:34.897000
2020-11-25T19:26:57
2020-11-25T19:26:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package playerActions; import automaton.*; public class ActionTurn extends Action { Direction m_dir; public ActionTurn(int percentage) { super(percentage); m_dir = Direction.R; } public ActionTurn(Direction direction, int percentage) { super(percentage); m_dir = direction; } @Override public boolean apply(Entity e) { return e.turn(m_dir); } }
UTF-8
Java
374
java
ActionTurn.java
Java
[]
null
[]
package playerActions; import automaton.*; public class ActionTurn extends Action { Direction m_dir; public ActionTurn(int percentage) { super(percentage); m_dir = Direction.R; } public ActionTurn(Direction direction, int percentage) { super(percentage); m_dir = direction; } @Override public boolean apply(Entity e) { return e.turn(m_dir); } }
374
0.703209
0.703209
24
14.583333
15.26684
57
false
false
0
0
0
0
0
0
1.291667
false
false
7
8216fd7179036cf8331fd75acde21be5864b8d3f
4,879,082,855,642
faa6ffa085f682871cb5fab4ac8ffeec6ca91b2a
/src/main/java/name/chabs/proxyapp/beans/ConfigBean.java
be7dddee37617d67aeaad1958073fb6c0f1b748d
[]
no_license
t-chab/noauth-proxy
https://github.com/t-chab/noauth-proxy
ecb45f90ef36f7376f73966309f77fb1e5e91213
b79ff24db7f6e92104c9ad588ca77f1b17fd600c
refs/heads/master
2021-11-27T06:11:04.994000
2015-08-19T05:29:37
2015-08-19T05:29:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package name.chabs.proxyapp.beans; import java.net.URL; /** * POJO which contains configuration properties */ public class ConfigBean { private final URL proxyUrl; private final int proxyPort; public ConfigBean(URL url, int port) { proxyUrl = url; proxyPort = port; } public URL getProxyUrl() { return proxyUrl; } public int getProxyPort() { return proxyPort; } }
UTF-8
Java
435
java
ConfigBean.java
Java
[]
null
[]
package name.chabs.proxyapp.beans; import java.net.URL; /** * POJO which contains configuration properties */ public class ConfigBean { private final URL proxyUrl; private final int proxyPort; public ConfigBean(URL url, int port) { proxyUrl = url; proxyPort = port; } public URL getProxyUrl() { return proxyUrl; } public int getProxyPort() { return proxyPort; } }
435
0.634483
0.634483
24
17.125
15.01475
47
false
false
0
0
0
0
0
0
0.375
false
false
7
b9e706e6e53ba1d0e9245953306c94b035c561be
4,690,104,345,931
1a71dcb6ac737a010d1669e0eb787dbb3b336613
/jigsaw-examples/example_unnamed-module-reflection-illegal-access/src/cpmain/pkgcpmain/MainCallingJavaDesktop.java
60cc70e5cc66cf62b4ebbd7509849a21b478fafb
[ "Apache-2.0" ]
permissive
accso/java9-jigsaw-examples
https://github.com/accso/java9-jigsaw-examples
c63fcf3ce6c4c9bdf5d6149459880a066c85c366
74029e9c370e31821d94893cf2a1374e7be29af6
refs/heads/master
2023-05-29T09:52:53.540000
2023-05-10T06:38:48
2023-05-10T06:38:48
66,267,939
36
14
Apache-2.0
false
2023-05-10T06:38:50
2016-08-22T11:45:11
2023-05-10T06:38:06
2023-05-10T06:38:49
10,295
33
13
0
Shell
false
false
package pkgcpmain; import java.lang.reflect.Constructor; /** * This class is on the classpath, i.e. in the unnamed module. */ public class MainCallingJavaDesktop { public static void main(String[] args) throws Exception { try { Class<?> clazz = Class.forName("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); // from module java.desktop Constructor<?> con = clazz.getDeclaredConstructor(); con.setAccessible(true); Object o = con.newInstance(); System.out.println(o.toString()); } catch (Throwable t) { t.printStackTrace(System.out); } } }
UTF-8
Java
597
java
MainCallingJavaDesktop.java
Java
[]
null
[]
package pkgcpmain; import java.lang.reflect.Constructor; /** * This class is on the classpath, i.e. in the unnamed module. */ public class MainCallingJavaDesktop { public static void main(String[] args) throws Exception { try { Class<?> clazz = Class.forName("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); // from module java.desktop Constructor<?> con = clazz.getDeclaredConstructor(); con.setAccessible(true); Object o = con.newInstance(); System.out.println(o.toString()); } catch (Throwable t) { t.printStackTrace(System.out); } } }
597
0.680067
0.680067
21
26.428572
27.934568
114
false
false
0
0
0
0
0
0
1.761905
false
false
7
1524b183c8832b3f367c82b0e34c701de0f6194d
6,923,487,336,420
19ec8c8cf31ec6cf4294c264cca93fbafe6de319
/NIA/src/main/java/com/aqm/testing/testDataEntity/MemberAttributesEntity.java
999200eb1a475df4e25536bb0f33ced72b829c09
[]
no_license
Prity1992/NIAcore
https://github.com/Prity1992/NIAcore
ec409e895d4c24a7c42a2ff0825a810cca354baa
d6ee44472b86604a59dcc7e73c364636cafc9f2b
refs/heads/master
2020-12-10T07:21:21.530000
2020-01-13T07:23:49
2020-01-13T07:23:49
233,533,455
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aqm.testing.testDataEntity; import com.aqm.framework.core.GenericEntity; public class MemberAttributesEntity extends GenericEntity { public MemberAttributesEntity() { super("MemberAttributesEntity"); // TODO Auto-generated constructor stub } }
UTF-8
Java
278
java
MemberAttributesEntity.java
Java
[]
null
[]
package com.aqm.testing.testDataEntity; import com.aqm.framework.core.GenericEntity; public class MemberAttributesEntity extends GenericEntity { public MemberAttributesEntity() { super("MemberAttributesEntity"); // TODO Auto-generated constructor stub } }
278
0.76259
0.76259
12
21.166666
21.524534
59
false
false
0
0
0
0
0
0
0.75
false
false
7
00c6b51efea180969acc480d0594dba9f2de5a2d
29,283,087,084,242
87ea35884d64d3faa914aa679b2ebbf2316b505e
/fachadas/fachadaCompraVenta.java
cdcffc034684e35d209f1e1628d2f0d0279e93c0
[]
no_license
DanielPinaM/Proyecto-IS-Java
https://github.com/DanielPinaM/Proyecto-IS-Java
456521cf7cfa48dd0859e6f5d95e70c59a21b71c
4805e52b3260b6dfdfafccd4441a95ae77ffa773
refs/heads/master
2022-01-13T02:12:24.671000
2019-07-10T10:24:42
2019-07-10T10:24:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fachadas; import java.io.IOException; import java.sql.SQLException; import java.util.List; import exception.CantidadSuperadaException; import exception.ValorNoExistenteException; import iFachadas.interfazCompraVenta; import iSASI.isasiCompraVenta; import modelodeDominio.Filtro; import modelodeDominio.Producto; import modelodeDominio.Venta; import sasi.sasiCompraVenta; public class fachadaCompraVenta implements interfazCompraVenta { protected isasiCompraVenta ISASICompraVenta; public fachadaCompraVenta(){ this.ISASICompraVenta = new sasiCompraVenta(); } @Override public void realizarPedidosProveedor(Producto calzados) throws SQLException, ValorNoExistenteException { this.ISASICompraVenta.realizarPedidosProveedor(calzados); } @Override public void realizarDevolucion(Producto producto, String idUsuario) throws Exception { this.ISASICompraVenta.realizarDevolucion(producto, idUsuario); } @Override public List<Producto> filtrar(Filtro f) throws SQLException { return this.ISASICompraVenta.filtrar(f); } @Override public List<Venta> consultarRegistroVentas(String mes, String Aņo, String dia, String nick) throws IOException, SQLException { return this.ISASICompraVenta.consultarRegistroVentas(mes, Aņo, dia, nick); } @Override public int consultarPuntos(String idCliente) throws SQLException { return this.ISASICompraVenta.consultarPuntos(idCliente); } @Override public void realizarCompra(String idUsuario) throws IOException, SQLException { this.ISASICompraVenta.realizarCompra(idUsuario); } @Override public void canjearPuntos(String idUsuario) throws SQLException { this.ISASICompraVenta.canjearPuntos(idUsuario); //Notificar a la gui } public void aceptarPedido(String idUsuario) throws SQLException{ this.ISASICompraVenta.aceptarPedido(idUsuario); } public List<Producto> consultarCarrito() throws SQLException{ return this.ISASICompraVenta.consultarCarrito(); } public List<Venta> consultarRegistroVentas() throws IOException, SQLException{ return this.ISASICompraVenta.consultarRegistroVentas(); } public List<Producto> consultarPedidos() throws SQLException{ return this.ISASICompraVenta.consultarPedidos(); } @Override public void carrito(Producto producto) throws SQLException, CantidadSuperadaException { this.ISASICompraVenta.carrito(producto); } public void eliminaCarrito(Producto producto) throws SQLException, CantidadSuperadaException{ this.ISASICompraVenta.eliminaCarrito(producto); } }
ISO-8859-10
Java
2,624
java
fachadaCompraVenta.java
Java
[]
null
[]
package fachadas; import java.io.IOException; import java.sql.SQLException; import java.util.List; import exception.CantidadSuperadaException; import exception.ValorNoExistenteException; import iFachadas.interfazCompraVenta; import iSASI.isasiCompraVenta; import modelodeDominio.Filtro; import modelodeDominio.Producto; import modelodeDominio.Venta; import sasi.sasiCompraVenta; public class fachadaCompraVenta implements interfazCompraVenta { protected isasiCompraVenta ISASICompraVenta; public fachadaCompraVenta(){ this.ISASICompraVenta = new sasiCompraVenta(); } @Override public void realizarPedidosProveedor(Producto calzados) throws SQLException, ValorNoExistenteException { this.ISASICompraVenta.realizarPedidosProveedor(calzados); } @Override public void realizarDevolucion(Producto producto, String idUsuario) throws Exception { this.ISASICompraVenta.realizarDevolucion(producto, idUsuario); } @Override public List<Producto> filtrar(Filtro f) throws SQLException { return this.ISASICompraVenta.filtrar(f); } @Override public List<Venta> consultarRegistroVentas(String mes, String Aņo, String dia, String nick) throws IOException, SQLException { return this.ISASICompraVenta.consultarRegistroVentas(mes, Aņo, dia, nick); } @Override public int consultarPuntos(String idCliente) throws SQLException { return this.ISASICompraVenta.consultarPuntos(idCliente); } @Override public void realizarCompra(String idUsuario) throws IOException, SQLException { this.ISASICompraVenta.realizarCompra(idUsuario); } @Override public void canjearPuntos(String idUsuario) throws SQLException { this.ISASICompraVenta.canjearPuntos(idUsuario); //Notificar a la gui } public void aceptarPedido(String idUsuario) throws SQLException{ this.ISASICompraVenta.aceptarPedido(idUsuario); } public List<Producto> consultarCarrito() throws SQLException{ return this.ISASICompraVenta.consultarCarrito(); } public List<Venta> consultarRegistroVentas() throws IOException, SQLException{ return this.ISASICompraVenta.consultarRegistroVentas(); } public List<Producto> consultarPedidos() throws SQLException{ return this.ISASICompraVenta.consultarPedidos(); } @Override public void carrito(Producto producto) throws SQLException, CantidadSuperadaException { this.ISASICompraVenta.carrito(producto); } public void eliminaCarrito(Producto producto) throws SQLException, CantidadSuperadaException{ this.ISASICompraVenta.eliminaCarrito(producto); } }
2,624
0.780702
0.780702
91
26.813187
30.371296
127
false
false
0
0
0
0
0
0
1.373626
false
false
7
6390f68b6dcdbe6ca380c3db19c810f2c98dc7a6
28,406,913,745,494
13ca1b6d8e429889a79d57b7186bb73592fd2185
/src/main/java/com/gopher/system/model/Customer.java
9335771d1088b3a62df7e3730f50556a61a457b7
[]
no_license
nukcydong/system
https://github.com/nukcydong/system
43fd6ea2c29f33205934b9051876a2743d91002f
b09effcade8e2c4ebdc6f3a51db9a7173a416cae
refs/heads/master
2020-04-01T00:37:01.230000
2019-03-26T04:59:10
2019-03-26T04:59:10
152,704,883
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gopher.system.model; public class Customer extends BaseModel { private static final long serialVersionUID = 3832160238061757765L; /** * 客户名称 */ private String name; /** * 客户描述 */ private String description; /** * 手机号码 */ private String mobilePhone; /** * 固定电话 */ private String telephone; /** * 微信号码 */ private String wechat; private String qq; /** * @see com.gopher.system.constant.State */ private int state; public int getState() { return state; } public void setState(int state) { this.state = state; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getMobilePhone() { return mobilePhone; } public void setMobilePhone(String mobilePhone) { this.mobilePhone = mobilePhone; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getWechat() { return wechat; } public void setWechat(String wechat) { this.wechat = wechat; } public String getQq() { return qq; } public void setQq(String qq) { this.qq = qq; } }
UTF-8
Java
1,450
java
Customer.java
Java
[]
null
[]
package com.gopher.system.model; public class Customer extends BaseModel { private static final long serialVersionUID = 3832160238061757765L; /** * 客户名称 */ private String name; /** * 客户描述 */ private String description; /** * 手机号码 */ private String mobilePhone; /** * 固定电话 */ private String telephone; /** * 微信号码 */ private String wechat; private String qq; /** * @see com.gopher.system.constant.State */ private int state; public int getState() { return state; } public void setState(int state) { this.state = state; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getMobilePhone() { return mobilePhone; } public void setMobilePhone(String mobilePhone) { this.mobilePhone = mobilePhone; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getWechat() { return wechat; } public void setWechat(String wechat) { this.wechat = wechat; } public String getQq() { return qq; } public void setQq(String qq) { this.qq = qq; } }
1,450
0.63617
0.622695
88
14.022727
15.134231
67
false
false
0
0
0
0
0
0
1.193182
false
false
7
b225b5ca7810f3c287209a335bc35850a557d1fd
19,292,993,155,940
7e215a5ffa7a78bcac818269ef474a4671ab8c12
/MySystemClock/app/src/main/java/com/example/mysystemclock/MainActivity.java
e1b7fd3b9f5e1ae9314d9ee9585d90d73c9d68f5
[]
no_license
rekafekili/MobileProgramming
https://github.com/rekafekili/MobileProgramming
44f853ad066ee913defd9b5e8687a3f94db54619
e51aaef8de6c45fbdd7e9f6a0df9ce3fc085cd55
refs/heads/master
2021-03-30T01:29:27.512000
2020-06-17T13:05:30
2020-06-17T13:05:30
248,001,868
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mysystemclock; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; /** * 정확한 시간이 표시되는 스톱워치를 만들려고 함. ("SystemClock" 사용함) */ public class MainActivity extends AppCompatActivity { private TextView tvMillis; private TextView tvSecond; private TextView tvMinute; private TextView tvHour; private LinearLayout linearLapList; private FloatingActionButton fabAction, fabReset; private ExtendedFloatingActionButton fabLap; private Handler handler = new Handler(); private boolean isRunning; private int hour; private int minute; private int sec; // 화면에 표시할 초 private int millis; // 화면에 표시할 밀리초 private int lap = 0; private long startTime; // 시작 버튼 누른 시점 (혹은 재시작 누른 시점) private long elapsedTime; // 최신 측정 시간 (시작 버튼 누른 이후 현재까지 경과 시간) private long totalElapsedTime; // 전체 측정 시간 (pause 누를때 elapsedTime 누적시킴) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); // 시작, 재시작 버튼 이벤트 처리 fabAction.setOnClickListener((v) -> { isRunning = !isRunning; if(isRunning) { start(); } else { pause(); } }); // 랩타임 기록 이벤트 처리 fabLap.setOnClickListener((v) -> { if(isRunning){ recordLapTime(); } else { Toast.makeText(this, "Please, Start Stopwatch", Toast.LENGTH_SHORT).show(); } }); // 리셋 이벤트 처리 fabReset.setOnClickListener((v) -> { reset(); }); } private void initView() { tvHour = findViewById(R.id.main_hour_textview); tvMinute = findViewById(R.id.main_minute_textview); tvSecond = findViewById(R.id.main_second_textview); tvMillis = findViewById(R.id.main_millisec_textview); linearLapList = findViewById(R.id.main_lap_list_linearlayout); fabAction = findViewById(R.id.main_action_floationbutton); fabLap = findViewById(R.id.main_laps_extended_floatingbutton); fabReset = findViewById(R.id.main_reset_floationbutton); } private void recordLapTime() { TextView textView = new TextView(this); lap++; textView.setText(String.format("%02d LAP : %02d:%02d:%02d.%02d", lap, hour, minute, sec, millis)); textView.setTextSize(20); textView.setWidth(MATCH_PARENT); textView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); linearLapList.addView(textView, 0); } private void reset() { totalElapsedTime = 0L; lap = 0; isRunning = false; fabAction.setImageResource(R.drawable.ic_play_arrow_black_24dp); linearLapList.removeAllViews(); handler.removeCallbacks(timeUpdater); // 대기중인 Runnable post 삭제 handler.post(() -> { tvHour.setText("00:"); tvHour.setTextColor(getResources().getColor(R.color.darker_gray)); tvMinute.setText("00:"); tvMinute.setTextColor(getResources().getColor(R.color.darker_gray)); tvSecond.setText("00"); tvMillis.setText(".00"); }); } private void pause() { // 버튼 모양을 재생으로 변경 fabAction.setImageResource(R.drawable.ic_play_arrow_black_24dp); // 마지막 "elapsedTime"을 추가 totalElapsedTime += elapsedTime; handler.removeCallbacks(timeUpdater); } private void start() { // 버튼 모양을 일시정지로 변경 fabAction.setImageResource(R.drawable.ic_pause_black_24dp); // 부팅 이후 경과 시간 -> ms startTime = SystemClock.uptimeMillis(); // UI 업데이트 하려고 함. handler.post(timeUpdater); } Runnable timeUpdater = new Runnable() { @Override public void run() { // Start 혹은 Restart 후 얼마나 경과했는지 측정 elapsedTime = SystemClock.uptimeMillis() - startTime; // 마지막 누적 측정 시간에 최근 경과 시간을 더해서 화면에 표시한 시간을 계산 long updateTime = totalElapsedTime + elapsedTime; // 1/100초 까지만 표시 millis = (int)(updateTime % 1000) / 10; sec = (int)(updateTime / 1000) % 60; minute = (int)(updateTime / 1000) / 60; if(minute > 0) { tvMinute.setTextColor(Color.BLACK); tvMinute.setText(String.format("%02d:", minute)); } hour = minute / 60; if(hour > 0) { tvMinute.setTextColor(Color.BLACK); tvMinute.setText(String.format("%02d:", hour)); } tvSecond.setText(String.format("%02d", sec)); tvMillis.setText(String.format(".%02d", millis)); handler.post(this); // 다시 시간 측정과 UI 업데이트 요청. 무한루프개념. 여전히 다른 쓰레드도 동시 실행되니 문제 없음 } }; }
UTF-8
Java
5,860
java
MainActivity.java
Java
[]
null
[]
package com.example.mysystemclock; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; /** * 정확한 시간이 표시되는 스톱워치를 만들려고 함. ("SystemClock" 사용함) */ public class MainActivity extends AppCompatActivity { private TextView tvMillis; private TextView tvSecond; private TextView tvMinute; private TextView tvHour; private LinearLayout linearLapList; private FloatingActionButton fabAction, fabReset; private ExtendedFloatingActionButton fabLap; private Handler handler = new Handler(); private boolean isRunning; private int hour; private int minute; private int sec; // 화면에 표시할 초 private int millis; // 화면에 표시할 밀리초 private int lap = 0; private long startTime; // 시작 버튼 누른 시점 (혹은 재시작 누른 시점) private long elapsedTime; // 최신 측정 시간 (시작 버튼 누른 이후 현재까지 경과 시간) private long totalElapsedTime; // 전체 측정 시간 (pause 누를때 elapsedTime 누적시킴) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); // 시작, 재시작 버튼 이벤트 처리 fabAction.setOnClickListener((v) -> { isRunning = !isRunning; if(isRunning) { start(); } else { pause(); } }); // 랩타임 기록 이벤트 처리 fabLap.setOnClickListener((v) -> { if(isRunning){ recordLapTime(); } else { Toast.makeText(this, "Please, Start Stopwatch", Toast.LENGTH_SHORT).show(); } }); // 리셋 이벤트 처리 fabReset.setOnClickListener((v) -> { reset(); }); } private void initView() { tvHour = findViewById(R.id.main_hour_textview); tvMinute = findViewById(R.id.main_minute_textview); tvSecond = findViewById(R.id.main_second_textview); tvMillis = findViewById(R.id.main_millisec_textview); linearLapList = findViewById(R.id.main_lap_list_linearlayout); fabAction = findViewById(R.id.main_action_floationbutton); fabLap = findViewById(R.id.main_laps_extended_floatingbutton); fabReset = findViewById(R.id.main_reset_floationbutton); } private void recordLapTime() { TextView textView = new TextView(this); lap++; textView.setText(String.format("%02d LAP : %02d:%02d:%02d.%02d", lap, hour, minute, sec, millis)); textView.setTextSize(20); textView.setWidth(MATCH_PARENT); textView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); linearLapList.addView(textView, 0); } private void reset() { totalElapsedTime = 0L; lap = 0; isRunning = false; fabAction.setImageResource(R.drawable.ic_play_arrow_black_24dp); linearLapList.removeAllViews(); handler.removeCallbacks(timeUpdater); // 대기중인 Runnable post 삭제 handler.post(() -> { tvHour.setText("00:"); tvHour.setTextColor(getResources().getColor(R.color.darker_gray)); tvMinute.setText("00:"); tvMinute.setTextColor(getResources().getColor(R.color.darker_gray)); tvSecond.setText("00"); tvMillis.setText(".00"); }); } private void pause() { // 버튼 모양을 재생으로 변경 fabAction.setImageResource(R.drawable.ic_play_arrow_black_24dp); // 마지막 "elapsedTime"을 추가 totalElapsedTime += elapsedTime; handler.removeCallbacks(timeUpdater); } private void start() { // 버튼 모양을 일시정지로 변경 fabAction.setImageResource(R.drawable.ic_pause_black_24dp); // 부팅 이후 경과 시간 -> ms startTime = SystemClock.uptimeMillis(); // UI 업데이트 하려고 함. handler.post(timeUpdater); } Runnable timeUpdater = new Runnable() { @Override public void run() { // Start 혹은 Restart 후 얼마나 경과했는지 측정 elapsedTime = SystemClock.uptimeMillis() - startTime; // 마지막 누적 측정 시간에 최근 경과 시간을 더해서 화면에 표시한 시간을 계산 long updateTime = totalElapsedTime + elapsedTime; // 1/100초 까지만 표시 millis = (int)(updateTime % 1000) / 10; sec = (int)(updateTime / 1000) % 60; minute = (int)(updateTime / 1000) / 60; if(minute > 0) { tvMinute.setTextColor(Color.BLACK); tvMinute.setText(String.format("%02d:", minute)); } hour = minute / 60; if(hour > 0) { tvMinute.setTextColor(Color.BLACK); tvMinute.setText(String.format("%02d:", hour)); } tvSecond.setText(String.format("%02d", sec)); tvMillis.setText(String.format(".%02d", millis)); handler.post(this); // 다시 시간 측정과 UI 업데이트 요청. 무한루프개념. 여전히 다른 쓰레드도 동시 실행되니 문제 없음 } }; }
5,860
0.612318
0.600337
158
32.810127
23.739662
106
false
false
0
0
0
0
0
0
0.664557
false
false
7
ba785055be540c37160054466cd3bcdd50b6a96d
24,395,414,278,332
eb5c21d53e4b32f0e599ac0e0c07058f654d2510
/SisuNetworkProtocol/src/NetworkNode.java
9aa2919aa345f8d1742f259aaeb0ae90590e6c9e
[]
no_license
rusty2hip292/workspace
https://github.com/rusty2hip292/workspace
ee3bc9ff5e17e0d88400c485a09c5aa92d01a5c4
2504da31a3c7ee2ea78b6b95c96fea8e65d4cc3b
refs/heads/master
2020-03-28T19:00:05.172000
2018-09-15T20:12:12
2018-09-15T20:12:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public abstract class NetworkNode { private NetworkConnection[] connections = new NetworkConnection[256]; private String networkName; private String name; public NetworkNode(NetworkNode parent) { } public NetworkNode(String networkName) { this.networkName = networkName + ":"; } public String read(int connectionNumber) { if(connectionNumber < 0 || connectionNumber >= connections.length) { return null; } NetworkConnection c = connections[connectionNumber]; if(c == null) { return null; } return c.read(this); } }
UTF-8
Java
560
java
NetworkNode.java
Java
[]
null
[]
public abstract class NetworkNode { private NetworkConnection[] connections = new NetworkConnection[256]; private String networkName; private String name; public NetworkNode(NetworkNode parent) { } public NetworkNode(String networkName) { this.networkName = networkName + ":"; } public String read(int connectionNumber) { if(connectionNumber < 0 || connectionNumber >= connections.length) { return null; } NetworkConnection c = connections[connectionNumber]; if(c == null) { return null; } return c.read(this); } }
560
0.708929
0.701786
27
19.703703
21.670624
70
false
false
0
0
0
0
0
0
1.740741
false
false
7
ca76bc74078daf5afe9928dc05d7df9f432d97fd
687,194,769,992
b8332ff21523210a5377a485dcc0a5757f4a4d61
/app/src/main/java/com/youjing/yjeducation/ui/dispaly/activity/AYJTodayProfitActivity.java
cf5939eca44b05039dc4e1def7c0c8cdea870917
[]
no_license
sun529417168/youjingmain
https://github.com/sun529417168/youjingmain
c59e54c8d53112ca53e105db011a56ef59ad9266
ae575c5bafedcef57008faf9738d96192a70e8fb
refs/heads/master
2021-01-21T18:21:22.632000
2017-05-22T09:30:50
2017-05-22T09:30:50
92,035,873
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.youjing.yjeducation.ui.dispaly.activity; import android.view.View; import com.youjing.yjeducation.R; import com.youjing.yjeducation.core.YJBaseActivity; import com.youjing.yjeducation.core.YJTitleLayoutController; import org.vwork.mobile.ui.delegate.IVClickDelegate; import org.vwork.mobile.ui.utils.VLayoutTag; /** * user 秦伟宁 * Date 2016/3/31 * Time 20:58 */ @VLayoutTag(R.layout.activity_today_profit) public class AYJTodayProfitActivity extends YJBaseActivity implements IVClickDelegate{ @Override protected void onLoadedView() { YJTitleLayoutController.initTitleBuleBg(this, "今日收益", true); } @Override public void onClick(View view) { } }
UTF-8
Java
712
java
AYJTodayProfitActivity.java
Java
[ { "context": "g.vwork.mobile.ui.utils.VLayoutTag;\n\n/**\n * user 秦伟宁\n * Date 2016/3/31\n * Time 20:58\n */\n@VLayoutTag(R", "end": 344, "score": 0.995396614074707, "start": 341, "tag": "NAME", "value": "秦伟宁" } ]
null
[]
package com.youjing.yjeducation.ui.dispaly.activity; import android.view.View; import com.youjing.yjeducation.R; import com.youjing.yjeducation.core.YJBaseActivity; import com.youjing.yjeducation.core.YJTitleLayoutController; import org.vwork.mobile.ui.delegate.IVClickDelegate; import org.vwork.mobile.ui.utils.VLayoutTag; /** * user 秦伟宁 * Date 2016/3/31 * Time 20:58 */ @VLayoutTag(R.layout.activity_today_profit) public class AYJTodayProfitActivity extends YJBaseActivity implements IVClickDelegate{ @Override protected void onLoadedView() { YJTitleLayoutController.initTitleBuleBg(this, "今日收益", true); } @Override public void onClick(View view) { } }
712
0.762178
0.746418
28
23.928572
24.367615
86
false
false
0
0
0
0
0
0
0.357143
false
false
7
a8d8d4346db1b7377f4f9f4eacfdc7b90cdae091
28,965,259,492,496
834fe532cf37615b99430d7eaf22f635acc44714
/AULA004/src/br/com/cursojava/aula004/ModoInverso.java
0edd3a9823da03750a3b4063646f83c6a6c8ac67
[]
no_license
ZeusSchmitz/transpoBrasilAulaGerall
https://github.com/ZeusSchmitz/transpoBrasilAulaGerall
dfcc29c9af48339107f80084b0ff50efc926c73a
9dc00fe2e7c73c66d1fee004794a8a4fad78d401
refs/heads/master
2020-03-28T22:05:21.307000
2018-11-10T18:18:01
2018-11-10T18:18:01
149,204,409
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.cursojava.aula004; import java.util.Scanner; public class ModoInverso { public static void main(String[] args) { Scanner teclado = new Scanner(System.in); System.out.println("Digite uma palavra"); String palavra = teclado.nextLine().replace(" ", ""); String plvrInvert = ""; int numLetras = palavra.length()-1; if (numLetras > -1) { do { plvrInvert += palavra.charAt(numLetras--); //numLetras--; } while (numLetras >= 0); } System.out.println("O inverso da palavra é: " + plvrInvert); teclado.close(); } }
WINDOWS-1252
Java
563
java
ModoInverso.java
Java
[]
null
[]
package br.com.cursojava.aula004; import java.util.Scanner; public class ModoInverso { public static void main(String[] args) { Scanner teclado = new Scanner(System.in); System.out.println("Digite uma palavra"); String palavra = teclado.nextLine().replace(" ", ""); String plvrInvert = ""; int numLetras = palavra.length()-1; if (numLetras > -1) { do { plvrInvert += palavra.charAt(numLetras--); //numLetras--; } while (numLetras >= 0); } System.out.println("O inverso da palavra é: " + plvrInvert); teclado.close(); } }
563
0.654804
0.644128
23
23.434782
19.016758
62
false
false
0
0
0
0
0
0
2.173913
false
false
7
250a54f12e6d55ab942d9de1deecbdb824a38b77
32,126,355,436,051
1e6fe808473cb362533b67fe547d2564090db343
/test/storeTest/MemberStoreLogicTest.java
ccc6f0960afa0fa3b858091580f5e78b07383619
[]
no_license
ssoooo/Kosta162
https://github.com/ssoooo/Kosta162
b4db25b361d711c09d30a4c8a529b6e5f28e536c
6e26a9034e5a3779ef1571644d438adfa84e6baa
refs/heads/master
2021-08-28T00:59:25.095000
2017-12-10T20:02:19
2017-12-10T20:02:19
111,880,862
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package storeTest; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import GeneralAffairs.domain.Member; import GeneralAffairs.store.MemberStore; import GeneralAffairs.store.logic.MemberStoreLogic; public class MemberStoreLogicTest { private MemberStore store; @Before public void setUp() { store = new MemberStoreLogic(); } // //testOK // @Test // public void testRegistMember() { // Member member = new Member(); // member.setAccount("111-233"); // member.setEmail("e1111f@nsdfe.com"); // member.setMemberId("성우형"); // member.setName("우형"); // member.setNickname("닉네임"); // member.setPassword("1234"); // member.setPhoneNumber("010-1119-2209"); // // store.registMember(member); // } // // //testOk // @Test // public void testUpdateMember() { // Member member = new Member(); // member.setAccount("111231-23"); // member.setEmail("test@nsdfe.com"); // member.setMemberId("수정양희수"); // member.setName("수정희수111"); // member.setNickname("수정닉네임"); // member.setPassword("수정123"); // member.setPhoneNumber("수정010-0909-0909"); // // store.updateMember(member); // assertEquals("수정희수111", member.getName()); // } // // //testOK // @Test // public void testDeleteMember() { // store.deleteMember("양희수"); // } // // //testOk // @Test // public void testRetrieveMemberById() { // Member member = new Member(); // member = store.retrieveMemberById("수정양희수"); // assertEquals("수정닉네임", member.getNickname()); // } // //testOK @Test public void testRetrieveAllMembersByGroup() { List<Member> list = new ArrayList<Member>(); list = store.retrieveAllMembersByGroup(1); assertEquals(4, list.size()); } //testOK // @Test // public void testRetrieveMembersByEvent() { // List<Member> list = new ArrayList<Member>(); // list = store.retrieveMembersByEvent(8); // // assertEquals(3, list.size()); // } //testOK(파라미터값변경) // @Test // public void testUpdateGrade() { // String memberId = "양희수"; // int groupId = 1; // String grade = "총무"; // // // assertTrue(store.updateGrade(memberId, groupId, grade)>0); // } // //testOK // @Test // public void testRegistReqSignInMember() { // String memberId = "민지"; // int groupId = 5; // store.registReqSignInMember(memberId, groupId); // } // //testOk // @Test // public void testDeleteSignInGroupReq() { // String memberId = "성우형"; // int groupId = 1; // store.deleteSignInGroupReq(memberId, groupId); // } // //testOk 리턴값 arrayList<Integer>로 바꿈. // @Test // public void testCheckMemberHasGroup() { // ArrayList<Integer> list = new ArrayList<Integer>(); // String memberId = "양희수"; // list = store.checkMemberHasGroup(memberId); // assertEquals(2, list.size()); // } // //testOk // @Test // public void testRetrieveAllSignInGroupReq() { // List<Member> list = new ArrayList<Member>(); // list = store.retrieveAllSignInGroupReq(5); // assertEquals(3, list.size()); // } }
UTF-8
Java
3,104
java
MemberStoreLogicTest.java
Java
[ { "context": "ember.setAccount(\"111-233\");\n//\t\tmember.setEmail(\"e1111f@nsdfe.com\");\n//\t\tmember.setMemberId(\"성우형\");\n//\t\tmember.setN", "end": 587, "score": 0.9999055862426758, "start": 571, "tag": "EMAIL", "value": "e1111f@nsdfe.com" }, { "context": "mail(\"e1111f@nsdfe.com\");\n//\t\tmember.setMemberId(\"성우형\");\n//\t\tmember.setName(\"우형\");\n//\t\tmember.setNickna", "end": 618, "score": 0.9969003200531006, "start": 615, "tag": "USERNAME", "value": "성우형" }, { "context": "/\t\tmember.setMemberId(\"성우형\");\n//\t\tmember.setName(\"우형\");\n//\t\tmember.setNickname(\"닉네임\");\n//\t\tmember.setP", "end": 644, "score": 0.682974100112915, "start": 642, "tag": "USERNAME", "value": "우형" }, { "context": "ember.setNickname(\"닉네임\");\n//\t\tmember.setPassword(\"1234\");\n//\t\tmember.setPhoneNumber(\"010-1119-2209\");\n//", "end": 707, "score": 0.9994325041770935, "start": 703, "tag": "PASSWORD", "value": "1234" }, { "context": "ber.setAccount(\"111231-23\");\n//\t\tmember.setEmail(\"test@nsdfe.com\");\n//\t\tmember.setMemberId(\"수정양희수\");\n//\t\tmember.se", "end": 962, "score": 0.9999194741249084, "start": 948, "tag": "EMAIL", "value": "test@nsdfe.com" }, { "context": "tEmail(\"test@nsdfe.com\");\n//\t\tmember.setMemberId(\"수정양희수\");\n//\t\tmember.setName(\"수정희수111\");\n//\t\tmember.setN", "end": 995, "score": 0.9600967168807983, "start": 990, "tag": "USERNAME", "value": "수정양희수" }, { "context": "\tmember.setMemberId(\"수정양희수\");\n//\t\tmember.setName(\"수정희수111\");\n//\t\tmember.setNickname(\"수정닉네임\");\n//\t\tmember.se", "end": 1026, "score": 0.8578161001205444, "start": 1019, "tag": "USERNAME", "value": "수정희수111" }, { "context": "ember.setName(\"수정희수111\");\n//\t\tmember.setNickname(\"수정닉네임\");\n//\t\tmember.setPassword(\"수정123\");\n//\t\tmembe", "end": 1055, "score": 0.714059591293335, "start": 1054, "tag": "USERNAME", "value": "수" }, { "context": "er.setName(\"수정희수111\");\n//\t\tmember.setNickname(\"수정닉네임\");\n//\t\tmember.setPassword(\"수정123\");\n//\t\tmember.s", "end": 1058, "score": 0.5336877703666687, "start": 1057, "tag": "NAME", "value": "네" }, { "context": "ber.setNickname(\"수정닉네임\");\n//\t\tmember.setPassword(\"수정123\");\n//\t\tmember.setPhoneNumber(\"수정010-0909-0909\");\n", "end": 1092, "score": 0.9994639158248901, "start": 1087, "tag": "PASSWORD", "value": "수정123" }, { "context": "void testDeleteMember() {\n//\t\tstore.deleteMember(\"양희수\");\n//\t}\n//\n//\t//testOk\n//\t@Test\n//\tpublic void te", "end": 1318, "score": 0.6951145529747009, "start": 1315, "tag": "NAME", "value": "양희수" }, { "context": " Member();\n//\t\tmember = store.retrieveMemberById(\"수정양희수\");\n//\t\tassertEquals(\"수정닉네임\", member.getNickname()", "end": 1471, "score": 0.9964745044708252, "start": 1466, "tag": "NAME", "value": "수정양희수" }, { "context": "c void testUpdateGrade() {\n//\t\tString memberId = \"양희수\";\n//\t\tint groupId = 1;\n//\t\tString grade = \"총무\";\n/", "end": 2016, "score": 0.9954211711883545, "start": 2013, "tag": "NAME", "value": "양희수" }, { "context": "tRegistReqSignInMember() {\n//\t\tString memberId = \"민지\";\n//\t\tint groupId = 5;\n//\t\tstore.registReqSignInM", "end": 2236, "score": 0.9835289120674133, "start": 2234, "tag": "NAME", "value": "민지" }, { "context": "stDeleteSignInGroupReq() {\n//\t\tString memberId = \"성우형\";\n//\t\tint groupId = 1;\n//\t\tstore.deleteSignInGrou", "end": 2410, "score": 0.9683496356010437, "start": 2407, "tag": "NAME", "value": "성우형" }, { "context": " new ArrayList<Integer>();\n//\t\tString memberId = \"양희수\";\n//\t\tlist = store.checkMemberHasGroup(memberId);", "end": 2666, "score": 0.7167918682098389, "start": 2663, "tag": "USERNAME", "value": "양희수" } ]
null
[]
package storeTest; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import GeneralAffairs.domain.Member; import GeneralAffairs.store.MemberStore; import GeneralAffairs.store.logic.MemberStoreLogic; public class MemberStoreLogicTest { private MemberStore store; @Before public void setUp() { store = new MemberStoreLogic(); } // //testOK // @Test // public void testRegistMember() { // Member member = new Member(); // member.setAccount("111-233"); // member.setEmail("<EMAIL>"); // member.setMemberId("성우형"); // member.setName("우형"); // member.setNickname("닉네임"); // member.setPassword("<PASSWORD>"); // member.setPhoneNumber("010-1119-2209"); // // store.registMember(member); // } // // //testOk // @Test // public void testUpdateMember() { // Member member = new Member(); // member.setAccount("111231-23"); // member.setEmail("<EMAIL>"); // member.setMemberId("수정양희수"); // member.setName("수정희수111"); // member.setNickname("수정닉네임"); // member.setPassword("<PASSWORD>"); // member.setPhoneNumber("수정010-0909-0909"); // // store.updateMember(member); // assertEquals("수정희수111", member.getName()); // } // // //testOK // @Test // public void testDeleteMember() { // store.deleteMember("양희수"); // } // // //testOk // @Test // public void testRetrieveMemberById() { // Member member = new Member(); // member = store.retrieveMemberById("수정양희수"); // assertEquals("수정닉네임", member.getNickname()); // } // //testOK @Test public void testRetrieveAllMembersByGroup() { List<Member> list = new ArrayList<Member>(); list = store.retrieveAllMembersByGroup(1); assertEquals(4, list.size()); } //testOK // @Test // public void testRetrieveMembersByEvent() { // List<Member> list = new ArrayList<Member>(); // list = store.retrieveMembersByEvent(8); // // assertEquals(3, list.size()); // } //testOK(파라미터값변경) // @Test // public void testUpdateGrade() { // String memberId = "양희수"; // int groupId = 1; // String grade = "총무"; // // // assertTrue(store.updateGrade(memberId, groupId, grade)>0); // } // //testOK // @Test // public void testRegistReqSignInMember() { // String memberId = "민지"; // int groupId = 5; // store.registReqSignInMember(memberId, groupId); // } // //testOk // @Test // public void testDeleteSignInGroupReq() { // String memberId = "성우형"; // int groupId = 1; // store.deleteSignInGroupReq(memberId, groupId); // } // //testOk 리턴값 arrayList<Integer>로 바꿈. // @Test // public void testCheckMemberHasGroup() { // ArrayList<Integer> list = new ArrayList<Integer>(); // String memberId = "양희수"; // list = store.checkMemberHasGroup(memberId); // assertEquals(2, list.size()); // } // //testOk // @Test // public void testRetrieveAllSignInGroupReq() { // List<Member> list = new ArrayList<Member>(); // list = store.retrieveAllSignInGroupReq(5); // assertEquals(3, list.size()); // } }
3,095
0.666554
0.644976
129
21.992249
17.163372
62
false
false
0
0
0
0
0
0
1.744186
false
false
7
f4966976610090153be596842a7f37377aabc4ee
32,195,074,911,832
b6c985bd9f493135c4de109f3ad78d38a3059c65
/src/viewer/src/geostreams/image/IImage.java
86f9c9ba5dacabd7e0063d7b7b5f4428c276a1ac
[]
no_license
qjhart/qjhart.geostreams
https://github.com/qjhart/qjhart.geostreams
4a80d85912cb6cdfb004017c841e3902f898fad5
7d5ec6a056ce43d2250553b99c7559f15db1d5fb
refs/heads/master
2021-01-10T18:46:48.653000
2015-03-19T00:13:33
2015-03-19T00:13:33
32,489,398
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package geostreams.image; import java.awt.image.BufferedImage; /** * Interface of images coming in a stream. * * @author Carlos Rueda-Velasquez * @version $Id: IImage.java,v 1.9 2007/06/13 00:08:43 crueda Exp $ */ public interface IImage { /** gets the starting x location. */ public int getX(); /** gets the starting y location. */ public int getY(); /** gets the width in pixels of this image. */ public int getWidth(); /** gets the height in pixels of this image. */ public int getHeight(); /** is this image null? */ public boolean isNull(); /** Creates a shallow copy of this image. */ public IImage clone(); /** Returns the stream that produces this image. */ public IStream getStream(); /** Sets the stream this image is associated to. */ public void setStream(IStream istream); /** gets the ID of the frame this image belongs to. */ public String getFrameID(); /** TODO quick hack * sets the ID of the frame this image belongs to. */ public void setFrameID(String frameID); // TODO To be removed -- use getStream().getID() public String getStreamID(); // TODO To be removed public void setStreamID(String streamID); // TODO To be removed -- use getStream().getChannelDef().getID() public String getChannelID(); ///////////////// TODO To be eventually removed /////////////////////// public BufferedImage getBufferedImage(); ///////////////// TODO To be eventually removed /////////////////////// public void setServerConnection(IServerConnection serverConnection); public IServerConnection getServerConnection(); }
UTF-8
Java
1,618
java
IImage.java
Java
[ { "context": "face of images coming in a stream.\n *\n * @author Carlos Rueda-Velasquez\n * @version $Id: IImage.java,v 1.9 2007/06/13 00", "end": 151, "score": 0.9998884201049805, "start": 129, "tag": "NAME", "value": "Carlos Rueda-Velasquez" } ]
null
[]
package geostreams.image; import java.awt.image.BufferedImage; /** * Interface of images coming in a stream. * * @author <NAME> * @version $Id: IImage.java,v 1.9 2007/06/13 00:08:43 crueda Exp $ */ public interface IImage { /** gets the starting x location. */ public int getX(); /** gets the starting y location. */ public int getY(); /** gets the width in pixels of this image. */ public int getWidth(); /** gets the height in pixels of this image. */ public int getHeight(); /** is this image null? */ public boolean isNull(); /** Creates a shallow copy of this image. */ public IImage clone(); /** Returns the stream that produces this image. */ public IStream getStream(); /** Sets the stream this image is associated to. */ public void setStream(IStream istream); /** gets the ID of the frame this image belongs to. */ public String getFrameID(); /** TODO quick hack * sets the ID of the frame this image belongs to. */ public void setFrameID(String frameID); // TODO To be removed -- use getStream().getID() public String getStreamID(); // TODO To be removed public void setStreamID(String streamID); // TODO To be removed -- use getStream().getChannelDef().getID() public String getChannelID(); ///////////////// TODO To be eventually removed /////////////////////// public BufferedImage getBufferedImage(); ///////////////// TODO To be eventually removed /////////////////////// public void setServerConnection(IServerConnection serverConnection); public IServerConnection getServerConnection(); }
1,602
0.656984
0.647095
72
21.458334
22.509836
72
false
false
0
0
0
0
0
0
0.972222
false
false
7
2d03e7987bc0d9aa3b483bef4256e6c5032a621c
6,399,501,333,252
39d512533e1d449a2306e2b59bf255875c1a4e2e
/eid-dal/src/main/java/com/eid/dal/dao/CompanyAgreementLadderDao.java
e6e036e6a23aa89f0e651d7b41b00025efe3b0e6
[]
no_license
pengdaizhong/eid-module
https://github.com/pengdaizhong/eid-module
d6f4a9df707218f448d74913efbb67c3bbab7bbe
5ae3b4adb92900e4319c5d68331ef4dd94891b7a
refs/heads/master
2018-12-12T04:13:46.381000
2018-09-13T05:14:50
2018-09-13T05:14:50
113,935,801
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eid.dal.dao; import com.eid.dal.entity.CompanyAgreementLadderEntity; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import org.springframework.transaction.annotation.Transactional; /** * Created by ruben on 2016/12/14. */ public interface CompanyAgreementLadderDao extends CrudRepository<CompanyAgreementLadderEntity, Long> { CompanyAgreementLadderEntity findBymIdAndStatus(Long id, Integer status); @Query(value = "select ladder from CompanyAgreementLadderEntity ladder where ladder.mId = :mId and :beginNum between ladder.beginNum and ladder.endNum and ladder.status = :status") CompanyAgreementLadderEntity queryFee(@Param("mId") Long mId, @Param("beginNum") Integer beginNum, @Param("status") Integer status); }
UTF-8
Java
927
java
CompanyAgreementLadderDao.java
Java
[ { "context": "ction.annotation.Transactional;\n\n/**\n * Created by ruben on 2016/12/14.\n */\npublic interface CompanyAgreem", "end": 398, "score": 0.9995598196983337, "start": 393, "tag": "USERNAME", "value": "ruben" } ]
null
[]
package com.eid.dal.dao; import com.eid.dal.entity.CompanyAgreementLadderEntity; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import org.springframework.transaction.annotation.Transactional; /** * Created by ruben on 2016/12/14. */ public interface CompanyAgreementLadderDao extends CrudRepository<CompanyAgreementLadderEntity, Long> { CompanyAgreementLadderEntity findBymIdAndStatus(Long id, Integer status); @Query(value = "select ladder from CompanyAgreementLadderEntity ladder where ladder.mId = :mId and :beginNum between ladder.beginNum and ladder.endNum and ladder.status = :status") CompanyAgreementLadderEntity queryFee(@Param("mId") Long mId, @Param("beginNum") Integer beginNum, @Param("status") Integer status); }
927
0.811219
0.802589
20
45.349998
49.536121
184
false
false
0
0
0
0
0
0
0.65
false
false
7
1d269d0a2a644ae6603a9a83912ce2e51a936763
13,503,377,235,465
bbe96ac48969724551bb097c5f6ff44002b4ce7c
/src/main/java/com/wishai/xzrtw/repository/FileRepository.java
2013b2c339aad031d3b97f4053df63c0e057014e
[]
no_license
wishAI/XZRTWebsite
https://github.com/wishAI/XZRTWebsite
7f54e50e32f8bebf355e7494844a572291b88b3e
1ff5d8de3ef33489f8bfbe21441ce492b642f2c2
refs/heads/master
2018-09-24T03:00:09.988000
2018-06-07T02:31:27
2018-06-07T02:31:27
105,570,079
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wishai.xzrtw.repository; import com.wishai.xzrtw.model.File; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; public interface FileRepository extends JpaRepository<File, Integer> { @Query("select f.id from File f where f.srcKey=?1 and f.type=?2") public Integer findIdBySrcKeyAndType(String srcKey, String type); }
UTF-8
Java
407
java
FileRepository.java
Java
[]
null
[]
package com.wishai.xzrtw.repository; import com.wishai.xzrtw.model.File; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; public interface FileRepository extends JpaRepository<File, Integer> { @Query("select f.id from File f where f.srcKey=?1 and f.type=?2") public Integer findIdBySrcKeyAndType(String srcKey, String type); }
407
0.788698
0.783784
13
30.307692
29.78483
70
false
false
0
0
0
0
0
0
0.538462
false
false
7
b7bf90c9e5f3ff16f3b15fa88be57c4e90d691bb
27,350,351,800,604
46c489592ae8df159c446c2d7b511380409696d7
/src/visao/RelatorioPagamentoTurmaVisao.java
932d7c72e43dbff043c873631bc8ec7708dc548f
[]
no_license
vunge7/GestEscolar
https://github.com/vunge7/GestEscolar
90c1be28dafb84fb0b1dc2fb5de8ebea85ea9681
179bdefd07fd3d5ef405f2ac573f9bbd67e9647f
refs/heads/master
2023-01-21T12:19:24.477000
2020-11-22T14:41:14
2020-11-22T14:41:14
315,058,182
1
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 visao; import dao.TurmaDao; import ireport.ListarPagamentoPropinaTurma; import java.util.Date; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManagerFactory; import javax.swing.DefaultComboBoxModel; import util.JPAEntntityMannagerFactoryUtil; /** * * @author mac */ public class RelatorioPagamentoTurmaVisao extends javax.swing.JFrame { /** * Creates new form RelatorioMaiorCustoViaturaVisao */ private final EntityManagerFactory emf = JPAEntntityMannagerFactoryUtil.em; private final TurmaDao turmaDao = new TurmaDao(emf); // private DepartamentoDao departamentoDao = new DepartamentoDao(emf); // private AdmissaoDao admissaoDao = new AdmissaoDao(emf); // //private Veiculo v = null; public RelatorioPagamentoTurmaVisao() { initComponents(); setLocationRelativeTo(null); // setDepartamento(); dc_inicio.setDate(new Date() ); dc_fim.setDate(new Date() ); setTurma(); //limpar(); } /** * 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() { jPanel1 = new javax.swing.JPanel(); jLabel19 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); dc_inicio = new com.toedter.calendar.JDateChooser(); dc_fim = new com.toedter.calendar.JDateChooser(); jLabel3 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); cmb_turma = new javax.swing.JComboBox<>(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Relatório de propinas por Turma"); jPanel1.setBackground(new java.awt.Color(192, 208, 232)); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jLabel19.setFont(new java.awt.Font("Tahoma", 1, 23)); // NOI18N jLabel19.setForeground(new java.awt.Color(255, 255, 255)); jLabel19.setText(" RELATÓRIO DE PAGAMENTOS POR TURMA"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE) .addContainerGap()) ); jLabel2.setText("De"); jLabel3.setText("à"); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jTextField1.setText("jTextField1"); jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/proucura.png"))); // NOI18N jButton2.setText("Visualizar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Logout 32x32.png"))); // NOI18N jButton3.setText("Sair"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(922, 922, 922) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(24, 24, 24) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32) .addComponent(jButton3))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(27, 27, 27) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(141, 141, 141)) ); jLabel1.setText("Turma:"); cmb_turma.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(238, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(214, 214, 214)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(78, 78, 78) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cmb_turma, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(dc_inicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32) .addComponent(dc_fim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(111, 111, 111)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(43, 43, 43) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(dc_inicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabel1) .addComponent(cmb_turma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(dc_fim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(38, 38, 38) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(90, 90, 90)) ); getAccessibleContext().setAccessibleName("fUNCIONÁRIO POR DEPARTAMENTO"); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: dispose(); }//GEN-LAST:event_jButton3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { // TODO add your handling code here: //actualizar_status_fim_contrato(); new ListarPagamentoPropinaTurma(dc_inicio.getDate(), dc_fim.getDate(), getIdTurma()); } catch (Exception ex) { ex.printStackTrace(); Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new RelatorioPagamentoTurmaVisao().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox<String> cmb_turma; private com.toedter.calendar.JDateChooser dc_fim; private com.toedter.calendar.JDateChooser dc_inicio; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JTextField jTextField1; // End of variables declaration//GEN-END:variables // private void procedimento_pesquisa() // { // // // // List<ItemVeiculoManutencao> lista_itemVeiculo = itemVeiculoManutencaoDao.getAllManutencao(dc_inicio.getDate() , dc_fim.getDate() ); // // adicionar_tabela(lista_itemVeiculo); // } // private void limpar() // { // lb_matricula.setText(""); // lb_itemVeiculo.setText(""); // lb_marca.setText(""); // lb_funcionario.setText(""); // lb_custo.setText(""); // // } // private void adicionar_tabela( List<ItemVeiculoManutencao> itemVeiculoManutencao) // { // // DefaultTableModel itemVeiculos = (DefaultTableModel) jTable1.getModel(); // // itemVeiculos.setRowCount(0); // try { // // // for (int i = 0; i < itemVeiculoManutencao.size(); i++) // { // itemVeiculos.addRow(new Object[]{ // itemVeiculoManutencao.get(i).getFkManutencao().getPkManutencao(), // itemVeiculoManutencao.get(i).getFkVeiculo().getMatricula(), // itemVeiculoManutencao.get(i).getFkVeiculo().getFkModelo().getDesignacao(), // itemVeiculoManutencao.get(i).getFkVeiculo().getFkEstadoVeiculo().getDesignacao(), // getData( itemVeiculoManutencao.get(i).getFkManutencao().getDataMantencao()), // itemVeiculoManutencao.get(i).getFkManutencao().getTotal() // // // }); // } // // // } catch (Exception e) { // } // // } private String getData(Date date) { return date.getDate() + "/" + ( date.getMonth() + 1) +"/" +( date.getYear() + 1900); } private void setTurma(){ cmb_turma.setModel( new DefaultComboBoxModel( (Vector) turmaDao.buscaTodos() )); } private int getIdTurma() { return turmaDao.getIdByDescricao(cmb_turma.getSelectedItem().toString()); } }
UTF-8
Java
18,860
java
RelatorioPagamentoTurmaVisao.java
Java
[ { "context": "JPAEntntityMannagerFactoryUtil;\n\n/**\n *\n * @author mac\n */\npublic class RelatorioPagamentoTurmaVisao ext", "end": 534, "score": 0.9945240020751953, "start": 531, "tag": "USERNAME", "value": "mac" } ]
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 visao; import dao.TurmaDao; import ireport.ListarPagamentoPropinaTurma; import java.util.Date; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.persistence.EntityManagerFactory; import javax.swing.DefaultComboBoxModel; import util.JPAEntntityMannagerFactoryUtil; /** * * @author mac */ public class RelatorioPagamentoTurmaVisao extends javax.swing.JFrame { /** * Creates new form RelatorioMaiorCustoViaturaVisao */ private final EntityManagerFactory emf = JPAEntntityMannagerFactoryUtil.em; private final TurmaDao turmaDao = new TurmaDao(emf); // private DepartamentoDao departamentoDao = new DepartamentoDao(emf); // private AdmissaoDao admissaoDao = new AdmissaoDao(emf); // //private Veiculo v = null; public RelatorioPagamentoTurmaVisao() { initComponents(); setLocationRelativeTo(null); // setDepartamento(); dc_inicio.setDate(new Date() ); dc_fim.setDate(new Date() ); setTurma(); //limpar(); } /** * 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() { jPanel1 = new javax.swing.JPanel(); jLabel19 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); dc_inicio = new com.toedter.calendar.JDateChooser(); dc_fim = new com.toedter.calendar.JDateChooser(); jLabel3 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); cmb_turma = new javax.swing.JComboBox<>(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Relatório de propinas por Turma"); jPanel1.setBackground(new java.awt.Color(192, 208, 232)); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jLabel19.setFont(new java.awt.Font("Tahoma", 1, 23)); // NOI18N jLabel19.setForeground(new java.awt.Color(255, 255, 255)); jLabel19.setText(" RELATÓRIO DE PAGAMENTOS POR TURMA"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE) .addContainerGap()) ); jLabel2.setText("De"); jLabel3.setText("à"); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jTextField1.setText("jTextField1"); jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/proucura.png"))); // NOI18N jButton2.setText("Visualizar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Logout 32x32.png"))); // NOI18N jButton3.setText("Sair"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(922, 922, 922) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(24, 24, 24) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32) .addComponent(jButton3))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(27, 27, 27) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(141, 141, 141)) ); jLabel1.setText("Turma:"); cmb_turma.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(238, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(214, 214, 214)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(78, 78, 78) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cmb_turma, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(dc_inicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32) .addComponent(dc_fim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(111, 111, 111)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(43, 43, 43) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(dc_inicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabel1) .addComponent(cmb_turma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(dc_fim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(38, 38, 38) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(90, 90, 90)) ); getAccessibleContext().setAccessibleName("fUNCIONÁRIO POR DEPARTAMENTO"); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: dispose(); }//GEN-LAST:event_jButton3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { // TODO add your handling code here: //actualizar_status_fim_contrato(); new ListarPagamentoPropinaTurma(dc_inicio.getDate(), dc_fim.getDate(), getIdTurma()); } catch (Exception ex) { ex.printStackTrace(); Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(RelatorioPagamentoTurmaVisao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new RelatorioPagamentoTurmaVisao().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox<String> cmb_turma; private com.toedter.calendar.JDateChooser dc_fim; private com.toedter.calendar.JDateChooser dc_inicio; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JTextField jTextField1; // End of variables declaration//GEN-END:variables // private void procedimento_pesquisa() // { // // // // List<ItemVeiculoManutencao> lista_itemVeiculo = itemVeiculoManutencaoDao.getAllManutencao(dc_inicio.getDate() , dc_fim.getDate() ); // // adicionar_tabela(lista_itemVeiculo); // } // private void limpar() // { // lb_matricula.setText(""); // lb_itemVeiculo.setText(""); // lb_marca.setText(""); // lb_funcionario.setText(""); // lb_custo.setText(""); // // } // private void adicionar_tabela( List<ItemVeiculoManutencao> itemVeiculoManutencao) // { // // DefaultTableModel itemVeiculos = (DefaultTableModel) jTable1.getModel(); // // itemVeiculos.setRowCount(0); // try { // // // for (int i = 0; i < itemVeiculoManutencao.size(); i++) // { // itemVeiculos.addRow(new Object[]{ // itemVeiculoManutencao.get(i).getFkManutencao().getPkManutencao(), // itemVeiculoManutencao.get(i).getFkVeiculo().getMatricula(), // itemVeiculoManutencao.get(i).getFkVeiculo().getFkModelo().getDesignacao(), // itemVeiculoManutencao.get(i).getFkVeiculo().getFkEstadoVeiculo().getDesignacao(), // getData( itemVeiculoManutencao.get(i).getFkManutencao().getDataMantencao()), // itemVeiculoManutencao.get(i).getFkManutencao().getTotal() // // // }); // } // // // } catch (Exception e) { // } // // } private String getData(Date date) { return date.getDate() + "/" + ( date.getMonth() + 1) +"/" +( date.getYear() + 1900); } private void setTurma(){ cmb_turma.setModel( new DefaultComboBoxModel( (Vector) turmaDao.buscaTodos() )); } private int getIdTurma() { return turmaDao.getIdByDescricao(cmb_turma.getSelectedItem().toString()); } }
18,860
0.600764
0.587452
467
39.376873
35.814526
169
false
false
0
0
0
0
0
0
0.490364
false
false
7
d8a6c8882c30702a8394560540d8002065c0b356
27,650,999,464,115
793b595388cd982aa26e606f65032a0f41ba5bc7
/src/pack/controller/HelloController.java
0ecb78a02ddee404b28aed60a5174faa898359ea
[]
no_license
ksh8194/sprweb6summary
https://github.com/ksh8194/sprweb6summary
503d42d8f202ac3e18f3362f4263580e0fbe44e2
3aa417a39ef90f887f880cefbdb005fd99f49859
refs/heads/master
2022-12-25T03:45:21.335000
2019-10-02T08:48:54
2019-10-02T08:48:54
212,293,659
0
0
null
false
2022-12-16T10:32:13
2019-10-02T08:47:56
2019-10-02T08:49:21
2022-12-16T10:32:10
11
0
0
2
Java
false
false
package pack.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.AbstractController; import org.springframework.web.servlet.mvc.Controller; import pack.model.HelloModel; //public class HelloController implements Controller{ // @Override // public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) { // return null; // } // //} public class HelloController extends AbstractController{ // private HelloModel helloModel; public void setHelloModel(HelloModel helloModel) { this.helloModel = helloModel; } @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception{ // 모델과 통 String result = helloModel.getGreeting(); ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("hello"); //forward //modelAndView.setViewName("redirect:/hello.jsp");//redirect방식 modelAndView.addObject("result",result); return modelAndView; //forward } }
UTF-8
Java
1,214
java
HelloController.java
Java
[]
null
[]
package pack.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.AbstractController; import org.springframework.web.servlet.mvc.Controller; import pack.model.HelloModel; //public class HelloController implements Controller{ // @Override // public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) { // return null; // } // //} public class HelloController extends AbstractController{ // private HelloModel helloModel; public void setHelloModel(HelloModel helloModel) { this.helloModel = helloModel; } @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception{ // 모델과 통 String result = helloModel.getGreeting(); ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("hello"); //forward //modelAndView.setViewName("redirect:/hello.jsp");//redirect방식 modelAndView.addObject("result",result); return modelAndView; //forward } }
1,214
0.750416
0.750416
47
23.531916
28.14994
121
false
false
0
0
0
0
0
0
1.297872
false
false
7
8bafd93f561b42efe4bc21f8fb7e3e1ceb88bac8
23,021,024,719,194
7347094b7a574abcc06a8eb207fcff2bf0b2ba0e
/hive-master/hive-metadata-indexer/src/main/java/org/irods/jargon/indexing/hive/metadata/utils/testing/package-info.java
bd855c2695d6a5c38bb4f6758a236f522feff1fa
[]
no_license
DICE-UNC/irods-hive
https://github.com/DICE-UNC/irods-hive
776feea03d9e8e1c605e93b0bd2bc7789a9dbc62
f9548931656eec930fe3b17ec37dbe912b8d0e9e
refs/heads/master
2016-09-05T21:42:43.160000
2015-05-01T14:57:50
2015-05-01T14:57:50
17,442,815
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Utilities for testing * @author Mike Conway - DICE * */ package org.irods.jargon.indexing.hive.metadata.utils.testing;
UTF-8
Java
128
java
package-info.java
Java
[ { "context": "/**\n * Utilities for testing\n * @author Mike Conway - DICE\n *\n */\npackage org.irods.jargon.indexing.h", "end": 51, "score": 0.9998047947883606, "start": 40, "tag": "NAME", "value": "Mike Conway" } ]
null
[]
/** * Utilities for testing * @author <NAME> - DICE * */ package org.irods.jargon.indexing.hive.metadata.utils.testing;
123
0.71875
0.71875
6
20.5
21.453438
62
false
false
0
0
0
0
0
0
0.166667
false
false
7
cea474688505fd808bd9c9302d7c64056a99f398
6,554,120,099,117
c88f057f931e5ce97c1ee858dcf9e5bed44dc84c
/src/main/java/com/github/archerda/jdk/arraycopy/ArrayCopy.java
8b7784a192f30881a6acbd7cec00afef3ccaad0c
[ "Apache-2.0" ]
permissive
archerda/java-example
https://github.com/archerda/java-example
227b1dcb5093a65e7e5c076cf2484bf2a9c797ea
92ecf506fa88a3b9a16752f624263dfc7c60282c
refs/heads/master
2022-12-20T23:09:11.018000
2022-06-27T10:23:59
2022-06-27T10:23:59
164,831,313
0
0
Apache-2.0
false
2022-12-16T06:03:55
2019-01-09T09:27:06
2021-10-20T07:26:09
2022-12-16T06:03:53
173
0
0
10
Java
false
false
package com.github.archerda.jdk.arraycopy; /** * Java中数组拷贝的3种方式效率比较 * Created by luohd on 2016/9/7. */ public class ArrayCopy { private static final int SIZE = 20000000; public static void main(String[] args) throws Exception{ String[] arr1 = new String[SIZE]; for (int i = 0; i < SIZE; ++i) { arr1[i] = String.valueOf(i); } copyByLoop(arr1); String[] arr2 = new String[SIZE]; for (int i = 0; i < SIZE; ++i) { arr2[i] = String.valueOf(i); } copyByClone(arr2); String[] arr3 = new String[SIZE]; for (int i = 0; i < SIZE; ++i) { arr3[i] = String.valueOf(i); } copyBySystemCopy(arr3); } /* 循环拷贝 */ private static void copyByLoop(String[] arr) { Long startTime = System.currentTimeMillis(); String[] destArray = new String[SIZE]; for (int i = 0; i < arr.length; i++) { destArray[i] = arr[i]; } Long endTime = System.currentTimeMillis(); System.out.println("copyByLoop cost: " + (endTime - startTime)); } /* 克隆函数拷贝 */ private static void copyByClone(String[] arr) { Long startTime = System.currentTimeMillis(); String[] destArray = arr.clone(); Long endTime = System.currentTimeMillis(); System.out.println("copyByClone cost: " + (endTime - startTime)); } /* System.arraycopy拷贝 */ private static void copyBySystemCopy(String[] arr) { Long startTime = System.currentTimeMillis(); String[] destArray = new String[SIZE]; System.arraycopy(arr, 0, destArray, 0, arr.length); Long endTime = System.currentTimeMillis(); System.out.println("copyBySystemCopy cost: " + (endTime - startTime)); } }
UTF-8
Java
1,858
java
ArrayCopy.java
Java
[ { "context": "rraycopy;\n\n/**\n * Java中数组拷贝的3种方式效率比较\n * Created by luohd on 2016/9/7.\n */\npublic class ArrayCopy {\n\n pr", "end": 89, "score": 0.9996888637542725, "start": 84, "tag": "USERNAME", "value": "luohd" } ]
null
[]
package com.github.archerda.jdk.arraycopy; /** * Java中数组拷贝的3种方式效率比较 * Created by luohd on 2016/9/7. */ public class ArrayCopy { private static final int SIZE = 20000000; public static void main(String[] args) throws Exception{ String[] arr1 = new String[SIZE]; for (int i = 0; i < SIZE; ++i) { arr1[i] = String.valueOf(i); } copyByLoop(arr1); String[] arr2 = new String[SIZE]; for (int i = 0; i < SIZE; ++i) { arr2[i] = String.valueOf(i); } copyByClone(arr2); String[] arr3 = new String[SIZE]; for (int i = 0; i < SIZE; ++i) { arr3[i] = String.valueOf(i); } copyBySystemCopy(arr3); } /* 循环拷贝 */ private static void copyByLoop(String[] arr) { Long startTime = System.currentTimeMillis(); String[] destArray = new String[SIZE]; for (int i = 0; i < arr.length; i++) { destArray[i] = arr[i]; } Long endTime = System.currentTimeMillis(); System.out.println("copyByLoop cost: " + (endTime - startTime)); } /* 克隆函数拷贝 */ private static void copyByClone(String[] arr) { Long startTime = System.currentTimeMillis(); String[] destArray = arr.clone(); Long endTime = System.currentTimeMillis(); System.out.println("copyByClone cost: " + (endTime - startTime)); } /* System.arraycopy拷贝 */ private static void copyBySystemCopy(String[] arr) { Long startTime = System.currentTimeMillis(); String[] destArray = new String[SIZE]; System.arraycopy(arr, 0, destArray, 0, arr.length); Long endTime = System.currentTimeMillis(); System.out.println("copyBySystemCopy cost: " + (endTime - startTime)); } }
1,858
0.574115
0.557522
60
29.133333
22.435438
78
false
false
0
0
0
0
0
0
0.616667
false
false
7
6199f8a4ba22029963ff7e5cf0f4e045be3e8489
15,814,069,601,141
362efde9423302b46188d959484f950f366ba6cb
/bt1them.java
5779793ed31abdf79d1820cd8232e9dec4fbaf61
[]
no_license
letuan6031/Lab1Agile
https://github.com/letuan6031/Lab1Agile
c21933c98274a79ea4c73d1f2b506c1ad7692d8f
8ef28547209e32e45767549aceba4bede4d3d84e
refs/heads/master
2022-11-12T12:03:17.269000
2020-07-09T02:24:38
2020-07-09T02:24:38
277,969,656
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lab3; import java.util.Arrays; public class bt1them { public static void main(String[] args) { String arr[]={"Hồng","Hà","Loan"}; System.out.println("Các phần tử mảng là:"); for(int i=0; i< arr.length; i++){ System.out.println(arr[i]); } Arrays.sort(arr); System.out.println("\n mảng sau khi sắp :"); for (String x : arr) { System.out.println(x); } } }
UTF-8
Java
504
java
bt1them.java
Java
[ { "context": "tring[] args) {\r\n \r\n String arr[]={\"Hồng\",\"Hà\",\"Loan\"};\r\n System.out.println(\"Các p", "end": 158, "score": 0.9131519794464111, "start": 154, "tag": "NAME", "value": "Hồng" }, { "context": " args) {\r\n \r\n String arr[]={\"Hồng\",\"Hà\",\"Loan\"};\r\n System.out.println(\"Các phần t", "end": 163, "score": 0.8408162593841553, "start": 161, "tag": "NAME", "value": "Hà" } ]
null
[]
package lab3; import java.util.Arrays; public class bt1them { public static void main(String[] args) { String arr[]={"Hồng","Hà","Loan"}; System.out.println("Các phần tử mảng là:"); for(int i=0; i< arr.length; i++){ System.out.println(arr[i]); } Arrays.sort(arr); System.out.println("\n mảng sau khi sắp :"); for (String x : arr) { System.out.println(x); } } }
504
0.492843
0.486708
20
22.35
17.709532
52
false
false
0
0
0
0
0
0
0.6
false
false
7
599b5a79e1987592a75958289df8bc79547ad1bb
2,207,613,244,183
0c208e2d2a794caabc6dad7fd6c3ef1c11989b22
/hw11-hibernate-cache/src/main/java/ru/otus/erinary/cache/orm/engine/CacheEngineImpl.java
e3857da7ca3d40978682b55b5b7eddfd6888281a
[]
no_license
Erinary/otus-java
https://github.com/Erinary/otus-java
57f51bf16f8761f45f177eb492af1ab5d56da8cf
127553c04b612b526fd92cfc81453a4bb448be2d
refs/heads/master
2023-08-17T01:15:13.373000
2023-08-15T11:33:39
2023-08-15T11:33:39
191,727,685
0
0
null
false
2022-11-16T09:29:02
2019-06-13T08:59:44
2021-07-15T10:50:44
2022-11-16T09:28:58
250
0
0
7
Java
false
false
package ru.otus.erinary.cache.orm.engine; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.util.*; public class CacheEngineImpl<K, V> implements CacheEngine<K, V> { private int hit = 0; private int miss = 0; private final ReferenceQueue<V> queue; private Map<K, SoftReference<V>> cache; private final Timer timer; public CacheEngineImpl(long cleanupPeriod) { this.cache = new HashMap<>(); this.queue = new ReferenceQueue<>(); this.timer = new Timer(); timer.schedule(getCleaningTask(), 0, cleanupPeriod); } @Override public void put(K key, V value) { cache.put(key, new SoftReference<>(value, queue)); } @Override public V get(K key) { return Optional.ofNullable(cache.get(key)).map(SoftReference::get) .map(element -> { hit++; return element; }) .orElseGet(() -> { miss++; return null; }); } @Override public int getHitCount() { return hit; } @Override public int getMissCount() { return miss; } @Override public int getCacheSize() { return cache.size(); } private TimerTask getCleaningTask() { return new TimerTask() { @Override public void run() { System.out.println("Started to clean up cache"); List<Reference> referencesToRemove = new ArrayList<>(); Reference reference; while ((reference = queue.poll()) != null) { referencesToRemove.add(reference); } if (!referencesToRemove.isEmpty()) { for (Reference ref : referencesToRemove) { cache.entrySet().removeIf(entry -> entry.getValue().equals(ref)); } referencesToRemove.clear(); } } }; } @Override public void cleanup() { timer.cancel(); } }
UTF-8
Java
2,178
java
CacheEngineImpl.java
Java
[]
null
[]
package ru.otus.erinary.cache.orm.engine; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.util.*; public class CacheEngineImpl<K, V> implements CacheEngine<K, V> { private int hit = 0; private int miss = 0; private final ReferenceQueue<V> queue; private Map<K, SoftReference<V>> cache; private final Timer timer; public CacheEngineImpl(long cleanupPeriod) { this.cache = new HashMap<>(); this.queue = new ReferenceQueue<>(); this.timer = new Timer(); timer.schedule(getCleaningTask(), 0, cleanupPeriod); } @Override public void put(K key, V value) { cache.put(key, new SoftReference<>(value, queue)); } @Override public V get(K key) { return Optional.ofNullable(cache.get(key)).map(SoftReference::get) .map(element -> { hit++; return element; }) .orElseGet(() -> { miss++; return null; }); } @Override public int getHitCount() { return hit; } @Override public int getMissCount() { return miss; } @Override public int getCacheSize() { return cache.size(); } private TimerTask getCleaningTask() { return new TimerTask() { @Override public void run() { System.out.println("Started to clean up cache"); List<Reference> referencesToRemove = new ArrayList<>(); Reference reference; while ((reference = queue.poll()) != null) { referencesToRemove.add(reference); } if (!referencesToRemove.isEmpty()) { for (Reference ref : referencesToRemove) { cache.entrySet().removeIf(entry -> entry.getValue().equals(ref)); } referencesToRemove.clear(); } } }; } @Override public void cleanup() { timer.cancel(); } }
2,178
0.526171
0.524793
81
25.888889
20.713209
89
true
false
0
0
0
0
0
0
0.481481
false
false
7
e9040c82850c66c82db6e5fa7281566949a491b0
6,786,048,341,238
03b812ec15c5f0ad77bb88aa49d8c68116a1c454
/src/android/com/frankgreen/task/DisplayTask.java
cc07ebd2ecc2a759486f55fa554734752c9f675b
[ "MIT" ]
permissive
MorningCoffeeDev/ACR-NFC-Reader-PhoneGap-Plugin
https://github.com/MorningCoffeeDev/ACR-NFC-Reader-PhoneGap-Plugin
db689deb73f6fa39fa9156cd56beca88a48c41c4
5ea3637a9dd0cfd8c2be25754cf28c67b1407ea9
refs/heads/master
2021-06-21T01:43:55.302000
2021-02-09T07:27:02
2021-02-09T07:27:02
35,984,104
4
14
null
false
2021-02-09T07:27:03
2015-05-21T01:38:44
2019-12-06T02:21:56
2021-02-09T07:27:03
251
5
11
9
Java
false
false
package com.frankgreen.task; import android.os.AsyncTask; import com.frankgreen.apdu.command.Display; import com.frankgreen.params.DisplayParams; /** * Created by kevin on 6/2/15. */ public class DisplayTask extends AsyncTask<DisplayParams, Void, Boolean> { final private String TAG = "DisplayTask"; @Override protected Boolean doInBackground(DisplayParams... paramses) { DisplayParams params = paramses[0]; if (params == null) { return false; } if(!params.getReader().isReady()){ params.getReader().raiseNotReady(params.getOnGetResultListener()); return false; } Display display = new Display(params); return display.run(); } }
UTF-8
Java
743
java
DisplayTask.java
Java
[ { "context": "rankgreen.params.DisplayParams;\n\n/**\n * Created by kevin on 6/2/15.\n */\npublic class DisplayTask extends A", "end": 172, "score": 0.9990664720535278, "start": 167, "tag": "USERNAME", "value": "kevin" } ]
null
[]
package com.frankgreen.task; import android.os.AsyncTask; import com.frankgreen.apdu.command.Display; import com.frankgreen.params.DisplayParams; /** * Created by kevin on 6/2/15. */ public class DisplayTask extends AsyncTask<DisplayParams, Void, Boolean> { final private String TAG = "DisplayTask"; @Override protected Boolean doInBackground(DisplayParams... paramses) { DisplayParams params = paramses[0]; if (params == null) { return false; } if(!params.getReader().isReady()){ params.getReader().raiseNotReady(params.getOnGetResultListener()); return false; } Display display = new Display(params); return display.run(); } }
743
0.651413
0.644684
27
26.518518
22.791113
78
false
false
0
0
0
0
0
0
0.481481
false
false
7
8ff171736e1218b71f1599501f955de785e852a6
11,123,965,319,428
e4ddb73ca1f2e8d0dca8e479bc71a860211873f3
/plugins/transforms/filterrows/src/main/java/org/apache/hop/pipeline/transforms/filterrows/FilterRowsMeta.java
d85a586da61c705bd123b353b8faad233d3ed977
[ "Apache-2.0" ]
permissive
nadment/hop
https://github.com/nadment/hop
80517836ba4b01a1777edd259a80f733b14313fc
bf55d361d8e6faf8eb37c8f99c1a096bf955e8f8
refs/heads/master
2023-08-30T11:46:14.712000
2022-12-07T20:57:25
2022-12-07T20:57:25
239,596,980
2
0
Apache-2.0
true
2022-03-21T22:18:13
2020-02-10T19:38:49
2022-01-09T19:35:46
2022-03-21T22:18:11
124,350
2
0
0
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hop.pipeline.transforms.filterrows; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Condition; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.metadata.api.IStringObjectConverter; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.ITransformIOMeta; import org.apache.hop.pipeline.transform.TransformIOMeta; import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; import org.apache.hop.pipeline.transform.stream.IStream.StreamType; import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; @Transform( id = "FilterRows", image = "filterrows.svg", name = "i18n::FilterRows.Name", description = "i18n::FilterRows.Description", categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Flow", keywords = "i18n::FilterRowsMeta.keyword", documentationUrl = "/pipeline/transforms/filterrows.html") public class FilterRowsMeta extends BaseTransformMeta<FilterRows, FilterRowsData> { private static final Class<?> PKG = FilterRowsMeta.class; // For Translator /** This is the main condition for the complete filter. */ @HopMetadataProperty( key = "compare", injectionKey = "CONDITION", injectionKeyDescription = "FilterRowsMeta.Injection.CONDITION", injectionStringObjectConverter = ConditionXmlConverter.class) private FRCompare compare; @HopMetadataProperty( key = "send_true_to", injectionKey = "SEND_TRUE_TRANSFORM", injectionKeyDescription = "FilterRowsMeta.Injection.SEND_TRUE_TRANSFORM") private String trueTransformName; @HopMetadataProperty( key = "send_false_to", injectionKey = "SEND_FALSE_TRANSFORM", injectionKeyDescription = "FilterRowsMeta.Injection.SEND_FALSE_TRANSFORM") private String falseTransformName; public FilterRowsMeta() { super(); compare = new FRCompare(); } @SuppressWarnings("CopyConstructorMissesField") public FilterRowsMeta(FilterRowsMeta m) { this.compare = m.compare == null ? new FRCompare() : new FRCompare(m.compare); this.setTrueTransformName(m.getTrueTransformName()); this.setFalseTransformName(m.getFalseTransformName()); } @Override public FilterRowsMeta clone() { return new FilterRowsMeta(this); } @Override public void setDefault() { compare = new FRCompare(); } @Override public void searchInfoAndTargetTransforms(List<TransformMeta> transforms) { List<IStream> targetStreams = getTransformIOMeta().getTargetStreams(); for (IStream stream : targetStreams) { stream.setTransformMeta(TransformMeta.findTransform(transforms, stream.getSubject())); } } @Override public void resetTransformIoMeta() { // Do nothing, keep dialog information around } @Override public void getFields( IRowMeta rowMeta, String origin, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) throws HopTransformException { // Clear the sortedDescending flag on fields used within the condition - otherwise the // comparisons will be // inverted!! String[] conditionField = getCondition().getUsedFields(); for (String s : conditionField) { int idx = rowMeta.indexOfValue(s); if (idx >= 0) { IValueMeta valueMeta = rowMeta.getValueMeta(idx); valueMeta.setSortedDescending(false); } } } @Override public void check( List<ICheckResult> remarks, PipelineMeta pipelineMeta, TransformMeta transformMeta, IRowMeta prev, String[] input, String[] output, IRowMeta info, IVariables variables, IHopMetadataProvider metadataProvider) { CheckResult cr; StringBuilder errorMessage; checkTarget(transformMeta, "true", getTrueTransformName(), output).ifPresent(remarks::add); checkTarget(transformMeta, "false", getFalseTransformName(), output).ifPresent(remarks::add); if (getCondition().isEmpty()) { cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.NoConditionSpecified"), transformMeta); } else { cr = new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.ConditionSpecified"), transformMeta); } remarks.add(cr); // Look up fields in the input stream <prev> if (prev != null && prev.size() > 0) { cr = new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.TransformReceivingFields", prev.size() + ""), transformMeta); remarks.add(cr); List<String> orphanFields = getOrphanFields(getCondition(), prev); if (!orphanFields.isEmpty()) { errorMessage = new StringBuilder(BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.FieldsNotFoundFromPreviousTransform") + Const.CR); for (String field : orphanFields) { errorMessage.append("\t\t").append(field).append(Const.CR); } cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage.toString(), transformMeta); } else { cr = new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.AllFieldsFoundInInputStream"), transformMeta); } remarks.add(cr); } else { remarks.add( new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.CouldNotReadFieldsFromPreviousTransform"), transformMeta)); } // See if we have input streams leading to this transform! if (input.length > 0) { remarks.add( new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.TransformReceivingInfoFromOtherTransforms"), transformMeta)); } else { remarks.add( new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.NoInputReceivedFromOtherTransforms"), transformMeta)); } } private Optional<CheckResult> checkTarget( TransformMeta transformMeta, String target, String targetTransformName, String[] output) { if (targetTransformName != null) { int trueTargetIdx = Const.indexOfString(targetTransformName, output); if (trueTargetIdx < 0) { return Optional.of( new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.TargetTransformInvalid", target, targetTransformName), transformMeta)); } } return Optional.empty(); } /** Returns the Input/Output metadata for this transform. */ @Override public ITransformIOMeta getTransformIOMeta() { ITransformIOMeta ioMeta = super.getTransformIOMeta(false); if (ioMeta == null) { ioMeta = new TransformIOMeta(true, true, false, false, false, false); ioMeta.addStream( new Stream( StreamType.TARGET, null, BaseMessages.getString(PKG, "FilterRowsMeta.InfoStream.True.Description"), StreamIcon.TRUE, null)); ioMeta.addStream( new Stream( StreamType.TARGET, null, BaseMessages.getString(PKG, "FilterRowsMeta.InfoStream.False.Description"), StreamIcon.FALSE, null)); setTransformIOMeta(ioMeta); } return ioMeta; } /** * When an optional stream is selected, this method is called to handled the ETL metadata * implications of that. * * @param stream The optional stream to handle. */ @Override public void handleStreamSelection(IStream stream) { // This transform targets another transform. // Make sure that we don't specify the same transform for true and false... // If the user requests false, we blank out true and vice versa // List<IStream> targets = getTransformIOMeta().getTargetStreams(); int index = targets.indexOf(stream); if (index == 0) { // True // TransformMeta falseTransform = targets.get(1).getTransformMeta(); if (falseTransform != null && falseTransform.equals(stream.getTransformMeta())) { targets.get(1).setTransformMeta(null); } } if (index == 1) { // False // TransformMeta trueTransform = targets.get(0).getTransformMeta(); if (trueTransform != null && trueTransform.equals(stream.getTransformMeta())) { targets.get(0).setTransformMeta(null); } } } @Override public boolean excludeFromCopyDistributeVerification() { return true; } /** * Get non-existing referenced input fields * * @param condition The condition to examine * @param prev The list of fields coming from previous transforms. * @return The list of orphaned fields */ public List<String> getOrphanFields(Condition condition, IRowMeta prev) { List<String> orphans = new ArrayList<>(); if (condition == null || prev == null) { return orphans; } String[] key = condition.getUsedFields(); for (String s : key) { if (Utils.isEmpty(s)) { continue; } IValueMeta v = prev.searchValueMeta(s); if (v == null) { orphans.add(s); } } return orphans; } public String getTrueTransformName() { return getTargetTransformName(0); } public void setTrueTransformName(String trueTransformName) { getTransformIOMeta().getTargetStreams().get(0).setSubject(trueTransformName); } public String getFalseTransformName() { return getTargetTransformName(1); } public void setFalseTransformName(String falseTransformName) { getTransformIOMeta().getTargetStreams().get(1).setSubject(falseTransformName); } private String getTargetTransformName(int streamIndex) { IStream stream = getTransformIOMeta().getTargetStreams().get(streamIndex); return java.util.stream.Stream.of(stream.getTransformName(), stream.getSubject()) .filter(Objects::nonNull) .findFirst() .map(Object::toString) .orElse(null); } public String getConditionXml() { String conditionXML = null; try { conditionXML = getCondition().getXml(); } catch (HopValueException e) { log.logError(e.getMessage()); } return conditionXML; } /** * @return Returns the condition. */ public Condition getCondition() { return compare.condition; } /** * @param condition The condition to set. */ public void setCondition(Condition condition) { this.compare.condition = condition; } /** * Gets compare * * @return value of compare */ public FRCompare getCompare() { return compare; } /** * Sets compare * * @param compare value of compare */ public void setCompare(FRCompare compare) { this.compare = compare; } public static final class FRCompare { @HopMetadataProperty(key = "condition") private Condition condition; public FRCompare() { condition = new Condition(); } public FRCompare(FRCompare c) { this.condition = new Condition(c.condition); } public FRCompare(Condition condition) { this.condition = condition; } /** * Gets condition * * @return value of condition */ public Condition getCondition() { return condition; } /** * Sets condition * * @param condition value of condition */ public void setCondition(Condition condition) { this.condition = condition; } } public static final class ConditionXmlConverter implements IStringObjectConverter { @Override public String getString(Object object) throws HopException { if (!(object instanceof FRCompare)) { throw new HopException("We only support XML serialization of Condition objects here"); } try { return ((FRCompare) object).getCondition().getXml(); } catch (Exception e) { throw new HopException("Error serializing Condition to XML", e); } } @Override public Object getObject(String xml) throws HopException { try { return new FRCompare(new Condition(xml)); } catch (Exception e) { throw new HopException("Error serializing Condition from XML", e); } } } }
UTF-8
Java
14,667
java
FilterRowsMeta.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hop.pipeline.transforms.filterrows; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Condition; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; import org.apache.hop.core.annotations.Transform; import org.apache.hop.core.exception.HopException; import org.apache.hop.core.exception.HopTransformException; import org.apache.hop.core.exception.HopValueException; import org.apache.hop.core.row.IRowMeta; import org.apache.hop.core.row.IValueMeta; import org.apache.hop.core.util.Utils; import org.apache.hop.core.variables.IVariables; import org.apache.hop.i18n.BaseMessages; import org.apache.hop.metadata.api.HopMetadataProperty; import org.apache.hop.metadata.api.IHopMetadataProvider; import org.apache.hop.metadata.api.IStringObjectConverter; import org.apache.hop.pipeline.PipelineMeta; import org.apache.hop.pipeline.transform.BaseTransformMeta; import org.apache.hop.pipeline.transform.ITransformIOMeta; import org.apache.hop.pipeline.transform.TransformIOMeta; import org.apache.hop.pipeline.transform.TransformMeta; import org.apache.hop.pipeline.transform.stream.IStream; import org.apache.hop.pipeline.transform.stream.IStream.StreamType; import org.apache.hop.pipeline.transform.stream.Stream; import org.apache.hop.pipeline.transform.stream.StreamIcon; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; @Transform( id = "FilterRows", image = "filterrows.svg", name = "i18n::FilterRows.Name", description = "i18n::FilterRows.Description", categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Flow", keywords = "i18n::FilterRowsMeta.keyword", documentationUrl = "/pipeline/transforms/filterrows.html") public class FilterRowsMeta extends BaseTransformMeta<FilterRows, FilterRowsData> { private static final Class<?> PKG = FilterRowsMeta.class; // For Translator /** This is the main condition for the complete filter. */ @HopMetadataProperty( key = "compare", injectionKey = "CONDITION", injectionKeyDescription = "FilterRowsMeta.Injection.CONDITION", injectionStringObjectConverter = ConditionXmlConverter.class) private FRCompare compare; @HopMetadataProperty( key = "send_true_to", injectionKey = "SEND_TRUE_TRANSFORM", injectionKeyDescription = "FilterRowsMeta.Injection.SEND_TRUE_TRANSFORM") private String trueTransformName; @HopMetadataProperty( key = "send_false_to", injectionKey = "SEND_FALSE_TRANSFORM", injectionKeyDescription = "FilterRowsMeta.Injection.SEND_FALSE_TRANSFORM") private String falseTransformName; public FilterRowsMeta() { super(); compare = new FRCompare(); } @SuppressWarnings("CopyConstructorMissesField") public FilterRowsMeta(FilterRowsMeta m) { this.compare = m.compare == null ? new FRCompare() : new FRCompare(m.compare); this.setTrueTransformName(m.getTrueTransformName()); this.setFalseTransformName(m.getFalseTransformName()); } @Override public FilterRowsMeta clone() { return new FilterRowsMeta(this); } @Override public void setDefault() { compare = new FRCompare(); } @Override public void searchInfoAndTargetTransforms(List<TransformMeta> transforms) { List<IStream> targetStreams = getTransformIOMeta().getTargetStreams(); for (IStream stream : targetStreams) { stream.setTransformMeta(TransformMeta.findTransform(transforms, stream.getSubject())); } } @Override public void resetTransformIoMeta() { // Do nothing, keep dialog information around } @Override public void getFields( IRowMeta rowMeta, String origin, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) throws HopTransformException { // Clear the sortedDescending flag on fields used within the condition - otherwise the // comparisons will be // inverted!! String[] conditionField = getCondition().getUsedFields(); for (String s : conditionField) { int idx = rowMeta.indexOfValue(s); if (idx >= 0) { IValueMeta valueMeta = rowMeta.getValueMeta(idx); valueMeta.setSortedDescending(false); } } } @Override public void check( List<ICheckResult> remarks, PipelineMeta pipelineMeta, TransformMeta transformMeta, IRowMeta prev, String[] input, String[] output, IRowMeta info, IVariables variables, IHopMetadataProvider metadataProvider) { CheckResult cr; StringBuilder errorMessage; checkTarget(transformMeta, "true", getTrueTransformName(), output).ifPresent(remarks::add); checkTarget(transformMeta, "false", getFalseTransformName(), output).ifPresent(remarks::add); if (getCondition().isEmpty()) { cr = new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.NoConditionSpecified"), transformMeta); } else { cr = new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.ConditionSpecified"), transformMeta); } remarks.add(cr); // Look up fields in the input stream <prev> if (prev != null && prev.size() > 0) { cr = new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.TransformReceivingFields", prev.size() + ""), transformMeta); remarks.add(cr); List<String> orphanFields = getOrphanFields(getCondition(), prev); if (!orphanFields.isEmpty()) { errorMessage = new StringBuilder(BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.FieldsNotFoundFromPreviousTransform") + Const.CR); for (String field : orphanFields) { errorMessage.append("\t\t").append(field).append(Const.CR); } cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage.toString(), transformMeta); } else { cr = new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.AllFieldsFoundInInputStream"), transformMeta); } remarks.add(cr); } else { remarks.add( new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.CouldNotReadFieldsFromPreviousTransform"), transformMeta)); } // See if we have input streams leading to this transform! if (input.length > 0) { remarks.add( new CheckResult( ICheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.TransformReceivingInfoFromOtherTransforms"), transformMeta)); } else { remarks.add( new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.NoInputReceivedFromOtherTransforms"), transformMeta)); } } private Optional<CheckResult> checkTarget( TransformMeta transformMeta, String target, String targetTransformName, String[] output) { if (targetTransformName != null) { int trueTargetIdx = Const.indexOfString(targetTransformName, output); if (trueTargetIdx < 0) { return Optional.of( new CheckResult( ICheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.TargetTransformInvalid", target, targetTransformName), transformMeta)); } } return Optional.empty(); } /** Returns the Input/Output metadata for this transform. */ @Override public ITransformIOMeta getTransformIOMeta() { ITransformIOMeta ioMeta = super.getTransformIOMeta(false); if (ioMeta == null) { ioMeta = new TransformIOMeta(true, true, false, false, false, false); ioMeta.addStream( new Stream( StreamType.TARGET, null, BaseMessages.getString(PKG, "FilterRowsMeta.InfoStream.True.Description"), StreamIcon.TRUE, null)); ioMeta.addStream( new Stream( StreamType.TARGET, null, BaseMessages.getString(PKG, "FilterRowsMeta.InfoStream.False.Description"), StreamIcon.FALSE, null)); setTransformIOMeta(ioMeta); } return ioMeta; } /** * When an optional stream is selected, this method is called to handled the ETL metadata * implications of that. * * @param stream The optional stream to handle. */ @Override public void handleStreamSelection(IStream stream) { // This transform targets another transform. // Make sure that we don't specify the same transform for true and false... // If the user requests false, we blank out true and vice versa // List<IStream> targets = getTransformIOMeta().getTargetStreams(); int index = targets.indexOf(stream); if (index == 0) { // True // TransformMeta falseTransform = targets.get(1).getTransformMeta(); if (falseTransform != null && falseTransform.equals(stream.getTransformMeta())) { targets.get(1).setTransformMeta(null); } } if (index == 1) { // False // TransformMeta trueTransform = targets.get(0).getTransformMeta(); if (trueTransform != null && trueTransform.equals(stream.getTransformMeta())) { targets.get(0).setTransformMeta(null); } } } @Override public boolean excludeFromCopyDistributeVerification() { return true; } /** * Get non-existing referenced input fields * * @param condition The condition to examine * @param prev The list of fields coming from previous transforms. * @return The list of orphaned fields */ public List<String> getOrphanFields(Condition condition, IRowMeta prev) { List<String> orphans = new ArrayList<>(); if (condition == null || prev == null) { return orphans; } String[] key = condition.getUsedFields(); for (String s : key) { if (Utils.isEmpty(s)) { continue; } IValueMeta v = prev.searchValueMeta(s); if (v == null) { orphans.add(s); } } return orphans; } public String getTrueTransformName() { return getTargetTransformName(0); } public void setTrueTransformName(String trueTransformName) { getTransformIOMeta().getTargetStreams().get(0).setSubject(trueTransformName); } public String getFalseTransformName() { return getTargetTransformName(1); } public void setFalseTransformName(String falseTransformName) { getTransformIOMeta().getTargetStreams().get(1).setSubject(falseTransformName); } private String getTargetTransformName(int streamIndex) { IStream stream = getTransformIOMeta().getTargetStreams().get(streamIndex); return java.util.stream.Stream.of(stream.getTransformName(), stream.getSubject()) .filter(Objects::nonNull) .findFirst() .map(Object::toString) .orElse(null); } public String getConditionXml() { String conditionXML = null; try { conditionXML = getCondition().getXml(); } catch (HopValueException e) { log.logError(e.getMessage()); } return conditionXML; } /** * @return Returns the condition. */ public Condition getCondition() { return compare.condition; } /** * @param condition The condition to set. */ public void setCondition(Condition condition) { this.compare.condition = condition; } /** * Gets compare * * @return value of compare */ public FRCompare getCompare() { return compare; } /** * Sets compare * * @param compare value of compare */ public void setCompare(FRCompare compare) { this.compare = compare; } public static final class FRCompare { @HopMetadataProperty(key = "condition") private Condition condition; public FRCompare() { condition = new Condition(); } public FRCompare(FRCompare c) { this.condition = new Condition(c.condition); } public FRCompare(Condition condition) { this.condition = condition; } /** * Gets condition * * @return value of condition */ public Condition getCondition() { return condition; } /** * Sets condition * * @param condition value of condition */ public void setCondition(Condition condition) { this.condition = condition; } } public static final class ConditionXmlConverter implements IStringObjectConverter { @Override public String getString(Object object) throws HopException { if (!(object instanceof FRCompare)) { throw new HopException("We only support XML serialization of Condition objects here"); } try { return ((FRCompare) object).getCondition().getXml(); } catch (Exception e) { throw new HopException("Error serializing Condition to XML", e); } } @Override public Object getObject(String xml) throws HopException { try { return new FRCompare(new Condition(xml)); } catch (Exception e) { throw new HopException("Error serializing Condition from XML", e); } } } }
14,667
0.668235
0.666326
459
30.954248
25.833303
101
false
false
0
0
0
0
0
0
0.459695
false
false
7
383076f97d17a2825c844a34552d7bb876fcbe50
27,358,941,690,637
31e3c96e4805860aadb96bb28fc83a2c0e5ad179
/src/exercises/technology/Smartphone.java
56e03e482bb99dafe283349cc0f82309640ec306
[]
no_license
aniorill/java-web-dev-exercises
https://github.com/aniorill/java-web-dev-exercises
68d229dc78057e12d36352c0607fcd23c396ed03
7aa3bd992e15c5ff1e71ea6522150f97fec428ba
refs/heads/master
2022-11-22T15:05:30.259000
2020-07-24T19:18:54
2020-07-24T19:18:54
272,583,246
0
0
null
true
2020-06-16T01:41:55
2020-06-16T01:41:54
2019-11-08T14:50:48
2019-11-30T07:05:57
397
0
0
0
null
false
false
package exercises.technology; import java.util.Scanner; public class Smartphone extends Computer { String phoneNumber; String password; Scanner input; public Smartphone(int storage, boolean internetAccess, int batteryLevel, String aPhoneNumber, String aPassword) { super(storage, internetAccess, batteryLevel); phoneNumber = aPhoneNumber; password = aPassword; } public String checkPassword(){ String userPassword; input = new Scanner(System.in); System.out.println("Enter password:"); userPassword = input.next(); input.close(); String checkPasswordOutput; if (userPassword.equals(password)){ checkPasswordOutput = "Welcome!"; } else { checkPasswordOutput = "Incorrect Password."; } return checkPasswordOutput; } public String checkPassword(String userPassword){ String checkPasswordOutput; if (userPassword.equals(password)){ checkPasswordOutput = "Welcome!"; } else { checkPasswordOutput = "Incorrect Password."; } return checkPasswordOutput; } }
UTF-8
Java
1,186
java
Smartphone.java
Java
[ { "context": " phoneNumber = aPhoneNumber;\n password = aPassword;\n\n }\n\n public String checkPassword(){\n ", "end": 402, "score": 0.9571239948272705, "start": 394, "tag": "PASSWORD", "value": "Password" }, { "context": "ls(password)){\n checkPasswordOutput = \"Welcome!\";\n } else {\n checkPasswordOutp", "end": 747, "score": 0.5522061586380005, "start": 740, "tag": "PASSWORD", "value": "Welcome" }, { "context": "ls(password)){\n checkPasswordOutput = \"Welcome!\";\n } else {\n checkPasswordOutput ", "end": 1054, "score": 0.7155178189277649, "start": 1047, "tag": "PASSWORD", "value": "Welcome" } ]
null
[]
package exercises.technology; import java.util.Scanner; public class Smartphone extends Computer { String phoneNumber; String password; Scanner input; public Smartphone(int storage, boolean internetAccess, int batteryLevel, String aPhoneNumber, String aPassword) { super(storage, internetAccess, batteryLevel); phoneNumber = aPhoneNumber; password = a<PASSWORD>; } public String checkPassword(){ String userPassword; input = new Scanner(System.in); System.out.println("Enter password:"); userPassword = input.next(); input.close(); String checkPasswordOutput; if (userPassword.equals(password)){ checkPasswordOutput = "<PASSWORD>!"; } else { checkPasswordOutput = "Incorrect Password."; } return checkPasswordOutput; } public String checkPassword(String userPassword){ String checkPasswordOutput; if (userPassword.equals(password)){ checkPasswordOutput = "<PASSWORD>!"; } else { checkPasswordOutput = "Incorrect Password."; } return checkPasswordOutput; } }
1,194
0.637437
0.637437
43
26.581396
22.875023
117
false
false
0
0
0
0
0
0
0.627907
false
false
7
a877738946f824f5b5a3aba1d47b3e28d4153f60
27,358,941,692,697
bf567db812142dfc4046101d1b0bea4cd56ae8f3
/src/Classes/ImagePanel.java
05471f22556ce003b5742e02cdabe7e458204845
[]
no_license
JoeMoloney/RSA_App
https://github.com/JoeMoloney/RSA_App
aa092dc374d398e2561241e3687d72d50d9a3e5c
cf52b19768831a54c0b4bac475a4dbffaa7248a3
refs/heads/master
2023-01-05T21:26:05.816000
2020-10-28T15:15:49
2020-10-28T15:15:49
302,001,636
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 Classes; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JPanel; /** * * @author K00243015 */ public class ImagePanel extends JPanel { Image image; Toolkit toolkit = Toolkit.getDefaultToolkit(); public ImagePanel() { image = toolkit.getImage("IMG/splash.gif"); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); if (image != null) g.drawImage(image, 0, 0, this); } }
UTF-8
Java
715
java
ImagePanel.java
Java
[ { "context": "kit;\nimport javax.swing.JPanel;\n\n/**\n *\n * @author K00243015\n */\npublic class ImagePanel extends JPanel\n{\n ", "end": 333, "score": 0.9993461966514587, "start": 324, "tag": "USERNAME", "value": "K00243015" } ]
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 Classes; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JPanel; /** * * @author K00243015 */ public class ImagePanel extends JPanel { Image image; Toolkit toolkit = Toolkit.getDefaultToolkit(); public ImagePanel() { image = toolkit.getImage("IMG/splash.gif"); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); if (image != null) g.drawImage(image, 0, 0, this); } }
715
0.657343
0.643357
34
20.029411
19.817528
79
false
false
0
0
0
0
0
0
0.470588
false
false
7
1a947b70a07ab23312bc4d2e1d841929a468b6a6
2,448,131,372,806
f29c39515d612b511a7c72fb903d50a0861c074a
/src/com/hxt/hPayOrder/model/HPayOrder.java
d66fb8ce44b86a8ca0085d9b9bcbd087e85be800
[]
no_license
wuzhenwei123/hxt_dg
https://github.com/wuzhenwei123/hxt_dg
315af518ef089e3c45f821dd8438317d25a9717f
cc1e161498cc148495c9947f62edc2b84f027e74
refs/heads/master
2020-03-22T15:27:07.659000
2018-09-19T05:28:10
2018-09-19T05:28:10
138,694,054
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hxt.hPayOrder.model; import java.math.BigDecimal; import java.util.Date; import java.util.List; import com.base.model.BaseModel; import com.hxt.hSubOrder.model.HSubOrder; /** * @author wuzhenwei * @time 2015年11月24日 23:49:11 */ public class HPayOrder extends BaseModel implements java.io.Serializable{ /** * */ private static final long serialVersionUID = 1L; private Integer o_id; private String o_no; private String query_id; private String pay_ip; private Integer c_id; private Integer o_sub_id; private Integer amount; private Integer actual_payment; private Integer account_payment; private String pay_type; private String pay_account; private Integer operator_id; private String payee; private Date create_time; private Date pay_time; private String pay_status; private String tick_off_status; private Date tick_off_time; private String back_fee_status; private Date back_time; private String c_name;//单位名称 private String o_sub_name;//子单位名称 private String yw_name;//业务员名称 private Integer yw_id;//业务员名称 private Date pay_start_time;// 支付开始时间 private Date pay_end_time;// 支付结束时间 private Date back_start_time;// 销账开始时间 private Date back_end_time;// 销账结束时间 private Date tick_start_time;// 退费开始时间 private Date tick_end_time;// 退费结束时间 private String electric_number;//电表号 private List<HSubOrder> listSubOrder; private String respMsg;//失败原因 private Integer fp_order_id;//发票订单关系 private Integer is_zz;//是否包含增值税发票 0不包含 1包含 private String amountStr; private Long totalFee; private String totalFeeStr; private String notTotalFeeStr; private Date create_start_time;// 订单开始时间 private Date create_end_time;// 订单结束时间 //新增子单位id private Integer sub_id;// //是否有评价 private Integer evaluateFlag; private String oneAgentOpenId;//一级代理openID private String oneAgentName;//一级代理名称 private String twoAgentOpenID;//二级代理openID private String twoAgentName;//二级代理名称 private Integer servicerId;//服务人员ID(adminID) private String servicerName;//服务人员姓名 private String contact_name;//客户联系人姓名 private String contact_phone;//客户联系人电话 private Integer trans_count;//交易次数 private Integer is_fp;//是否开票 1 开票 0未开票 private BigDecimal oneRate; private BigDecimal twoRate; private BigDecimal serverRate; private Integer roleType; private Integer role_id; private Integer queryType; private Long allOrderFee;//订单总额 private Date startTime; private Date endTime; private Integer allCount; private Long allDetailFee; private String allMoney; private BigDecimal allRateFee;//总分润金额 private String agentName; private String rateMoney; private String payTimeStr; private Integer order_type;//订单类型 1 支付订单 2 提现订单 private Integer apply_id;//提现申请ID private Integer startTotalFee; private Integer endTotalFee; private Integer fr;//是否分润 1 分润 0不分润 public Integer getFr() { return fr; } public void setFr(Integer fr) { this.fr = fr; } public Integer getStartTotalFee() { return startTotalFee; } public void setStartTotalFee(Integer startTotalFee) { this.startTotalFee = startTotalFee; } public Integer getEndTotalFee() { return endTotalFee; } public void setEndTotalFee(Integer endTotalFee) { this.endTotalFee = endTotalFee; } public Integer getApply_id() { return apply_id; } public void setApply_id(Integer apply_id) { this.apply_id = apply_id; } public Integer getOrder_type() { return order_type; } public void setOrder_type(Integer order_type) { this.order_type = order_type; } public String getPayTimeStr() { return payTimeStr; } public void setPayTimeStr(String payTimeStr) { this.payTimeStr = payTimeStr; } public String getRateMoney() { return rateMoney; } public void setRateMoney(String rateMoney) { this.rateMoney = rateMoney; } public String getAgentName() { return agentName; } public void setAgentName(String agentName) { this.agentName = agentName; } public Long getAllOrderFee() { return allOrderFee; } public void setAllOrderFee(Long allOrderFee) { this.allOrderFee = allOrderFee; } public Integer getAllCount() { return allCount; } public void setAllCount(Integer allCount) { this.allCount = allCount; } public Long getAllDetailFee() { return allDetailFee; } public void setAllDetailFee(Long allDetailFee) { this.allDetailFee = allDetailFee; } public String getAllMoney() { return allMoney; } public void setAllMoney(String allMoney) { this.allMoney = allMoney; } public BigDecimal getAllRateFee() { return allRateFee; } public void setAllRateFee(BigDecimal allRateFee) { this.allRateFee = allRateFee; } public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } public Integer getQueryType() { return queryType; } public void setQueryType(Integer queryType) { this.queryType = queryType; } public Integer getRoleType() { return roleType; } public void setRoleType(Integer roleType) { this.roleType = roleType; } public Integer getRole_id() { return role_id; } public void setRole_id(Integer role_id) { this.role_id = role_id; } public BigDecimal getOneRate() { return oneRate; } public void setOneRate(BigDecimal oneRate) { this.oneRate = oneRate; } public BigDecimal getTwoRate() { return twoRate; } public void setTwoRate(BigDecimal twoRate) { this.twoRate = twoRate; } public BigDecimal getServerRate() { return serverRate; } public void setServerRate(BigDecimal serverRate) { this.serverRate = serverRate; } public Integer getIs_fp() { return is_fp; } public void setIs_fp(Integer is_fp) { this.is_fp = is_fp; } public Integer getTrans_count() { return trans_count; } public void setTrans_count(Integer trans_count) { this.trans_count = trans_count; } public String getContact_name() { return contact_name; } public void setContact_name(String contact_name) { this.contact_name = contact_name; } public String getContact_phone() { return contact_phone; } public void setContact_phone(String contact_phone) { this.contact_phone = contact_phone; } public String getOneAgentOpenId() { return oneAgentOpenId; } public void setOneAgentOpenId(String oneAgentOpenId) { this.oneAgentOpenId = oneAgentOpenId; } public String getOneAgentName() { return oneAgentName; } public void setOneAgentName(String oneAgentName) { this.oneAgentName = oneAgentName; } public String getTwoAgentOpenID() { return twoAgentOpenID; } public void setTwoAgentOpenID(String twoAgentOpenID) { this.twoAgentOpenID = twoAgentOpenID; } public String getTwoAgentName() { return twoAgentName; } public void setTwoAgentName(String twoAgentName) { this.twoAgentName = twoAgentName; } public Integer getServicerId() { return servicerId; } public void setServicerId(Integer servicerId) { this.servicerId = servicerId; } public String getServicerName() { return servicerName; } public void setServicerName(String servicerName) { this.servicerName = servicerName; } public Integer getEvaluateFlag() { return evaluateFlag; } public void setEvaluateFlag(Integer evaluateFlag) { this.evaluateFlag = evaluateFlag; } public Integer getSub_id() { return sub_id; } public void setSub_id(Integer sub_id) { this.sub_id = sub_id; } public Date getCreate_start_time() { return create_start_time; } public void setCreate_start_time(Date create_start_time) { this.create_start_time = create_start_time; } public Date getCreate_end_time() { return create_end_time; } public void setCreate_end_time(Date create_end_time) { this.create_end_time = create_end_time; } public String getNotTotalFeeStr() { return notTotalFeeStr; } public void setNotTotalFeeStr(String notTotalFeeStr) { this.notTotalFeeStr = notTotalFeeStr; } public String getTotalFeeStr() { return totalFeeStr; } public void setTotalFeeStr(String totalFeeStr) { this.totalFeeStr = totalFeeStr; } public Long getTotalFee() { return totalFee; } public void setTotalFee(Long totalFee) { this.totalFee = totalFee; } public String getAmountStr() { return amountStr; } public void setAmountStr(String amountStr) { this.amountStr = amountStr; } public Integer getIs_zz() { return is_zz; } public void setIs_zz(Integer is_zz) { this.is_zz = is_zz; } public Integer getFp_order_id() { return fp_order_id; } public void setFp_order_id(Integer fp_order_id) { this.fp_order_id = fp_order_id; } public String getRespMsg() { return respMsg; } public void setRespMsg(String respMsg) { this.respMsg = respMsg; } public List<HSubOrder> getListSubOrder() { return listSubOrder; } public void setListSubOrder(List<HSubOrder> listSubOrder) { this.listSubOrder = listSubOrder; } public String getElectric_number() { return electric_number; } public void setElectric_number(String electric_number) { this.electric_number = electric_number; } public Date getPay_start_time() { return pay_start_time; } public void setPay_start_time(Date pay_start_time) { this.pay_start_time = pay_start_time; } public Date getPay_end_time() { return pay_end_time; } public void setPay_end_time(Date pay_end_time) { this.pay_end_time = pay_end_time; } public Date getBack_start_time() { return back_start_time; } public void setBack_start_time(Date back_start_time) { this.back_start_time = back_start_time; } public Date getBack_end_time() { return back_end_time; } public void setBack_end_time(Date back_end_time) { this.back_end_time = back_end_time; } public Date getTick_start_time() { return tick_start_time; } public void setTick_start_time(Date tick_start_time) { this.tick_start_time = tick_start_time; } public Date getTick_end_time() { return tick_end_time; } public void setTick_end_time(Date tick_end_time) { this.tick_end_time = tick_end_time; } public String getC_name() { return c_name; } public void setC_name(String c_name) { this.c_name = c_name; } public String getO_sub_name() { return o_sub_name; } public void setO_sub_name(String o_sub_name) { this.o_sub_name = o_sub_name; } public String getYw_name() { return yw_name; } public void setYw_name(String yw_name) { this.yw_name = yw_name; } public Integer getYw_id() { return yw_id; } public void setYw_id(Integer yw_id) { this.yw_id = yw_id; } public Integer getO_id() { return o_id; } public void setO_id(Integer o_id) { this.o_id = o_id; } public String getO_no() { return o_no; } public void setO_no(String o_no) { this.o_no = o_no; } public String getQuery_id() { return query_id; } public void setQuery_id(String query_id) { this.query_id = query_id; } public String getPay_ip() { return pay_ip; } public void setPay_ip(String pay_ip) { this.pay_ip = pay_ip; } public Integer getC_id() { return c_id; } public void setC_id(Integer c_id) { this.c_id = c_id; } public Integer getO_sub_id() { return o_sub_id; } public void setO_sub_id(Integer o_sub_id) { this.o_sub_id = o_sub_id; } public Integer getAmount() { return amount; } public void setAmount(Integer amount) { this.amount = amount; } public Integer getActual_payment() { return actual_payment; } public void setActual_payment(Integer actual_payment) { this.actual_payment = actual_payment; } public Integer getAccount_payment() { return account_payment; } public void setAccount_payment(Integer account_payment) { this.account_payment = account_payment; } public String getPay_type() { return pay_type; } public void setPay_type(String pay_type) { this.pay_type = pay_type; } public String getPay_account() { return pay_account; } public void setPay_account(String pay_account) { this.pay_account = pay_account; } public Integer getOperator_id() { return operator_id; } public void setOperator_id(Integer operator_id) { this.operator_id = operator_id; } public String getPayee() { return payee; } public void setPayee(String payee) { this.payee = payee; } public Date getCreate_time() { return create_time; } public void setCreate_time(Date create_time) { this.create_time = create_time; } public Date getPay_time() { return pay_time; } public void setPay_time(Date pay_time) { this.pay_time = pay_time; } public String getPay_status() { return pay_status; } public void setPay_status(String pay_status) { this.pay_status = pay_status; } public String getTick_off_status() { return tick_off_status; } public void setTick_off_status(String tick_off_status) { this.tick_off_status = tick_off_status; } public Date getTick_off_time() { return tick_off_time; } public void setTick_off_time(Date tick_off_time) { this.tick_off_time = tick_off_time; } public String getBack_fee_status() { return back_fee_status; } public void setBack_fee_status(String back_fee_status) { this.back_fee_status = back_fee_status; } public Date getBack_time() { return back_time; } public void setBack_time(Date back_time) { this.back_time = back_time; } }
UTF-8
Java
14,293
java
HPayOrder.java
Java
[ { "context": "com.hxt.hSubOrder.model.HSubOrder;\n/**\n * @author\twuzhenwei\n * @time\t2015年11月24日 23:49:11\n */\npublic class HP", "end": 209, "score": 0.9996626377105713, "start": 200, "tag": "USERNAME", "value": "wuzhenwei" } ]
null
[]
package com.hxt.hPayOrder.model; import java.math.BigDecimal; import java.util.Date; import java.util.List; import com.base.model.BaseModel; import com.hxt.hSubOrder.model.HSubOrder; /** * @author wuzhenwei * @time 2015年11月24日 23:49:11 */ public class HPayOrder extends BaseModel implements java.io.Serializable{ /** * */ private static final long serialVersionUID = 1L; private Integer o_id; private String o_no; private String query_id; private String pay_ip; private Integer c_id; private Integer o_sub_id; private Integer amount; private Integer actual_payment; private Integer account_payment; private String pay_type; private String pay_account; private Integer operator_id; private String payee; private Date create_time; private Date pay_time; private String pay_status; private String tick_off_status; private Date tick_off_time; private String back_fee_status; private Date back_time; private String c_name;//单位名称 private String o_sub_name;//子单位名称 private String yw_name;//业务员名称 private Integer yw_id;//业务员名称 private Date pay_start_time;// 支付开始时间 private Date pay_end_time;// 支付结束时间 private Date back_start_time;// 销账开始时间 private Date back_end_time;// 销账结束时间 private Date tick_start_time;// 退费开始时间 private Date tick_end_time;// 退费结束时间 private String electric_number;//电表号 private List<HSubOrder> listSubOrder; private String respMsg;//失败原因 private Integer fp_order_id;//发票订单关系 private Integer is_zz;//是否包含增值税发票 0不包含 1包含 private String amountStr; private Long totalFee; private String totalFeeStr; private String notTotalFeeStr; private Date create_start_time;// 订单开始时间 private Date create_end_time;// 订单结束时间 //新增子单位id private Integer sub_id;// //是否有评价 private Integer evaluateFlag; private String oneAgentOpenId;//一级代理openID private String oneAgentName;//一级代理名称 private String twoAgentOpenID;//二级代理openID private String twoAgentName;//二级代理名称 private Integer servicerId;//服务人员ID(adminID) private String servicerName;//服务人员姓名 private String contact_name;//客户联系人姓名 private String contact_phone;//客户联系人电话 private Integer trans_count;//交易次数 private Integer is_fp;//是否开票 1 开票 0未开票 private BigDecimal oneRate; private BigDecimal twoRate; private BigDecimal serverRate; private Integer roleType; private Integer role_id; private Integer queryType; private Long allOrderFee;//订单总额 private Date startTime; private Date endTime; private Integer allCount; private Long allDetailFee; private String allMoney; private BigDecimal allRateFee;//总分润金额 private String agentName; private String rateMoney; private String payTimeStr; private Integer order_type;//订单类型 1 支付订单 2 提现订单 private Integer apply_id;//提现申请ID private Integer startTotalFee; private Integer endTotalFee; private Integer fr;//是否分润 1 分润 0不分润 public Integer getFr() { return fr; } public void setFr(Integer fr) { this.fr = fr; } public Integer getStartTotalFee() { return startTotalFee; } public void setStartTotalFee(Integer startTotalFee) { this.startTotalFee = startTotalFee; } public Integer getEndTotalFee() { return endTotalFee; } public void setEndTotalFee(Integer endTotalFee) { this.endTotalFee = endTotalFee; } public Integer getApply_id() { return apply_id; } public void setApply_id(Integer apply_id) { this.apply_id = apply_id; } public Integer getOrder_type() { return order_type; } public void setOrder_type(Integer order_type) { this.order_type = order_type; } public String getPayTimeStr() { return payTimeStr; } public void setPayTimeStr(String payTimeStr) { this.payTimeStr = payTimeStr; } public String getRateMoney() { return rateMoney; } public void setRateMoney(String rateMoney) { this.rateMoney = rateMoney; } public String getAgentName() { return agentName; } public void setAgentName(String agentName) { this.agentName = agentName; } public Long getAllOrderFee() { return allOrderFee; } public void setAllOrderFee(Long allOrderFee) { this.allOrderFee = allOrderFee; } public Integer getAllCount() { return allCount; } public void setAllCount(Integer allCount) { this.allCount = allCount; } public Long getAllDetailFee() { return allDetailFee; } public void setAllDetailFee(Long allDetailFee) { this.allDetailFee = allDetailFee; } public String getAllMoney() { return allMoney; } public void setAllMoney(String allMoney) { this.allMoney = allMoney; } public BigDecimal getAllRateFee() { return allRateFee; } public void setAllRateFee(BigDecimal allRateFee) { this.allRateFee = allRateFee; } public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } public Integer getQueryType() { return queryType; } public void setQueryType(Integer queryType) { this.queryType = queryType; } public Integer getRoleType() { return roleType; } public void setRoleType(Integer roleType) { this.roleType = roleType; } public Integer getRole_id() { return role_id; } public void setRole_id(Integer role_id) { this.role_id = role_id; } public BigDecimal getOneRate() { return oneRate; } public void setOneRate(BigDecimal oneRate) { this.oneRate = oneRate; } public BigDecimal getTwoRate() { return twoRate; } public void setTwoRate(BigDecimal twoRate) { this.twoRate = twoRate; } public BigDecimal getServerRate() { return serverRate; } public void setServerRate(BigDecimal serverRate) { this.serverRate = serverRate; } public Integer getIs_fp() { return is_fp; } public void setIs_fp(Integer is_fp) { this.is_fp = is_fp; } public Integer getTrans_count() { return trans_count; } public void setTrans_count(Integer trans_count) { this.trans_count = trans_count; } public String getContact_name() { return contact_name; } public void setContact_name(String contact_name) { this.contact_name = contact_name; } public String getContact_phone() { return contact_phone; } public void setContact_phone(String contact_phone) { this.contact_phone = contact_phone; } public String getOneAgentOpenId() { return oneAgentOpenId; } public void setOneAgentOpenId(String oneAgentOpenId) { this.oneAgentOpenId = oneAgentOpenId; } public String getOneAgentName() { return oneAgentName; } public void setOneAgentName(String oneAgentName) { this.oneAgentName = oneAgentName; } public String getTwoAgentOpenID() { return twoAgentOpenID; } public void setTwoAgentOpenID(String twoAgentOpenID) { this.twoAgentOpenID = twoAgentOpenID; } public String getTwoAgentName() { return twoAgentName; } public void setTwoAgentName(String twoAgentName) { this.twoAgentName = twoAgentName; } public Integer getServicerId() { return servicerId; } public void setServicerId(Integer servicerId) { this.servicerId = servicerId; } public String getServicerName() { return servicerName; } public void setServicerName(String servicerName) { this.servicerName = servicerName; } public Integer getEvaluateFlag() { return evaluateFlag; } public void setEvaluateFlag(Integer evaluateFlag) { this.evaluateFlag = evaluateFlag; } public Integer getSub_id() { return sub_id; } public void setSub_id(Integer sub_id) { this.sub_id = sub_id; } public Date getCreate_start_time() { return create_start_time; } public void setCreate_start_time(Date create_start_time) { this.create_start_time = create_start_time; } public Date getCreate_end_time() { return create_end_time; } public void setCreate_end_time(Date create_end_time) { this.create_end_time = create_end_time; } public String getNotTotalFeeStr() { return notTotalFeeStr; } public void setNotTotalFeeStr(String notTotalFeeStr) { this.notTotalFeeStr = notTotalFeeStr; } public String getTotalFeeStr() { return totalFeeStr; } public void setTotalFeeStr(String totalFeeStr) { this.totalFeeStr = totalFeeStr; } public Long getTotalFee() { return totalFee; } public void setTotalFee(Long totalFee) { this.totalFee = totalFee; } public String getAmountStr() { return amountStr; } public void setAmountStr(String amountStr) { this.amountStr = amountStr; } public Integer getIs_zz() { return is_zz; } public void setIs_zz(Integer is_zz) { this.is_zz = is_zz; } public Integer getFp_order_id() { return fp_order_id; } public void setFp_order_id(Integer fp_order_id) { this.fp_order_id = fp_order_id; } public String getRespMsg() { return respMsg; } public void setRespMsg(String respMsg) { this.respMsg = respMsg; } public List<HSubOrder> getListSubOrder() { return listSubOrder; } public void setListSubOrder(List<HSubOrder> listSubOrder) { this.listSubOrder = listSubOrder; } public String getElectric_number() { return electric_number; } public void setElectric_number(String electric_number) { this.electric_number = electric_number; } public Date getPay_start_time() { return pay_start_time; } public void setPay_start_time(Date pay_start_time) { this.pay_start_time = pay_start_time; } public Date getPay_end_time() { return pay_end_time; } public void setPay_end_time(Date pay_end_time) { this.pay_end_time = pay_end_time; } public Date getBack_start_time() { return back_start_time; } public void setBack_start_time(Date back_start_time) { this.back_start_time = back_start_time; } public Date getBack_end_time() { return back_end_time; } public void setBack_end_time(Date back_end_time) { this.back_end_time = back_end_time; } public Date getTick_start_time() { return tick_start_time; } public void setTick_start_time(Date tick_start_time) { this.tick_start_time = tick_start_time; } public Date getTick_end_time() { return tick_end_time; } public void setTick_end_time(Date tick_end_time) { this.tick_end_time = tick_end_time; } public String getC_name() { return c_name; } public void setC_name(String c_name) { this.c_name = c_name; } public String getO_sub_name() { return o_sub_name; } public void setO_sub_name(String o_sub_name) { this.o_sub_name = o_sub_name; } public String getYw_name() { return yw_name; } public void setYw_name(String yw_name) { this.yw_name = yw_name; } public Integer getYw_id() { return yw_id; } public void setYw_id(Integer yw_id) { this.yw_id = yw_id; } public Integer getO_id() { return o_id; } public void setO_id(Integer o_id) { this.o_id = o_id; } public String getO_no() { return o_no; } public void setO_no(String o_no) { this.o_no = o_no; } public String getQuery_id() { return query_id; } public void setQuery_id(String query_id) { this.query_id = query_id; } public String getPay_ip() { return pay_ip; } public void setPay_ip(String pay_ip) { this.pay_ip = pay_ip; } public Integer getC_id() { return c_id; } public void setC_id(Integer c_id) { this.c_id = c_id; } public Integer getO_sub_id() { return o_sub_id; } public void setO_sub_id(Integer o_sub_id) { this.o_sub_id = o_sub_id; } public Integer getAmount() { return amount; } public void setAmount(Integer amount) { this.amount = amount; } public Integer getActual_payment() { return actual_payment; } public void setActual_payment(Integer actual_payment) { this.actual_payment = actual_payment; } public Integer getAccount_payment() { return account_payment; } public void setAccount_payment(Integer account_payment) { this.account_payment = account_payment; } public String getPay_type() { return pay_type; } public void setPay_type(String pay_type) { this.pay_type = pay_type; } public String getPay_account() { return pay_account; } public void setPay_account(String pay_account) { this.pay_account = pay_account; } public Integer getOperator_id() { return operator_id; } public void setOperator_id(Integer operator_id) { this.operator_id = operator_id; } public String getPayee() { return payee; } public void setPayee(String payee) { this.payee = payee; } public Date getCreate_time() { return create_time; } public void setCreate_time(Date create_time) { this.create_time = create_time; } public Date getPay_time() { return pay_time; } public void setPay_time(Date pay_time) { this.pay_time = pay_time; } public String getPay_status() { return pay_status; } public void setPay_status(String pay_status) { this.pay_status = pay_status; } public String getTick_off_status() { return tick_off_status; } public void setTick_off_status(String tick_off_status) { this.tick_off_status = tick_off_status; } public Date getTick_off_time() { return tick_off_time; } public void setTick_off_time(Date tick_off_time) { this.tick_off_time = tick_off_time; } public String getBack_fee_status() { return back_fee_status; } public void setBack_fee_status(String back_fee_status) { this.back_fee_status = back_fee_status; } public Date getBack_time() { return back_time; } public void setBack_time(Date back_time) { this.back_time = back_time; } }
14,293
0.687253
0.685597
687
19.224163
17.527332
73
false
false
0
0
0
0
0
0
2.160116
false
false
7
59684bed9c51e3fcc22f9fdf8a059e49ac8450c6
25,555,055,427,807
fb61c24f3f6d48a55b591cc0174cfa9d25992b4f
/src/main/java/com/mateolegi/git/remote/gitlab/GitLabRemote.java
0a83a7fe8f019531c5a468572677517760d5e128
[]
no_license
Mateolegi/ProcessManager
https://github.com/Mateolegi/ProcessManager
22ca6a381aee5d4c0182afe8d52c1ccec521dcc7
fb673f96f36859c5bdd7dbc2a8420cdc694fc782
refs/heads/master
2022-05-30T16:07:05.716000
2019-10-18T21:23:21
2019-10-18T21:23:21
212,011,742
0
0
null
false
2022-05-20T21:11:34
2019-10-01T04:22:31
2019-10-18T21:24:09
2022-05-20T21:11:34
300
0
0
3
Java
false
false
package com.mateolegi.git.remote.gitlab; import com.mateolegi.git.remote.GitRemote; import com.mateolegi.net.Rest; import java.net.http.HttpResponse; import java.util.List; public class GitLabRemote implements GitRemote { @Override public List<Branch> getRemoteBranches(String endpoint) { var rest = new Rest(); var pages = rest.get(endpoint) .thenApply(HttpResponse::headers) .thenApply(httpHeaders -> httpHeaders.firstValue("X-Total-Pages")); System.out.println(pages); return null; } // private List<Branch> getBranchesListPerPage(String endpoint, int page) { // var rest = new Rest(); // rest.get(endpoint + "?per_page=100&page=" + page); // } }
UTF-8
Java
776
java
GitLabRemote.java
Java
[]
null
[]
package com.mateolegi.git.remote.gitlab; import com.mateolegi.git.remote.GitRemote; import com.mateolegi.net.Rest; import java.net.http.HttpResponse; import java.util.List; public class GitLabRemote implements GitRemote { @Override public List<Branch> getRemoteBranches(String endpoint) { var rest = new Rest(); var pages = rest.get(endpoint) .thenApply(HttpResponse::headers) .thenApply(httpHeaders -> httpHeaders.firstValue("X-Total-Pages")); System.out.println(pages); return null; } // private List<Branch> getBranchesListPerPage(String endpoint, int page) { // var rest = new Rest(); // rest.get(endpoint + "?per_page=100&page=" + page); // } }
776
0.636598
0.632732
25
29.040001
24.386028
83
false
false
0
0
0
0
0
0
0.48
false
false
7
3fdc8f45c94ba5d93f6cd7b4c63da30e35386f31
32,899,449,512,307
15b260ccada93e20bb696ae19b14ec62e78ed023
/v2/src/main/java/com/alipay/api/domain/CedsipeihuanCcomplex.java
e451f5deb837577d81aa97d80321277b6974c622
[ "Apache-2.0" ]
permissive
alipay/alipay-sdk-java-all
https://github.com/alipay/alipay-sdk-java-all
df461d00ead2be06d834c37ab1befa110736b5ab
8cd1750da98ce62dbc931ed437f6101684fbb66a
refs/heads/master
2023-08-27T03:59:06.566000
2023-08-22T14:54:57
2023-08-22T14:54:57
132,569,986
470
207
Apache-2.0
false
2022-12-25T07:37:40
2018-05-08T07:19:22
2022-12-17T09:20:53
2022-12-25T07:37:39
344,790
385
180
46
Java
false
false
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * c * * @author auto create * @since 1.0, 2023-05-16 17:44:54 */ public class CedsipeihuanCcomplex extends AlipayObject { private static final long serialVersionUID = 5154396564285123137L; /** * 特殊可选 */ @ApiField("d") private String d; /** * 可选 当前字段已废弃(废弃物测试VDC成都市) */ @ApiField("dede") @Deprecated private String dede; /** * 必选 */ @ApiField("fgrf") private String fgrf; /** * 必选 */ @ApiField("hdj_open_id") private String hdjOpenId; /** * 必选 */ @ApiField("sdcd") private String sdcd; public String getD() { return this.d; } public void setD(String d) { this.d = d; } public String getDede() { return this.dede; } public void setDede(String dede) { this.dede = dede; } public String getFgrf() { return this.fgrf; } public void setFgrf(String fgrf) { this.fgrf = fgrf; } public String getHdjOpenId() { return this.hdjOpenId; } public void setHdjOpenId(String hdjOpenId) { this.hdjOpenId = hdjOpenId; } public String getSdcd() { return this.sdcd; } public void setSdcd(String sdcd) { this.sdcd = sdcd; } }
UTF-8
Java
1,274
java
CedsipeihuanCcomplex.java
Java
[ { "context": "internal.mapping.ApiField;\n\n/**\n * c\n *\n * @author auto create\n * @since 1.0, 2023-05-16 17:44:54\n */\npublic cla", "end": 152, "score": 0.5067001581192017, "start": 141, "tag": "USERNAME", "value": "auto create" } ]
null
[]
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * c * * @author auto create * @since 1.0, 2023-05-16 17:44:54 */ public class CedsipeihuanCcomplex extends AlipayObject { private static final long serialVersionUID = 5154396564285123137L; /** * 特殊可选 */ @ApiField("d") private String d; /** * 可选 当前字段已废弃(废弃物测试VDC成都市) */ @ApiField("dede") @Deprecated private String dede; /** * 必选 */ @ApiField("fgrf") private String fgrf; /** * 必选 */ @ApiField("hdj_open_id") private String hdjOpenId; /** * 必选 */ @ApiField("sdcd") private String sdcd; public String getD() { return this.d; } public void setD(String d) { this.d = d; } public String getDede() { return this.dede; } public void setDede(String dede) { this.dede = dede; } public String getFgrf() { return this.fgrf; } public void setFgrf(String fgrf) { this.fgrf = fgrf; } public String getHdjOpenId() { return this.hdjOpenId; } public void setHdjOpenId(String hdjOpenId) { this.hdjOpenId = hdjOpenId; } public String getSdcd() { return this.sdcd; } public void setSdcd(String sdcd) { this.sdcd = sdcd; } }
1,274
0.658197
0.629508
82
13.878049
14.565571
67
false
false
0
0
0
0
0
0
1.060976
false
false
7
56b1fcabfec5b50ac4523f1d6878742aa52979f8
9,242,769,642,721
e38ab03528d0674d9838cc887ec0d6ec6922daab
/Secure_Storage_Service/src/weloveclouds/loadbalancer/services/HealthMonitoringService.java
3447b3193653865901db8847e83bc34b4d5aa6e3
[]
no_license
benedekh/WeLoveClouds
https://github.com/benedekh/WeLoveClouds
d8ba2c7024205985c15de5b49fd0e221c4b55cce
085579c889713b3a63c7ad01dbf30973bce7dabc
refs/heads/master
2022-07-22T02:46:22.989000
2022-07-14T06:25:24
2022-07-14T06:25:24
71,482,555
0
1
null
false
2022-07-14T06:25:25
2016-10-20T16:29:29
2021-12-29T16:54:36
2022-07-14T06:25:24
62,469
0
1
0
Java
false
false
package weloveclouds.loadbalancer.services; import static weloveclouds.commons.status.ServerStatus.RUNNING; import java.io.IOException; import java.net.ServerSocket; import org.apache.log4j.Logger; import com.google.inject.Inject; import com.google.inject.Singleton; import weloveclouds.commons.networking.AbstractConnectionHandler; import weloveclouds.commons.networking.AbstractServer; import weloveclouds.commons.networking.socket.server.IServerSocketFactory; import weloveclouds.commons.serialization.IMessageDeserializer; import weloveclouds.commons.serialization.IMessageSerializer; import weloveclouds.commons.serialization.models.SerializedMessage; import weloveclouds.commons.utils.StringUtils; import weloveclouds.communication.CommunicationApiFactory; import weloveclouds.communication.api.IConcurrentCommunicationApi; import weloveclouds.communication.models.Connection; import weloveclouds.communication.models.SecureConnection; import weloveclouds.loadbalancer.configuration.annotations.HealthMonitoringServicePort; import weloveclouds.loadbalancer.models.IKVHeartbeatMessage; /** * Created by Benoit on 2016-12-05. */ @Singleton public class HealthMonitoringService extends AbstractServer<IKVHeartbeatMessage> implements IHealthMonitoringService { private IDistributedSystemAccessService distributedSystemAccessService; private NodeHealthWatcher nodeHealthWatcher; @Inject public HealthMonitoringService(CommunicationApiFactory communicationApiFactory, IServerSocketFactory serverSocketFactory, IMessageSerializer<SerializedMessage, IKVHeartbeatMessage> messageSerializer, IMessageDeserializer<IKVHeartbeatMessage, SerializedMessage> messageDeserializer, @HealthMonitoringServicePort int port, IDistributedSystemAccessService distributedSystemAccessService, NodeHealthWatcher nodeHealthWatcher) throws IOException { super(communicationApiFactory, serverSocketFactory, messageSerializer, messageDeserializer, port); this.logger = Logger.getLogger(this.getClass()); this.distributedSystemAccessService = distributedSystemAccessService; this.nodeHealthWatcher = nodeHealthWatcher; } @Override public void run() { status = RUNNING; logger.info("Health monitoring service started with endpoint: " + serverSocket); try (ServerSocket socket = serverSocket) { registerShutdownHookForSocket(socket); nodeHealthWatcher.start(); while (status == RUNNING) { ConnectionHandler connectionHandler = new ConnectionHandler( communicationApiFactory.createConcurrentCommunicationApiV1(), new SecureConnection.Builder().socket(socket.accept()).build(), messageSerializer, messageDeserializer, distributedSystemAccessService); connectionHandler.handleConnection(); } } catch (IOException ex) { logger.error(ex); } catch (Throwable ex) { logger.fatal(ex); } finally { logger.info("Health monitoring service stopped."); } } private class ConnectionHandler extends AbstractConnectionHandler<IKVHeartbeatMessage> { private IDistributedSystemAccessService distributedSystemAccessService; ConnectionHandler(IConcurrentCommunicationApi communicationApi, Connection<?> connection, IMessageSerializer<SerializedMessage, IKVHeartbeatMessage> messageSerializer, IMessageDeserializer<IKVHeartbeatMessage, SerializedMessage> messageDeserializer, IDistributedSystemAccessService distributedSystemAccessService) { super(communicationApi, connection, messageSerializer, messageDeserializer); this.logger = Logger.getLogger(this.getClass()); this.distributedSystemAccessService = distributedSystemAccessService; } @Override public void handleConnection() { start(); } @Override public void run() { logger.info("Client is connected to server."); try { IKVHeartbeatMessage receivedMessage; while (connection.isConnected()) { receivedMessage = messageDeserializer .deserialize(communicationApi.receiveFrom(connection)); logger.debug(StringUtils.join(" ", "Message received:", receivedMessage)); distributedSystemAccessService .updateServiceHealthWith(receivedMessage.getNodeHealthInfos()); nodeHealthWatcher.registerHeartbeat(receivedMessage.getNodeHealthInfos()); } } catch (Throwable e) { logger.error(e); } finally { closeConnection(); logger.info("Client is disconnected."); } } } }
UTF-8
Java
5,070
java
HealthMonitoringService.java
Java
[ { "context": "cer.models.IKVHeartbeatMessage;\n\n/**\n * Created by Benoit on 2016-12-05.\n */\n@Singleton\npublic class Health", "end": 1121, "score": 0.9998257160186768, "start": 1115, "tag": "NAME", "value": "Benoit" } ]
null
[]
package weloveclouds.loadbalancer.services; import static weloveclouds.commons.status.ServerStatus.RUNNING; import java.io.IOException; import java.net.ServerSocket; import org.apache.log4j.Logger; import com.google.inject.Inject; import com.google.inject.Singleton; import weloveclouds.commons.networking.AbstractConnectionHandler; import weloveclouds.commons.networking.AbstractServer; import weloveclouds.commons.networking.socket.server.IServerSocketFactory; import weloveclouds.commons.serialization.IMessageDeserializer; import weloveclouds.commons.serialization.IMessageSerializer; import weloveclouds.commons.serialization.models.SerializedMessage; import weloveclouds.commons.utils.StringUtils; import weloveclouds.communication.CommunicationApiFactory; import weloveclouds.communication.api.IConcurrentCommunicationApi; import weloveclouds.communication.models.Connection; import weloveclouds.communication.models.SecureConnection; import weloveclouds.loadbalancer.configuration.annotations.HealthMonitoringServicePort; import weloveclouds.loadbalancer.models.IKVHeartbeatMessage; /** * Created by Benoit on 2016-12-05. */ @Singleton public class HealthMonitoringService extends AbstractServer<IKVHeartbeatMessage> implements IHealthMonitoringService { private IDistributedSystemAccessService distributedSystemAccessService; private NodeHealthWatcher nodeHealthWatcher; @Inject public HealthMonitoringService(CommunicationApiFactory communicationApiFactory, IServerSocketFactory serverSocketFactory, IMessageSerializer<SerializedMessage, IKVHeartbeatMessage> messageSerializer, IMessageDeserializer<IKVHeartbeatMessage, SerializedMessage> messageDeserializer, @HealthMonitoringServicePort int port, IDistributedSystemAccessService distributedSystemAccessService, NodeHealthWatcher nodeHealthWatcher) throws IOException { super(communicationApiFactory, serverSocketFactory, messageSerializer, messageDeserializer, port); this.logger = Logger.getLogger(this.getClass()); this.distributedSystemAccessService = distributedSystemAccessService; this.nodeHealthWatcher = nodeHealthWatcher; } @Override public void run() { status = RUNNING; logger.info("Health monitoring service started with endpoint: " + serverSocket); try (ServerSocket socket = serverSocket) { registerShutdownHookForSocket(socket); nodeHealthWatcher.start(); while (status == RUNNING) { ConnectionHandler connectionHandler = new ConnectionHandler( communicationApiFactory.createConcurrentCommunicationApiV1(), new SecureConnection.Builder().socket(socket.accept()).build(), messageSerializer, messageDeserializer, distributedSystemAccessService); connectionHandler.handleConnection(); } } catch (IOException ex) { logger.error(ex); } catch (Throwable ex) { logger.fatal(ex); } finally { logger.info("Health monitoring service stopped."); } } private class ConnectionHandler extends AbstractConnectionHandler<IKVHeartbeatMessage> { private IDistributedSystemAccessService distributedSystemAccessService; ConnectionHandler(IConcurrentCommunicationApi communicationApi, Connection<?> connection, IMessageSerializer<SerializedMessage, IKVHeartbeatMessage> messageSerializer, IMessageDeserializer<IKVHeartbeatMessage, SerializedMessage> messageDeserializer, IDistributedSystemAccessService distributedSystemAccessService) { super(communicationApi, connection, messageSerializer, messageDeserializer); this.logger = Logger.getLogger(this.getClass()); this.distributedSystemAccessService = distributedSystemAccessService; } @Override public void handleConnection() { start(); } @Override public void run() { logger.info("Client is connected to server."); try { IKVHeartbeatMessage receivedMessage; while (connection.isConnected()) { receivedMessage = messageDeserializer .deserialize(communicationApi.receiveFrom(connection)); logger.debug(StringUtils.join(" ", "Message received:", receivedMessage)); distributedSystemAccessService .updateServiceHealthWith(receivedMessage.getNodeHealthInfos()); nodeHealthWatcher.registerHeartbeat(receivedMessage.getNodeHealthInfos()); } } catch (Throwable e) { logger.error(e); } finally { closeConnection(); logger.info("Client is disconnected."); } } } }
5,070
0.702367
0.700394
112
44.267857
32.210518
118
false
false
0
0
0
0
0
0
0.678571
false
false
7
3d16e996f26229f7507a110fb08898e27c2bfae3
12,214,887,004,339
c77455b03f86ce5d48c99d5967f580123dba337d
/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/metadata/MetadataConsumerSubscriberService.java
93c4813a977d2c98fc9bc92b8bd36530e28e4b32
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
cdapio/cdap
https://github.com/cdapio/cdap
1573d0d00c94d7735085a544f130e60456a0578e
37c280ca9dc142171755ffd6d4224764e47c51e9
refs/heads/develop
2023-09-05T23:03:50.689000
2023-09-04T18:08:12
2023-09-04T18:08:12
22,542,759
478
242
NOASSERTION
false
2023-09-14T00:31:04
2014-08-02T09:00:10
2023-09-01T04:57:10
2023-09-14T00:31:03
622,947
719
337
86
Java
false
false
/* * Copyright © 2022 Cask Data, 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 io.cdap.cdap.internal.metadata; import com.google.common.collect.ImmutableMap; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.inject.Inject; import io.cdap.cdap.api.lineage.field.EndPoint; import io.cdap.cdap.api.lineage.field.Operation; import io.cdap.cdap.api.messaging.Message; import io.cdap.cdap.api.messaging.MessagingContext; import io.cdap.cdap.api.metrics.MetricsCollectionService; import io.cdap.cdap.common.ConflictException; import io.cdap.cdap.common.app.RunIds; import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.service.RetryStrategies; import io.cdap.cdap.common.utils.ImmutablePair; import io.cdap.cdap.data2.metadata.lineage.field.EndPointField; import io.cdap.cdap.data2.metadata.lineage.field.EndpointFieldDeserializer; import io.cdap.cdap.data2.metadata.lineage.field.FieldLineageInfo; import io.cdap.cdap.data2.metadata.writer.MetadataMessage; import io.cdap.cdap.data2.metadata.writer.MetadataOperation; import io.cdap.cdap.data2.metadata.writer.MetadataOperationTypeAdapter; import io.cdap.cdap.internal.app.store.AppMetadataStore; import io.cdap.cdap.messaging.MessagingService; import io.cdap.cdap.messaging.context.MultiThreadMessagingContext; import io.cdap.cdap.messaging.subscriber.AbstractMessagingSubscriberService; import io.cdap.cdap.metadata.MetadataMessageProcessor; import io.cdap.cdap.proto.ProgramRunStatus; import io.cdap.cdap.proto.codec.EntityIdTypeAdapter; import io.cdap.cdap.proto.codec.OperationTypeAdapter; import io.cdap.cdap.proto.element.EntityType; import io.cdap.cdap.proto.id.EntityId; import io.cdap.cdap.proto.id.NamespaceId; import io.cdap.cdap.proto.id.ProgramRunId; import io.cdap.cdap.spi.data.StructuredTableContext; import io.cdap.cdap.spi.data.TableNotFoundException; import io.cdap.cdap.spi.data.transaction.TransactionRunner; import io.cdap.cdap.spi.metadata.Asset; import io.cdap.cdap.spi.metadata.LineageInfo; import io.cdap.cdap.spi.metadata.MetadataConsumer; import io.cdap.cdap.spi.metadata.MetadataConsumerMetrics; import io.cdap.cdap.spi.metadata.ProgramRun; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nullable; import org.apache.tephra.TxConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Service responsible for consuming metadata messages from TMS and consume it in ext modules if configured. * This is a wrapping service to host multiple {@link AbstractMessagingSubscriberService}s for lineage subscriptions. * No transactions should be started in any of the overridden methods since they are already wrapped in a transaction. */ public class MetadataConsumerSubscriberService extends AbstractMessagingSubscriberService<MetadataMessage> { private static final Logger LOG = LoggerFactory.getLogger(MetadataConsumerSubscriberService.class); private static final Gson GSON = new GsonBuilder() .registerTypeAdapter(EntityId.class, new EntityIdTypeAdapter()) .registerTypeAdapter(MetadataOperation.class, new MetadataOperationTypeAdapter()) .registerTypeAdapter(Operation.class, new OperationTypeAdapter()) .create(); private static final String FQN = "fqn"; private final MultiThreadMessagingContext messagingContext; private final TransactionRunner transactionRunner; private final int maxRetriesOnConflict; private final CConfiguration cConf; private final MetadataConsumerExtensionLoader provider; private final MetricsCollectionService metricsCollectionService; private String conflictMessageId; private int conflictCount; @Inject MetadataConsumerSubscriberService(CConfiguration cConf, MessagingService messagingService, MetricsCollectionService metricsCollectionService, TransactionRunner transactionRunner, MetadataConsumerExtensionLoader provider) { super( NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)), cConf.getInt(Constants.Metadata.MESSAGING_FETCH_SIZE), cConf.getInt(TxConstants.Manager.CFG_TX_TIMEOUT), cConf.getLong(Constants.Metadata.MESSAGING_POLL_DELAY_MILLIS), RetryStrategies.fromConfiguration(cConf, "system.metadata."), metricsCollectionService.getContext(ImmutableMap.of( Constants.Metrics.Tag.COMPONENT, Constants.Service.MASTER_SERVICES, Constants.Metrics.Tag.INSTANCE_ID, "0", Constants.Metrics.Tag.NAMESPACE, NamespaceId.SYSTEM.getNamespace(), Constants.Metrics.Tag.TOPIC, cConf.get(Constants.Metadata.MESSAGING_TOPIC), Constants.Metrics.Tag.CONSUMER, Constants.Metadata.METADATA_WRITER_SUBSCRIBER ))); this.messagingContext = new MultiThreadMessagingContext(messagingService); this.transactionRunner = transactionRunner; this.maxRetriesOnConflict = cConf.getInt(Constants.Metadata.MESSAGING_RETRIES_ON_CONFLICT); this.cConf = cConf; this.provider = provider; this.metricsCollectionService = metricsCollectionService; } @Override protected MessagingContext getMessagingContext() { return messagingContext; } @Override protected TransactionRunner getTransactionRunner() { return transactionRunner; } @Override protected MetadataMessage decodeMessage(Message message) { return message.decodePayload(r -> GSON.fromJson(r, MetadataMessage.class)); } @Nullable @Override protected String loadMessageId(StructuredTableContext context) throws IOException, TableNotFoundException { AppMetadataStore appMetadataStore = AppMetadataStore.create(context); return appMetadataStore.retrieveSubscriberState(getTopicId().getTopic(), Constants.Metadata.METADATA_WRITER_SUBSCRIBER); } @Override protected void storeMessageId(StructuredTableContext context, String messageId) throws IOException, TableNotFoundException { AppMetadataStore appMetadataStore = AppMetadataStore.create(context); appMetadataStore.persistSubscriberState(getTopicId().getTopic(), Constants.Metadata.METADATA_WRITER_SUBSCRIBER, messageId); } @Override protected boolean shouldRunInSeparateTx(ImmutablePair<String, MetadataMessage> message) { // if this message caused a conflict last time we tried, stop here to commit all messages processed so far if (message.getFirst().equals(conflictMessageId)) { return true; } // operations at the instance or namespace level can take time. Stop here to process in a new transaction EntityType entityType = message.getSecond().getEntityId().getEntityType(); return entityType.equals(EntityType.INSTANCE) || entityType.equals(EntityType.NAMESPACE); } @Override protected void preProcess() { // no-op } @Override protected void doStartUp() throws Exception { super.doStartUp(); } @Override protected void processMessages(StructuredTableContext structuredTableContext, Iterator<ImmutablePair<String, MetadataMessage>> messages) throws IOException, ConflictException { Map<MetadataMessage.Type, MetadataMessageProcessor> processors = new HashMap<>(); // Loop over all fetched messages and process them with corresponding MetadataMessageProcessor while (messages.hasNext()) { ImmutablePair<String, MetadataMessage> next = messages.next(); String messageId = next.getFirst(); MetadataMessage message = next.getSecond(); MetadataMessageProcessor processor = processors.computeIfAbsent(message.getType(), type -> { if (type == MetadataMessage.Type.FIELD_LINEAGE) { return new FieldLineageProcessor(this.cConf, this.provider.loadMetadataConsumers(), this.metricsCollectionService); } return null; }); // Intellij would warn here that the condition is always false - because the switch above covers all cases. // But if there is ever an unexpected message, we can't throw exception, that would leave the message there. if (processor == null) { continue; } try { processor.processMessage(message, structuredTableContext); conflictCount = 0; } catch (ConflictException e) { if (messageId.equals(conflictMessageId)) { conflictCount++; if (conflictCount >= maxRetriesOnConflict) { LOG.warn("Skipping metadata message {} after processing it has caused {} consecutive conflicts: {}", message, conflictCount, e.getMessage()); continue; } } else { conflictMessageId = messageId; conflictCount = 1; } throw e; } } } /** * The {@link MetadataMessageProcessor} for processing field lineage. */ private static final class FieldLineageProcessor implements MetadataMessageProcessor { private final CConfiguration cConf; private final Map<String, MetadataConsumer> consumers; private final MetricsCollectionService metricsCollectionService; FieldLineageProcessor(CConfiguration cConf, Map<String, MetadataConsumer> consumers, MetricsCollectionService metricsCollectionService) { this.cConf = cConf; this.consumers = consumers; this.metricsCollectionService = metricsCollectionService; } @Override public void processMessage(MetadataMessage message, StructuredTableContext context) { if (!(message.getEntityId() instanceof ProgramRunId)) { LOG.warn("Missing program run id from the field lineage information. Ignoring the message {}", message); return; } ProgramRunId programRunId = (ProgramRunId) message.getEntityId(); FieldLineageInfo fieldLineageInfo; try { Gson gson = new GsonBuilder() .registerTypeAdapter(EntityId.class, new EntityIdTypeAdapter()) .registerTypeAdapter(MetadataOperation.class, new MetadataOperationTypeAdapter()) .registerTypeAdapter(Operation.class, new OperationTypeAdapter()) .registerTypeAdapter(EndPointField.class, new EndpointFieldDeserializer()) .create(); fieldLineageInfo = message.getPayload(gson, FieldLineageInfo.class); } catch (Throwable t) { LOG.warn("Error while deserializing the field lineage information message received from TMS. Ignoring : {}", message, t); return; } ProgramRun run; LineageInfo info; try { // create ProgramRun and LineageInfo for MetadataConsumer long startTimeMs = RunIds.getTime(programRunId.getRun(), TimeUnit.MILLISECONDS); long endTimeMs = System.currentTimeMillis(); run = getProgramRunForConsumer(programRunId, startTimeMs, endTimeMs); info = getLineageInfoForConsumer(fieldLineageInfo, startTimeMs, endTimeMs); } catch (IllegalArgumentException e) { LOG.warn("Error while processing field-lineage information received from TMS. Ignoring : {}", message, e); return; } this.consumers.forEach((key, consumer) -> { DefaultMetadataConsumerContext metadataConsumerContext = new DefaultMetadataConsumerContext(cConf, consumer.getName(), this.metricsCollectionService, run.getNamespace(), run.getApplication()); MetadataConsumerMetrics metrics = metadataConsumerContext.getMetrics(Collections.emptyMap()); try { metrics.increment("metadata.consumer.calls.attempted", 1); // if there is any error from the implementation, log and continue here // as we are already retrying at the service level consumer.consumeLineage(metadataConsumerContext, run, info); } catch (Throwable e) { LOG.error("Error calling the metadata consumer {}: {}", consumer.getName(), e.getMessage()); metrics.increment("metadata.consumer.calls.failed", 1); } }); } private ProgramRun getProgramRunForConsumer(ProgramRunId programRunId, long startTimeMs, long endTimeMs) { return ProgramRun.builder(programRunId.getRun()) .setProgramId(programRunId.getParent().toString()) .setApplication(programRunId.getApplication()) .setNamespace(programRunId.getNamespace()) .setStatus(ProgramRunStatus.COMPLETED.name()) .setStartTimeMs(startTimeMs) .setEndTimeMs(endTimeMs) .build(); } private LineageInfo getLineageInfoForConsumer(FieldLineageInfo lineage, long startTimeMs, long endTimeMs) { return LineageInfo.builder() .setStartTimeMs(startTimeMs) .setEndTimeMs(endTimeMs) .setSources(lineage.getSources().stream().map(this::getAssetForEndpoint) .collect(Collectors.toSet())) .setTargets(lineage.getDestinations().stream().map(this::getAssetForEndpoint) .collect(Collectors.toSet())) .setTargetToSources(getAssetsMapFromEndpointFieldsMap(lineage.getIncomingSummary())) .setSourceToTargets(getAssetsMapFromEndpointFieldsMap(lineage.getOutgoingSummary())) .build(); } private Asset getAssetForEndpoint(EndPoint endPoint) { // if the instance is upgraded and the pipeline is not, then there is a chance that fqn is null // throw illegal argument exception so that such messages can be ignored as it does not make sense to retry Map<String, String> properties = endPoint.getProperties(); if (!properties.containsKey(FQN) || (properties.containsKey(FQN) && properties.get(FQN) == null)) { throw new IllegalArgumentException("FQN for the asset is null"); } return new Asset(properties.get(FQN)); } private Map<Asset, Set<Asset>> getAssetsMapFromEndpointFieldsMap(Map<EndPointField, Set<EndPointField>> endPointFieldSetMap) { return endPointFieldSetMap.entrySet().stream() .collect(Collectors.toMap(entry -> getAssetForEndpoint(entry.getKey().getEndPoint()), entry -> entry.getValue().stream() .filter(EndPointField::isValid) .map(endPointField -> getAssetForEndpoint(endPointField.getEndPoint())) .collect(Collectors.toSet()), (first, second) -> Stream.of(first, second).flatMap(Set::stream) .collect(Collectors.toSet()))); } } }
UTF-8
Java
15,575
java
MetadataConsumerSubscriberService.java
Java
[ { "context": "/*\n * Copyright © 2022 Cask Data, Inc.\n *\n * Licensed under the Apache License, Ve", "end": 32, "score": 0.7497997283935547, "start": 23, "tag": "NAME", "value": "Cask Data" } ]
null
[]
/* * Copyright © 2022 <NAME>, 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 io.cdap.cdap.internal.metadata; import com.google.common.collect.ImmutableMap; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.inject.Inject; import io.cdap.cdap.api.lineage.field.EndPoint; import io.cdap.cdap.api.lineage.field.Operation; import io.cdap.cdap.api.messaging.Message; import io.cdap.cdap.api.messaging.MessagingContext; import io.cdap.cdap.api.metrics.MetricsCollectionService; import io.cdap.cdap.common.ConflictException; import io.cdap.cdap.common.app.RunIds; import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.service.RetryStrategies; import io.cdap.cdap.common.utils.ImmutablePair; import io.cdap.cdap.data2.metadata.lineage.field.EndPointField; import io.cdap.cdap.data2.metadata.lineage.field.EndpointFieldDeserializer; import io.cdap.cdap.data2.metadata.lineage.field.FieldLineageInfo; import io.cdap.cdap.data2.metadata.writer.MetadataMessage; import io.cdap.cdap.data2.metadata.writer.MetadataOperation; import io.cdap.cdap.data2.metadata.writer.MetadataOperationTypeAdapter; import io.cdap.cdap.internal.app.store.AppMetadataStore; import io.cdap.cdap.messaging.MessagingService; import io.cdap.cdap.messaging.context.MultiThreadMessagingContext; import io.cdap.cdap.messaging.subscriber.AbstractMessagingSubscriberService; import io.cdap.cdap.metadata.MetadataMessageProcessor; import io.cdap.cdap.proto.ProgramRunStatus; import io.cdap.cdap.proto.codec.EntityIdTypeAdapter; import io.cdap.cdap.proto.codec.OperationTypeAdapter; import io.cdap.cdap.proto.element.EntityType; import io.cdap.cdap.proto.id.EntityId; import io.cdap.cdap.proto.id.NamespaceId; import io.cdap.cdap.proto.id.ProgramRunId; import io.cdap.cdap.spi.data.StructuredTableContext; import io.cdap.cdap.spi.data.TableNotFoundException; import io.cdap.cdap.spi.data.transaction.TransactionRunner; import io.cdap.cdap.spi.metadata.Asset; import io.cdap.cdap.spi.metadata.LineageInfo; import io.cdap.cdap.spi.metadata.MetadataConsumer; import io.cdap.cdap.spi.metadata.MetadataConsumerMetrics; import io.cdap.cdap.spi.metadata.ProgramRun; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nullable; import org.apache.tephra.TxConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Service responsible for consuming metadata messages from TMS and consume it in ext modules if configured. * This is a wrapping service to host multiple {@link AbstractMessagingSubscriberService}s for lineage subscriptions. * No transactions should be started in any of the overridden methods since they are already wrapped in a transaction. */ public class MetadataConsumerSubscriberService extends AbstractMessagingSubscriberService<MetadataMessage> { private static final Logger LOG = LoggerFactory.getLogger(MetadataConsumerSubscriberService.class); private static final Gson GSON = new GsonBuilder() .registerTypeAdapter(EntityId.class, new EntityIdTypeAdapter()) .registerTypeAdapter(MetadataOperation.class, new MetadataOperationTypeAdapter()) .registerTypeAdapter(Operation.class, new OperationTypeAdapter()) .create(); private static final String FQN = "fqn"; private final MultiThreadMessagingContext messagingContext; private final TransactionRunner transactionRunner; private final int maxRetriesOnConflict; private final CConfiguration cConf; private final MetadataConsumerExtensionLoader provider; private final MetricsCollectionService metricsCollectionService; private String conflictMessageId; private int conflictCount; @Inject MetadataConsumerSubscriberService(CConfiguration cConf, MessagingService messagingService, MetricsCollectionService metricsCollectionService, TransactionRunner transactionRunner, MetadataConsumerExtensionLoader provider) { super( NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)), cConf.getInt(Constants.Metadata.MESSAGING_FETCH_SIZE), cConf.getInt(TxConstants.Manager.CFG_TX_TIMEOUT), cConf.getLong(Constants.Metadata.MESSAGING_POLL_DELAY_MILLIS), RetryStrategies.fromConfiguration(cConf, "system.metadata."), metricsCollectionService.getContext(ImmutableMap.of( Constants.Metrics.Tag.COMPONENT, Constants.Service.MASTER_SERVICES, Constants.Metrics.Tag.INSTANCE_ID, "0", Constants.Metrics.Tag.NAMESPACE, NamespaceId.SYSTEM.getNamespace(), Constants.Metrics.Tag.TOPIC, cConf.get(Constants.Metadata.MESSAGING_TOPIC), Constants.Metrics.Tag.CONSUMER, Constants.Metadata.METADATA_WRITER_SUBSCRIBER ))); this.messagingContext = new MultiThreadMessagingContext(messagingService); this.transactionRunner = transactionRunner; this.maxRetriesOnConflict = cConf.getInt(Constants.Metadata.MESSAGING_RETRIES_ON_CONFLICT); this.cConf = cConf; this.provider = provider; this.metricsCollectionService = metricsCollectionService; } @Override protected MessagingContext getMessagingContext() { return messagingContext; } @Override protected TransactionRunner getTransactionRunner() { return transactionRunner; } @Override protected MetadataMessage decodeMessage(Message message) { return message.decodePayload(r -> GSON.fromJson(r, MetadataMessage.class)); } @Nullable @Override protected String loadMessageId(StructuredTableContext context) throws IOException, TableNotFoundException { AppMetadataStore appMetadataStore = AppMetadataStore.create(context); return appMetadataStore.retrieveSubscriberState(getTopicId().getTopic(), Constants.Metadata.METADATA_WRITER_SUBSCRIBER); } @Override protected void storeMessageId(StructuredTableContext context, String messageId) throws IOException, TableNotFoundException { AppMetadataStore appMetadataStore = AppMetadataStore.create(context); appMetadataStore.persistSubscriberState(getTopicId().getTopic(), Constants.Metadata.METADATA_WRITER_SUBSCRIBER, messageId); } @Override protected boolean shouldRunInSeparateTx(ImmutablePair<String, MetadataMessage> message) { // if this message caused a conflict last time we tried, stop here to commit all messages processed so far if (message.getFirst().equals(conflictMessageId)) { return true; } // operations at the instance or namespace level can take time. Stop here to process in a new transaction EntityType entityType = message.getSecond().getEntityId().getEntityType(); return entityType.equals(EntityType.INSTANCE) || entityType.equals(EntityType.NAMESPACE); } @Override protected void preProcess() { // no-op } @Override protected void doStartUp() throws Exception { super.doStartUp(); } @Override protected void processMessages(StructuredTableContext structuredTableContext, Iterator<ImmutablePair<String, MetadataMessage>> messages) throws IOException, ConflictException { Map<MetadataMessage.Type, MetadataMessageProcessor> processors = new HashMap<>(); // Loop over all fetched messages and process them with corresponding MetadataMessageProcessor while (messages.hasNext()) { ImmutablePair<String, MetadataMessage> next = messages.next(); String messageId = next.getFirst(); MetadataMessage message = next.getSecond(); MetadataMessageProcessor processor = processors.computeIfAbsent(message.getType(), type -> { if (type == MetadataMessage.Type.FIELD_LINEAGE) { return new FieldLineageProcessor(this.cConf, this.provider.loadMetadataConsumers(), this.metricsCollectionService); } return null; }); // Intellij would warn here that the condition is always false - because the switch above covers all cases. // But if there is ever an unexpected message, we can't throw exception, that would leave the message there. if (processor == null) { continue; } try { processor.processMessage(message, structuredTableContext); conflictCount = 0; } catch (ConflictException e) { if (messageId.equals(conflictMessageId)) { conflictCount++; if (conflictCount >= maxRetriesOnConflict) { LOG.warn("Skipping metadata message {} after processing it has caused {} consecutive conflicts: {}", message, conflictCount, e.getMessage()); continue; } } else { conflictMessageId = messageId; conflictCount = 1; } throw e; } } } /** * The {@link MetadataMessageProcessor} for processing field lineage. */ private static final class FieldLineageProcessor implements MetadataMessageProcessor { private final CConfiguration cConf; private final Map<String, MetadataConsumer> consumers; private final MetricsCollectionService metricsCollectionService; FieldLineageProcessor(CConfiguration cConf, Map<String, MetadataConsumer> consumers, MetricsCollectionService metricsCollectionService) { this.cConf = cConf; this.consumers = consumers; this.metricsCollectionService = metricsCollectionService; } @Override public void processMessage(MetadataMessage message, StructuredTableContext context) { if (!(message.getEntityId() instanceof ProgramRunId)) { LOG.warn("Missing program run id from the field lineage information. Ignoring the message {}", message); return; } ProgramRunId programRunId = (ProgramRunId) message.getEntityId(); FieldLineageInfo fieldLineageInfo; try { Gson gson = new GsonBuilder() .registerTypeAdapter(EntityId.class, new EntityIdTypeAdapter()) .registerTypeAdapter(MetadataOperation.class, new MetadataOperationTypeAdapter()) .registerTypeAdapter(Operation.class, new OperationTypeAdapter()) .registerTypeAdapter(EndPointField.class, new EndpointFieldDeserializer()) .create(); fieldLineageInfo = message.getPayload(gson, FieldLineageInfo.class); } catch (Throwable t) { LOG.warn("Error while deserializing the field lineage information message received from TMS. Ignoring : {}", message, t); return; } ProgramRun run; LineageInfo info; try { // create ProgramRun and LineageInfo for MetadataConsumer long startTimeMs = RunIds.getTime(programRunId.getRun(), TimeUnit.MILLISECONDS); long endTimeMs = System.currentTimeMillis(); run = getProgramRunForConsumer(programRunId, startTimeMs, endTimeMs); info = getLineageInfoForConsumer(fieldLineageInfo, startTimeMs, endTimeMs); } catch (IllegalArgumentException e) { LOG.warn("Error while processing field-lineage information received from TMS. Ignoring : {}", message, e); return; } this.consumers.forEach((key, consumer) -> { DefaultMetadataConsumerContext metadataConsumerContext = new DefaultMetadataConsumerContext(cConf, consumer.getName(), this.metricsCollectionService, run.getNamespace(), run.getApplication()); MetadataConsumerMetrics metrics = metadataConsumerContext.getMetrics(Collections.emptyMap()); try { metrics.increment("metadata.consumer.calls.attempted", 1); // if there is any error from the implementation, log and continue here // as we are already retrying at the service level consumer.consumeLineage(metadataConsumerContext, run, info); } catch (Throwable e) { LOG.error("Error calling the metadata consumer {}: {}", consumer.getName(), e.getMessage()); metrics.increment("metadata.consumer.calls.failed", 1); } }); } private ProgramRun getProgramRunForConsumer(ProgramRunId programRunId, long startTimeMs, long endTimeMs) { return ProgramRun.builder(programRunId.getRun()) .setProgramId(programRunId.getParent().toString()) .setApplication(programRunId.getApplication()) .setNamespace(programRunId.getNamespace()) .setStatus(ProgramRunStatus.COMPLETED.name()) .setStartTimeMs(startTimeMs) .setEndTimeMs(endTimeMs) .build(); } private LineageInfo getLineageInfoForConsumer(FieldLineageInfo lineage, long startTimeMs, long endTimeMs) { return LineageInfo.builder() .setStartTimeMs(startTimeMs) .setEndTimeMs(endTimeMs) .setSources(lineage.getSources().stream().map(this::getAssetForEndpoint) .collect(Collectors.toSet())) .setTargets(lineage.getDestinations().stream().map(this::getAssetForEndpoint) .collect(Collectors.toSet())) .setTargetToSources(getAssetsMapFromEndpointFieldsMap(lineage.getIncomingSummary())) .setSourceToTargets(getAssetsMapFromEndpointFieldsMap(lineage.getOutgoingSummary())) .build(); } private Asset getAssetForEndpoint(EndPoint endPoint) { // if the instance is upgraded and the pipeline is not, then there is a chance that fqn is null // throw illegal argument exception so that such messages can be ignored as it does not make sense to retry Map<String, String> properties = endPoint.getProperties(); if (!properties.containsKey(FQN) || (properties.containsKey(FQN) && properties.get(FQN) == null)) { throw new IllegalArgumentException("FQN for the asset is null"); } return new Asset(properties.get(FQN)); } private Map<Asset, Set<Asset>> getAssetsMapFromEndpointFieldsMap(Map<EndPointField, Set<EndPointField>> endPointFieldSetMap) { return endPointFieldSetMap.entrySet().stream() .collect(Collectors.toMap(entry -> getAssetForEndpoint(entry.getKey().getEndPoint()), entry -> entry.getValue().stream() .filter(EndPointField::isValid) .map(endPointField -> getAssetForEndpoint(endPointField.getEndPoint())) .collect(Collectors.toSet()), (first, second) -> Stream.of(first, second).flatMap(Set::stream) .collect(Collectors.toSet()))); } } }
15,572
0.715552
0.714203
335
45.489552
33.220642
118
false
false
0
0
0
0
0
0
0.698507
false
false
7
c8706e6a97d82fb6485fb34fcab7592fb1a25fed
3,083,786,527,479
b022a519f77e67d268e379aaddf23a0ec8c9432d
/src/main/java/com/fcgl/madrid/points/service/TrophyService.java
092c37d121b5303e728c6f6fd1e1b6d1ed7c7524
[ "MIT" ]
permissive
fcgl/point-system
https://github.com/fcgl/point-system
a4b64bf565b65062acf5472067b787d59370e8fd
47fc615cafadd5835c73fa86b08e7a3abd4f726e
refs/heads/master
2022-02-16T14:58:11.186000
2019-10-08T04:44:30
2019-10-08T04:44:30
199,157,188
1
4
MIT
false
2022-01-21T23:28:41
2019-07-27T11:38:56
2019-10-08T04:44:32
2022-01-21T23:28:39
199
1
3
1
Java
false
false
package com.fcgl.madrid.points.service; import com.fcgl.madrid.points.dataModel.Trophy; import com.fcgl.madrid.points.repository.TrophyRepository; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; @Service public class TrophyService { private TrophyRepository trophyRepository; @Autowired public TrophyService(TrophyRepository trophyRepository) { this.trophyRepository = trophyRepository; } public List<Trophy> findAll() { return trophyRepository.findAll(); } }
UTF-8
Java
590
java
TrophyService.java
Java
[]
null
[]
package com.fcgl.madrid.points.service; import com.fcgl.madrid.points.dataModel.Trophy; import com.fcgl.madrid.points.repository.TrophyRepository; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; @Service public class TrophyService { private TrophyRepository trophyRepository; @Autowired public TrophyService(TrophyRepository trophyRepository) { this.trophyRepository = trophyRepository; } public List<Trophy> findAll() { return trophyRepository.findAll(); } }
590
0.772881
0.772881
22
25.818182
22.558281
62
false
false
0
0
0
0
0
0
0.409091
false
false
7
e35fb11433be1a490d04eee5e3a66fc0d243d42e
790,274,033,974
39df4ebdc529bd677017caf3fc2af20be3dd3538
/fap-workflow/fap-flow-core/src/main/java/eon/hg/fap/flow/process/node/calendar/BusinessCalendar.java
2740e2fd0b1ce92fbb26c457a410de8745be8abf
[]
no_license
aeonj/eon-dmp
https://github.com/aeonj/eon-dmp
6d3580d758f697d407178175bb6bc532add8a85f
d1cfc867bb31833f5d4b7faa3146d468434f9fc5
refs/heads/master
2022-09-12T09:51:32.136000
2021-07-02T09:26:42
2021-07-02T09:26:42
141,535,375
0
0
null
false
2022-09-01T23:09:36
2018-07-19T06:39:51
2021-07-03T08:11:41
2022-09-01T23:09:34
19,055
0
0
3
Java
false
false
/******************************************************************************* * Copyright 2017 Bstek * * 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 eon.hg.fap.flow.process.node.calendar; import java.util.Calendar; import java.util.Date; /** * @author Jacky.gao * @since 2013年9月18日 */ public class BusinessCalendar { public static final String BEAN_ID="wf.businessCalendar"; private int businessDayHours; public Date calEndDate(Calendar startDate,Calendar endDate,org.quartz.Calendar baseCalendar){ int holidayMinutes=calHolidayMinutes(startDate,endDate,baseCalendar); if(holidayMinutes==0){ return endDate.getTime(); } startDate.setTime(endDate.getTime()); endDate.add(Calendar.MINUTE, holidayMinutes); return calEndDate(startDate,endDate,baseCalendar); } private int calHolidayMinutes(Calendar startDate,Calendar endDate,org.quartz.Calendar baseCalendar) { if(startDate.getTimeInMillis()==endDate.getTimeInMillis()){ return 0; } int count=0; while(startDate.getTimeInMillis()<endDate.getTimeInMillis()){ if(!baseCalendar.isTimeIncluded(startDate.getTime().getTime())){ count++; } startDate.add(Calendar.MINUTE, 1); } return count; } public int getBusinessDayHours() { return businessDayHours; } public void setBusinessDayHours(int businessDayHours) { this.businessDayHours = businessDayHours; } }
UTF-8
Java
1,978
java
BusinessCalendar.java
Java
[ { "context": "********************************\n * Copyright 2017 Bstek\n * \n * Licensed under the Apache License, Version", "end": 104, "score": 0.7943820953369141, "start": 99, "tag": "USERNAME", "value": "Bstek" }, { "context": "l.Calendar;\nimport java.util.Date;\n\n/**\n * @author Jacky.gao\n * @since 2013年9月18日\n */\npublic class BusinessCal", "end": 870, "score": 0.9996862411499023, "start": 861, "tag": "NAME", "value": "Jacky.gao" } ]
null
[]
/******************************************************************************* * Copyright 2017 Bstek * * 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 eon.hg.fap.flow.process.node.calendar; import java.util.Calendar; import java.util.Date; /** * @author Jacky.gao * @since 2013年9月18日 */ public class BusinessCalendar { public static final String BEAN_ID="wf.businessCalendar"; private int businessDayHours; public Date calEndDate(Calendar startDate,Calendar endDate,org.quartz.Calendar baseCalendar){ int holidayMinutes=calHolidayMinutes(startDate,endDate,baseCalendar); if(holidayMinutes==0){ return endDate.getTime(); } startDate.setTime(endDate.getTime()); endDate.add(Calendar.MINUTE, holidayMinutes); return calEndDate(startDate,endDate,baseCalendar); } private int calHolidayMinutes(Calendar startDate,Calendar endDate,org.quartz.Calendar baseCalendar) { if(startDate.getTimeInMillis()==endDate.getTimeInMillis()){ return 0; } int count=0; while(startDate.getTimeInMillis()<endDate.getTimeInMillis()){ if(!baseCalendar.isTimeIncluded(startDate.getTime().getTime())){ count++; } startDate.add(Calendar.MINUTE, 1); } return count; } public int getBusinessDayHours() { return businessDayHours; } public void setBusinessDayHours(int businessDayHours) { this.businessDayHours = businessDayHours; } }
1,978
0.691684
0.682049
60
31.866667
29.68696
102
false
false
0
0
0
0
0
0
1.5
false
false
7
41be675de94d57d4f2fb60cbc82859353032e9f0
18,262,200,944,106
a701ed72e84e7195ed8337fd400edcf618528c6a
/src/main/java/oplang/internal/utils/FileHandler.java
dd2346579cbd8b77c3086d789a085b36a178d894
[]
no_license
tobycaulk/OPLang
https://github.com/tobycaulk/OPLang
eb66b5824f5962b12d4058933f9068477c63cd12
11e4804673ebbd540ae6231a8dc44b459f2ae32b
refs/heads/master
2016-07-26T12:19:46.389000
2015-08-01T23:33:22
2015-08-01T23:33:22
40,063,022
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package oplang.internal.utils; import java.io.File; import java.io.IOException; import java.nio.file.Paths; import org.apache.commons.io.FileUtils; public class FileHandler { public static String read(String path) { File file = new File(Paths.get(".").toAbsolutePath().normalize().toString() + "\\" + path); if(!file.isFile()) { try { throw new Exception("File could not be found: " + path); } catch (Exception e) { e.printStackTrace(); } } String content = ""; try { content = FileUtils.readFileToString(file); } catch (IOException e) { e.printStackTrace(); } return content; } }
UTF-8
Java
635
java
FileHandler.java
Java
[]
null
[]
package oplang.internal.utils; import java.io.File; import java.io.IOException; import java.nio.file.Paths; import org.apache.commons.io.FileUtils; public class FileHandler { public static String read(String path) { File file = new File(Paths.get(".").toAbsolutePath().normalize().toString() + "\\" + path); if(!file.isFile()) { try { throw new Exception("File could not be found: " + path); } catch (Exception e) { e.printStackTrace(); } } String content = ""; try { content = FileUtils.readFileToString(file); } catch (IOException e) { e.printStackTrace(); } return content; } }
635
0.655118
0.655118
31
19.483871
20.606718
93
false
false
0
0
0
0
0
0
1.903226
false
false
7
1b502166d14a6b247b8fbdef844039c4bbc8624a
14,903,536,537,198
94840c0a16cd8805d488ca2d6f40ae977649c25f
/itoken-web-admin/src/main/java/com/kaysanshi/itoken/web/admin/service/fallback/RedisServiceFallBack.java
ef87aaa0f4fd6e5651e94f81a8b597aae4338c28
[]
no_license
kaysanshi/spring-cloud-itoken
https://github.com/kaysanshi/spring-cloud-itoken
652c26ec8bee895def68090fddb03fbdc882e4da
5d22ce65e56e7158c6087b6c0cd811b3452d98b6
refs/heads/master
2021-12-11T10:53:24.245000
2020-10-24T06:42:09
2020-10-24T06:42:09
194,363,259
1
1
null
false
2021-12-09T21:20:43
2019-06-29T04:15:37
2020-10-29T02:46:29
2021-12-09T21:20:40
332
0
1
3
Java
false
false
package com.kaysanshi.itoken.web.admin.service.fallback; import com.google.common.collect.Lists; import com.kaysanshi.itoken.common.constants.HttpStatusConstants; import com.kaysanshi.itoken.common.dto.BaseResult; import com.kaysanshi.itoken.common.utils.MapperUtils; import com.kaysanshi.itoken.web.admin.service.RedisService; import org.springframework.stereotype.Component; /** *熔断 * @Author kay三石 * @date:2019/6/28 */ @Component public class RedisServiceFallBack implements RedisService { @Override public String put(String key, String vlaue, long seconds) { try { return MapperUtils.obj2json(BaseResult.notOk( Lists.newArrayList( new BaseResult.Error(String.valueOf(HttpStatusConstants.BAD_GATEWAY.getStatus()), HttpStatusConstants.BAD_GATEWAY.getContent())))); } catch (Exception e) { e.printStackTrace(); } return null; } @Override public String get(String key) { try { return MapperUtils.obj2json(BaseResult.notOk( Lists.newArrayList( new BaseResult.Error(String.valueOf(HttpStatusConstants.BAD_GATEWAY.getStatus()), HttpStatusConstants.BAD_GATEWAY.getContent())))); } catch (Exception e) { e.printStackTrace(); } return null; } }
UTF-8
Java
1,460
java
RedisServiceFallBack.java
Java
[ { "context": "amework.stereotype.Component;\n\n/**\n *熔断\n * @Author kay三石\n * @date:2019/6/28\n */\n@Component\npublic class Re", "end": 404, "score": 0.6840019226074219, "start": 399, "tag": "NAME", "value": "kay三石" } ]
null
[]
package com.kaysanshi.itoken.web.admin.service.fallback; import com.google.common.collect.Lists; import com.kaysanshi.itoken.common.constants.HttpStatusConstants; import com.kaysanshi.itoken.common.dto.BaseResult; import com.kaysanshi.itoken.common.utils.MapperUtils; import com.kaysanshi.itoken.web.admin.service.RedisService; import org.springframework.stereotype.Component; /** *熔断 * @Author kay三石 * @date:2019/6/28 */ @Component public class RedisServiceFallBack implements RedisService { @Override public String put(String key, String vlaue, long seconds) { try { return MapperUtils.obj2json(BaseResult.notOk( Lists.newArrayList( new BaseResult.Error(String.valueOf(HttpStatusConstants.BAD_GATEWAY.getStatus()), HttpStatusConstants.BAD_GATEWAY.getContent())))); } catch (Exception e) { e.printStackTrace(); } return null; } @Override public String get(String key) { try { return MapperUtils.obj2json(BaseResult.notOk( Lists.newArrayList( new BaseResult.Error(String.valueOf(HttpStatusConstants.BAD_GATEWAY.getStatus()), HttpStatusConstants.BAD_GATEWAY.getContent())))); } catch (Exception e) { e.printStackTrace(); } return null; } }
1,460
0.628099
0.621901
42
33.57143
29.082104
109
false
false
0
0
0
0
0
0
0.404762
false
false
7
65510956c0984ed4ea3ed0b9f2fd99f7c01b7505
22,282,290,351,457
4cb2629ff7386055dfe1d75e20b2da5fa8c1b618
/QCloudCosXmlSample/app/src/main/java/com/tencent/qcloud/cosxml/sample/ProgressActivity.java
fb50ac3bef24471265a426109ed38fe9d6b7c953
[ "MIT" ]
permissive
weiyirong/qcloud-sdk-android-samples
https://github.com/weiyirong/qcloud-sdk-android-samples
5e3ae802e121be0bd0147594c582b30b141b0bd2
6290f8087af8469a020a496587b531281aafa71e
refs/heads/master
2022-03-14T00:04:19.502000
2019-12-18T02:21:20
2019-12-18T02:21:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tencent.qcloud.cosxml.sample; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.tencent.qcloud.cosxml.sample.ObjectSample.AbortMultiUploadSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.CompleteMultiUploadSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.GetObjectSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.ListPartsSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.MultipartUploadHelperSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.UploadPartSample; import com.tencent.qcloud.cosxml.sample.common.QServiceCfg; public class ProgressActivity extends AppCompatActivity { QServiceCfg qServiceCfg; ProgressBar progressBar; Button abortButton; Button listPartButton; int taskType; boolean criticalOp; UploadPartSample uploadPartSample; MultipartUploadHelperSample multipartUploadHelperSample; Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 0: progressBar.setProgress((Integer) msg.obj); break; case 1: Toast.makeText(ProgressActivity.this, "任务完成", Toast.LENGTH_LONG).show(); if (taskType == 1) { // 分片上传完成后,必须要做一次complete操作,才能完成文件的上传 onComplete(); } break; } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_download_progress); progressBar = (ProgressBar) findViewById(R.id.progress); progressBar.setMax(100); abortButton = (Button) findViewById(R.id.abort); listPartButton = (Button) findViewById(R.id.list_part); qServiceCfg = QServiceCfg.instance(this); String cosPath = getIntent().getStringExtra("cosPath"); String label = getIntent().getStringExtra("label"); // 0: 下载 // 1:普通分片上传 // 2:用upload helper分片上传 // 3:追加块 taskType = getIntent().getIntExtra("taskType", 0); // 对于首次下载分片的sample数据,不允许退出,demo内部状态,可以无视 criticalOp = getIntent().getBooleanExtra("critical", false); if (taskType == 1) { abortButton.setVisibility(View.VISIBLE); abortButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onAbort(); } }); listPartButton.setVisibility(View.VISIBLE); listPartButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onListPart(); } }); } ((TextView) findViewById(R.id.label)).setText(label); onGetAsync(cosPath, taskType); } void onListPart() { ListPartsSample listPartsSample = new ListPartsSample(qServiceCfg); // listPartsSample.startAsync(this); } @Override public void onBackPressed() { if (taskType == 1 || taskType == 2) { // 对于上传任务,因为耗时较长,退出就终止任务 new AlertDialog.Builder(this) .setTitle("是否要终止任务") .setPositiveButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }) .setNegativeButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { onAbort(); ProgressActivity.super.onBackPressed(); } }).create().show(); } else if (criticalOp) { // 对于首次下载分片的sample数据,不允许退出,否则会影响分片上传的功能演示 Toast.makeText(ProgressActivity.this, "请耐心等待任务完成~", Toast.LENGTH_LONG).show(); } else { super.onBackPressed(); } } void onComplete() { CompleteMultiUploadSample completeMultiUploadSample = new CompleteMultiUploadSample(qServiceCfg); // completeMultiUploadSample.startAsync(this); } void onAbort() { if (uploadPartSample != null) { // uploadPartSample.abort(); AbortMultiUploadSample abortMultiUploadSample = new AbortMultiUploadSample(qServiceCfg); abortMultiUploadSample.startAsync(this); } else if (multipartUploadHelperSample != null) { // multipartUploadHelperSample.abort(); } } // void onGet(final String cosPath, final int taskType) { // new Thread(new Runnable() { // @Override // public void run() { // if (taskType == 0) { // GetObjectSample getObjectSample = new GetObjectSample(qServiceCfg, cosPath, handler); // getObjectSample.start(); // } else if (taskType == 1) { // uploadPartSample = new UploadPartSample(qServiceCfg, handler); // uploadPartSample.start(); // } else if (taskType == 2) { // MultipartUploadHelperSample multipartUploadHelperSample = new MultipartUploadHelperSample(qServiceCfg, handler); // multipartUploadHelperSample.start(); // } // } // }).start(); // } void onGetAsync(final String cosPath, final int taskType) { // if (taskType == 0) { // GetObjectSample getObjectSample = new GetObjectSample(qServiceCfg, cosPath, handler); // getObjectSample.startAsync(this); // } else if (taskType == 1) { // uploadPartSample = new UploadPartSample(qServiceCfg, handler); // uploadPartSample.startAsync(this); // } else if (taskType == 2) { // new Thread(new Runnable() { // @Override // public void run() { // multipartUploadHelperSample = new MultipartUploadHelperSample(qServiceCfg, handler); // ResultHelper result = multipartUploadHelperSample.start(); // if(result != null){ // Intent intent = new Intent(ProgressActivity.this, ResultActivity.class); // intent.putExtra("RESULT", result.showMessage()); // startActivity(intent); // } else { // Toast.makeText(ProgressActivity.this, "result is null", Toast.LENGTH_LONG).show(); // } // finish(); // } // }).start(); // } else if (taskType == 3) { // AppendObjectSample appendObjectSample = new AppendObjectSample(qServiceCfg, handler); // appendObjectSample.startAsync(this); // } } }
UTF-8
Java
7,880
java
ProgressActivity.java
Java
[]
null
[]
package com.tencent.qcloud.cosxml.sample; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.tencent.qcloud.cosxml.sample.ObjectSample.AbortMultiUploadSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.CompleteMultiUploadSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.GetObjectSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.ListPartsSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.MultipartUploadHelperSample; import com.tencent.qcloud.cosxml.sample.ObjectSample.UploadPartSample; import com.tencent.qcloud.cosxml.sample.common.QServiceCfg; public class ProgressActivity extends AppCompatActivity { QServiceCfg qServiceCfg; ProgressBar progressBar; Button abortButton; Button listPartButton; int taskType; boolean criticalOp; UploadPartSample uploadPartSample; MultipartUploadHelperSample multipartUploadHelperSample; Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 0: progressBar.setProgress((Integer) msg.obj); break; case 1: Toast.makeText(ProgressActivity.this, "任务完成", Toast.LENGTH_LONG).show(); if (taskType == 1) { // 分片上传完成后,必须要做一次complete操作,才能完成文件的上传 onComplete(); } break; } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_download_progress); progressBar = (ProgressBar) findViewById(R.id.progress); progressBar.setMax(100); abortButton = (Button) findViewById(R.id.abort); listPartButton = (Button) findViewById(R.id.list_part); qServiceCfg = QServiceCfg.instance(this); String cosPath = getIntent().getStringExtra("cosPath"); String label = getIntent().getStringExtra("label"); // 0: 下载 // 1:普通分片上传 // 2:用upload helper分片上传 // 3:追加块 taskType = getIntent().getIntExtra("taskType", 0); // 对于首次下载分片的sample数据,不允许退出,demo内部状态,可以无视 criticalOp = getIntent().getBooleanExtra("critical", false); if (taskType == 1) { abortButton.setVisibility(View.VISIBLE); abortButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onAbort(); } }); listPartButton.setVisibility(View.VISIBLE); listPartButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onListPart(); } }); } ((TextView) findViewById(R.id.label)).setText(label); onGetAsync(cosPath, taskType); } void onListPart() { ListPartsSample listPartsSample = new ListPartsSample(qServiceCfg); // listPartsSample.startAsync(this); } @Override public void onBackPressed() { if (taskType == 1 || taskType == 2) { // 对于上传任务,因为耗时较长,退出就终止任务 new AlertDialog.Builder(this) .setTitle("是否要终止任务") .setPositiveButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }) .setNegativeButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { onAbort(); ProgressActivity.super.onBackPressed(); } }).create().show(); } else if (criticalOp) { // 对于首次下载分片的sample数据,不允许退出,否则会影响分片上传的功能演示 Toast.makeText(ProgressActivity.this, "请耐心等待任务完成~", Toast.LENGTH_LONG).show(); } else { super.onBackPressed(); } } void onComplete() { CompleteMultiUploadSample completeMultiUploadSample = new CompleteMultiUploadSample(qServiceCfg); // completeMultiUploadSample.startAsync(this); } void onAbort() { if (uploadPartSample != null) { // uploadPartSample.abort(); AbortMultiUploadSample abortMultiUploadSample = new AbortMultiUploadSample(qServiceCfg); abortMultiUploadSample.startAsync(this); } else if (multipartUploadHelperSample != null) { // multipartUploadHelperSample.abort(); } } // void onGet(final String cosPath, final int taskType) { // new Thread(new Runnable() { // @Override // public void run() { // if (taskType == 0) { // GetObjectSample getObjectSample = new GetObjectSample(qServiceCfg, cosPath, handler); // getObjectSample.start(); // } else if (taskType == 1) { // uploadPartSample = new UploadPartSample(qServiceCfg, handler); // uploadPartSample.start(); // } else if (taskType == 2) { // MultipartUploadHelperSample multipartUploadHelperSample = new MultipartUploadHelperSample(qServiceCfg, handler); // multipartUploadHelperSample.start(); // } // } // }).start(); // } void onGetAsync(final String cosPath, final int taskType) { // if (taskType == 0) { // GetObjectSample getObjectSample = new GetObjectSample(qServiceCfg, cosPath, handler); // getObjectSample.startAsync(this); // } else if (taskType == 1) { // uploadPartSample = new UploadPartSample(qServiceCfg, handler); // uploadPartSample.startAsync(this); // } else if (taskType == 2) { // new Thread(new Runnable() { // @Override // public void run() { // multipartUploadHelperSample = new MultipartUploadHelperSample(qServiceCfg, handler); // ResultHelper result = multipartUploadHelperSample.start(); // if(result != null){ // Intent intent = new Intent(ProgressActivity.this, ResultActivity.class); // intent.putExtra("RESULT", result.showMessage()); // startActivity(intent); // } else { // Toast.makeText(ProgressActivity.this, "result is null", Toast.LENGTH_LONG).show(); // } // finish(); // } // }).start(); // } else if (taskType == 3) { // AppendObjectSample appendObjectSample = new AppendObjectSample(qServiceCfg, handler); // appendObjectSample.startAsync(this); // } } }
7,880
0.583223
0.58019
194
38.082474
27.538416
134
false
false
0
0
0
0
0
0
0.603093
false
false
7
1728125d70a5dbc1cceb1dc68ec019ee7500d1bb
10,067,403,351,143
8a2cb6b6db8f654357ef5b682bb81e00ce8b93d9
/src/main/java/App/Service/UserLoginService.java
7804453cde455516f675e1e2e9228eb5f5927f30
[]
no_license
Kohilmes/ichuan
https://github.com/Kohilmes/ichuan
4e51db478d0eb66efec42214bb4346e1933d7d54
6f0da8f5519c5198943703e508fe5125d3be127a
refs/heads/master
2023-03-15T15:34:28.304000
2019-04-25T08:31:12
2019-04-25T08:31:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package App.Service; import App.Domain.UserLogin; import App.Mapper.UserLoginMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @Transactional public class UserLoginService { @Autowired UserLoginMapper userLoginMapper; // //管理员登陆 // public UserLogin systemManagerLogin(String accountNumber,String password) // { // UserLogin selectResult= userLoginMapper.systemManagerLogin(accountNumber, password); // return selectResult; // } // //用户登陆 // public UserLogin userLogin (String accountNumber,String password){ // UserLogin selectResult= userLoginMapper.userLogin(accountNumber, password); // return selectResult; // } //增加用户 public Integer userLoginInsert (String accountNumber,String password,String email,String phone){ return userLoginMapper.userLoginInsert(accountNumber, password, email, phone); } //修改密码 public Integer userLoginUpdatePasswordById(String password,Integer userLoginId){ return userLoginMapper.userLoginUpdatePasswordById(password, userLoginId); } //修改邮箱 public Integer userLoginUpdateEmailById(String email,Integer userLoginId) { return userLoginMapper.userLoginUpdateEmailById(email, userLoginId); } //修改电话 public Integer userLoginUpdatePhoneById(String phone,Integer userLoginId) { return userLoginMapper.userLoginUpdatePhoneById(phone, userLoginId); } }
UTF-8
Java
1,618
java
UserLoginService.java
Java
[]
null
[]
package App.Service; import App.Domain.UserLogin; import App.Mapper.UserLoginMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @Transactional public class UserLoginService { @Autowired UserLoginMapper userLoginMapper; // //管理员登陆 // public UserLogin systemManagerLogin(String accountNumber,String password) // { // UserLogin selectResult= userLoginMapper.systemManagerLogin(accountNumber, password); // return selectResult; // } // //用户登陆 // public UserLogin userLogin (String accountNumber,String password){ // UserLogin selectResult= userLoginMapper.userLogin(accountNumber, password); // return selectResult; // } //增加用户 public Integer userLoginInsert (String accountNumber,String password,String email,String phone){ return userLoginMapper.userLoginInsert(accountNumber, password, email, phone); } //修改密码 public Integer userLoginUpdatePasswordById(String password,Integer userLoginId){ return userLoginMapper.userLoginUpdatePasswordById(password, userLoginId); } //修改邮箱 public Integer userLoginUpdateEmailById(String email,Integer userLoginId) { return userLoginMapper.userLoginUpdateEmailById(email, userLoginId); } //修改电话 public Integer userLoginUpdatePhoneById(String phone,Integer userLoginId) { return userLoginMapper.userLoginUpdatePhoneById(phone, userLoginId); } }
1,618
0.751913
0.751913
45
33.844444
32.832203
100
false
false
0
0
0
0
0
0
0.688889
false
false
7
c47d30d2c9595edea7c43f57329c54cf291e47c9
18,124,762,045,186
f26098e8144a8c89abc8a2ade1716779a631cc8d
/rankmigrator/src/main/java/com/github/seliba/devcordbot/migrator/TomlData.java
185e9c436ccec05dcc7c415ab858098d08aedb9d
[ "Apache-2.0" ]
permissive
JohnnyJayJay/DevcordBot
https://github.com/JohnnyJayJay/DevcordBot
3ddfdc4dadffcdfa8273d0de5863a4be7a76c284
8a1240e14726354d08f682f46084522a6a9c9ffb
refs/heads/master
2021-05-19T11:23:46.016000
2020-03-30T19:18:50
2020-03-30T19:18:50
263,324,944
0
0
null
true
2020-05-12T12:05:22
2020-05-12T12:05:21
2020-04-15T09:55:12
2020-05-07T20:48:48
666
0
0
0
null
false
false
/* * Copyright 2020 Daniel Scherf & Michael Rittmeister * * 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.github.seliba.devcordbot.migrator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; /** * This class manages a TOML file and offers options to save and read data from the TOML file * format. * * @author Seliba * @version 1.0 */ public class TomlData { private static final Logger LOGGER = LoggerFactory.getLogger(Migrator.class); private File file; private Map<String, Object> entrys = new HashMap<>(); /** * @param fileName The name of the file where the values should be stored */ public TomlData(String fileName) { file = new File(fileName + ".toml"); reload(); } /** * Reloads all data that is stored in the TOML file */ public void reload() { try (Scanner scanner = new Scanner(file)) { if (!file.exists()) { file.createNewFile(); LOGGER.info("Neuer File erstellt!"); } entrys.clear(); while (scanner.hasNextLine()) { String nextLine = scanner.nextLine(); String[] arguments = nextLine.split(" "); if (arguments[1].equals(" ")) { Object value; Long longValue = Long.valueOf(arguments[2]); if (longValue != null) { value = longValue; } else { value = arguments[2]; } entrys.put(arguments[0], value); } } } catch (IOException exception) { LOGGER.error("An error occurred while parsing file", exception); } } /** * Set the path to the given value. The method creates new paths if they don't already exist. * * @param path The path where the value should be stored * @param value The value that should be stored */ public synchronized void set(String path, Object value) { entrys.put(path, value); this.save(); } /** * Gets the value of a path, in this case of an Long. * * @param path The path of the value in the TOML file * @return The value that is defined in the TOML file */ public Long getLong(String path) { return (Long) entrys.get(path); } /** * Gets the value of a path, in this case of an String. * * @param path The path of the value in the TOML file * @return The value that is defined in the TOML file */ public String getString(String path) { return (String) entrys.get(path); } /** * @return All entries that are saved in the TOML file. */ public Map<String, Object> getEntries() { return entrys; } public void delete() { file.delete(); } /** * Saves the current data to the TOML file */ public void save() { List<String> lines = new ArrayList<>(); entrys.forEach((string, object) -> lines.add(string + " = " + (object))); Path filePath = Paths.get(file.getPath()); try { Files.write(filePath, lines, StandardCharsets.UTF_8); } catch (IOException exception) { LOGGER.atError().setCause(exception).log("Error while saving file {}!", file.getName()); } } }
UTF-8
Java
4,168
java
TomlData.java
Java
[ { "context": "/*\n * Copyright 2020 Daniel Scherf & Michael Rittmeister\n *\n * Licensed under the", "end": 34, "score": 0.9998172521591187, "start": 21, "tag": "NAME", "value": "Daniel Scherf" }, { "context": "/*\n * Copyright 2020 Daniel Scherf & Michael Rittmeister\n *\n * Licensed under the Apache License, Versi", "end": 56, "score": 0.9998472929000854, "start": 37, "tag": "NAME", "value": "Michael Rittmeister" }, { "context": "d data from the TOML file\n * format.\n *\n * @author Seliba\n * @version 1.0\n */\npublic class TomlData {\n\n ", "end": 1077, "score": 0.9763883352279663, "start": 1071, "tag": "NAME", "value": "Seliba" } ]
null
[]
/* * Copyright 2020 <NAME> & <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.github.seliba.devcordbot.migrator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; /** * This class manages a TOML file and offers options to save and read data from the TOML file * format. * * @author Seliba * @version 1.0 */ public class TomlData { private static final Logger LOGGER = LoggerFactory.getLogger(Migrator.class); private File file; private Map<String, Object> entrys = new HashMap<>(); /** * @param fileName The name of the file where the values should be stored */ public TomlData(String fileName) { file = new File(fileName + ".toml"); reload(); } /** * Reloads all data that is stored in the TOML file */ public void reload() { try (Scanner scanner = new Scanner(file)) { if (!file.exists()) { file.createNewFile(); LOGGER.info("Neuer File erstellt!"); } entrys.clear(); while (scanner.hasNextLine()) { String nextLine = scanner.nextLine(); String[] arguments = nextLine.split(" "); if (arguments[1].equals(" ")) { Object value; Long longValue = Long.valueOf(arguments[2]); if (longValue != null) { value = longValue; } else { value = arguments[2]; } entrys.put(arguments[0], value); } } } catch (IOException exception) { LOGGER.error("An error occurred while parsing file", exception); } } /** * Set the path to the given value. The method creates new paths if they don't already exist. * * @param path The path where the value should be stored * @param value The value that should be stored */ public synchronized void set(String path, Object value) { entrys.put(path, value); this.save(); } /** * Gets the value of a path, in this case of an Long. * * @param path The path of the value in the TOML file * @return The value that is defined in the TOML file */ public Long getLong(String path) { return (Long) entrys.get(path); } /** * Gets the value of a path, in this case of an String. * * @param path The path of the value in the TOML file * @return The value that is defined in the TOML file */ public String getString(String path) { return (String) entrys.get(path); } /** * @return All entries that are saved in the TOML file. */ public Map<String, Object> getEntries() { return entrys; } public void delete() { file.delete(); } /** * Saves the current data to the TOML file */ public void save() { List<String> lines = new ArrayList<>(); entrys.forEach((string, object) -> lines.add(string + " = " + (object))); Path filePath = Paths.get(file.getPath()); try { Files.write(filePath, lines, StandardCharsets.UTF_8); } catch (IOException exception) { LOGGER.atError().setCause(exception).log("Error while saving file {}!", file.getName()); } } }
4,148
0.588052
0.583973
136
29.654411
25.718893
100
false
false
0
0
0
0
0
0
0.397059
false
false
7
ecbbb927ffc0ff07b93612bdce34709806525f60
16,071,767,629,503
9443c58efc7db377060f901eff3ea054ad1ff7ac
/app/src/main/java/com/goaffilate/app/CategoryWebview.java
4314fa56d7b542f45b1ee1b805e08e7e86f5a245
[]
no_license
ShivamDev31/AIO
https://github.com/ShivamDev31/AIO
6b86e7e5a51d66f5d5b61f586324b840bda7dbbd
0ed4bf42908b2a53f2e920767b47a06e1f77b5f9
refs/heads/master
2020-08-04T22:40:19.533000
2019-11-03T10:47:14
2019-11-03T10:47:14
212,300,152
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.goaffilate.app; import android.app.ProgressDialog; import android.graphics.Bitmap; import android.os.Bundle; import android.view.KeyEvent; import android.view.MotionEvent; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import androidx.appcompat.app.AppCompatActivity; public class CategoryWebview extends AppCompatActivity { WebView web; String applink; ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_banner); applink=getIntent().getStringExtra("categorylink"); web = (WebView) findViewById(R.id.webview01); web.loadUrl(applink); web.getSettings().setJavaScriptEnabled(true); web.getSettings().setDomStorageEnabled(true); web.getSettings().setLoadWithOverviewMode(true); web.getSettings().setUseWideViewPort(true); web.setWebChromeClient(new WebChromeClient()); web.getSettings().setPluginState(WebSettings.PluginState.ON); web.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); web.setWebViewClient(new myWebClient()); web.canGoBack(); web.setOnKeyListener((v, keyCode, event) -> { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == MotionEvent.ACTION_UP && web.canGoBack()) { web.goBack(); return true; } return false; }); } public class myWebClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // progressDialog.dismiss(); } } }
UTF-8
Java
2,224
java
CategoryWebview.java
Java
[]
null
[]
package com.goaffilate.app; import android.app.ProgressDialog; import android.graphics.Bitmap; import android.os.Bundle; import android.view.KeyEvent; import android.view.MotionEvent; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import androidx.appcompat.app.AppCompatActivity; public class CategoryWebview extends AppCompatActivity { WebView web; String applink; ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_banner); applink=getIntent().getStringExtra("categorylink"); web = (WebView) findViewById(R.id.webview01); web.loadUrl(applink); web.getSettings().setJavaScriptEnabled(true); web.getSettings().setDomStorageEnabled(true); web.getSettings().setLoadWithOverviewMode(true); web.getSettings().setUseWideViewPort(true); web.setWebChromeClient(new WebChromeClient()); web.getSettings().setPluginState(WebSettings.PluginState.ON); web.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); web.setWebViewClient(new myWebClient()); web.canGoBack(); web.setOnKeyListener((v, keyCode, event) -> { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == MotionEvent.ACTION_UP && web.canGoBack()) { web.goBack(); return true; } return false; }); } public class myWebClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // progressDialog.dismiss(); } } }
2,224
0.647032
0.646133
92
23.173914
23.491724
77
false
false
0
0
0
0
0
0
0.5
false
false
7
b307b26e0e71c9090dc82f531b20c7a62477daf5
22,789,096,527,952
b6606a04e22e3f29e5b9925050f85ddef945bb10
/src/tim_so_nguyen_to/LazyPrimeFactorization.java
45c9d508c54f894b207020da3432a81323ae5ff4
[]
no_license
trankimthuong/CodeGym_Java_Week2
https://github.com/trankimthuong/CodeGym_Java_Week2
c066c4c19f2fd7ae516ce8737fae563470b416ac
e316d9b7de09e0ab638628e945ab71804b2c7fbc
refs/heads/master
2022-12-06T00:15:39.509000
2020-08-24T04:45:27
2020-08-24T04:45:27
284,625,602
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tim_so_nguyen_to; public class LazyPrimeFactorization implements Runnable { @Override public void run() { int count = 0; for(int i = 2; ; i++){ if(checkPrime(i)){ try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(i); count++; } if(count == 2000) break; } } private boolean checkPrime(int number){ boolean check = true; for(int i = 2; i < number; i++){ if(number % i == 0) return false; } return true; } }
UTF-8
Java
795
java
LazyPrimeFactorization.java
Java
[]
null
[]
package tim_so_nguyen_to; public class LazyPrimeFactorization implements Runnable { @Override public void run() { int count = 0; for(int i = 2; ; i++){ if(checkPrime(i)){ try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(i); count++; } if(count == 2000) break; } } private boolean checkPrime(int number){ boolean check = true; for(int i = 2; i < number; i++){ if(number % i == 0) return false; } return true; } }
795
0.394969
0.383648
32
23.84375
15.898328
57
false
false
0
0
0
0
0
0
0.4375
false
false
7
b300617c874a9fa1274da23472f640a3453ce1e9
25,400,436,591,827
4bfab2f197e23c198c6307bd0f84f52cf0e0541b
/ClotheMe/src/com/logicalModelLayer/Interface/CategoryArchiveInfoInterface.java
fc632af0289d4fe39c61d1dda3d5e28f5915ed36
[]
no_license
liuxingyutonghua/ClotheMe
https://github.com/liuxingyutonghua/ClotheMe
1b7eff8952f0c0c0e3c5dba4ca28522de04ccc71
b9db80be9352a9e3380abd939141c97ce677d2c7
refs/heads/master
2020-03-15T07:17:44.846000
2014-07-27T07:43:57
2014-07-27T07:43:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.logicalModelLayer.Interface; import java.util.ArrayList; import com.daogen.clotheme.CategoryArchive; public interface CategoryArchiveInfoInterface { public int Load(); public int getCategoryArchive(int in_meterialID,CategoryArchive out_CategoryArchive); public int setCategoryArchive(int in_meterialID,CategoryArchive in_CategoryArchive); public int removeCategoryArchive(int in_meterialID); public ArrayList<String> getAllRemindFrequency(); }
UTF-8
Java
464
java
CategoryArchiveInfoInterface.java
Java
[]
null
[]
package com.logicalModelLayer.Interface; import java.util.ArrayList; import com.daogen.clotheme.CategoryArchive; public interface CategoryArchiveInfoInterface { public int Load(); public int getCategoryArchive(int in_meterialID,CategoryArchive out_CategoryArchive); public int setCategoryArchive(int in_meterialID,CategoryArchive in_CategoryArchive); public int removeCategoryArchive(int in_meterialID); public ArrayList<String> getAllRemindFrequency(); }
464
0.838362
0.838362
13
34.692307
29.132019
86
false
false
0
0
0
0
0
0
1.153846
false
false
7
4f2f63b79ea802361a31132e97b5bf14cc08dc8d
22,342,419,876,166
bcdacb31ebb2da2e9da0efe9190a00ff0407edf5
/java编程/csp 10-4/src/Main.java
09158b9e50f42aab505723f41895ec83aa8e0c30
[]
no_license
guohaoyu110/Self-Learning-DataStructure
https://github.com/guohaoyu110/Self-Learning-DataStructure
08fe60fccb4b48e8503dd95f469ed82f7f109059
0d1533f70cf46aa28be5a5be84b9ce6cd4cc5dda
refs/heads/master
2022-02-22T07:23:21.956000
2019-10-12T22:52:02
2019-10-12T22:52:02
109,500,323
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner input=new Scanner(System.in); int i,n,m,k=0,r=0,min,minl=0; n=input.nextInt(); m=input.nextInt(); int[][]s=new int[n][2]; int[][]d=new int[m][3]; for(i=0;i<m;i++) for(int j=0;j<3;j++) d[i][j]=input.nextInt(); for(int j=0;j<m;j++){ min=d[0][2]; minl=0; for(i=0;i<m;i++){//找最小权重的边 if(d[i][2]<min){ min=d[i][2]; minl=i; } } boolean flaga=true,flagb=true;//向s中插入新的节点 for(i=0;i<r;i++){ if(s[i][0]==d[minl][0])flaga=false; if(s[i][0]==d[minl][1])flagb=false; } if(flaga==true){s[r++][0]=d[minl][0];d[minl][2]=10000;} if(flagb==true){s[r++][0]=d[minl][1];d[minl][2]=10000;} } // for(i=0;i<r;i++) // System.out.printf("%d ", s[i][0]); int max=s[0][0]; for(i=1;i<s.length;i++) { if(s[i][0]>max) max=s[i][0]; } System.out.print(max); } }
UTF-8
Java
1,260
java
Main.java
Java
[]
null
[]
import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner input=new Scanner(System.in); int i,n,m,k=0,r=0,min,minl=0; n=input.nextInt(); m=input.nextInt(); int[][]s=new int[n][2]; int[][]d=new int[m][3]; for(i=0;i<m;i++) for(int j=0;j<3;j++) d[i][j]=input.nextInt(); for(int j=0;j<m;j++){ min=d[0][2]; minl=0; for(i=0;i<m;i++){//找最小权重的边 if(d[i][2]<min){ min=d[i][2]; minl=i; } } boolean flaga=true,flagb=true;//向s中插入新的节点 for(i=0;i<r;i++){ if(s[i][0]==d[minl][0])flaga=false; if(s[i][0]==d[minl][1])flagb=false; } if(flaga==true){s[r++][0]=d[minl][0];d[minl][2]=10000;} if(flagb==true){s[r++][0]=d[minl][1];d[minl][2]=10000;} } // for(i=0;i<r;i++) // System.out.printf("%d ", s[i][0]); int max=s[0][0]; for(i=1;i<s.length;i++) { if(s[i][0]>max) max=s[i][0]; } System.out.print(max); } }
1,260
0.391057
0.356098
43
27.627907
16.379259
67
false
false
0
0
0
0
0
0
1.046512
false
false
7
c9e3a1c7810858c565bdc67016d764509be49174
31,516,470,034,952
26c2c35386f822b02d83f94ce1a15dcc5c102840
/chapter_001/src/test/java/ru/job4j/loop/package-info.java
ba96f20fb7365fe60e872686916b9af29a7bec23
[ "Apache-2.0" ]
permissive
tsemaanton/junior
https://github.com/tsemaanton/junior
c7e2611e4459e2d3a5433440f2bf866b4079de44
60efe60a58820568f8d48ddcbc126548c44c85e8
refs/heads/master
2021-08-15T08:55:28.145000
2017-11-17T16:56:48
2017-11-17T16:56:48
106,232,664
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Package for Loop. * * @author Anton Tsema (mailto:alsinghspb@gmail) * @version 0.1 * @since 23.10.2017 */ package ru.job4j.loop;
UTF-8
Java
134
java
package-info.java
Java
[ { "context": "/**\n* Package for Loop.\n*\n* @author Anton Tsema (mailto:alsinghspb@gmail)\n* @version 0.1\n* @since", "end": 47, "score": 0.9998741149902344, "start": 36, "tag": "NAME", "value": "Anton Tsema" }, { "context": "Package for Loop.\n*\n* @author Anton Tsema (mailto:alsinghspb@gmail)\n* @version 0.1\n* @since 23.10.2017\n*/\npackage ru", "end": 72, "score": 0.9998952746391296, "start": 56, "tag": "EMAIL", "value": "alsinghspb@gmail" } ]
null
[]
/** * Package for Loop. * * @author <NAME> (mailto:<EMAIL>) * @version 0.1 * @since 23.10.2017 */ package ru.job4j.loop;
120
0.679105
0.597015
8
15.875
14.181304
47
false
false
0
0
0
0
0
0
0.125
false
false
7
baf722417456f3d207bb12e37f84e296906c4ff5
9,268,539,477,682
0dcc2851676f469d158587a9cf2c871d4d2426e1
/src/com/interceptor/LoginInterceptor.java
9de88f4648dced8ed9f503b78b927a21cb94438a
[]
no_license
swp2017-cmd/Spring-Mvc-
https://github.com/swp2017-cmd/Spring-Mvc-
580942a8fe8a9a8667345b218052206656e8cb09
8ba3a96ce90db2e612da568c14f1464710af57ec
refs/heads/master
2021-05-21T01:18:21.132000
2020-04-02T14:45:41
2020-04-02T14:45:41
252,482,969
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.interceptor; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * @date 2020/3/23 15:49 * @autho SWP * @Version 1.0 */ public class LoginInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { HttpSession session = httpServletRequest.getSession(); if(session.getAttribute("data") != null) { return true; }else{ httpServletResponse.sendRedirect("login.html"); return false; } } @Override public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { } @Override public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { } }
UTF-8
Java
1,250
java
LoginInterceptor.java
Java
[ { "context": "tpSession;\n\n/**\n * @date 2020/3/23 15:49\n * @autho SWP\n * @Version 1.0\n */\npublic class LoginInterceptor", "end": 437, "score": 0.9995995759963989, "start": 434, "tag": "USERNAME", "value": "SWP" } ]
null
[]
package com.interceptor; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * @date 2020/3/23 15:49 * @autho SWP * @Version 1.0 */ public class LoginInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { HttpSession session = httpServletRequest.getSession(); if(session.getAttribute("data") != null) { return true; }else{ httpServletResponse.sendRedirect("login.html"); return false; } } @Override public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { } @Override public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { } }
1,250
0.7888
0.7784
39
31.051283
40.480415
160
false
false
0
0
0
0
0
0
0.512821
false
false
7
ba99cc5ebd633095de749edf93471371d220d804
8,632,884,268,905
2fe6548ff4ea92bc91e8326063aacced000ac48a
/src/main/java/me/jianghs/meepo/并发包/SemaphoreExample.java
52a16148fad3020ec20b29945bce935609092ebd
[]
no_license
organizations-loop/meepo
https://github.com/organizations-loop/meepo
3d478342845fe24537e3fc25c44a6e659de18217
fafede4dc98031a02d9a9af04fe6c69ffa3fd2f6
refs/heads/main
2023-08-01T03:59:23.769000
2021-02-23T02:54:04
2021-02-23T02:54:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.jianghs.meepo.并发包; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.stream.IntStream; /** * @className: Semaphore * @description: * @author: jianghs430 * @createDate: 2021/2/20 17:27 * @version: 1.0 */ public class SemaphoreExample { private static Logger logger = LoggerFactory.getLogger(SemaphoreExample.class); public static void main(String[] args) { int MAX_PERMIT_LOGIN_ACCOUNT = 10; LoginService loginService = new LoginService(MAX_PERMIT_LOGIN_ACCOUNT); IntStream.range(0, 20).forEach(i -> new Thread(() -> { boolean login = loginService.login(); if (!login) { logger.info("登录失败"); return; } try { TimeUnit.SECONDS.sleep(2); } catch (Exception e) { e.printStackTrace(); } finally { loginService.logout(); } }).start()); } private static class LoginService { private static Logger logger = LoggerFactory.getLogger(LoginService.class); private final Semaphore semaphore; private LoginService(int maxPermitLoginAccount) { this.semaphore = new Semaphore(maxPermitLoginAccount, true); } public boolean login() { try { this.semaphore.acquire(); } catch (InterruptedException e) { e.printStackTrace(); return false; } logger.info("login success"); return true; } public void logout() { this.semaphore.release(); logger.info("login out"); } } }
UTF-8
Java
1,814
java
SemaphoreExample.java
Java
[ { "context": "@className: Semaphore\n * @description:\n * @author: jianghs430\n * @createDate: 2021/2/20 17:27\n * @version: 1.0\n", "end": 270, "score": 0.9996513724327087, "start": 260, "tag": "USERNAME", "value": "jianghs430" } ]
null
[]
package me.jianghs.meepo.并发包; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.stream.IntStream; /** * @className: Semaphore * @description: * @author: jianghs430 * @createDate: 2021/2/20 17:27 * @version: 1.0 */ public class SemaphoreExample { private static Logger logger = LoggerFactory.getLogger(SemaphoreExample.class); public static void main(String[] args) { int MAX_PERMIT_LOGIN_ACCOUNT = 10; LoginService loginService = new LoginService(MAX_PERMIT_LOGIN_ACCOUNT); IntStream.range(0, 20).forEach(i -> new Thread(() -> { boolean login = loginService.login(); if (!login) { logger.info("登录失败"); return; } try { TimeUnit.SECONDS.sleep(2); } catch (Exception e) { e.printStackTrace(); } finally { loginService.logout(); } }).start()); } private static class LoginService { private static Logger logger = LoggerFactory.getLogger(LoginService.class); private final Semaphore semaphore; private LoginService(int maxPermitLoginAccount) { this.semaphore = new Semaphore(maxPermitLoginAccount, true); } public boolean login() { try { this.semaphore.acquire(); } catch (InterruptedException e) { e.printStackTrace(); return false; } logger.info("login success"); return true; } public void logout() { this.semaphore.release(); logger.info("login out"); } } }
1,814
0.568333
0.555
67
25.865671
21.180035
83
false
false
0
0
0
0
0
0
0.41791
false
false
7
83b700607780eb29079fb130ba1a5afd3d8446b9
27,839,978,019,982
20d1b2db5a3398744d7895fc2bf1515322bbd0e5
/test-rocketmq/test-rocketmq-infrastructure/src/main/java/com/book/rocketmq/annotation/EnableRocketMQ.java
79d5a8a27b03a60a0b37ad997b71ab0291660e48
[]
no_license
badboyf/book-management
https://github.com/badboyf/book-management
0ef812307fd0fcb28b3d968d03602b70d7c3e636
2a85f8f37ba0cc5fc5531be7c00bcbad308a8c89
refs/heads/master
2021-01-19T18:50:48.142000
2017-09-22T07:43:25
2017-09-22T07:43:25
101,171,100
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.book.rocketmq.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Import; import com.book.rocketmq.annotation.surpport.RocketMQRegistrar; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Documented @Import(RocketMQRegistrar.class) public @interface EnableRocketMQ { String[] packages() default {}; }
UTF-8
Java
538
java
EnableRocketMQ.java
Java
[]
null
[]
package com.book.rocketmq.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Import; import com.book.rocketmq.annotation.surpport.RocketMQRegistrar; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Documented @Import(RocketMQRegistrar.class) public @interface EnableRocketMQ { String[] packages() default {}; }
538
0.828996
0.828996
19
27.31579
19.018143
63
false
false
0
0
0
0
0
0
0.526316
false
false
6
b37ad4b9a0046e94a212385560470056f0f42f05
32,890,859,589,277
2eb5604c0ba311a9a6910576474c747e9ad86313
/chado-pg-orm/src/org/irri/iric/chado/so/ValidatedCdnaClone.java
fb71b4c34b8ee312b1c72a8974da38bafa4399a9
[]
no_license
iric-irri/portal
https://github.com/iric-irri/portal
5385c6a4e4fd3e569f5334e541d4b852edc46bc1
b2d3cd64be8d9d80b52d21566f329eeae46d9749
refs/heads/master
2021-01-16T00:28:30.272000
2014-05-26T05:46:30
2014-05-26T05:46:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.irri.iric.chado.so; // Generated 05 26, 14 1:32:25 PM by Hibernate Tools 3.4.0.CR1 /** * ValidatedCdnaClone generated by hbm2java */ public class ValidatedCdnaClone implements java.io.Serializable { private ValidatedCdnaCloneId id; public ValidatedCdnaClone() { } public ValidatedCdnaClone(ValidatedCdnaCloneId id) { this.id = id; } public ValidatedCdnaCloneId getId() { return this.id; } public void setId(ValidatedCdnaCloneId id) { this.id = id; } }
UTF-8
Java
489
java
ValidatedCdnaClone.java
Java
[]
null
[]
package org.irri.iric.chado.so; // Generated 05 26, 14 1:32:25 PM by Hibernate Tools 3.4.0.CR1 /** * ValidatedCdnaClone generated by hbm2java */ public class ValidatedCdnaClone implements java.io.Serializable { private ValidatedCdnaCloneId id; public ValidatedCdnaClone() { } public ValidatedCdnaClone(ValidatedCdnaCloneId id) { this.id = id; } public ValidatedCdnaCloneId getId() { return this.id; } public void setId(ValidatedCdnaCloneId id) { this.id = id; } }
489
0.732106
0.699386
27
17.111111
21.09473
65
false
false
0
0
0
0
0
0
0.777778
false
false
6
e306f1b85dc15e0976aad564b820efb6ceafb1db
20,950,850,493,507
32b8366f00d48beb6c441d0341329f1bf2d5794d
/app/src/main/java/com/asher/threeline/serve/net/content/INetContentServe.java
94584fde230cbbda67cd3e7b01a3cce14bc39728
[ "Apache-2.0" ]
permissive
AsherYang/ThreeLine
https://github.com/AsherYang/ThreeLine
2fb7a3c7208aba3ef61d4130e5277a293e0e9d87
351dc8bfd1c0a536ffbf36ce8b1af953cc71f93a
refs/heads/master
2021-01-22T20:54:17.795000
2018-08-15T02:09:51
2018-08-15T02:09:51
85,374,008
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.asher.threeline.serve.net.content; import com.asher.threeline.db.bean.DbContent; import com.asher.threeline.serve.net.base.OnNetCallBack; import java.util.List; /** * Created by ouyangfan on 2017/4/6. * <p> * 获取服务器数据网络接口 */ public interface INetContentServe { /** * 获取最新内容数据 * * @param callBack 回调 */ void getLastData(OnNetCallBack<List<DbContent>> callBack); }
UTF-8
Java
452
java
INetContentServe.java
Java
[ { "context": "llBack;\n\nimport java.util.List;\n\n/**\n * Created by ouyangfan on 2017/4/6.\n * <p>\n * 获取服务器数据网络接口\n */\npublic int", "end": 203, "score": 0.9996312260627747, "start": 194, "tag": "USERNAME", "value": "ouyangfan" } ]
null
[]
package com.asher.threeline.serve.net.content; import com.asher.threeline.db.bean.DbContent; import com.asher.threeline.serve.net.base.OnNetCallBack; import java.util.List; /** * Created by ouyangfan on 2017/4/6. * <p> * 获取服务器数据网络接口 */ public interface INetContentServe { /** * 获取最新内容数据 * * @param callBack 回调 */ void getLastData(OnNetCallBack<List<DbContent>> callBack); }
452
0.692683
0.678049
21
18.523809
19.706463
62
false
false
0
0
0
0
0
0
0.238095
false
false
6
b117043ef65fc51761196eaaea77a585b0aa4b93
30,279,519,454,300
ceb52e9a2a38ed9be276f62b19bca8ed6cb149bc
/Brian_Zhu_111608106_hw2/JohnvsTheNightKing.java
214e40f8e15bbc8685fe389c64620e316b71501c
[ "MIT" ]
permissive
br-zhu/Learning-Data-Structures
https://github.com/br-zhu/Learning-Data-Structures
c3f493c4159cd7fc961ea59bcba7c238f01e866b
aa359779c003333edcdde229872572efe703e547
refs/heads/master
2022-02-22T05:41:05.259000
2019-07-30T02:36:23
2019-07-30T02:36:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class JohnvsTheNightKing { public static int[] sortPowers(int[] powers, int numWhiteWalkers, int selectAmount) { int[] walkerIndices = new int[selectAmount]; Queue whiteWalkers = new Queue(numWhiteWalkers); int numTimes = selectAmount; int count = 0; int indexCount = 0; if (selectAmount == 0) { return walkerIndices; } //Enqueue all the white walkers while (count < numWhiteWalkers) { whiteWalkers.enqueue(new WhiteWalker(count, powers[count])); count++; } while (numTimes > 0) { int tempSize = selectAmount; if (selectAmount > whiteWalkers.getSize()) { tempSize = whiteWalkers.getSize(); } Queue tempWhiteWalkers = new Queue(tempSize); //Dequeueing elements for (int i = 0; i < tempSize; i++) { tempWhiteWalkers.enqueue(whiteWalkers.dequeue()); } //Finding maxPower and index of that White Walker int maxPower = tempWhiteWalkers.peek().getPower(); int maxWalkerIndex = tempWhiteWalkers.peek().getIndex(); Queue dumpQueue = new Queue(tempSize); for (int i = 0; i < tempSize; i++) { WhiteWalker currWalker = tempWhiteWalkers.dequeue(); if (currWalker.getPower() > maxPower) { maxPower = currWalker.getPower(); maxWalkerIndex = currWalker.getIndex(); } dumpQueue.enqueue(currWalker); } tempWhiteWalkers = dumpQueue; //Setting the index into the final index array walkerIndices[indexCount++] = maxWalkerIndex; //Enqueueing back the elements for(int i = 0; i < tempSize; i++) { WhiteWalker currWalker = tempWhiteWalkers.dequeue(); int currPower = currWalker.getPower(); int currIndex = currWalker.getIndex(); if (currPower == maxPower && currIndex == maxWalkerIndex) { continue; } else { if (currPower - 1 < 0) { currWalker.setPower(0); } else { currWalker.setPower(currPower - 1); } } whiteWalkers.enqueue(currWalker); } numTimes--; } return walkerIndices; } public static void main(String[] args) throws FileNotFoundException { File file = new File("in4.txt"); Scanner input = new Scanner(file); int numCases = Integer.parseInt(input.nextLine()); int[] powersArr; String numWalkers; String powers; Scanner input2; Scanner input3; for(int i = 0; i < numCases; i++) { numWalkers = input.nextLine(); powers = input.nextLine(); input2 = new Scanner(numWalkers); input3 = new Scanner(powers); int m = input2.nextInt(); int n = input2.nextInt(); powersArr = new int[m]; for (int j = 0; j < m; j++) { powersArr[j] = input3.nextInt(); } int[] walkerIndices = sortPowers(powersArr, m, n); for (int k: walkerIndices) { System.out.print(k + " "); } input2.close(); input3.close(); } input.close(); } }
UTF-8
Java
3,137
java
JohnvsTheNightKing.java
Java
[]
null
[]
import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class JohnvsTheNightKing { public static int[] sortPowers(int[] powers, int numWhiteWalkers, int selectAmount) { int[] walkerIndices = new int[selectAmount]; Queue whiteWalkers = new Queue(numWhiteWalkers); int numTimes = selectAmount; int count = 0; int indexCount = 0; if (selectAmount == 0) { return walkerIndices; } //Enqueue all the white walkers while (count < numWhiteWalkers) { whiteWalkers.enqueue(new WhiteWalker(count, powers[count])); count++; } while (numTimes > 0) { int tempSize = selectAmount; if (selectAmount > whiteWalkers.getSize()) { tempSize = whiteWalkers.getSize(); } Queue tempWhiteWalkers = new Queue(tempSize); //Dequeueing elements for (int i = 0; i < tempSize; i++) { tempWhiteWalkers.enqueue(whiteWalkers.dequeue()); } //Finding maxPower and index of that White Walker int maxPower = tempWhiteWalkers.peek().getPower(); int maxWalkerIndex = tempWhiteWalkers.peek().getIndex(); Queue dumpQueue = new Queue(tempSize); for (int i = 0; i < tempSize; i++) { WhiteWalker currWalker = tempWhiteWalkers.dequeue(); if (currWalker.getPower() > maxPower) { maxPower = currWalker.getPower(); maxWalkerIndex = currWalker.getIndex(); } dumpQueue.enqueue(currWalker); } tempWhiteWalkers = dumpQueue; //Setting the index into the final index array walkerIndices[indexCount++] = maxWalkerIndex; //Enqueueing back the elements for(int i = 0; i < tempSize; i++) { WhiteWalker currWalker = tempWhiteWalkers.dequeue(); int currPower = currWalker.getPower(); int currIndex = currWalker.getIndex(); if (currPower == maxPower && currIndex == maxWalkerIndex) { continue; } else { if (currPower - 1 < 0) { currWalker.setPower(0); } else { currWalker.setPower(currPower - 1); } } whiteWalkers.enqueue(currWalker); } numTimes--; } return walkerIndices; } public static void main(String[] args) throws FileNotFoundException { File file = new File("in4.txt"); Scanner input = new Scanner(file); int numCases = Integer.parseInt(input.nextLine()); int[] powersArr; String numWalkers; String powers; Scanner input2; Scanner input3; for(int i = 0; i < numCases; i++) { numWalkers = input.nextLine(); powers = input.nextLine(); input2 = new Scanner(numWalkers); input3 = new Scanner(powers); int m = input2.nextInt(); int n = input2.nextInt(); powersArr = new int[m]; for (int j = 0; j < m; j++) { powersArr[j] = input3.nextInt(); } int[] walkerIndices = sortPowers(powersArr, m, n); for (int k: walkerIndices) { System.out.print(k + " "); } input2.close(); input3.close(); } input.close(); } }
3,137
0.602168
0.594836
138
20.731884
19.06455
84
false
false
0
0
0
0
0
0
3.326087
false
false
6
92a8a7f3056c6d464921332e154b22586e8baf07
1,700,807,070,553
cc05ab86b3953f58354511b76eaffa0e9ec26abf
/Кузьмичев/9/src/main/transactions/Transaction.java
f2ef7d051f59954f5ba0e7a25361eb2c5fe0570a
[]
no_license
Apollinary/mera_se_0620
https://github.com/Apollinary/mera_se_0620
aab359c3cea2711434b705926df25bb13dde360e
15980478791bb48d44e6b0caa6e60e19ecfb8e35
refs/heads/master
2022-12-08T21:22:52.465000
2020-09-06T18:06:03
2020-09-06T18:06:03
293,332,056
0
0
null
true
2020-09-06T17:53:29
2020-09-06T17:53:28
2020-08-22T07:28:57
2020-08-31T17:26:13
3,476
0
0
0
null
false
false
/********************************************************* * File: Transaction.java * Purpose: General class of all transactions * Notice: (c) 2020 Nikolay Kuzmichev. All rights reserved. ********************************************************/ package main.transactions; public abstract class Transaction { }
UTF-8
Java
317
java
Transaction.java
Java
[ { "context": "eral class of all transactions\n * Notice: (c) 2020 Nikolay Kuzmichev. All rights reserved.\n **************************", "end": 168, "score": 0.9998965263366699, "start": 151, "tag": "NAME", "value": "Nikolay Kuzmichev" } ]
null
[]
/********************************************************* * File: Transaction.java * Purpose: General class of all transactions * Notice: (c) 2020 <NAME>. All rights reserved. ********************************************************/ package main.transactions; public abstract class Transaction { }
306
0.479495
0.466877
10
30.700001
23.1
59
false
false
0
0
0
0
0
0
0.1
false
false
6
0999117194073f897b68a21e8f453a469f0c5cf9
858,993,472,077
097e3c8a199d0db18d7ca9008bc554dff9b2947d
/spring-cloud-alibaba-discovery-client/src/main/java/com/dwring/springcloud/alibaba/controller/TestController.java
a53bf3c17ee41a6da527ad17a99fc6ed8293335d
[]
no_license
zhanghaichang/spring-cloud-alibaba-start
https://github.com/zhanghaichang/spring-cloud-alibaba-start
1af237ad7a9567a853abbbaf38d80cc17499765d
dadbfe4984f80319de22ca07d4661bfd66182e68
refs/heads/master
2021-11-25T05:40:40.743000
2021-10-28T13:07:09
2021-10-28T13:07:09
168,270,667
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dwring.springcloud.alibaba.controller; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; @RestController @Slf4j public class TestController { @Autowired private LoadBalancerClient client; @Autowired private RestTemplate restTemplate; @GetMapping("/consumer") public String consumer() { ServiceInstance serviceInstance = client.choose("alibaba-nacos-discovery-server"); String url = serviceInstance.getUri() + "/producer?name="+"zhanghaichang"; log.info("url: {}",url); String response = restTemplate.getForObject(url, String.class); return "Invoke : " + url + ", return : " + response; } }
UTF-8
Java
1,031
java
TestController.java
Java
[ { "context": "l = serviceInstance.getUri() + \"/producer?name=\"+\"zhanghaichang\";\n log.info(\"url: {}\",url);\n String", "end": 853, "score": 0.976925790309906, "start": 840, "tag": "USERNAME", "value": "zhanghaichang" } ]
null
[]
package com.dwring.springcloud.alibaba.controller; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; @RestController @Slf4j public class TestController { @Autowired private LoadBalancerClient client; @Autowired private RestTemplate restTemplate; @GetMapping("/consumer") public String consumer() { ServiceInstance serviceInstance = client.choose("alibaba-nacos-discovery-server"); String url = serviceInstance.getUri() + "/producer?name="+"zhanghaichang"; log.info("url: {}",url); String response = restTemplate.getForObject(url, String.class); return "Invoke : " + url + ", return : " + response; } }
1,031
0.749758
0.746848
34
29.32353
28.13175
90
false
false
0
0
0
0
0
0
0.529412
false
false
6
c57040a9fc58e13064a8f5f107ebd7e423583b9a
16,913,581,240,803
4cc3e29e79d6bdc6aa31e98bbd1bdca6e3ede13e
/src/patterns/sdk/PatternsLogicBasic.java
c04b21eacb06b1e60343cf0c21339192edf7933a
[]
no_license
Jaysmito101/cskit
https://github.com/Jaysmito101/cskit
aed904314c5bf42037086fbdb71544c9b09c52f2
9e9530cbf9a51e2e71f3e8223ef4d45e422144b3
refs/heads/main
2023-06-20T23:14:05.736000
2021-07-29T15:29:06
2021-07-29T15:29:06
365,793,998
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package patterns.sdk; import master.MethodInvocationUtils; import master.RuntimeCompiler; import javax.swing.*; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.lang.reflect.Method; public abstract class PatternsLogicBasic implements PatternLogic { private String stdoutCapture = ""; private PrintStream stdOut; @Override public void startStdoutCapture() { stdOut = System.out; System.setOut(new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { stdoutCapture += (char) b; } })); } @Override public void executeCode(String code) { try { if (code.contains("System.in") || code.contains("System.exit") || code.contains("Runtime")) { System.out.println("The code you are trying to execute is not allowed!"); return; } RuntimeCompiler runtimeCompiler = new RuntimeCompiler(); runtimeCompiler.addClass("Solution", "import javax.swing.*;\n" + "public class Solution{\n" + " public static void printPattern(){\n" + " " + code + "\n" + " return;\n" + " } \n" + "\n" + "public static String input(String message){\n" + " return (JOptionPane.showInputDialog(null, message, \"Input\", JOptionPane.OK_OPTION));" + "}\n" + "\n" + "public static int integerInput(String message){\n" + " return Integer.parseInt(JOptionPane.showInputDialog(null, message, \"Input\", JOptionPane.OK_OPTION));" + "}\n" + "}"); if (runtimeCompiler.compile()) { Class<?> solution = runtimeCompiler.getCompiledClass("Solution"); MethodInvocationUtils.invokeStaticMethod(solution, "printPattern"); } else { System.out.println(runtimeCompiler.debug); } } catch (Exception ex) { JOptionPane.showMessageDialog(null, "Error in code execution."); System.out.println("Error in code execution."); } } @Override public String stopStdoutCapture() { System.setOut(stdOut); new Thread(()->{ try { Thread.sleep(100); stdoutCapture = ""; }catch (Exception ex){} }).start(); return stdoutCapture; } }
UTF-8
Java
2,799
java
PatternsLogicBasic.java
Java
[]
null
[]
package patterns.sdk; import master.MethodInvocationUtils; import master.RuntimeCompiler; import javax.swing.*; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.lang.reflect.Method; public abstract class PatternsLogicBasic implements PatternLogic { private String stdoutCapture = ""; private PrintStream stdOut; @Override public void startStdoutCapture() { stdOut = System.out; System.setOut(new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { stdoutCapture += (char) b; } })); } @Override public void executeCode(String code) { try { if (code.contains("System.in") || code.contains("System.exit") || code.contains("Runtime")) { System.out.println("The code you are trying to execute is not allowed!"); return; } RuntimeCompiler runtimeCompiler = new RuntimeCompiler(); runtimeCompiler.addClass("Solution", "import javax.swing.*;\n" + "public class Solution{\n" + " public static void printPattern(){\n" + " " + code + "\n" + " return;\n" + " } \n" + "\n" + "public static String input(String message){\n" + " return (JOptionPane.showInputDialog(null, message, \"Input\", JOptionPane.OK_OPTION));" + "}\n" + "\n" + "public static int integerInput(String message){\n" + " return Integer.parseInt(JOptionPane.showInputDialog(null, message, \"Input\", JOptionPane.OK_OPTION));" + "}\n" + "}"); if (runtimeCompiler.compile()) { Class<?> solution = runtimeCompiler.getCompiledClass("Solution"); MethodInvocationUtils.invokeStaticMethod(solution, "printPattern"); } else { System.out.println(runtimeCompiler.debug); } } catch (Exception ex) { JOptionPane.showMessageDialog(null, "Error in code execution."); System.out.println("Error in code execution."); } } @Override public String stopStdoutCapture() { System.setOut(stdOut); new Thread(()->{ try { Thread.sleep(100); stdoutCapture = ""; }catch (Exception ex){} }).start(); return stdoutCapture; } }
2,799
0.508396
0.507324
75
36.32
28.729153
138
false
false
0
0
0
0
0
0
0.586667
false
false
6
182d946d01934487047de65b8263b9788e29683d
2,903,397,939,201
652245240d3fb204487c4df8ee7eba6602be713f
/module/core-framework/src/main/java/com/infinite/eoa/auth/client/ShiroAuthClient.java
6876b00ec3469b86529ce7c17e324d1ffd092a0d
[]
no_license
China-ls/framework
https://github.com/China-ls/framework
eb63e9b0f93bc3a71a12d24cc6cfd3afeae92563
5936c25fed66b76555d8c6a536bbc0e8c1fdf13b
refs/heads/master
2020-04-12T08:45:03.067000
2016-11-14T05:50:38
2016-11-14T05:50:39
65,697,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.infinite.eoa.auth.client; /** * Created by hx on 16-7-4. */ public class ShiroAuthClient extends AbstractAuthClient { }
UTF-8
Java
135
java
ShiroAuthClient.java
Java
[ { "context": "e com.infinite.eoa.auth.client;\n\n/**\n * Created by hx on 16-7-4.\n */\npublic class ShiroAuthClient exten", "end": 59, "score": 0.9917188882827759, "start": 57, "tag": "USERNAME", "value": "hx" } ]
null
[]
package com.infinite.eoa.auth.client; /** * Created by hx on 16-7-4. */ public class ShiroAuthClient extends AbstractAuthClient { }
135
0.733333
0.703704
7
18.285715
20.789518
57
false
false
0
0
0
0
0
0
0.142857
false
false
6
51ce0ef8c44e66691a6e9d41cde606fa6d86b4da
19,980,187,895,631
24fa285801eb3ea9490db46936facfda6d84e65e
/src/main/java/TwitterLifecycleManager.java
b4e286eb6c1a4cb5636e34ce2e60c63ab4e0bd50
[]
no_license
carlosjmviana/twitter-produtor-kafka
https://github.com/carlosjmviana/twitter-produtor-kafka
f798727bdb3e0f5638f7f7772f7d88190777cea7
22e1ed070209aa055b5fb59b03979848e304835d
refs/heads/master
2023-04-03T02:19:07.338000
2019-06-04T13:59:31
2019-06-04T13:59:31
355,194,357
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import twitter4j.*; import twitter4j.conf.ConfigurationBuilder; import java.io.Serializable; public class TwitterLifecycleManager implements LifecycleManager, Serializable { private static final Logger logger = Logger.getLogger(TwitterLifecycleManager.class); private static final String _consumerKey = System.getenv().get("TWITTER_CONSUMER_KEY"); private static final String _consumerSecret = System.getenv().get("TWITTER_CONSUMER_SECRET"); private static final String _accessToken = System.getenv().get("TWITTER_ACCESS_TOKEN"); private static final String _accessTokenSecret = System.getenv().get("TWITTER_ACCESS_TOKEN_SECRET"); // private static final Twitter twitterInstance = getTwitterInstance(); private static final TwitterStream twitterStream = getTwitterStreamInstance(); // public static Twitter getTwitterInstance() { // ConfigurationBuilder cb = new ConfigurationBuilder(); // cb.setDebugEnabled(true) // .setOAuthConsumerKey(_consumerKey) // .setOAuthConsumerSecret(_consumerSecret) // .setOAuthAccessToken(_accessToken) // .setOAuthAccessTokenSecret(_accessTokenSecret); // // TwitterFactory tf = new TwitterFactory(cb.build()); // return tf.getInstance(); // } public static TwitterStream getTwitterStreamInstance() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey(_consumerKey) .setOAuthConsumerSecret(_consumerSecret) .setOAuthAccessToken(_accessToken) .setOAuthAccessTokenSecret(_accessTokenSecret); TwitterStreamFactory tf = new TwitterStreamFactory(cb.build()); return tf.getInstance(); } @Override public void start() { logger.info("Starting Stream..."); twitterStream.addListener(new TweetListener()); twitterStream.filter(getFilter()); logger.info("Stream created! " + twitterStream.toString()); } @Override public void stop() { logger.info("Stopping stream..."); twitterStream.cleanUp(); twitterStream.clearListeners(); logger.info("Stream Stopped..."); } private FilterQuery getFilter() { String trackedTerms = System.getenv().get("TWITTER_TRACKED_TERMS"); FilterQuery query = new FilterQuery(); query.track(trackedTerms.split(",")); return query; } }
UTF-8
Java
2,221
java
TwitterLifecycleManager.java
Java
[]
null
[]
import twitter4j.*; import twitter4j.conf.ConfigurationBuilder; import java.io.Serializable; public class TwitterLifecycleManager implements LifecycleManager, Serializable { private static final Logger logger = Logger.getLogger(TwitterLifecycleManager.class); private static final String _consumerKey = System.getenv().get("TWITTER_CONSUMER_KEY"); private static final String _consumerSecret = System.getenv().get("TWITTER_CONSUMER_SECRET"); private static final String _accessToken = System.getenv().get("TWITTER_ACCESS_TOKEN"); private static final String _accessTokenSecret = System.getenv().get("TWITTER_ACCESS_TOKEN_SECRET"); // private static final Twitter twitterInstance = getTwitterInstance(); private static final TwitterStream twitterStream = getTwitterStreamInstance(); // public static Twitter getTwitterInstance() { // ConfigurationBuilder cb = new ConfigurationBuilder(); // cb.setDebugEnabled(true) // .setOAuthConsumerKey(_consumerKey) // .setOAuthConsumerSecret(_consumerSecret) // .setOAuthAccessToken(_accessToken) // .setOAuthAccessTokenSecret(_accessTokenSecret); // // TwitterFactory tf = new TwitterFactory(cb.build()); // return tf.getInstance(); // } public static TwitterStream getTwitterStreamInstance() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey(_consumerKey) .setOAuthConsumerSecret(_consumerSecret) .setOAuthAccessToken(_accessToken) .setOAuthAccessTokenSecret(_accessTokenSecret); TwitterStreamFactory tf = new TwitterStreamFactory(cb.build()); return tf.getInstance(); } @Override public void start() { logger.info("Starting Stream..."); twitterStream.addListener(new TweetListener()); twitterStream.filter(getFilter()); logger.info("Stream created! " + twitterStream.toString()); } @Override public void stop() { logger.info("Stopping stream..."); twitterStream.cleanUp(); twitterStream.clearListeners(); logger.info("Stream Stopped..."); } private FilterQuery getFilter() { String trackedTerms = System.getenv().get("TWITTER_TRACKED_TERMS"); FilterQuery query = new FilterQuery(); query.track(trackedTerms.split(",")); return query; } }
2,221
0.758667
0.757767
63
34.253967
28.045862
101
false
false
0
0
0
0
0
0
1.952381
false
false
6
1d28a370a73f093c7c3ad655ad6525c4310b02d3
28,733,331,278,014
7591225e35175c3f78959b936956825a22d33235
/src/main/java/com/chenhao/seniorl/week1/service/impl/GoodsServiceImpl.java
4d5e80f9f7c661c92dda8d1b28201994e14e02d9
[]
no_license
chenhao1212/chenhao_week1
https://github.com/chenhao1212/chenhao_week1
2dc1fcd13b1c48c6c18440aaf82526c79d1fd703
9477a5c7fc875f7fd896161f8ce07b3d72b8c815
refs/heads/master
2022-12-24T18:58:54.566000
2020-02-26T01:44:41
2020-02-26T01:44:41
243,143,280
0
0
null
false
2022-12-16T09:34:28
2020-02-26T01:47:30
2020-02-26T01:48:19
2022-12-16T09:34:26
86
0
0
14
Java
false
false
package com.chenhao.seniorl.week1.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.chenhao.seniorl.week1.dao.GoodsDao; import com.chenhao.seniorl.week1.entity.Condition; import com.chenhao.seniorl.week1.entity.Goods; import com.chenhao.seniorl.week1.entity.Type; import com.chenhao.seniorl.week1.service.GoodsService; @Service public class GoodsServiceImpl implements GoodsService{ @Autowired private GoodsDao dao; @Override public List<Goods> queryAllGoods(Condition con) { // TODO Auto-generated method stub return dao.queryAllGoods(con); } @Override public List<Type> selectAllType() { // TODO Auto-generated method stub return dao.selectAllType(); } }
UTF-8
Java
818
java
GoodsServiceImpl.java
Java
[]
null
[]
package com.chenhao.seniorl.week1.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.chenhao.seniorl.week1.dao.GoodsDao; import com.chenhao.seniorl.week1.entity.Condition; import com.chenhao.seniorl.week1.entity.Goods; import com.chenhao.seniorl.week1.entity.Type; import com.chenhao.seniorl.week1.service.GoodsService; @Service public class GoodsServiceImpl implements GoodsService{ @Autowired private GoodsDao dao; @Override public List<Goods> queryAllGoods(Condition con) { // TODO Auto-generated method stub return dao.queryAllGoods(con); } @Override public List<Type> selectAllType() { // TODO Auto-generated method stub return dao.selectAllType(); } }
818
0.766504
0.759169
30
25.266666
20.993544
62
false
false
0
0
0
0
0
0
0.966667
false
false
6
01d2d03ffc2a862fbc42ed3613b042953cdfe888
28,733,331,277,553
4e53569b84e430534b6cf501b6b1ce9a7b996180
/eHR/uml-src/cn/hb/entity/hr/personnel/语言能力.java
07b9ecf53ed7b4b07f7d029935255bc4d8c7dea3
[]
no_license
hebei8267/meloneehr
https://github.com/hebei8267/meloneehr
3010a437acda3416d42d743b4f64da715860bb8b
0eebd817082296a00862919812f259c9a80c7f14
refs/heads/master
2021-01-23T19:38:36.021000
2014-01-12T05:02:31
2014-01-12T05:02:31
32,136,383
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.hb.entity.hr.personnel; public class 语言能力 { private String 编号(PK); private String 语言名称; private String 掌握程度; private 个人基本信息 个人基本信息; private 语言能力-掌握方面 语言能力-掌握方面; }
UTF-8
Java
299
java
语言能力.java
Java
[]
null
[]
package cn.hb.entity.hr.personnel; public class 语言能力 { private String 编号(PK); private String 语言名称; private String 掌握程度; private 个人基本信息 个人基本信息; private 语言能力-掌握方面 语言能力-掌握方面; }
299
0.632558
0.632558
15
12.133333
11.865169
34
false
false
0
0
0
0
0
0
1.066667
false
false
6