blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
sequence
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
sequence
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
4a84c936e43d5336c9cfff053d994d99d8834f1a
13,889,924,280,741
9cdaf6f571a28a355096c656341a636409f09115
/app/src/main/java/com/polant/projectsport/preferences/PreferencesOldActivity.java
d6928e870125ec4dc160838a1ede0379a67a05c8
[]
no_license
endri969/Health-App
https://github.com/endri969/Health-App
9f545bfe197fb9565d72afd1e5b9f6f03c5a1539
32c15ffc43ac928a595e75bc28f073959ce29533
refs/heads/main
2023-01-19T22:07:46.895000
2020-11-10T03:38:05
2020-11-10T03:38:05
311,535,417
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.polant.projectsport.preferences; import android.os.Bundle; import android.preference.PreferenceActivity; import com.polant.projectsport.R; public class PreferencesOldActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.user_preferences); } }
UTF-8
Java
405
java
PreferencesOldActivity.java
Java
[]
null
[]
package com.polant.projectsport.preferences; import android.os.Bundle; import android.preference.PreferenceActivity; import com.polant.projectsport.R; public class PreferencesOldActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.user_preferences); } }
405
0.780247
0.780247
17
22.82353
23.734402
64
false
false
0
0
0
0
0
0
0.352941
false
false
4
8e138c32272b59ba834c5cea566570a73b5249d4
1,005,022,396,273
036333bc9a0c97aeed384c84d9caf1d96b49e687
/src/maxeler/InputBuilder.java
89477cae27982cd923e432e20221e4c094a8cb6b
[]
no_license
robpd123/VirtualMachine
https://github.com/robpd123/VirtualMachine
15a9e23d5254d3d2b648d6a18b4dda239932ddf8
4ed48f82a469413cdc01ff04d767905d08be7b18
refs/heads/master
2021-01-01T20:12:44.917000
2017-07-30T08:39:48
2017-07-30T08:39:48
98,785,491
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 maxeler; import java.util.ArrayList; import java.util.stream.IntStream; /** * * @author robpd */ public class InputBuilder { private String A1 = "RULURULU"; private String A2 = "LURULURU"; private String A3 = "DRDLDRDL"; private String B1 = "DRURDRUR"; private String B2 = "DLULDLUL"; private String B3 = "LDLULDLU"; private String C1 = "URDRURDR"; private String C2 = "ULDLULDL"; private String D1 = "RURDRURD"; private String D2 = "LULDLULD"; private String E1 = "RDRURDRU"; private String ROffset = "R"; private String LOffset = "L"; private String UOffset = "U"; private String DOffset = "D"; private int currentX = 0; private int currentY = 0; private int currentSizeX = 10; private int currentSizeY = 10; public InputBuilder() { } //Takes array of shapes and an order to process and outputs string of form "LLLUU...X" public String createInput(ArrayList<Shape> shapes, int[] shapeOrder) { StringBuilder input = new StringBuilder(); ArrayList<String> inputs = new ArrayList<String>(); for (int i = 0; i < shapeOrder.length; i++) { //Offset String offsetString = drawOffset(shapes.get(shapeOrder[i])); //Resize String resizeString = ""; if (shapes.get(shapeOrder[i]).getSize() != currentX) { resizeString = drawSize(shapes.get(shapeOrder[i])); } //Draw String shapeString = drawShape(shapes.get(shapeOrder[i])); input.append(offsetString); input.append(resizeString); input.append(shapeString); } input.append("X"); return input.toString(); } //Creates String to recentre drawer private String drawOffset(Shape shape) { if (currentX == shape.getDesiredX() && currentY == shape.getDesiredY()) { return ""; } StringBuilder offset = new StringBuilder(); //set drawing length to 10 - could be optimised offset.append(drawSize(new Shape("A1", 0, 0, 10))); offset.append("P"); while (currentX != shape.getDesiredX()) { if (Math.abs(currentX - shape.getDesiredX()) < currentSizeX) { //Offset is only ever 5 or 10 offset.append("JJJJJ"); currentSizeX = 5; } if (currentX < shape.getDesiredX()) { offset.append("R"); currentX += currentSizeX; } else { offset.append("L"); currentX -= currentSizeX; } } while (currentY != shape.getDesiredY()) { if (Math.abs(currentY - shape.getDesiredY()) < currentSizeY) { //Offset is only ever 5 or 10 offset.append("MMMMM"); currentSizeY = 5; } if (currentY < shape.getDesiredY()) { offset.append("U"); currentY += currentSizeY; } else { offset.append("D"); currentY -= currentSizeY; } } //Reset current size to 10 if (currentSizeX == 5) { offset.append("KKKKK"); currentSizeX = 10; } if (currentSizeY == 5) { offset.append("NNNNN"); currentSizeY = 10; } offset.append("P"); return offset.toString(); } //Creates String to set drawing size to required size private String drawSize(Shape shape) { StringBuilder sb = new StringBuilder(); while (currentSizeX != shape.getSize()) { if (currentSizeX < shape.getSize()) { sb.append("K"); currentSizeX++; } else { sb.append("J"); currentSizeX--; } } while (currentSizeY != shape.getSize()) { if (currentSizeY < shape.getSize()) { sb.append("N"); currentSizeY++; } else { sb.append("M"); currentSizeY--; } } return sb.toString(); } //Creates String to draw a shape of desired size private String drawShape(Shape shape) { switch (shape.getType()) { case ("A1"): currentX += currentSizeX * 0; currentY += currentSizeY * 4; return A1; case ("A2"): currentX += currentSizeX * 0; currentY += currentSizeY * 4; return A2; case ("A3"): currentX += currentSizeX * 0; currentY -= currentSizeY * 4; return A3; case ("B1"): currentX += currentSizeX * 4; currentY += currentSizeY * 0; return B1; case ("B2"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return B2; case ("B3"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return B3; case ("C1"): currentX += currentSizeX * 4; currentY += currentSizeY * 0; return C1; case ("C2"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return C2; case ("D1"): currentX += currentSizeX * 4; currentY -= currentSizeY * 0; return D1; case ("D2"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return D2; case ("E1"): currentX += currentSizeX * 4; currentY += currentSizeX * 0; return E1; } return ""; } }
UTF-8
Java
6,448
java
InputBuilder.java
Java
[ { "context": "java.util.stream.IntStream;\r\n\r\n/**\r\n *\r\n * @author robpd\r\n */\r\npublic class InputBuilder {\r\n\r\n private ", "end": 302, "score": 0.9996300339698792, "start": 297, "tag": "USERNAME", "value": "robpd" } ]
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 maxeler; import java.util.ArrayList; import java.util.stream.IntStream; /** * * @author robpd */ public class InputBuilder { private String A1 = "RULURULU"; private String A2 = "LURULURU"; private String A3 = "DRDLDRDL"; private String B1 = "DRURDRUR"; private String B2 = "DLULDLUL"; private String B3 = "LDLULDLU"; private String C1 = "URDRURDR"; private String C2 = "ULDLULDL"; private String D1 = "RURDRURD"; private String D2 = "LULDLULD"; private String E1 = "RDRURDRU"; private String ROffset = "R"; private String LOffset = "L"; private String UOffset = "U"; private String DOffset = "D"; private int currentX = 0; private int currentY = 0; private int currentSizeX = 10; private int currentSizeY = 10; public InputBuilder() { } //Takes array of shapes and an order to process and outputs string of form "LLLUU...X" public String createInput(ArrayList<Shape> shapes, int[] shapeOrder) { StringBuilder input = new StringBuilder(); ArrayList<String> inputs = new ArrayList<String>(); for (int i = 0; i < shapeOrder.length; i++) { //Offset String offsetString = drawOffset(shapes.get(shapeOrder[i])); //Resize String resizeString = ""; if (shapes.get(shapeOrder[i]).getSize() != currentX) { resizeString = drawSize(shapes.get(shapeOrder[i])); } //Draw String shapeString = drawShape(shapes.get(shapeOrder[i])); input.append(offsetString); input.append(resizeString); input.append(shapeString); } input.append("X"); return input.toString(); } //Creates String to recentre drawer private String drawOffset(Shape shape) { if (currentX == shape.getDesiredX() && currentY == shape.getDesiredY()) { return ""; } StringBuilder offset = new StringBuilder(); //set drawing length to 10 - could be optimised offset.append(drawSize(new Shape("A1", 0, 0, 10))); offset.append("P"); while (currentX != shape.getDesiredX()) { if (Math.abs(currentX - shape.getDesiredX()) < currentSizeX) { //Offset is only ever 5 or 10 offset.append("JJJJJ"); currentSizeX = 5; } if (currentX < shape.getDesiredX()) { offset.append("R"); currentX += currentSizeX; } else { offset.append("L"); currentX -= currentSizeX; } } while (currentY != shape.getDesiredY()) { if (Math.abs(currentY - shape.getDesiredY()) < currentSizeY) { //Offset is only ever 5 or 10 offset.append("MMMMM"); currentSizeY = 5; } if (currentY < shape.getDesiredY()) { offset.append("U"); currentY += currentSizeY; } else { offset.append("D"); currentY -= currentSizeY; } } //Reset current size to 10 if (currentSizeX == 5) { offset.append("KKKKK"); currentSizeX = 10; } if (currentSizeY == 5) { offset.append("NNNNN"); currentSizeY = 10; } offset.append("P"); return offset.toString(); } //Creates String to set drawing size to required size private String drawSize(Shape shape) { StringBuilder sb = new StringBuilder(); while (currentSizeX != shape.getSize()) { if (currentSizeX < shape.getSize()) { sb.append("K"); currentSizeX++; } else { sb.append("J"); currentSizeX--; } } while (currentSizeY != shape.getSize()) { if (currentSizeY < shape.getSize()) { sb.append("N"); currentSizeY++; } else { sb.append("M"); currentSizeY--; } } return sb.toString(); } //Creates String to draw a shape of desired size private String drawShape(Shape shape) { switch (shape.getType()) { case ("A1"): currentX += currentSizeX * 0; currentY += currentSizeY * 4; return A1; case ("A2"): currentX += currentSizeX * 0; currentY += currentSizeY * 4; return A2; case ("A3"): currentX += currentSizeX * 0; currentY -= currentSizeY * 4; return A3; case ("B1"): currentX += currentSizeX * 4; currentY += currentSizeY * 0; return B1; case ("B2"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return B2; case ("B3"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return B3; case ("C1"): currentX += currentSizeX * 4; currentY += currentSizeY * 0; return C1; case ("C2"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return C2; case ("D1"): currentX += currentSizeX * 4; currentY -= currentSizeY * 0; return D1; case ("D2"): currentX -= currentSizeX * 4; currentY -= currentSizeY * 0; return D2; case ("E1"): currentX += currentSizeX * 4; currentY += currentSizeX * 0; return E1; } return ""; } }
6,448
0.474256
0.461073
216
27.851852
19.695747
90
false
false
0
0
0
0
0
0
0.5
false
false
4
4c8277dd2a44408ea3232f6b14e08f97d618052c
6,622,839,578,566
ea825088a11e0f3f6c6687bb4f735d470f5c64c2
/src/main/java/com/xiayun/config/HibernateConfiguration.java
ce2ee66a99b588af057521071cea80a50e25ae6d
[]
no_license
chaohuxiayun/show
https://github.com/chaohuxiayun/show
70847d8c390b081559f241b140077ff703a238d3
47198dc12f1b5d474f8850ae77161881e1720af7
refs/heads/master
2022-12-24T08:28:16.650000
2019-06-07T09:37:12
2019-06-07T09:37:12
179,777,433
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xiayun.config; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "spring.hibernate") public class HibernateConfiguration { }
UTF-8
Java
203
java
HibernateConfiguration.java
Java
[]
null
[]
package com.xiayun.config; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "spring.hibernate") public class HibernateConfiguration { }
203
0.82266
0.82266
11
17.454546
25.457142
75
false
false
0
0
0
0
0
0
0.181818
false
false
4
0abf96e7100c2b6ec3f9bb67874faea59611d17c
33,509,334,861,865
20e51ebee551a5569494b17658e4ed33c5a2e046
/app/src/main/java/com/example/vinaymaneti/myapplication/whileloop.java
0ab4fd5cb0f035a6f4243a69e973495eb6fa3d2b
[]
no_license
manetivinay/MyApplication
https://github.com/manetivinay/MyApplication
e16f1485273646508fd5fbf5c6fa220c9d5906eb
2c430712e1dcc4736f1f04b54538e8773ab75e1d
refs/heads/master
2020-12-26T21:11:57.525000
2016-09-20T03:54:19
2016-09-20T03:54:19
68,672,017
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.vinaymaneti.myapplication; /** * Created by vinaymaneti on 7/26/16. */ public class whileloop { public static void main(String args[]){ int a = 0; while(a < 10){ System.out.println("value with while loop:- " + a); a = a +1; // a += 1; } } }
UTF-8
Java
321
java
whileloop.java
Java
[ { "context": "package com.example.vinaymaneti.myapplication;\n\n/**\n * Created by vinaymaneti on ", "end": 31, "score": 0.850470781326294, "start": 20, "tag": "USERNAME", "value": "vinaymaneti" }, { "context": "mple.vinaymaneti.myapplication;\n\n/**\n * Created by vinaymaneti on 7/26/16.\n */\npublic class whileloop {\n publ", "end": 77, "score": 0.9993280172348022, "start": 66, "tag": "USERNAME", "value": "vinaymaneti" } ]
null
[]
package com.example.vinaymaneti.myapplication; /** * Created by vinaymaneti on 7/26/16. */ public class whileloop { public static void main(String args[]){ int a = 0; while(a < 10){ System.out.println("value with while loop:- " + a); a = a +1; // a += 1; } } }
321
0.53271
0.501558
15
20.4
19.310791
63
false
false
0
0
0
0
0
0
0.333333
false
false
4
70c3706e50b8efe2a62cbb4af7eb922973e632d5
33,509,334,863,772
dc22fc005f7540e9b15e843d732bde1bde0d8c09
/src/main/java/com/simple/pos/simplepointofsale/controller/CustomerAddressesController.java
64ce3b08a4fffd8ed9fc30f18698c40428705640
[]
no_license
daviddonikapanjaitan/simple-pos-springboot-thymeleaf
https://github.com/daviddonikapanjaitan/simple-pos-springboot-thymeleaf
5e3cc4e2082e8bd13752c2f0a56f033536c916f1
d903ee28bcd5c352067d96fd122d122bdf585fc6
refs/heads/master
2023-08-23T17:21:31.305000
2021-10-04T14:35:45
2021-10-04T14:35:45
399,143,283
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.simple.pos.simplepointofsale.controller; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.simple.pos.simplepointofsale.Dto.CustomerAddressesDto; import com.simple.pos.simplepointofsale.Dto.PaginationDto; import com.simple.pos.simplepointofsale.Dto.PaginationRequestDto; import com.simple.pos.simplepointofsale.model.AddressTypes; import com.simple.pos.simplepointofsale.model.Addresses; import com.simple.pos.simplepointofsale.model.Customer; import com.simple.pos.simplepointofsale.model.CustomerAddresses; import com.simple.pos.simplepointofsale.service.AddressTypesService; import com.simple.pos.simplepointofsale.service.AddressesService; import com.simple.pos.simplepointofsale.service.CustomerAddressService; import com.simple.pos.simplepointofsale.service.CustomerService; import com.simple.pos.simplepointofsale.utils.AddAttributeService; import com.simple.pos.simplepointofsale.utils.ConverterService; import com.simple.pos.simplepointofsale.utils.PaginationService; import com.simple.pos.simplepointofsale.validationService.CustomerAddressValidationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Controller @RequestMapping("/customer-addresses") public class CustomerAddressesController { private static Logger logger = LoggerFactory.getLogger(CustomerAddressesController.class); private static String titleCRUD = "Customer Addresses"; private static String listLink = "customer-addresses/list"; private static String saveFormLink = "customer-addresses/add-form"; private static String updateFormLink = "customer-addresses/update-form"; private static String deleteFormLink = "customer-addresses/delete"; private static String postSaveLink = "customer-addresses/save"; @Autowired private CustomerAddressService customerAddressService; @Autowired private ConverterService converterService; @Autowired AddAttributeService addAttributeService; @Autowired CustomerAddressValidationService customerAddressValidationService; @Autowired CustomerService customerService; @Autowired AddressesService addressesService; @Autowired AddressTypesService addressTypesService; @Autowired PaginationService paginationService; @GetMapping("/list") public String viewCUstomerAddressMethodPage(Model model, @RequestParam(defaultValue = "ascDesc") String ascDesc, @RequestParam(defaultValue = "page") String page, @RequestParam(defaultValue = "size") String size, @RequestParam(defaultValue = "filtering") String filtering ){ PaginationRequestDto paginationRequestDto = new PaginationRequestDto( ascDesc, page, size, filtering, addressTypesService.getSize(), "customerAddressId" ); PaginationDto paginationDto = paginationService .paginationService(paginationRequestDto); Pageable pageable = paginationDto.getPageable(); Integer pageList = paginationDto.getPageList(); Integer nextPageList = paginationDto.getNextPageList(); Integer totalPage = paginationDto.getTotalPage(); List<CustomerAddresses> lCustomerAddresses = new ArrayList<>(); lCustomerAddresses = customerAddressService.getAllCustomerAddressAscDesc(pageable); List<CustomerAddresses> lCustomerAddressesFiltering = new ArrayList<>(); if(!filtering.equalsIgnoreCase("filtering")){ for(CustomerAddresses customerAddresses : lCustomerAddresses){ if(customerAddresses.getCustomerAddressId() == Long.parseLong(filtering)){ lCustomerAddressesFiltering.add(customerAddresses); } } lCustomerAddresses = lCustomerAddressesFiltering; }else{ filtering = ""; } addAttributeService.addFirstNameAttribute(model); model.addAttribute("updateFormLink", updateFormLink); model.addAttribute("listCustomerAddress", lCustomerAddresses); model.addAttribute("titleCRUD", titleCRUD); model.addAttribute("saveFormLink", saveFormLink); model.addAttribute("deleteFormLink", deleteFormLink); model.addAttribute("refresh", listLink); model.addAttribute("totalPage", totalPage); model.addAttribute("ascDesc", ascDesc); model.addAttribute("size", size); model.addAttribute("page", page); model.addAttribute("filtering", filtering); model.addAttribute("pageList", pageList); model.addAttribute("nextPageList", nextPageList); return "customer_address_ui/list"; } @GetMapping("/add-form") public String addForm(Model model){ List<Customer> lCustomers = customerService.getAllCustomers(); List<Addresses> lAddresses = addressesService.getAllAddresses(); List<AddressTypes> lTypes = addressTypesService.getAllAddressTypes(); addAttributeService.addFirstNameAttribute(model); CustomerAddresses customerAddresses = new CustomerAddresses(); model.addAttribute("listCustomers", lCustomers); model.addAttribute("listAddress", lAddresses); model.addAttribute("listAddressTypes", lTypes); model.addAttribute("titleCRUD", titleCRUD); model.addAttribute("customerAddresses", customerAddresses); model.addAttribute("listLink", listLink); model.addAttribute("postSaveLink", postSaveLink); return "customer_address_ui/add_customer_address"; } @PostMapping("/save") public String save( @ModelAttribute("customerAddresses") CustomerAddressesDto customerAddressesDto, RedirectAttributes redirectAttributes ){ String returnRedirect = "redirect:/customer-addresses/list"; logger.info("{}", customerAddressesDto.toString()); Date dateFrom = converterService.stringToDate(customerAddressesDto.getDateFrom(), "yyyy-MM-dd"); Date dateTo = converterService.stringToDate(customerAddressesDto.getDateTo(), "yyyy-MM-dd"); if(!customerAddressValidationService .customerAddressValidation( customerAddressesDto, redirectAttributes)){ customerAddressService.saveCustomerAddress(new CustomerAddresses( Long.parseLong(customerAddressesDto.getCustomerId()), Long.parseLong(customerAddressesDto.getAddressId()), customerAddressesDto.getAddressTypeCode(), dateFrom, dateTo )); }else{ returnRedirect = "redirect:/customer-addresses/add-form"; } return returnRedirect; } @GetMapping("/update-form/{id}") public String updateFormCustomerAddress( @PathVariable Long id, Model model ){ List<Customer> lCustomers = customerService.getAllCustomers(); List<Addresses> lAddresses = addressesService.getAllAddresses(); List<AddressTypes> lTypes = addressTypesService.getAllAddressTypes(); addAttributeService.addFirstNameAttribute(model); CustomerAddresses customerAddresses = customerAddressService.getCustomerAddressById(id); String dateFrom = converterService.dateToString(customerAddresses.getDateFrom(), "yyyy-MM-dd"); String dateTo = converterService.dateToString(customerAddresses.getDateTo(), "yyyy-MM-dd"); CustomerAddressesDto customerAddressesDto = new CustomerAddressesDto( customerAddresses.getCustomerId().toString(), customerAddresses.getAddressId().toString(), customerAddresses.getAddressTypeCode(), dateFrom, dateTo ); model.addAttribute("address_id", customerAddresses.getAddressId()); model.addAttribute("customer_id", customerAddresses.getCustomerId()); model.addAttribute("listCustomers", lCustomers); model.addAttribute("listAddress", lAddresses); model.addAttribute("listAddressTypes", lTypes); model.addAttribute("updateFormLink", updateFormLink + '/' + id); model.addAttribute("listLink", listLink); model.addAttribute("titleCRUD", titleCRUD); model.addAttribute("customerAddressesDto", customerAddressesDto); model.addAttribute("customerAddressesId", id); return "customer_address_ui/update_customer_addresses"; } @PostMapping("/update-form/{id}") public String updateCustomerAddress( @PathVariable(value = "id") Long id, @ModelAttribute("customerAddressDto") CustomerAddressesDto customerAddressesDto ) throws ParseException{ Date dateFrom = converterService.stringToDate(customerAddressesDto.getDateFrom(), "yyyy-MM-dd"); Date dateTo = converterService.stringToDate(customerAddressesDto.getDateTo(), "yyyy-MM-dd"); CustomerAddresses customerAddresses = new CustomerAddresses( Long.parseLong(customerAddressesDto.getCustomerId()), Long.parseLong(customerAddressesDto.getAddressId()), customerAddressesDto.getAddressTypeCode(), dateFrom, dateTo ); customerAddresses.setCustomerAddressId(id); customerAddressService.saveCustomerAddress(customerAddresses); return "redirect:/customer-addresses/list"; } @GetMapping("/delete/{id}") public String deleteCustomerAddress( @PathVariable(value = "id") Long id ){ this.customerAddressService.deleteCustomerAddressById(id); return "redirect:/customer-addresses/list"; } }
UTF-8
Java
10,353
java
CustomerAddressesController.java
Java
[]
null
[]
package com.simple.pos.simplepointofsale.controller; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.simple.pos.simplepointofsale.Dto.CustomerAddressesDto; import com.simple.pos.simplepointofsale.Dto.PaginationDto; import com.simple.pos.simplepointofsale.Dto.PaginationRequestDto; import com.simple.pos.simplepointofsale.model.AddressTypes; import com.simple.pos.simplepointofsale.model.Addresses; import com.simple.pos.simplepointofsale.model.Customer; import com.simple.pos.simplepointofsale.model.CustomerAddresses; import com.simple.pos.simplepointofsale.service.AddressTypesService; import com.simple.pos.simplepointofsale.service.AddressesService; import com.simple.pos.simplepointofsale.service.CustomerAddressService; import com.simple.pos.simplepointofsale.service.CustomerService; import com.simple.pos.simplepointofsale.utils.AddAttributeService; import com.simple.pos.simplepointofsale.utils.ConverterService; import com.simple.pos.simplepointofsale.utils.PaginationService; import com.simple.pos.simplepointofsale.validationService.CustomerAddressValidationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Controller @RequestMapping("/customer-addresses") public class CustomerAddressesController { private static Logger logger = LoggerFactory.getLogger(CustomerAddressesController.class); private static String titleCRUD = "Customer Addresses"; private static String listLink = "customer-addresses/list"; private static String saveFormLink = "customer-addresses/add-form"; private static String updateFormLink = "customer-addresses/update-form"; private static String deleteFormLink = "customer-addresses/delete"; private static String postSaveLink = "customer-addresses/save"; @Autowired private CustomerAddressService customerAddressService; @Autowired private ConverterService converterService; @Autowired AddAttributeService addAttributeService; @Autowired CustomerAddressValidationService customerAddressValidationService; @Autowired CustomerService customerService; @Autowired AddressesService addressesService; @Autowired AddressTypesService addressTypesService; @Autowired PaginationService paginationService; @GetMapping("/list") public String viewCUstomerAddressMethodPage(Model model, @RequestParam(defaultValue = "ascDesc") String ascDesc, @RequestParam(defaultValue = "page") String page, @RequestParam(defaultValue = "size") String size, @RequestParam(defaultValue = "filtering") String filtering ){ PaginationRequestDto paginationRequestDto = new PaginationRequestDto( ascDesc, page, size, filtering, addressTypesService.getSize(), "customerAddressId" ); PaginationDto paginationDto = paginationService .paginationService(paginationRequestDto); Pageable pageable = paginationDto.getPageable(); Integer pageList = paginationDto.getPageList(); Integer nextPageList = paginationDto.getNextPageList(); Integer totalPage = paginationDto.getTotalPage(); List<CustomerAddresses> lCustomerAddresses = new ArrayList<>(); lCustomerAddresses = customerAddressService.getAllCustomerAddressAscDesc(pageable); List<CustomerAddresses> lCustomerAddressesFiltering = new ArrayList<>(); if(!filtering.equalsIgnoreCase("filtering")){ for(CustomerAddresses customerAddresses : lCustomerAddresses){ if(customerAddresses.getCustomerAddressId() == Long.parseLong(filtering)){ lCustomerAddressesFiltering.add(customerAddresses); } } lCustomerAddresses = lCustomerAddressesFiltering; }else{ filtering = ""; } addAttributeService.addFirstNameAttribute(model); model.addAttribute("updateFormLink", updateFormLink); model.addAttribute("listCustomerAddress", lCustomerAddresses); model.addAttribute("titleCRUD", titleCRUD); model.addAttribute("saveFormLink", saveFormLink); model.addAttribute("deleteFormLink", deleteFormLink); model.addAttribute("refresh", listLink); model.addAttribute("totalPage", totalPage); model.addAttribute("ascDesc", ascDesc); model.addAttribute("size", size); model.addAttribute("page", page); model.addAttribute("filtering", filtering); model.addAttribute("pageList", pageList); model.addAttribute("nextPageList", nextPageList); return "customer_address_ui/list"; } @GetMapping("/add-form") public String addForm(Model model){ List<Customer> lCustomers = customerService.getAllCustomers(); List<Addresses> lAddresses = addressesService.getAllAddresses(); List<AddressTypes> lTypes = addressTypesService.getAllAddressTypes(); addAttributeService.addFirstNameAttribute(model); CustomerAddresses customerAddresses = new CustomerAddresses(); model.addAttribute("listCustomers", lCustomers); model.addAttribute("listAddress", lAddresses); model.addAttribute("listAddressTypes", lTypes); model.addAttribute("titleCRUD", titleCRUD); model.addAttribute("customerAddresses", customerAddresses); model.addAttribute("listLink", listLink); model.addAttribute("postSaveLink", postSaveLink); return "customer_address_ui/add_customer_address"; } @PostMapping("/save") public String save( @ModelAttribute("customerAddresses") CustomerAddressesDto customerAddressesDto, RedirectAttributes redirectAttributes ){ String returnRedirect = "redirect:/customer-addresses/list"; logger.info("{}", customerAddressesDto.toString()); Date dateFrom = converterService.stringToDate(customerAddressesDto.getDateFrom(), "yyyy-MM-dd"); Date dateTo = converterService.stringToDate(customerAddressesDto.getDateTo(), "yyyy-MM-dd"); if(!customerAddressValidationService .customerAddressValidation( customerAddressesDto, redirectAttributes)){ customerAddressService.saveCustomerAddress(new CustomerAddresses( Long.parseLong(customerAddressesDto.getCustomerId()), Long.parseLong(customerAddressesDto.getAddressId()), customerAddressesDto.getAddressTypeCode(), dateFrom, dateTo )); }else{ returnRedirect = "redirect:/customer-addresses/add-form"; } return returnRedirect; } @GetMapping("/update-form/{id}") public String updateFormCustomerAddress( @PathVariable Long id, Model model ){ List<Customer> lCustomers = customerService.getAllCustomers(); List<Addresses> lAddresses = addressesService.getAllAddresses(); List<AddressTypes> lTypes = addressTypesService.getAllAddressTypes(); addAttributeService.addFirstNameAttribute(model); CustomerAddresses customerAddresses = customerAddressService.getCustomerAddressById(id); String dateFrom = converterService.dateToString(customerAddresses.getDateFrom(), "yyyy-MM-dd"); String dateTo = converterService.dateToString(customerAddresses.getDateTo(), "yyyy-MM-dd"); CustomerAddressesDto customerAddressesDto = new CustomerAddressesDto( customerAddresses.getCustomerId().toString(), customerAddresses.getAddressId().toString(), customerAddresses.getAddressTypeCode(), dateFrom, dateTo ); model.addAttribute("address_id", customerAddresses.getAddressId()); model.addAttribute("customer_id", customerAddresses.getCustomerId()); model.addAttribute("listCustomers", lCustomers); model.addAttribute("listAddress", lAddresses); model.addAttribute("listAddressTypes", lTypes); model.addAttribute("updateFormLink", updateFormLink + '/' + id); model.addAttribute("listLink", listLink); model.addAttribute("titleCRUD", titleCRUD); model.addAttribute("customerAddressesDto", customerAddressesDto); model.addAttribute("customerAddressesId", id); return "customer_address_ui/update_customer_addresses"; } @PostMapping("/update-form/{id}") public String updateCustomerAddress( @PathVariable(value = "id") Long id, @ModelAttribute("customerAddressDto") CustomerAddressesDto customerAddressesDto ) throws ParseException{ Date dateFrom = converterService.stringToDate(customerAddressesDto.getDateFrom(), "yyyy-MM-dd"); Date dateTo = converterService.stringToDate(customerAddressesDto.getDateTo(), "yyyy-MM-dd"); CustomerAddresses customerAddresses = new CustomerAddresses( Long.parseLong(customerAddressesDto.getCustomerId()), Long.parseLong(customerAddressesDto.getAddressId()), customerAddressesDto.getAddressTypeCode(), dateFrom, dateTo ); customerAddresses.setCustomerAddressId(id); customerAddressService.saveCustomerAddress(customerAddresses); return "redirect:/customer-addresses/list"; } @GetMapping("/delete/{id}") public String deleteCustomerAddress( @PathVariable(value = "id") Long id ){ this.customerAddressService.deleteCustomerAddressById(id); return "redirect:/customer-addresses/list"; } }
10,353
0.72211
0.721916
247
40.914978
28.46912
104
false
false
0
0
0
0
0
0
0.744939
false
false
4
4b4968c53bc73c6362d6e763fa1b5e50aac2270f
3,307,124,880,842
f5710a814cc7c92bd17cfd01dc1c629a3db8bee9
/src/main/java/genericsPractice/entity/ArrayEntity.java
9d8387abf0f02a79f7439299ca2035369734c402
[]
no_license
bugbug2022/baseConceptPractice
https://github.com/bugbug2022/baseConceptPractice
8c0f21d92b2b6a04bc5fa33c5b03ae17b09d7f36
aeba2469946e4d7ae75a92da187bae1c956da67e
refs/heads/main
2023-07-16T23:26:21.693000
2021-02-25T09:43:25
2021-02-25T09:43:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package genericsPractice.entity; /** * Created by ZQ. * 泛型方法 * @date 2021/2/25$ 11:01$ */ public class ArrayEntity { // 泛型方法 printArray public static < E > void printArray( E[] inputArray ) { // 输出数组元素 for ( E element : inputArray ){ System.out.printf( "%s ", element ); } System.out.println(); } }
UTF-8
Java
393
java
ArrayEntity.java
Java
[ { "context": "ackage genericsPractice.entity;\n\n/**\n * Created by ZQ.\n * 泛型方法\n * @date 2021/2/25$ 11:01$\n */\npublic cl", "end": 54, "score": 0.9963895082473755, "start": 52, "tag": "USERNAME", "value": "ZQ" } ]
null
[]
package genericsPractice.entity; /** * Created by ZQ. * 泛型方法 * @date 2021/2/25$ 11:01$ */ public class ArrayEntity { // 泛型方法 printArray public static < E > void printArray( E[] inputArray ) { // 输出数组元素 for ( E element : inputArray ){ System.out.printf( "%s ", element ); } System.out.println(); } }
393
0.545205
0.515068
19
18.210526
16.624582
57
false
false
0
0
0
0
0
0
0.210526
false
false
4
065f80b594f147545956b07047f46c1b40076a93
25,177,098,307,763
d379a65911f0691f6150a797ba7a6d585a3f4f69
/src/com/mmuca/expLab/domain/Market/graphs/MarketGraphVisualizationServerProvider.java
6d92c49090a85608937ad7c3e37f594ffe0fdd4d
[]
no_license
plutokid/Mixed-Multi-Unit-Combinatorial-Auctions-Test-Suit
https://github.com/plutokid/Mixed-Multi-Unit-Combinatorial-Auctions-Test-Suit
90b53c7e6ca086c1d0b271e22f0ca811d2ca437b
313738568b38106b4c640f3d46b68ab3c4b929d2
refs/heads/master
2020-05-29T11:50:22.675000
2011-11-02T09:49:00
2011-11-02T09:49:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mmuca.expLab.domain.Market.graphs; import com.mmuca.expLab.domain.Market.Market; import edu.uci.ics.jung.algorithms.layout.Layout; import edu.uci.ics.jung.algorithms.layout.StaticLayout; import edu.uci.ics.jung.graph.Graph; import edu.uci.ics.jung.graph.util.Context; import edu.uci.ics.jung.visualization.BasicVisualizationServer; import org.apache.commons.collections15.Predicate; import org.apache.commons.collections15.Transformer; import org.apache.commons.collections15.functors.TruePredicate; import java.awt.*; import java.awt.geom.Point2D; public class MarketGraphVisualizationServerProvider { private GraphTransformers graphTransformers; private MarketGraphProvider graphProvider; public MarketGraphVisualizationServerProvider(GraphTransformers graphTransformers, MarketGraphProvider graphProvider){ this.graphTransformers = graphTransformers; this.graphProvider = graphProvider; } public BasicVisualizationServer<Object,MarketEdge> getServerFor(Market market, Dimension size, double scale){ return createServer(market, new MarketVertexAllTransLayoutTransformer(market, size, scale), TruePredicate.<Context<Graph<Object, MarketEdge>, Object>>getInstance()); } public BasicVisualizationServer<Object,MarketEdge> getOnlyIOTServerFor(Market market, Dimension size, double scale){ return createServer(market, new MarketVertexOnlyIOTLayoutTransformer(market, size, scale), new MarketVertexIncludeOnlyIOTPredicate()); } private BasicVisualizationServer<Object, MarketEdge> createServer(Market market, Transformer<Object, Point2D> transformer, Predicate<Context<Graph<Object, MarketEdge>, Object>> predicate) { Layout<Object, MarketEdge> layout = new StaticLayout<Object, MarketEdge>(graphProvider.graphFor(market), transformer) ; BasicVisualizationServer<Object,MarketEdge> visualizationServer = new BasicVisualizationServer<Object,MarketEdge>(layout); visualizationServer.getRenderContext().setVertexShapeTransformer(graphTransformers.vertexShapeTransformer); visualizationServer.getRenderContext().setVertexFillPaintTransformer(graphTransformers.vertexColorTransformer); visualizationServer.getRenderContext().setEdgeDrawPaintTransformer(graphTransformers.edgeColorTransformer); visualizationServer.getRenderContext().setArrowDrawPaintTransformer(graphTransformers.edgeColorTransformer); visualizationServer.getRenderContext().setArrowFillPaintTransformer(graphTransformers.edgeColorTransformer); visualizationServer.getRenderContext().setVertexIncludePredicate(predicate); return visualizationServer; } public static class GraphTransformers { private final Transformer<Object, Shape> vertexShapeTransformer; private final Transformer<Object, Paint> vertexColorTransformer; private final Transformer<MarketEdge, Paint> edgeColorTransformer; public GraphTransformers(Transformer<Object, Shape> vertexShapeTransformer, Transformer<Object, Paint> vertexColorTransformer, Transformer<MarketEdge, Paint> edgeColorTransformer) { this.vertexShapeTransformer = vertexShapeTransformer; this.vertexColorTransformer = vertexColorTransformer; this.edgeColorTransformer = edgeColorTransformer; } public Transformer<Object, Shape> getVertexShapeTransformer() { return vertexShapeTransformer; } public Transformer<Object, Paint> getVertexColorTransformer() { return vertexColorTransformer; } public Transformer<MarketEdge, Paint> getEdgeColorTransformer() { return edgeColorTransformer; } } }
UTF-8
Java
3,720
java
MarketGraphVisualizationServerProvider.java
Java
[]
null
[]
package com.mmuca.expLab.domain.Market.graphs; import com.mmuca.expLab.domain.Market.Market; import edu.uci.ics.jung.algorithms.layout.Layout; import edu.uci.ics.jung.algorithms.layout.StaticLayout; import edu.uci.ics.jung.graph.Graph; import edu.uci.ics.jung.graph.util.Context; import edu.uci.ics.jung.visualization.BasicVisualizationServer; import org.apache.commons.collections15.Predicate; import org.apache.commons.collections15.Transformer; import org.apache.commons.collections15.functors.TruePredicate; import java.awt.*; import java.awt.geom.Point2D; public class MarketGraphVisualizationServerProvider { private GraphTransformers graphTransformers; private MarketGraphProvider graphProvider; public MarketGraphVisualizationServerProvider(GraphTransformers graphTransformers, MarketGraphProvider graphProvider){ this.graphTransformers = graphTransformers; this.graphProvider = graphProvider; } public BasicVisualizationServer<Object,MarketEdge> getServerFor(Market market, Dimension size, double scale){ return createServer(market, new MarketVertexAllTransLayoutTransformer(market, size, scale), TruePredicate.<Context<Graph<Object, MarketEdge>, Object>>getInstance()); } public BasicVisualizationServer<Object,MarketEdge> getOnlyIOTServerFor(Market market, Dimension size, double scale){ return createServer(market, new MarketVertexOnlyIOTLayoutTransformer(market, size, scale), new MarketVertexIncludeOnlyIOTPredicate()); } private BasicVisualizationServer<Object, MarketEdge> createServer(Market market, Transformer<Object, Point2D> transformer, Predicate<Context<Graph<Object, MarketEdge>, Object>> predicate) { Layout<Object, MarketEdge> layout = new StaticLayout<Object, MarketEdge>(graphProvider.graphFor(market), transformer) ; BasicVisualizationServer<Object,MarketEdge> visualizationServer = new BasicVisualizationServer<Object,MarketEdge>(layout); visualizationServer.getRenderContext().setVertexShapeTransformer(graphTransformers.vertexShapeTransformer); visualizationServer.getRenderContext().setVertexFillPaintTransformer(graphTransformers.vertexColorTransformer); visualizationServer.getRenderContext().setEdgeDrawPaintTransformer(graphTransformers.edgeColorTransformer); visualizationServer.getRenderContext().setArrowDrawPaintTransformer(graphTransformers.edgeColorTransformer); visualizationServer.getRenderContext().setArrowFillPaintTransformer(graphTransformers.edgeColorTransformer); visualizationServer.getRenderContext().setVertexIncludePredicate(predicate); return visualizationServer; } public static class GraphTransformers { private final Transformer<Object, Shape> vertexShapeTransformer; private final Transformer<Object, Paint> vertexColorTransformer; private final Transformer<MarketEdge, Paint> edgeColorTransformer; public GraphTransformers(Transformer<Object, Shape> vertexShapeTransformer, Transformer<Object, Paint> vertexColorTransformer, Transformer<MarketEdge, Paint> edgeColorTransformer) { this.vertexShapeTransformer = vertexShapeTransformer; this.vertexColorTransformer = vertexColorTransformer; this.edgeColorTransformer = edgeColorTransformer; } public Transformer<Object, Shape> getVertexShapeTransformer() { return vertexShapeTransformer; } public Transformer<Object, Paint> getVertexColorTransformer() { return vertexColorTransformer; } public Transformer<MarketEdge, Paint> getEdgeColorTransformer() { return edgeColorTransformer; } } }
3,720
0.78629
0.78414
68
53.705883
49.611153
193
false
false
0
0
0
0
0
0
1.102941
false
false
4
53cd300f97a69257becbab5e098e832a6771b3a9
8,177,617,758,306
38a94daf1fb3564105fa16a4f138e70b3d114199
/src/com/mySampleApplication/client/Messages.java
e7073b88e7f221b24465840c59a2a48792feacf2
[]
no_license
yalexeyenko/gwt-sample-application
https://github.com/yalexeyenko/gwt-sample-application
cc29bdfe2799e91a468b4a328fd91086467697ac
cfdbaa8225ee5143dc70c6f617a1143b0a82d49e
refs/heads/master
2021-07-09T21:11:23.565000
2017-10-09T02:14:25
2017-10-09T02:14:25
106,226,664
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mySampleApplication.client; public interface Messages { String getMessage(String messageKey); String getParametrizedMessage(String messageName, Object... params); String format(final String format, final Object... args); }
UTF-8
Java
252
java
Messages.java
Java
[]
null
[]
package com.mySampleApplication.client; public interface Messages { String getMessage(String messageKey); String getParametrizedMessage(String messageName, Object... params); String format(final String format, final Object... args); }
252
0.757937
0.757937
11
21.90909
26.210527
72
false
false
0
0
0
0
0
0
0.545455
false
false
4
6ca2dbb2ddef767687624b138c9f726a6f57869f
26,826,365,790,541
91681f207b2901981c5c048a34f8549b18f9bd17
/src/test/java/com/byedbl/PathMatchingResourcePatternResolverTest.java
9fc9e5abff4f5147cdec7a3a5e0e8f6fca5f225e
[]
no_license
GitHubzzj/spring-bean-extention
https://github.com/GitHubzzj/spring-bean-extention
757d1d0634cca8353d060f5e9e4dbc068b13bf39
dd40ef586c1771b2f6294b56850b604ad8a9b1ee
refs/heads/master
2020-03-30T03:11:27.940000
2018-10-06T05:07:26
2018-10-06T05:07:26
150,674,318
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.byedbl; import org.junit.Test; public class PathMatchingResourcePatternResolverTest { @Test public void testDetermineRootDir() { System.out.println(determineRootDir("classpath*:com/byedbl/**/*.class")); System.out.println(determineRootDir("classpath*:com/byedbl/**/*.class/")); System.out.println(determineRootDir("classpath*:com/byedbl/**/*.clas/s")); System.out.println(determineRootDir("classpath*:com/byedbl/**/*.clas/s//")); } protected String determineRootDir(String location) { int prefixEnd = location.indexOf(":") + 1; int rootDirEnd = location.length(); while (rootDirEnd > prefixEnd && isPattern(location.substring(prefixEnd, rootDirEnd))) { rootDirEnd = location.lastIndexOf('/', rootDirEnd -1) ; // rootDirEnd = location.lastIndexOf('/', rootDirEnd -2) +1 ; } if (rootDirEnd == 0) { rootDirEnd = prefixEnd; } rootDirEnd += 1; return location.substring(0, rootDirEnd); } public boolean isPattern(String path) { return (path.indexOf('*') != -1 || path.indexOf('?') != -1); } }
UTF-8
Java
1,176
java
PathMatchingResourcePatternResolverTest.java
Java
[]
null
[]
package com.byedbl; import org.junit.Test; public class PathMatchingResourcePatternResolverTest { @Test public void testDetermineRootDir() { System.out.println(determineRootDir("classpath*:com/byedbl/**/*.class")); System.out.println(determineRootDir("classpath*:com/byedbl/**/*.class/")); System.out.println(determineRootDir("classpath*:com/byedbl/**/*.clas/s")); System.out.println(determineRootDir("classpath*:com/byedbl/**/*.clas/s//")); } protected String determineRootDir(String location) { int prefixEnd = location.indexOf(":") + 1; int rootDirEnd = location.length(); while (rootDirEnd > prefixEnd && isPattern(location.substring(prefixEnd, rootDirEnd))) { rootDirEnd = location.lastIndexOf('/', rootDirEnd -1) ; // rootDirEnd = location.lastIndexOf('/', rootDirEnd -2) +1 ; } if (rootDirEnd == 0) { rootDirEnd = prefixEnd; } rootDirEnd += 1; return location.substring(0, rootDirEnd); } public boolean isPattern(String path) { return (path.indexOf('*') != -1 || path.indexOf('?') != -1); } }
1,176
0.618197
0.610544
35
32.599998
30.998802
96
false
false
0
0
0
0
0
0
0.571429
false
false
4
01b269e3969ed9026acdfde4cfb16964eca7d3c5
8,400,956,046,367
9fffb34d8724acb2c16db8edc7d8ad9627bdc01f
/leetcode/src/main/java/com/acxie/leetcode/leetcode算法题/一和零/一和零_dp.java
5a788f6d172155a99d2fcb8ec417044822947c08
[]
no_license
winkerwinker/demo
https://github.com/winkerwinker/demo
04424a63fa7cdc6373a0aeac53c83742a135d48b
114d011fa271d2f28581132a407f36aaf36a940a
refs/heads/master
2023-04-09T22:45:00.311000
2021-04-15T13:12:20
2021-04-15T13:24:45
292,801,125
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.acxie.leetcode.leetcode算法题.一和零; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @description: * @author: xieaichen * @time: 2020/9/2 16:33 */ //在计算机界中,我们总是追求用有限的资源获取最大的收益。 //现在,假设你分别支配着 m 个0和 n 个1。另外,还有一个仅包含0和1字符串的数组。 //你的任务是使用给定的m 个0和 n 个1,找到能拼出存在于数组中的字符串的最大数量。每个0和1至多被使用一次。 //多维数组的背包问题 public class 一和零_dp { static int[][] ints; public static int findMaxForm(String[] strs, int m, int n) { // strs转数组 ints = new int[m + 1][n + 1]; for (int i = 0; i < m + 1; i++) { for (int j = 0; j < n + 1; j++) { ints[i][j] = -1; } } findMaxForm1(Arrays.asList(strs), m, n); System.out.println(Arrays.deepToString(ints)); return ints[m][n]; } public static int findMaxForm1(List<String> strs, int m, int n) { if (m < 0 || n < 0 || (m == 0 && n == 0)) { return 0; } int tempmax = 0; for (String str : strs) { int[] helper = helper(str); List<String> temp = new ArrayList<>(); temp.addAll(strs); temp.remove(str); int i = (m < helper[0] || n < helper[1]) ? 0 : 1; // TODO: 2020/10/12 不选择当前考虑的字符串,至少是这个数值 || 因此会出错 // if (m - helper[0] >= 0 && n - helper[1] >= 0 && ints[m - helper[0]][n - helper[1]] != -1) { // tempmax = Math.max(tempmx, i + ints[m - healper[0]][n - helper[1]]); // } else { // tempmax = Math.max(tempmax, i + findMaxForm1(temp, m - helper[0], n - helper[1])); // } tempmax = Math.max(tempmax, i + findMaxForm1(temp, m - helper[0], n - helper[1])); System.out.println(Arrays.deepToString(ints)); } ints[m][n] = tempmax; return tempmax; } public static int[] helper(String str) { int[] ints = new int[2]; int count1 = 0; for (char c : str.toCharArray() ) { if (c == '1') { count1++; } } ints[0] = str.length() - count1; ints[1] = count1; return ints; } public static void main(String[] args) { // String[] a = new String[]{"10", "0001", "111001", "1", "0"}; // int maxForm = findMaxForm(a, 5, 3); String[] a = new String[]{"10", "0", "1"}; int maxForm = findMaxForm(a, 2, 1); System.out.println(maxForm); } }
UTF-8
Java
2,784
java
一和零_dp.java
Java
[ { "context": " java.util.List;\n\n/**\n * @description:\n * @author: xieaichen\n * @time: 2020/9/2 16:33\n */\n\n//在计算机界中,我们总是追求用有限的", "end": 164, "score": 0.9995028972625732, "start": 155, "tag": "USERNAME", "value": "xieaichen" } ]
null
[]
package com.acxie.leetcode.leetcode算法题.一和零; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @description: * @author: xieaichen * @time: 2020/9/2 16:33 */ //在计算机界中,我们总是追求用有限的资源获取最大的收益。 //现在,假设你分别支配着 m 个0和 n 个1。另外,还有一个仅包含0和1字符串的数组。 //你的任务是使用给定的m 个0和 n 个1,找到能拼出存在于数组中的字符串的最大数量。每个0和1至多被使用一次。 //多维数组的背包问题 public class 一和零_dp { static int[][] ints; public static int findMaxForm(String[] strs, int m, int n) { // strs转数组 ints = new int[m + 1][n + 1]; for (int i = 0; i < m + 1; i++) { for (int j = 0; j < n + 1; j++) { ints[i][j] = -1; } } findMaxForm1(Arrays.asList(strs), m, n); System.out.println(Arrays.deepToString(ints)); return ints[m][n]; } public static int findMaxForm1(List<String> strs, int m, int n) { if (m < 0 || n < 0 || (m == 0 && n == 0)) { return 0; } int tempmax = 0; for (String str : strs) { int[] helper = helper(str); List<String> temp = new ArrayList<>(); temp.addAll(strs); temp.remove(str); int i = (m < helper[0] || n < helper[1]) ? 0 : 1; // TODO: 2020/10/12 不选择当前考虑的字符串,至少是这个数值 || 因此会出错 // if (m - helper[0] >= 0 && n - helper[1] >= 0 && ints[m - helper[0]][n - helper[1]] != -1) { // tempmax = Math.max(tempmx, i + ints[m - healper[0]][n - helper[1]]); // } else { // tempmax = Math.max(tempmax, i + findMaxForm1(temp, m - helper[0], n - helper[1])); // } tempmax = Math.max(tempmax, i + findMaxForm1(temp, m - helper[0], n - helper[1])); System.out.println(Arrays.deepToString(ints)); } ints[m][n] = tempmax; return tempmax; } public static int[] helper(String str) { int[] ints = new int[2]; int count1 = 0; for (char c : str.toCharArray() ) { if (c == '1') { count1++; } } ints[0] = str.length() - count1; ints[1] = count1; return ints; } public static void main(String[] args) { // String[] a = new String[]{"10", "0001", "111001", "1", "0"}; // int maxForm = findMaxForm(a, 5, 3); String[] a = new String[]{"10", "0", "1"}; int maxForm = findMaxForm(a, 2, 1); System.out.println(maxForm); } }
2,784
0.491136
0.454472
89
26.88764
24.681995
105
false
false
0
0
0
0
0
0
0.775281
false
false
4
836264225b1857461c05c8ed9a7ad5fced12d7bb
5,377,299,066,817
838fc22f46b7a597f8ae51756692ecb71b6c55fe
/vive/0-Intelcom/.svn/tmp/svn.27.tmp
873e7288db8d7934cdebf71962daef73b7dd6947
[]
no_license
juandevtoledo/Imocom
https://github.com/juandevtoledo/Imocom
9a714bc78c56a03a2c8729024ad333e0954ee23f
37abcd0c65c765d31704efa13d53486a0dc14752
refs/heads/main
2023-02-03T03:08:07.864000
2020-12-16T21:45:21
2020-12-16T21:45:21
302,337,466
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2014 IMOCOM. All Rights Reserved. * * This software is the confidential and proprietary information of IMOCOM. * ("Confidential Information"). * It may not be copied or reproduced in any manner without the express * written permission of IMOCOM. */ package com.imocom.intelcom.persistence.entities; import com.imocom.intelcom.persistence.AbstractEntity; import com.imocom.intelcom.persistence.IDataModel; import java.io.Serializable; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * <strong>Aplicación</strong> : IMOCOM Sistema de inteligencia comercial. * <br/> * <br/> * <strong>Date</strong> : Oct 27, 2014 * <br/><br/> * <strong>Target</strong> : * * @author Carlos Guzman (cguzman) - PointMind S.A.S. - carlos.guzman@pointmind.com * */ @Entity @Table(name = "TIPO") @NamedQueries({ @NamedQuery(name = "Tipo.findAll", query = "SELECT t FROM Tipo t order by t.idTipo"), @NamedQuery(name = "Tipo.findByIdTipo", query = "SELECT t FROM Tipo t WHERE t.idTipo = :idTipo order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoNombre", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoEtiqueta", query = "SELECT t FROM Tipo t WHERE t.tipoEtiqueta = :tipoEtiqueta order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoValor", query = "SELECT t FROM Tipo t WHERE t.tipoValor = :tipoValor order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoNombreTipoEtiqueta", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre and t.tipoEtiqueta = :tipoEtiqueta order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoNombreValorTipopadre", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre and t.tipoValor = :tipoValor and t.tipoPadre = :tipoPadre"), @NamedQuery(name = "Tipo.findByTipoNombreValor", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre and t.tipoValor = :tipoValor"), @NamedQuery(name = "Tipo.findByTipoPadre", query = "SELECT t FROM Tipo t WHERE t.tipoPadre = :tipoPadre order by t.idTipo")}) public class Tipo extends AbstractEntity implements Serializable, IDataModel { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO, generator="Tipo_seq_gen") @SequenceGenerator(name="Tipo_seq_gen", sequenceName="SEQ_TIPO", allocationSize = 1) @Column(name = "ID_TIPO") private Long idTipo; @Column(name = "TIPO_NOMBRE") private String tipoNombre; @Column(name = "TIPO_ETIQUETA") private String tipoEtiqueta; @Column(name = "TIPO_VALOR") private String tipoValor; @Column(name = "TIPO_PADRE") private Long tipoPadre; @OneToMany(mappedBy = "idTipomoneda") private Set<Cotizacion> cotizacionSet; @OneToMany(mappedBy = "idIncoterm") private Set<Cotizacion> cotizacionSet1; @OneToMany(mappedBy = "idEstadocotizacion") private Set<Cotizacion> cotizacionSet2; @OneToMany(mappedBy = "idtipooferta") private Set<Cotizacion> cotizacionSet3; @OneToMany(mappedBy = "idEstado") private Set<Visita> visitaSet; @OneToMany(mappedBy = "idTipovisita") private Set<Visita> visitaSet1; public Tipo() { } public Tipo(Long idTipo) { this.idTipo = idTipo; } public Long getIdTipo() { return idTipo; } public void setIdTipo(Long idTipo) { this.idTipo = idTipo; } public String getTipoNombre() { return tipoNombre; } public void setTipoNombre(String tipoNombre) { this.tipoNombre = tipoNombre; } public String getTipoEtiqueta() { return tipoEtiqueta; } public void setTipoEtiqueta(String tipoEtiqueta) { this.tipoEtiqueta = tipoEtiqueta; } public String getTipoValor() { return tipoValor; } public void setTipoValor(String tipoValor) { this.tipoValor = tipoValor; } public Long getTipoPadre() { return tipoPadre; } public void setTipoPadre(Long tipoPadre) { this.tipoPadre = tipoPadre; } public Set<Cotizacion> getCotizacionSet() { return cotizacionSet; } public void setCotizacionSet(Set<Cotizacion> cotizacionSet) { this.cotizacionSet = cotizacionSet; } public Set<Cotizacion> getCotizacionSet1() { return cotizacionSet1; } public void setCotizacionSet1(Set<Cotizacion> cotizacionSet1) { this.cotizacionSet1 = cotizacionSet1; } public Set<Cotizacion> getCotizacionSet2() { return cotizacionSet2; } public void setCotizacionSet2(Set<Cotizacion> cotizacionSet2) { this.cotizacionSet2 = cotizacionSet2; } public Set<Cotizacion> getCotizacionSet3() { return cotizacionSet3; } public void setCotizacionSet3(Set<Cotizacion> cotizacionSet3) { this.cotizacionSet3 = cotizacionSet3; } public Set<Visita> getVisitaSet() { return visitaSet; } public void setVisitaSet(Set<Visita> visitaSet) { this.visitaSet = visitaSet; } public Set<Visita> getVisitaSet1() { return visitaSet1; } public void setVisitaSet1(Set<Visita> visitaSet1) { this.visitaSet1 = visitaSet1; } @Override public int hashCode() { int hash = 0; hash += (idTipo != null ? idTipo.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Tipo)) { return false; } Tipo other = (Tipo) object; if ((this.idTipo == null && other.idTipo != null) || (this.idTipo != null && !this.idTipo.equals(other.idTipo))) { return false; } return true; } @Override public String toString() { return "com.imocom.intelcom.persistence.entities.Tipo[ idTipo=" + idTipo + " ]"; } public String getKeyModel() { if (this.idTipo != null) return String.valueOf(this.idTipo); return null; } }
UTF-8
Java
6,578
tmp
svn.27.tmp
Java
[ { "context": "* <strong>Target</strong> : \n *\n * @author Carlos Guzman (cguzman) - PointMind S.A.S. - carlos.guzman@poin", "end": 1081, "score": 0.9998874664306641, "start": 1068, "tag": "NAME", "value": "Carlos Guzman" }, { "context": "</strong> : \n *\n * @author Carlos Guzman (cguzman) - PointMind S.A.S. - carlos.guzman@pointmind.com", "end": 1090, "score": 0.9996715784072876, "start": 1083, "tag": "USERNAME", "value": "cguzman" }, { "context": "uthor Carlos Guzman (cguzman) - PointMind S.A.S. - carlos.guzman@pointmind.com\n *\n */\n@Entity\n@Table(name = \"TIPO\")\n@NamedQuerie", "end": 1140, "score": 0.9999282956123352, "start": 1113, "tag": "EMAIL", "value": "carlos.guzman@pointmind.com" } ]
null
[]
/* * Copyright (c) 2014 IMOCOM. All Rights Reserved. * * This software is the confidential and proprietary information of IMOCOM. * ("Confidential Information"). * It may not be copied or reproduced in any manner without the express * written permission of IMOCOM. */ package com.imocom.intelcom.persistence.entities; import com.imocom.intelcom.persistence.AbstractEntity; import com.imocom.intelcom.persistence.IDataModel; import java.io.Serializable; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * <strong>Aplicación</strong> : IMOCOM Sistema de inteligencia comercial. * <br/> * <br/> * <strong>Date</strong> : Oct 27, 2014 * <br/><br/> * <strong>Target</strong> : * * @author <NAME> (cguzman) - PointMind S.A.S. - <EMAIL> * */ @Entity @Table(name = "TIPO") @NamedQueries({ @NamedQuery(name = "Tipo.findAll", query = "SELECT t FROM Tipo t order by t.idTipo"), @NamedQuery(name = "Tipo.findByIdTipo", query = "SELECT t FROM Tipo t WHERE t.idTipo = :idTipo order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoNombre", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoEtiqueta", query = "SELECT t FROM Tipo t WHERE t.tipoEtiqueta = :tipoEtiqueta order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoValor", query = "SELECT t FROM Tipo t WHERE t.tipoValor = :tipoValor order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoNombreTipoEtiqueta", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre and t.tipoEtiqueta = :tipoEtiqueta order by t.idTipo"), @NamedQuery(name = "Tipo.findByTipoNombreValorTipopadre", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre and t.tipoValor = :tipoValor and t.tipoPadre = :tipoPadre"), @NamedQuery(name = "Tipo.findByTipoNombreValor", query = "SELECT t FROM Tipo t WHERE t.tipoNombre = :tipoNombre and t.tipoValor = :tipoValor"), @NamedQuery(name = "Tipo.findByTipoPadre", query = "SELECT t FROM Tipo t WHERE t.tipoPadre = :tipoPadre order by t.idTipo")}) public class Tipo extends AbstractEntity implements Serializable, IDataModel { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO, generator="Tipo_seq_gen") @SequenceGenerator(name="Tipo_seq_gen", sequenceName="SEQ_TIPO", allocationSize = 1) @Column(name = "ID_TIPO") private Long idTipo; @Column(name = "TIPO_NOMBRE") private String tipoNombre; @Column(name = "TIPO_ETIQUETA") private String tipoEtiqueta; @Column(name = "TIPO_VALOR") private String tipoValor; @Column(name = "TIPO_PADRE") private Long tipoPadre; @OneToMany(mappedBy = "idTipomoneda") private Set<Cotizacion> cotizacionSet; @OneToMany(mappedBy = "idIncoterm") private Set<Cotizacion> cotizacionSet1; @OneToMany(mappedBy = "idEstadocotizacion") private Set<Cotizacion> cotizacionSet2; @OneToMany(mappedBy = "idtipooferta") private Set<Cotizacion> cotizacionSet3; @OneToMany(mappedBy = "idEstado") private Set<Visita> visitaSet; @OneToMany(mappedBy = "idTipovisita") private Set<Visita> visitaSet1; public Tipo() { } public Tipo(Long idTipo) { this.idTipo = idTipo; } public Long getIdTipo() { return idTipo; } public void setIdTipo(Long idTipo) { this.idTipo = idTipo; } public String getTipoNombre() { return tipoNombre; } public void setTipoNombre(String tipoNombre) { this.tipoNombre = tipoNombre; } public String getTipoEtiqueta() { return tipoEtiqueta; } public void setTipoEtiqueta(String tipoEtiqueta) { this.tipoEtiqueta = tipoEtiqueta; } public String getTipoValor() { return tipoValor; } public void setTipoValor(String tipoValor) { this.tipoValor = tipoValor; } public Long getTipoPadre() { return tipoPadre; } public void setTipoPadre(Long tipoPadre) { this.tipoPadre = tipoPadre; } public Set<Cotizacion> getCotizacionSet() { return cotizacionSet; } public void setCotizacionSet(Set<Cotizacion> cotizacionSet) { this.cotizacionSet = cotizacionSet; } public Set<Cotizacion> getCotizacionSet1() { return cotizacionSet1; } public void setCotizacionSet1(Set<Cotizacion> cotizacionSet1) { this.cotizacionSet1 = cotizacionSet1; } public Set<Cotizacion> getCotizacionSet2() { return cotizacionSet2; } public void setCotizacionSet2(Set<Cotizacion> cotizacionSet2) { this.cotizacionSet2 = cotizacionSet2; } public Set<Cotizacion> getCotizacionSet3() { return cotizacionSet3; } public void setCotizacionSet3(Set<Cotizacion> cotizacionSet3) { this.cotizacionSet3 = cotizacionSet3; } public Set<Visita> getVisitaSet() { return visitaSet; } public void setVisitaSet(Set<Visita> visitaSet) { this.visitaSet = visitaSet; } public Set<Visita> getVisitaSet1() { return visitaSet1; } public void setVisitaSet1(Set<Visita> visitaSet1) { this.visitaSet1 = visitaSet1; } @Override public int hashCode() { int hash = 0; hash += (idTipo != null ? idTipo.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Tipo)) { return false; } Tipo other = (Tipo) object; if ((this.idTipo == null && other.idTipo != null) || (this.idTipo != null && !this.idTipo.equals(other.idTipo))) { return false; } return true; } @Override public String toString() { return "com.imocom.intelcom.persistence.entities.Tipo[ idTipo=" + idTipo + " ]"; } public String getKeyModel() { if (this.idTipo != null) return String.valueOf(this.idTipo); return null; } }
6,551
0.666717
0.660331
216
29.449074
32.326992
185
false
false
0
0
0
0
0
0
0.388889
false
false
4
69130ddc9c25949821a3b6fcae0ddf27edb5bdfa
12,335,146,114,530
02bc32f7f6b8ead1989e0c2e67b2b678ea751166
/app/src/main/java/com/devcora/android/reconnect/activities/MyApplication.java
608538050730e0f40ee767a1f37a9346a14badca
[]
no_license
muslimomar/ReConnect
https://github.com/muslimomar/ReConnect
1991317a64609cc712f78a5d7abfe0c50aadf743
968ae45b7bc6038b802553d201de7c67c28ee9f9
refs/heads/master
2022-09-19T14:17:05.330000
2022-09-05T14:23:24
2022-09-05T14:23:24
132,469,254
0
0
null
false
2018-08-28T15:57:22
2018-05-07T14:04:36
2018-07-29T20:58:22
2018-08-28T15:57:21
14,280
0
0
0
Java
false
null
package com.devcora.android.reconnect.activities; import android.app.Application; import com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric; import io.realm.Realm; import io.realm.RealmConfiguration; /** * Created by william on 5/15/2018. */ public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); Realm.init(this); RealmConfiguration config = new RealmConfiguration.Builder() .name("meditation.realm").deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(config); } }
UTF-8
Java
686
java
MyApplication.java
Java
[ { "context": "rt io.realm.RealmConfiguration;\n\n/**\n * Created by william on 5/15/2018.\n */\n\npublic class MyApplication ext", "end": 250, "score": 0.9983795285224915, "start": 243, "tag": "USERNAME", "value": "william" } ]
null
[]
package com.devcora.android.reconnect.activities; import android.app.Application; import com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric; import io.realm.Realm; import io.realm.RealmConfiguration; /** * Created by william on 5/15/2018. */ public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); Realm.init(this); RealmConfiguration config = new RealmConfiguration.Builder() .name("meditation.realm").deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(config); } }
686
0.688047
0.677843
28
23.5
21.632483
72
false
false
0
0
0
0
0
0
0.428571
false
false
4
4a0504d3a4de16cedf6d8e61d7b66daa21e8e2e5
4,114,578,680,668
e4fc7575bb961fc5e96d77741df947eb05464b74
/src/Gui/GuiDoctorPortal.java
f229ae51e15c83497b2198e0a0707a777f0cf91d
[]
no_license
RandaOsama1999/Hospital-Management-System
https://github.com/RandaOsama1999/Hospital-Management-System
20a2d22769ca56cab1d5b3e4790769b8afdaa542
1c63fdd7e00c1f5b5c38da7c33de239a69286a30
refs/heads/master
2022-12-02T01:41:35.149000
2020-08-08T15:41:45
2020-08-08T15:41:45
286,069,502
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 Gui; import RSFN.DataLoad; import RSFN.Graph; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.text.ParseException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; /** * * @author Randa */ public class GuiDoctorPortal extends JFrame{ JButton btn1; JButton btn2; JButton btn3; JButton btn4; public GuiDoctorPortal() { setSize(10000,10000); JLabel string=new JLabel("Doctor Portal:"); btn1=new JButton ("Display Patients"); btn2=new JButton ("Search Patients"); btn3=new JButton ("Appointments"); btn4=new JButton ("Statistics Graph"); try { setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("C:\\Users\\rodyr\\Desktop\\Hospital pics\\dr4.jpg"))))); } catch (IOException ex) { Logger.getLogger(GuiDoctorPortal.class.getName()).log(Level.SEVERE, null, ex); } Container cont=getContentPane(); cont.setLayout(null); string.setBounds(550, 90, 300, 60); btn1.setBounds(550, 150, 200, 40); btn2.setBounds(550, 200, 200, 40); btn3.setBounds(550, 250, 200, 40); btn4.setBounds(550, 300, 200, 40); string.setFont(new Font("",Font.BOLD,20)); cont.add(string); cont.add(btn1); cont.add(btn2); cont.add(btn3); cont.add(btn4); btn1.addActionListener(new action()); btn2.addActionListener(new action()); btn3.addActionListener(new action()); btn4.addActionListener(new action()); } private class action implements ActionListener { @Override public void actionPerformed(ActionEvent ae) { if(ae.getSource().equals(btn1)) { GuiDisplayPatient dp=new GuiDisplayPatient(); dp.setVisible(true); dp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dispose(); } else if(ae.getSource().equals(btn2)) { try { GuiSearchPatient dp=new GuiSearchPatient(); dp.setVisible(true); dp.setDefaultCloseOperation(DataLoad.writePatient()); dispose(); } catch (ParseException ex) { Logger.getLogger(GuiDoctorPortal.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(GuiDoctorPortal.class.getName()).log(Level.SEVERE, null, ex); } } else if(ae.getSource().equals(btn3)) { GuiDisplayAppointment dp=new GuiDisplayAppointment(); dp.setVisible(true); dp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dispose(); } else if(ae.getSource().equals(btn4)) { Graph mainPanel = new Graph(); mainPanel.setPreferredSize(new Dimension(800, 600)); JFrame frame = new JFrame("Patients' Medical Cases Graph"); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); //The pack method packs the components within the window based on the component’s preferred sizes frame.setLocationRelativeTo(null); frame.setVisible(true); } } } }
UTF-8
Java
4,176
java
GuiDoctorPortal.java
Java
[ { "context": "\nimport javax.swing.JLabel;\r\n\r\n/**\r\n *\r\n * @author Randa\r\n */\r\npublic class GuiDoctorPortal extends JFrame{\r", "end": 729, "score": 0.9952402114868164, "start": 724, "tag": "NAME", "value": "Randa" }, { "context": "l(new ImageIcon(ImageIO.read(new File(\"C:\\\\Users\\\\rodyr\\\\Desktop\\\\Hospital pics\\\\dr4.jpg\")))));\r\n ", "end": 1282, "score": 0.8140389323234558, "start": 1277, "tag": "USERNAME", "value": "rodyr" } ]
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 Gui; import RSFN.DataLoad; import RSFN.Graph; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.text.ParseException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; /** * * @author Randa */ public class GuiDoctorPortal extends JFrame{ JButton btn1; JButton btn2; JButton btn3; JButton btn4; public GuiDoctorPortal() { setSize(10000,10000); JLabel string=new JLabel("Doctor Portal:"); btn1=new JButton ("Display Patients"); btn2=new JButton ("Search Patients"); btn3=new JButton ("Appointments"); btn4=new JButton ("Statistics Graph"); try { setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("C:\\Users\\rodyr\\Desktop\\Hospital pics\\dr4.jpg"))))); } catch (IOException ex) { Logger.getLogger(GuiDoctorPortal.class.getName()).log(Level.SEVERE, null, ex); } Container cont=getContentPane(); cont.setLayout(null); string.setBounds(550, 90, 300, 60); btn1.setBounds(550, 150, 200, 40); btn2.setBounds(550, 200, 200, 40); btn3.setBounds(550, 250, 200, 40); btn4.setBounds(550, 300, 200, 40); string.setFont(new Font("",Font.BOLD,20)); cont.add(string); cont.add(btn1); cont.add(btn2); cont.add(btn3); cont.add(btn4); btn1.addActionListener(new action()); btn2.addActionListener(new action()); btn3.addActionListener(new action()); btn4.addActionListener(new action()); } private class action implements ActionListener { @Override public void actionPerformed(ActionEvent ae) { if(ae.getSource().equals(btn1)) { GuiDisplayPatient dp=new GuiDisplayPatient(); dp.setVisible(true); dp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dispose(); } else if(ae.getSource().equals(btn2)) { try { GuiSearchPatient dp=new GuiSearchPatient(); dp.setVisible(true); dp.setDefaultCloseOperation(DataLoad.writePatient()); dispose(); } catch (ParseException ex) { Logger.getLogger(GuiDoctorPortal.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(GuiDoctorPortal.class.getName()).log(Level.SEVERE, null, ex); } } else if(ae.getSource().equals(btn3)) { GuiDisplayAppointment dp=new GuiDisplayAppointment(); dp.setVisible(true); dp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dispose(); } else if(ae.getSource().equals(btn4)) { Graph mainPanel = new Graph(); mainPanel.setPreferredSize(new Dimension(800, 600)); JFrame frame = new JFrame("Patients' Medical Cases Graph"); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); //The pack method packs the components within the window based on the component’s preferred sizes frame.setLocationRelativeTo(null); frame.setVisible(true); } } } }
4,176
0.567082
0.543843
119
33.07563
25.114246
131
false
false
0
0
0
0
0
0
0.815126
false
false
4
1912bb0647d84010acbd1e5b8b0b0f435d195c02
30,855,045,089,664
ebf61fa6cf5801a043b17af433fd252472ba7bc7
/HomeWork_15/src/main/java/com/hillel/homework_14/utils/GameUtilClass.java
6b4a1e03e0a47dfd105088ca367d868a40a05dd0
[]
no_license
foreverdumb/HillelJavaSecondCourse
https://github.com/foreverdumb/HillelJavaSecondCourse
364e533dbff52ffcb7006e47550cbf8e7649e615
4e308277da6cfbbdd6cc247422376722f84e1ca8
refs/heads/main
2023-06-24T21:47:32.842000
2021-07-21T14:11:32
2021-07-21T14:11:32
383,540,311
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hillel.homework_14.utils; import com.hillel.homework_15.utils.FIleUtilsClass; import java.io.IOException; import java.util.Objects; import java.util.Scanner; import java.util.concurrent.ThreadLocalRandom; public class GameUtilClass { public static int setYourOption() { Scanner sc = new Scanner(System.in); int option; do { System.out.println(""" Please, enter one of these options: 0 - stone; 1 - paper; 2 - scissors. Be patient, type in NUMBERS instead of words. """); while (!sc.hasNextInt()) { System.out.println("Integer required!"); sc.next(); } option = sc.nextInt(); } while (option < 0); return option; } public static int setGameQuantity() { Scanner sc = new Scanner(System.in); int quantity; do { System.out.println("Please, set the number of games you want to play: "); while (!sc.hasNextInt()) { System.out.println("Integer required!"); sc.next(); } quantity = sc.nextInt(); } while (quantity <= 0); return quantity; } public static int createArtificialIntelligence() { return ThreadLocalRandom.current().nextInt(0, 2); } public static String setUserName() { Scanner sc = new Scanner(System.in); System.out.println("Please, enter your name(English letters only, or your name will be set automatically): "); if (sc.hasNext("[A-Za-z]*")) { return sc.nextLine(); } else { return "No One"; } } public static String goOrStop() { Scanner sc = new Scanner(System.in); String option; System.out.println(""" Enter 'Yes' to continue the game Enter 'No' to stop the game """); option = sc.nextLine(); if (!option.equals("Yes")) if (!option.equals("No")) System.out.println("Wrong input!"); return option; } public static void getWinner() throws IndexOutOfBoundsException, IOException { String nameFile = FIleUtilsClass.createDirectory(); String name = setUserName(); String yesNo; int quantity = setGameQuantity(); int logQuantity = quantity; int logQuantityDeclined = quantity; int declineResult; int totalWins = 0; int totalLoses = 0; int totalDraws = 0; int[][] answersTable = new int[3][3]; answersTable[0][0] = 0; answersTable[0][1] = 1; answersTable[0][2] = 2; answersTable[1][0] = 2; answersTable[1][1] = 0; answersTable[1][2] = 1; answersTable[2][0] = 1; answersTable[2][1] = 2; answersTable[2][2] = 0; try { do { int[] answers = getAnswers(); int artificial; int user; artificial = answers[0]; user = answers[1]; for (int i = 0; i < 1; i++) { for (int j = 0; j < answersTable[i].length; j++) { if (answersTable[i][j] == answersTable[artificial][user]) { if (answersTable[i][j] == 0) { totalDraws++; System.out.println("Draw, robot chose the same option <<" + artificial + ">> as you!"); } else if (answersTable[i][j] == 1) { totalWins++; System.out.println("User " + name + " wins! " + "Robot chose <<" + artificial + ">> option! "); } else { totalLoses++; System.out.println("Robot wins, it chose <<" + artificial + ">> option!"); } } } } quantity--; declineResult = logQuantityDeclined - quantity; FIleUtilsClass.writeLog(totalWins, totalLoses, totalDraws, logQuantity, nameFile, name, artificial, user , declineResult); if (quantity == 0) break; yesNo = goOrStop(); } while (Objects.equals(yesNo, "Yes") && quantity > 0); System.out.println("---------------------------------------"); System.out.println("Dear " + name + ", your total wins equal: " + totalWins + " and total loses equal: " + totalLoses + " if you are interested in draws, the total count equals: " + totalDraws); } catch (IndexOutOfBoundsException | IOException indexOutOfBoundsException) { System.out.println("You are allowed to enter only 3 options - 0, 1 and 2. " + "Read startup description carefully!"); } } public static int[] getAnswers() { int choiceOfArtificialIntelligence; int userChoice; int[] arrAnswers = new int[2]; choiceOfArtificialIntelligence = createArtificialIntelligence(); userChoice = setYourOption(); arrAnswers[0] = choiceOfArtificialIntelligence; arrAnswers[1] = userChoice; return arrAnswers; } }
UTF-8
Java
5,600
java
GameUtilClass.java
Java
[ { "context": "tilsClass.createDirectory();\n String name = setUserName();\n String yesNo;\n int quantity = s", "end": 2401, "score": 0.9985750913619995, "start": 2390, "tag": "USERNAME", "value": "setUserName" } ]
null
[]
package com.hillel.homework_14.utils; import com.hillel.homework_15.utils.FIleUtilsClass; import java.io.IOException; import java.util.Objects; import java.util.Scanner; import java.util.concurrent.ThreadLocalRandom; public class GameUtilClass { public static int setYourOption() { Scanner sc = new Scanner(System.in); int option; do { System.out.println(""" Please, enter one of these options: 0 - stone; 1 - paper; 2 - scissors. Be patient, type in NUMBERS instead of words. """); while (!sc.hasNextInt()) { System.out.println("Integer required!"); sc.next(); } option = sc.nextInt(); } while (option < 0); return option; } public static int setGameQuantity() { Scanner sc = new Scanner(System.in); int quantity; do { System.out.println("Please, set the number of games you want to play: "); while (!sc.hasNextInt()) { System.out.println("Integer required!"); sc.next(); } quantity = sc.nextInt(); } while (quantity <= 0); return quantity; } public static int createArtificialIntelligence() { return ThreadLocalRandom.current().nextInt(0, 2); } public static String setUserName() { Scanner sc = new Scanner(System.in); System.out.println("Please, enter your name(English letters only, or your name will be set automatically): "); if (sc.hasNext("[A-Za-z]*")) { return sc.nextLine(); } else { return "No One"; } } public static String goOrStop() { Scanner sc = new Scanner(System.in); String option; System.out.println(""" Enter 'Yes' to continue the game Enter 'No' to stop the game """); option = sc.nextLine(); if (!option.equals("Yes")) if (!option.equals("No")) System.out.println("Wrong input!"); return option; } public static void getWinner() throws IndexOutOfBoundsException, IOException { String nameFile = FIleUtilsClass.createDirectory(); String name = setUserName(); String yesNo; int quantity = setGameQuantity(); int logQuantity = quantity; int logQuantityDeclined = quantity; int declineResult; int totalWins = 0; int totalLoses = 0; int totalDraws = 0; int[][] answersTable = new int[3][3]; answersTable[0][0] = 0; answersTable[0][1] = 1; answersTable[0][2] = 2; answersTable[1][0] = 2; answersTable[1][1] = 0; answersTable[1][2] = 1; answersTable[2][0] = 1; answersTable[2][1] = 2; answersTable[2][2] = 0; try { do { int[] answers = getAnswers(); int artificial; int user; artificial = answers[0]; user = answers[1]; for (int i = 0; i < 1; i++) { for (int j = 0; j < answersTable[i].length; j++) { if (answersTable[i][j] == answersTable[artificial][user]) { if (answersTable[i][j] == 0) { totalDraws++; System.out.println("Draw, robot chose the same option <<" + artificial + ">> as you!"); } else if (answersTable[i][j] == 1) { totalWins++; System.out.println("User " + name + " wins! " + "Robot chose <<" + artificial + ">> option! "); } else { totalLoses++; System.out.println("Robot wins, it chose <<" + artificial + ">> option!"); } } } } quantity--; declineResult = logQuantityDeclined - quantity; FIleUtilsClass.writeLog(totalWins, totalLoses, totalDraws, logQuantity, nameFile, name, artificial, user , declineResult); if (quantity == 0) break; yesNo = goOrStop(); } while (Objects.equals(yesNo, "Yes") && quantity > 0); System.out.println("---------------------------------------"); System.out.println("Dear " + name + ", your total wins equal: " + totalWins + " and total loses equal: " + totalLoses + " if you are interested in draws, the total count equals: " + totalDraws); } catch (IndexOutOfBoundsException | IOException indexOutOfBoundsException) { System.out.println("You are allowed to enter only 3 options - 0, 1 and 2. " + "Read startup description carefully!"); } } public static int[] getAnswers() { int choiceOfArtificialIntelligence; int userChoice; int[] arrAnswers = new int[2]; choiceOfArtificialIntelligence = createArtificialIntelligence(); userChoice = setYourOption(); arrAnswers[0] = choiceOfArtificialIntelligence; arrAnswers[1] = userChoice; return arrAnswers; } }
5,600
0.492143
0.481607
151
36.086094
24.988989
120
false
false
0
0
0
0
0
0
0.721854
false
false
4
00e92113f78f52096bb34cb30132fbb646607715
19,430,432,071,333
4b1be5987928b7bd9d36a3f7899114ab27e82d5e
/src/main/java/com/baoquan/shuxin/service/impl/product/ProductTagServiceImpl.java
bd7be13fd855497f057e1422bf3242bda3f134c8
[]
no_license
maozhibin/shuxin-java
https://github.com/maozhibin/shuxin-java
0f0a93c2c36770f54d9404a0a82f84eca70c7b5a
81d8f1b733bc39747448e21dc76ca9123ae218f3
refs/heads/master
2021-09-02T23:09:20.799000
2018-01-04T01:59:25
2018-01-04T01:59:25
116,202,145
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.baoquan.shuxin.service.impl.product; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import javax.inject.Named; import org.apache.commons.collections.CollectionUtils; import com.alibaba.fastjson.JSONArray; import com.baoquan.shuxin.dao.product.ProductTagDao; import com.baoquan.shuxin.dao.tag.TagsDao; import com.baoquan.shuxin.model.product.ProductTag; import com.baoquan.shuxin.model.tag.Tags; import com.baoquan.shuxin.service.spi.product.ProductTagService; @Named public class ProductTagServiceImpl implements ProductTagService{ @Inject private ProductTagDao productTagDao; @Inject private TagsDao tagsDao; /** * 查询标签信息 */ @Override public String findByProductId(Integer id) { List<String> findProductInfo = productTagDao.findProductInfo(id); String names=""; int index = findProductInfo.size()-1; for(int i=0; i < findProductInfo.size();i++){ String name=findProductInfo.get(i); if(index == i){ names += name; }else{ names += name+","; } } return names; } /** * 标签属性修改 */ @SuppressWarnings("unchecked") @Override public Boolean setTages(JSONArray productTags,Integer productId ) { List<Object> tagsNameList = null; for(int i=0;i<productTags.size();i++){ tagsNameList = (List<Object>) productTags.get(i); } if(CollectionUtils.isEmpty(tagsNameList)){ return false; } List<Integer> tagIdList = new ArrayList<>(); List<ProductTag> productTaglist=productTagDao.findByproductId(productId); for(int i=0;i<productTaglist.size();i++){ Integer tagId = productTaglist.get(i).getTagId(); tagIdList.add(tagId); } if(!CollectionUtils.isEmpty(tagIdList)){ tagsDao.delete(tagIdList); productTagDao.delete(productId); } String tagsName=null; Tags tags =null; List<Tags> tagsList = new ArrayList<>(); for(int i=0;i<tagsNameList.size();i++){ tags = new Tags(); tagsName=(String) tagsNameList.get(i); if(tagsDao.queryByName(tagsName)!=null){ continue; } tags.setName(tagsName); tagsList.add(tags); } tagsDao.insertTagsList(tagsList); List<Integer> tagsIds = tagsDao.getItermByName(tagsNameList); if(CollectionUtils.isEmpty(tagsIds)){ return false; } List<ProductTag> productTagList = new ArrayList<>(); for(int i=0;i<tagsIds.size();i++){ ProductTag productTag = new ProductTag(); productTag.setProductId(productId); productTag.setTagId(tagsIds.get(i)); productTagList.add(productTag); } productTagDao.insertListByTagTds(productTagList); return true; } @Override public List<String> findByproductId(Integer productId) { return productTagDao.findProductInfo(productId); } }
UTF-8
Java
2,700
java
ProductTagServiceImpl.java
Java
[]
null
[]
package com.baoquan.shuxin.service.impl.product; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import javax.inject.Named; import org.apache.commons.collections.CollectionUtils; import com.alibaba.fastjson.JSONArray; import com.baoquan.shuxin.dao.product.ProductTagDao; import com.baoquan.shuxin.dao.tag.TagsDao; import com.baoquan.shuxin.model.product.ProductTag; import com.baoquan.shuxin.model.tag.Tags; import com.baoquan.shuxin.service.spi.product.ProductTagService; @Named public class ProductTagServiceImpl implements ProductTagService{ @Inject private ProductTagDao productTagDao; @Inject private TagsDao tagsDao; /** * 查询标签信息 */ @Override public String findByProductId(Integer id) { List<String> findProductInfo = productTagDao.findProductInfo(id); String names=""; int index = findProductInfo.size()-1; for(int i=0; i < findProductInfo.size();i++){ String name=findProductInfo.get(i); if(index == i){ names += name; }else{ names += name+","; } } return names; } /** * 标签属性修改 */ @SuppressWarnings("unchecked") @Override public Boolean setTages(JSONArray productTags,Integer productId ) { List<Object> tagsNameList = null; for(int i=0;i<productTags.size();i++){ tagsNameList = (List<Object>) productTags.get(i); } if(CollectionUtils.isEmpty(tagsNameList)){ return false; } List<Integer> tagIdList = new ArrayList<>(); List<ProductTag> productTaglist=productTagDao.findByproductId(productId); for(int i=0;i<productTaglist.size();i++){ Integer tagId = productTaglist.get(i).getTagId(); tagIdList.add(tagId); } if(!CollectionUtils.isEmpty(tagIdList)){ tagsDao.delete(tagIdList); productTagDao.delete(productId); } String tagsName=null; Tags tags =null; List<Tags> tagsList = new ArrayList<>(); for(int i=0;i<tagsNameList.size();i++){ tags = new Tags(); tagsName=(String) tagsNameList.get(i); if(tagsDao.queryByName(tagsName)!=null){ continue; } tags.setName(tagsName); tagsList.add(tags); } tagsDao.insertTagsList(tagsList); List<Integer> tagsIds = tagsDao.getItermByName(tagsNameList); if(CollectionUtils.isEmpty(tagsIds)){ return false; } List<ProductTag> productTagList = new ArrayList<>(); for(int i=0;i<tagsIds.size();i++){ ProductTag productTag = new ProductTag(); productTag.setProductId(productId); productTag.setTagId(tagsIds.get(i)); productTagList.add(productTag); } productTagDao.insertListByTagTds(productTagList); return true; } @Override public List<String> findByproductId(Integer productId) { return productTagDao.findProductInfo(productId); } }
2,700
0.726457
0.724215
100
25.76
20.374554
75
false
false
0
0
0
0
0
0
2.23
false
false
4
2e155435adc6abbd1ad7742f2f9cab7607ea07b2
39,273,180,978,224
180866b1a5224a313bc0d9f70ef085eca05ca58f
/Plugins/OAuth.MiniApp/src/main/java/com/cqwo/xxx/plugin/oauth/miniapp/model/ApiRegistModel.java
0d76de8b0d8b1414410e05c664b9ef7fba466eda
[]
no_license
cqingwo/baseos
https://github.com/cqingwo/baseos
eddd1ea89fd808d84a9e37c7a33e5ec8ca0dc692
7add95ee869bbb9c58a7735a8928f2c781634b56
refs/heads/master
2021-06-20T03:08:09.468000
2019-08-27T14:18:44
2019-08-27T14:18:44
145,635,750
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * * * Copyright (C) 2017. * * 用于JAVA项目开发 * * 重庆青沃科技有限公司 版权所有 * * Copyright (C) 2017. CqingWo Systems Incorporated. All rights reserved. * */ package com.cqwo.xxx.plugin.oauth.miniapp.model; /** * Created by Administrator on 2017/12/25. */ import javax.validation.constraints.NotBlank; /** * 用户注册 */ public class ApiRegistModel { /** * openId */ @NotBlank(message = "openId不能为空") private String openId = ""; /** * 昵称 */ @NotBlank(message = "昵称不能为空") private String nickName = ""; /** * 性别 */ private int gender = 0; /** * 头像 */ private String avatar = ""; public ApiRegistModel() { } public ApiRegistModel(String openId, String nickName, int gender, String avatar) { this.openId = openId; this.nickName = nickName; this.gender = gender; this.avatar = avatar; } public String getOpenId() { return openId; } public void setOpenId(String openId) { this.openId = openId; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } @Override public String toString() { return "ApiRegistModel{" + "openId='" + openId + '\'' + ", nickName='" + nickName + '\'' + ", gender='" + gender + '\'' + ", avatar='" + avatar + '\'' + '}'; } }
UTF-8
Java
1,876
java
ApiRegistModel.java
Java
[ { "context": "xxx.plugin.oauth.miniapp.model;\n\n/**\n * Created by Administrator on 2017/12/25.\n */\n\nimport javax.validation.const", "end": 239, "score": 0.3710314929485321, "start": 226, "tag": "NAME", "value": "Administrator" }, { "context": " this.openId = openId;\n this.nickName = nickName;\n this.gender = gender;\n this.avata", "end": 853, "score": 0.8463090658187866, "start": 845, "tag": "NAME", "value": "nickName" }, { "context": "+ openId + '\\'' +\n \", nickName='\" + nickName + '\\'' +\n \", gender='\" + gende", "end": 1659, "score": 0.6729801893234253, "start": 1655, "tag": "NAME", "value": "nick" }, { "context": "nId + '\\'' +\n \", nickName='\" + nickName + '\\'' +\n \", gender='\" + gender + ", "end": 1663, "score": 0.6966449022293091, "start": 1659, "tag": "USERNAME", "value": "Name" } ]
null
[]
/* * * * Copyright (C) 2017. * * 用于JAVA项目开发 * * 重庆青沃科技有限公司 版权所有 * * Copyright (C) 2017. CqingWo Systems Incorporated. All rights reserved. * */ package com.cqwo.xxx.plugin.oauth.miniapp.model; /** * Created by Administrator on 2017/12/25. */ import javax.validation.constraints.NotBlank; /** * 用户注册 */ public class ApiRegistModel { /** * openId */ @NotBlank(message = "openId不能为空") private String openId = ""; /** * 昵称 */ @NotBlank(message = "昵称不能为空") private String nickName = ""; /** * 性别 */ private int gender = 0; /** * 头像 */ private String avatar = ""; public ApiRegistModel() { } public ApiRegistModel(String openId, String nickName, int gender, String avatar) { this.openId = openId; this.nickName = nickName; this.gender = gender; this.avatar = avatar; } public String getOpenId() { return openId; } public void setOpenId(String openId) { this.openId = openId; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } @Override public String toString() { return "ApiRegistModel{" + "openId='" + openId + '\'' + ", nickName='" + nickName + '\'' + ", gender='" + gender + '\'' + ", avatar='" + avatar + '\'' + '}'; } }
1,876
0.52951
0.520045
99
17.141415
18.089569
86
false
false
0
0
0
0
0
0
0.252525
false
false
4
f0ad17be8359bcc8f04d561fdebaced15baa56bd
34,291,018,945,167
8f6d38d35f669fada1b069c75ec5fe6f4588356a
/app/src/main/java/org/kaldi/demo/Loading.java
09c47f562b1b1220c76cd19640da8405cee096e9
[ "Apache-2.0" ]
permissive
EugeneLeonidovich/Click_on_me
https://github.com/EugeneLeonidovich/Click_on_me
9bb66e46cc781978c0ef2c263daf6311a90eea59
637defc918d34f457419891ce1f40865b243dfa9
refs/heads/master
2022-09-22T01:04:45.631000
2020-06-03T11:19:23
2020-06-03T11:19:23
268,527,063
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.kaldi.demo; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import android.Manifest; import android.annotation.SuppressLint; import android.content.Intent; import android.content.pm.PackageManager; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Window; import android.view.WindowManager; import com.victor.loading.rotate.RotateLoading; import org.kaldi.Assets; import org.kaldi.Model; import org.kaldi.Vosk; import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; public class Loading extends AppCompatActivity{ static { System.loadLibrary("kaldi_jni"); } private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 1; private RotateLoading rotateLoading; private RecognizerModel mod; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_loading); fullWindow(); rotateLoading = findViewById(R.id.rotateloading); rotateLoading.start(); checkSound(); new SetupTask(this).execute(); } private void fullWindow(){ Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } @SuppressLint("StaticFieldLeak") class SetupTask extends AsyncTask<Void, Void, Void> { WeakReference<Loading> activityReference; SetupTask(Loading activity) { this.activityReference = new WeakReference<>(activity); } @Override protected Void doInBackground(Void... params) { try { Assets assets = new Assets(activityReference.get()); File assetDir = assets.syncAssets(); Log.d("KaldiDemo", "Sync files in the folder " + assetDir.toString()); Vosk.SetLogLevel(0); activityReference.get().mod.model = new Model(assetDir.toString() + "/model-android"); } catch (IOException ignored) {} return null; } @Override protected void onPostExecute(Void result) { System.out.println("onPostExecute выполнен"); recognizeMicrophone(); loadNextActivity(); } } private void checkSound(){ int permissionCheck = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.RECORD_AUDIO); if (permissionCheck != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, PERMISSIONS_REQUEST_RECORD_AUDIO); return; } } private void loadNextActivity(){ rotateLoading.stop(); Intent intent = new Intent(this, LaunchActivity.class); startActivity(intent); finish(); } public void recognizeMicrophone() { try { RecognizerModel.createRecognizer(); }catch (Exception e){} } }
UTF-8
Java
3,166
java
Loading.java
Java
[]
null
[]
package org.kaldi.demo; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import android.Manifest; import android.annotation.SuppressLint; import android.content.Intent; import android.content.pm.PackageManager; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Window; import android.view.WindowManager; import com.victor.loading.rotate.RotateLoading; import org.kaldi.Assets; import org.kaldi.Model; import org.kaldi.Vosk; import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; public class Loading extends AppCompatActivity{ static { System.loadLibrary("kaldi_jni"); } private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 1; private RotateLoading rotateLoading; private RecognizerModel mod; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_loading); fullWindow(); rotateLoading = findViewById(R.id.rotateloading); rotateLoading.start(); checkSound(); new SetupTask(this).execute(); } private void fullWindow(){ Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } @SuppressLint("StaticFieldLeak") class SetupTask extends AsyncTask<Void, Void, Void> { WeakReference<Loading> activityReference; SetupTask(Loading activity) { this.activityReference = new WeakReference<>(activity); } @Override protected Void doInBackground(Void... params) { try { Assets assets = new Assets(activityReference.get()); File assetDir = assets.syncAssets(); Log.d("KaldiDemo", "Sync files in the folder " + assetDir.toString()); Vosk.SetLogLevel(0); activityReference.get().mod.model = new Model(assetDir.toString() + "/model-android"); } catch (IOException ignored) {} return null; } @Override protected void onPostExecute(Void result) { System.out.println("onPostExecute выполнен"); recognizeMicrophone(); loadNextActivity(); } } private void checkSound(){ int permissionCheck = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.RECORD_AUDIO); if (permissionCheck != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, PERMISSIONS_REQUEST_RECORD_AUDIO); return; } } private void loadNextActivity(){ rotateLoading.stop(); Intent intent = new Intent(this, LaunchActivity.class); startActivity(intent); finish(); } public void recognizeMicrophone() { try { RecognizerModel.createRecognizer(); }catch (Exception e){} } }
3,166
0.666561
0.665928
99
30.898991
25.791901
134
false
false
0
0
0
0
0
0
0.606061
false
false
4
73f6a7198243a056676c25d3cbc6baa9ae724d03
19,576,460,998,880
e3cad0271926eacfa769a88e57c349fbcda53680
/java-advanced/src/main/java/com/sda/randomizer/Utils.java
2f8af622bfa700cce4b5c3c68afe0b221c786b23
[]
no_license
DanNistor1/sda-course
https://github.com/DanNistor1/sda-course
72030b4cd0ce4701b3cd4caf093fdea7a0795534
3209f143c942947e06a66d3f57ca04709bc325b5
refs/heads/master
2022-12-13T23:49:36.595000
2022-12-05T07:17:47
2022-12-05T07:17:47
219,139,511
0
0
null
false
2022-12-04T23:31:14
2019-11-02T10:43:36
2022-02-21T06:44:34
2022-12-04T23:31:14
2,265
0
0
15
Java
false
false
package com.sda.randomizer; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Utils { public static int getRandomNumberInRange(int min, int max){ Random random = new Random(); return random.nextInt((max-min) + 1 + min); } public static List<String> readFile(String source){ Path input = Paths.get(source); List<String> lines = null; try { lines = Files.readAllLines(input); } catch (IOException e) { e.printStackTrace(); } return lines; } public static List<Person> convert(List<String> stringList){ List<Person> personList = new ArrayList<>(); stringList.stream() .forEach(s ->personList.add(new Person(s, 5))); return personList; } }
UTF-8
Java
945
java
Utils.java
Java
[]
null
[]
package com.sda.randomizer; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Utils { public static int getRandomNumberInRange(int min, int max){ Random random = new Random(); return random.nextInt((max-min) + 1 + min); } public static List<String> readFile(String source){ Path input = Paths.get(source); List<String> lines = null; try { lines = Files.readAllLines(input); } catch (IOException e) { e.printStackTrace(); } return lines; } public static List<Person> convert(List<String> stringList){ List<Person> personList = new ArrayList<>(); stringList.stream() .forEach(s ->personList.add(new Person(s, 5))); return personList; } }
945
0.624339
0.622222
36
25.25
19.556719
65
false
false
0
0
0
0
0
0
0.555556
false
false
4
db6fd69a627129f1181e7835cbcc33c488d993c7
39,694,087,760,271
fb8dd20b752a0a5a6fa571007d2d205c5f6fbd22
/src/main/java/com/exercices/file/pojo/Book.java
6a9d8cb3e715b22dfd622bdcfcfe4f75004084b8
[]
no_license
gambrodev/exercises
https://github.com/gambrodev/exercises
2afeb10a7f588c6a7ebd979ac40241054f4c5a20
6c26bda2c72c6033248d76a5e932fadb6bac6254
refs/heads/master
2023-01-01T13:55:29.891000
2020-10-05T20:24:45
2020-10-05T20:24:45
294,228,593
0
0
null
false
2020-09-28T22:28:41
2020-09-09T21:01:11
2020-09-23T08:55:35
2020-09-28T22:28:40
13
0
0
0
Java
false
false
package com.exercices.file.pojo; import java.util.ArrayList; import java.util.List; public class Book { private String titolo; private String autore; private Integer anno; private Integer pagine; private boolean disponibile; private List<Person> users = new ArrayList(); public String getTitolo() { return titolo; } public void setTitolo(String titolo) { this.titolo = titolo; } public String getAutore() { return autore; } public void setAutore(String autore) { this.autore = autore; } public Integer getAnno() { return anno; } public void setAnno(Integer anno) { this.anno = anno; } public Integer getPagine() { return pagine; } public void setPagine(Integer pagine) { this.pagine = pagine; } public List<Person> getUsers() { return users; } public void setUsers(List<Person> users) { this.users = users; } public boolean isDisponibile() { return disponibile; } public void setDisponibile(boolean disponibile) { this.disponibile = disponibile; } @Override public String toString() { return "Book{" + "titolo='" + titolo + '\'' + ", autore='" + autore + '\'' + ", anno=" + anno + ", pagine=" + pagine + ", disponibile=" + disponibile + ", users=" + users + '}'; } }
UTF-8
Java
1,529
java
Book.java
Java
[]
null
[]
package com.exercices.file.pojo; import java.util.ArrayList; import java.util.List; public class Book { private String titolo; private String autore; private Integer anno; private Integer pagine; private boolean disponibile; private List<Person> users = new ArrayList(); public String getTitolo() { return titolo; } public void setTitolo(String titolo) { this.titolo = titolo; } public String getAutore() { return autore; } public void setAutore(String autore) { this.autore = autore; } public Integer getAnno() { return anno; } public void setAnno(Integer anno) { this.anno = anno; } public Integer getPagine() { return pagine; } public void setPagine(Integer pagine) { this.pagine = pagine; } public List<Person> getUsers() { return users; } public void setUsers(List<Person> users) { this.users = users; } public boolean isDisponibile() { return disponibile; } public void setDisponibile(boolean disponibile) { this.disponibile = disponibile; } @Override public String toString() { return "Book{" + "titolo='" + titolo + '\'' + ", autore='" + autore + '\'' + ", anno=" + anno + ", pagine=" + pagine + ", disponibile=" + disponibile + ", users=" + users + '}'; } }
1,529
0.547417
0.547417
72
20.236111
16.050695
53
false
false
0
0
0
0
0
0
0.375
false
false
4
595b2deea3cc5061c4783eb26304914aa060440e
36,876,589,243,234
88a30d8a880eaef7c50e8e2c49341d12ee7cf763
/app/src/main/java/com/example/benet/restaurant4app/Model/Restaurant.java
16eee188d038fc6c737101edd778d2ca2e95869a
[]
no_license
BenetPerarnau/Restaurant4App
https://github.com/BenetPerarnau/Restaurant4App
780b715aa05ffad5e42e146726e4bf221046cd46
0316a019a556a4e6870844b08dc56c5d71441a33
refs/heads/master
2016-09-10T16:35:01.757000
2015-02-24T17:32:24
2015-02-24T17:32:24
31,262,730
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.benet.restaurant4app.Model; import java.io.Serializable; /** * Created by Benet on 23/02/15. */ public class Restaurant implements Serializable { private String name; private String city; private String district; private String url; private int img; public Restaurant(String name, String city, String district, String url, int img) { this.name = name; this.city = city; this.district = district; this.url = url; this.img = img; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDistrict() { return district; } public void setDistrict(String district) { this.district = district; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public int getImg() { return img; } public void setImg(int img) { this.img = img; } }
UTF-8
Java
1,182
java
Restaurant.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by Benet on 23/02/15.\n */\npublic class Restaurant implemen", "end": 102, "score": 0.9995797276496887, "start": 97, "tag": "NAME", "value": "Benet" } ]
null
[]
package com.example.benet.restaurant4app.Model; import java.io.Serializable; /** * Created by Benet on 23/02/15. */ public class Restaurant implements Serializable { private String name; private String city; private String district; private String url; private int img; public Restaurant(String name, String city, String district, String url, int img) { this.name = name; this.city = city; this.district = district; this.url = url; this.img = img; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDistrict() { return district; } public void setDistrict(String district) { this.district = district; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public int getImg() { return img; } public void setImg(int img) { this.img = img; } }
1,182
0.58291
0.576988
63
17.761906
16.776508
87
false
false
0
0
0
0
0
0
0.412698
false
false
4
7ed757ac66ccda18680fc0a4e27f95d240371db4
38,637,525,822,927
216000e3cdd8401e5c7aa8300e5c50dfc4dada7f
/android/app/src/main/java/com/example/musthafa/automaticslight/Activity/UserHomeActivity.java
c52ec79ff4dd6984e58ad9a2a0e24379973df9ce
[]
no_license
musthafapulikkal/AutomaticSlight
https://github.com/musthafapulikkal/AutomaticSlight
0d22668c6c42d480ae2f95380a58038bec326aa7
2745efb834ed996bf7eedea179645e7833555869
refs/heads/master
2020-05-24T15:31:36.196000
2019-05-18T08:23:34
2019-05-18T08:23:34
187,332,581
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.musthafa.automaticslight.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.example.musthafa.automaticslight.R; import static com.example.musthafa.automaticslight.Activity.MainActivity.obemail; public class UserHomeActivity extends AppCompatActivity { Button btn_make_complaiint; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_home); btn_make_complaiint=(Button)findViewById(R.id.id_make_complaint); btn_make_complaiint.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getApplicationContext(),AddComplaintActivity.class)); } }); findViewById(R.id.id_logout).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SharedPreferences preferences =getSharedPreferences(obemail,Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.clear(); editor.commit(); finish(); startActivity(new Intent(getApplicationContext(),MainActivity.class)); finish(); } }); } }
UTF-8
Java
1,575
java
UserHomeActivity.java
Java
[]
null
[]
package com.example.musthafa.automaticslight.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.example.musthafa.automaticslight.R; import static com.example.musthafa.automaticslight.Activity.MainActivity.obemail; public class UserHomeActivity extends AppCompatActivity { Button btn_make_complaiint; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_home); btn_make_complaiint=(Button)findViewById(R.id.id_make_complaint); btn_make_complaiint.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getApplicationContext(),AddComplaintActivity.class)); } }); findViewById(R.id.id_logout).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SharedPreferences preferences =getSharedPreferences(obemail,Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.clear(); editor.commit(); finish(); startActivity(new Intent(getApplicationContext(),MainActivity.class)); finish(); } }); } }
1,575
0.68127
0.680635
41
37.414635
27.574268
98
false
false
0
0
0
0
0
0
0.658537
false
false
4
ef72f0315f70e4b36a30300901d02b5fd6eaf5cc
36,464,272,388,420
dbc7bc144f3871fb4b7eae50e697eb445be42238
/AppReportes/src/Model/Filtros/Filtro.java
a4ec8a8289d8d517cb6906657713f0da5d6d79e1
[]
no_license
PatricioEsteban07/AplicacionReportesAgrosuper
https://github.com/PatricioEsteban07/AplicacionReportesAgrosuper
be7ea0ccb95ea0394a2c8989d7df347d8a8c6b23
da8c79e3987593bebf8b19e8d0386ec9deb280db
refs/heads/master
2021-05-12T14:20:17.099000
2018-03-09T20:27:06
2018-03-09T20:27:06
116,954,291
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 Model.Filtros; /** * Clase abstracta para los Objetos de tipo Filtro. * @author Patricio */ public abstract class Filtro { public String nombre; protected int opcion; public Filtro(String nombre) { this.nombre = nombre; this.opcion=0; } /** * Método para obtener la opción seleccionada actualmente. * @return un valor entero correspondiente a la opción seleccionada. */ public int getOpcion() { return opcion; } /** * Método abstracto que se encarga de vaciar el filtro correspondiente. * @return true si fué exitoso o false en caso contrario. */ public abstract boolean vaciarFiltro(); /** * Método abstracto que se encarga de cambiar la opción seleccionada. * @return true si fué exitoso o false en caso contrario. */ public abstract boolean setOpcion(int value); /** * Método abstracto que se encarga de vaciar el filtro correspondiente. * @return un String con la etiqueta generada si fué exitoso o null en caso contrario. */ public abstract String generarEtiquetaInfo(); }
UTF-8
Java
1,346
java
Filtro.java
Java
[ { "context": "tracta para los Objetos de tipo Filtro.\n * @author Patricio\n */\npublic abstract class Filtro\n{\n public Str", "end": 284, "score": 0.9997977614402771, "start": 276, "tag": "NAME", "value": "Patricio" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Model.Filtros; /** * Clase abstracta para los Objetos de tipo Filtro. * @author Patricio */ public abstract class Filtro { public String nombre; protected int opcion; public Filtro(String nombre) { this.nombre = nombre; this.opcion=0; } /** * Método para obtener la opción seleccionada actualmente. * @return un valor entero correspondiente a la opción seleccionada. */ public int getOpcion() { return opcion; } /** * Método abstracto que se encarga de vaciar el filtro correspondiente. * @return true si fué exitoso o false en caso contrario. */ public abstract boolean vaciarFiltro(); /** * Método abstracto que se encarga de cambiar la opción seleccionada. * @return true si fué exitoso o false en caso contrario. */ public abstract boolean setOpcion(int value); /** * Método abstracto que se encarga de vaciar el filtro correspondiente. * @return un String con la etiqueta generada si fué exitoso o null en caso contrario. */ public abstract String generarEtiquetaInfo(); }
1,346
0.666168
0.665419
49
26.265306
26.56127
90
false
false
0
0
0
0
0
0
0.244898
false
false
4
7f624a6565bd929c5f7dd51b080f36f287b10a40
33,663,953,734,755
4bbf37583966c8a6452123f7470026803cdfe4ae
/core/src/com/pindurpendurok/xvegyszer/SimpleLoadingStage.java
02b13c8a2791db0d6f817645c1839bea21756293
[]
no_license
marton552/Pendroid2K20_2
https://github.com/marton552/Pendroid2K20_2
3ef340aa11f705ab77f723ec6f3a43bc84c25ee5
13a73f4491e4d3e9ed8e9b1435a34a73b6d52515
refs/heads/master
2020-12-23T23:05:26.775000
2020-02-01T01:17:39
2020-02-01T01:17:39
237,303,560
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pindurpendurok.xvegyszer; import com.badlogic.gdx.utils.viewport.Viewport; import hu.csanyzeg.master.MyBaseClasses.Assets.AssetList; import hu.csanyzeg.master.MyBaseClasses.Assets.LoadingStage; import hu.csanyzeg.master.MyBaseClasses.Game.MyGame; import hu.csanyzeg.master.MyBaseClasses.Scene2D.ResponseViewport; public class SimpleLoadingStage extends LoadingStage { public static AssetList list = new AssetList(); public SimpleLoadingStage(MyGame game) { super(new ResponseViewport(720), game); } @Override public AssetList getAssetList() { return list; } }
UTF-8
Java
618
java
SimpleLoadingStage.java
Java
[]
null
[]
package com.pindurpendurok.xvegyszer; import com.badlogic.gdx.utils.viewport.Viewport; import hu.csanyzeg.master.MyBaseClasses.Assets.AssetList; import hu.csanyzeg.master.MyBaseClasses.Assets.LoadingStage; import hu.csanyzeg.master.MyBaseClasses.Game.MyGame; import hu.csanyzeg.master.MyBaseClasses.Scene2D.ResponseViewport; public class SimpleLoadingStage extends LoadingStage { public static AssetList list = new AssetList(); public SimpleLoadingStage(MyGame game) { super(new ResponseViewport(720), game); } @Override public AssetList getAssetList() { return list; } }
618
0.768608
0.762136
22
27.09091
24.267279
65
false
false
0
0
0
0
0
0
0.454545
false
false
4
8e80b9b7e7c756a146db7b63136d2a3f9b20456c
31,078,383,418,238
f0fee92ab303775d83d0e96f5488a9f825e67257
/KMP.java
3847b8747e54be63158774ef03a6ca05fb36abd2
[]
no_license
xlc-soda/Data_Structure_Java
https://github.com/xlc-soda/Data_Structure_Java
d57c29a27d00792c0526d004d662d67a62252390
576e5172e3416d90dd8417bf04bb415ed3f97601
refs/heads/master
2021-08-15T04:02:32.157000
2017-11-17T09:45:48
2017-11-17T09:45:48
109,012,735
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class KMP { private int[] next; private int size; private char[] s; public KMP(int n,char[] s1){ next = new int[n]; size = n; s = s1; } public void getnext(){ next[0]=-1; int j=0,k=-1; while(j<size){ if(k==-1||s[j]==s[k]){ ++j; ++k; if(s[j]!=s[k]) next[j]=k; else next[j]=next[k]; }else k=next[k]; } return; } public int kmp(int n,char[] b){ int i=0,j=0; while(i<size&&j<n){ if(i==-1 || s[i]==b[j]){ ++i; ++j; }else i=next[i]; } if(i == size) return i-size+1; else return -1; } }
UTF-8
Java
606
java
KMP.java
Java
[]
null
[]
public class KMP { private int[] next; private int size; private char[] s; public KMP(int n,char[] s1){ next = new int[n]; size = n; s = s1; } public void getnext(){ next[0]=-1; int j=0,k=-1; while(j<size){ if(k==-1||s[j]==s[k]){ ++j; ++k; if(s[j]!=s[k]) next[j]=k; else next[j]=next[k]; }else k=next[k]; } return; } public int kmp(int n,char[] b){ int i=0,j=0; while(i<size&&j<n){ if(i==-1 || s[i]==b[j]){ ++i; ++j; }else i=next[i]; } if(i == size) return i-size+1; else return -1; } }
606
0.452145
0.432343
36
14.777778
8.505263
32
false
false
0
0
0
0
0
0
3.027778
false
false
4
009e73a59353144451664e5f18b0a18a0c9c5f2c
755,914,307,907
9ac50efd6e2f7a433ce5693864817ea3bd81ccb9
/src/main/java/StudentBase/UI/Util/ValidatorDatePickerNotNullAndContainsDate.java
34ffc12ebddd313158cfa44980deb72ac3f02bb9
[]
no_license
gresing/StudentBase
https://github.com/gresing/StudentBase
6a12b8fec21f062f4a2749e7e7c695e54e9f7363
86692f05d190b9ccae3b193c074f6678ff707c6e
refs/heads/master
2021-01-20T19:57:39.309000
2016-06-20T20:09:38
2016-06-20T20:09:38
61,570,644
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package StudentBase.UI.Util; import com.vaadin.data.Validator; import java.sql.Date; /** * Created by gres on 20.06.2016. */ public class ValidatorDatePickerNotNullAndContainsDate implements Validator { @Override public void validate(Object o) throws InvalidValueException { if (o == null) { throw new InvalidValueException("Значение не может быть нулевым"); } try { Date.valueOf(o.toString()); } catch (Exception e) { throw new InvalidValueException("Ожидается дата"); } } }
UTF-8
Java
632
java
ValidatorDatePickerNotNullAndContainsDate.java
Java
[ { "context": ";\r\n\r\nimport java.sql.Date;\r\n\r\n\r\n/**\r\n * Created by gres on 20.06.2016.\r\n */\r\npublic class ValidatorDatePi", "end": 119, "score": 0.9993747472763062, "start": 115, "tag": "USERNAME", "value": "gres" } ]
null
[]
package StudentBase.UI.Util; import com.vaadin.data.Validator; import java.sql.Date; /** * Created by gres on 20.06.2016. */ public class ValidatorDatePickerNotNullAndContainsDate implements Validator { @Override public void validate(Object o) throws InvalidValueException { if (o == null) { throw new InvalidValueException("Значение не может быть нулевым"); } try { Date.valueOf(o.toString()); } catch (Exception e) { throw new InvalidValueException("Ожидается дата"); } } }
632
0.615514
0.602024
23
23.782608
24.740314
78
false
false
0
0
0
0
0
0
0.26087
false
false
4
d7ef03ca960d113265d53f8caabc69e93234835f
14,637,248,609,849
e23ce565e7eac2f48eb4867bae697f8fc9c48ec0
/android/src/main/java/com/wix/pagedcontacts/utils/ImageUtils.java
c9a446730d67b588aab677f83491010818358da4
[ "MIT" ]
permissive
softwarehutpl/react-native-paged-contacts
https://github.com/softwarehutpl/react-native-paged-contacts
67f7e43cd8104da5247cf437b3a06ede0a77aada
080cdabbac7c93943722b928dfdb6ea157a043a2
refs/heads/master
2020-03-10T06:18:32.726000
2020-02-13T11:31:27
2020-02-13T11:31:27
129,236,734
0
1
MIT
true
2019-11-27T11:01:48
2018-04-12T10:52:03
2019-01-25T07:45:31
2019-11-27T11:01:46
284
0
0
0
Java
false
false
package com.wix.pagedcontacts.utils; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import androidx.annotation.NonNull; import android.util.Base64; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.InputStream; public class ImageUtils { public static String toBase64(byte[] blob) { return Base64.encodeToString(blob, Base64.DEFAULT); } public static String toBase64(Context context, @NonNull String imageUri) { try { Uri photo = Uri.parse(imageUri); Bitmap bitmap = getBitmap(context, photo); byte[] byteArray = getBytes(bitmap); return Base64.encodeToString(byteArray, Base64.DEFAULT); } catch (Exception e) { e.printStackTrace(); return null; } } private static byte[] getBytes(Bitmap bitmap) { ByteArrayOutputStream os = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, os); return os.toByteArray(); } private static Bitmap getBitmap(Context context, Uri photo) throws FileNotFoundException { InputStream is = context.getContentResolver().openInputStream(photo); BufferedInputStream in = new BufferedInputStream(is); return BitmapFactory.decodeStream(in); } }
UTF-8
Java
1,438
java
ImageUtils.java
Java
[]
null
[]
package com.wix.pagedcontacts.utils; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import androidx.annotation.NonNull; import android.util.Base64; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.InputStream; public class ImageUtils { public static String toBase64(byte[] blob) { return Base64.encodeToString(blob, Base64.DEFAULT); } public static String toBase64(Context context, @NonNull String imageUri) { try { Uri photo = Uri.parse(imageUri); Bitmap bitmap = getBitmap(context, photo); byte[] byteArray = getBytes(bitmap); return Base64.encodeToString(byteArray, Base64.DEFAULT); } catch (Exception e) { e.printStackTrace(); return null; } } private static byte[] getBytes(Bitmap bitmap) { ByteArrayOutputStream os = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, os); return os.toByteArray(); } private static Bitmap getBitmap(Context context, Uri photo) throws FileNotFoundException { InputStream is = context.getContentResolver().openInputStream(photo); BufferedInputStream in = new BufferedInputStream(is); return BitmapFactory.decodeStream(in); } }
1,438
0.698887
0.687065
43
32.44186
24.381943
94
false
false
0
0
0
0
0
0
0.72093
false
false
4
4fda452259acca094ae96295069afc2704c54ab5
14,637,248,607,339
4ff581fde3bfdc2f76400a976d38e237b88fa62d
/Cube Database/src/main/core/MtgSet.java
238f00b01060316d1fdc8cba23c3e08955a9b4b3
[]
no_license
kanguilla/cube-database
https://github.com/kanguilla/cube-database
b420b612c1c71be45c5e5e0a6b32c8d26b4ff775
54c0ca3ac0d5b7f06f4057e008b81aa06b542336
refs/heads/master
2021-01-21T04:47:14.265000
2016-07-28T20:33:22
2016-07-28T20:33:22
54,730,852
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.core; import java.util.List; import main.core.Card; public class MtgSet{ String name; String code; String magicCardsInfoCode; String releaseDate; String type; List<Object> booster; String mkm_name; int mkm_id; List<Card> cards; public MtgSet(String name, String code, String mcic, String releaseDate, String type){ this.name = name; this.code = code; this.magicCardsInfoCode = mcic; this.releaseDate = releaseDate; this.type = type; } }
UTF-8
Java
498
java
MtgSet.java
Java
[]
null
[]
package main.core; import java.util.List; import main.core.Card; public class MtgSet{ String name; String code; String magicCardsInfoCode; String releaseDate; String type; List<Object> booster; String mkm_name; int mkm_id; List<Card> cards; public MtgSet(String name, String code, String mcic, String releaseDate, String type){ this.name = name; this.code = code; this.magicCardsInfoCode = mcic; this.releaseDate = releaseDate; this.type = type; } }
498
0.696787
0.696787
25
18
17.092688
87
false
false
0
0
0
0
0
0
1.68
false
false
4
8a79cecec7c1c44e4f8d41d3958e2dbdaa818064
33,079,838,184,539
1845d47de858eac7fa01d9142ac55ec5a4b92500
/LogicalOperators.java
074e3654dfc4a7bf3253047d370938b781724887
[]
no_license
shrey-a-gupta/JavaPractice
https://github.com/shrey-a-gupta/JavaPractice
4be0e6fd9a6a85dd68d38af482157d62baa1cb18
c269cdb4c7ba1d2d618e610c5d15963ce4929c72
refs/heads/main
2023-06-23T11:56:31.194000
2021-07-17T12:38:34
2021-07-17T12:38:34
386,170,107
0
0
null
false
2021-07-17T12:38:35
2021-07-15T05:06:13
2021-07-17T12:34:38
2021-07-17T12:38:34
0
0
0
0
Java
false
false
package basics; public class LogicalOperators { public static void main(String[] args) { int numOne = 100; int numTwo = 20; int numThree = 30; System.out.println((numOne > numTwo) && (numOne > numThree)); //Output will be true } }
UTF-8
Java
259
java
LogicalOperators.java
Java
[]
null
[]
package basics; public class LogicalOperators { public static void main(String[] args) { int numOne = 100; int numTwo = 20; int numThree = 30; System.out.println((numOne > numTwo) && (numOne > numThree)); //Output will be true } }
259
0.633205
0.606178
11
21.545454
24.061903
86
false
false
0
0
0
0
0
0
1.818182
false
false
4
d76ff193abd365103df374fa748539af4f160993
22,471,268,901,152
ebeece5f4fc790cf377e442ea289fc3e3b65bb85
/plugins/org.storydriven.storydiagrams.expressions.common.ui/src-gen/org/storydriven/storydiagrams/expressions/common/ui/contentassist/AbstractExpressionsProposalProvider.java
a3456eddba5b99bc65d9526c3a1d1b3d47d24b9f
[]
no_license
ReEng/sdm-commons
https://github.com/ReEng/sdm-commons
8534449c2b52daa079db307283652dc916a08863
c97d88e696c0f8c8b365d7a7610fd3271b4eb469
refs/heads/master
2021-01-18T23:05:30.360000
2019-08-20T07:03:00
2019-08-20T07:03:00
39,124,066
1
1
null
false
2019-10-13T12:01:29
2015-07-15T07:59:03
2019-08-20T07:03:03
2019-08-20T07:03:01
31,418
1
1
19
Java
false
false
/* * generated by Xtext */ package org.storydriven.storydiagrams.expressions.common.ui.contentassist; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.Assignment; import org.eclipse.xtext.RuleCall; import org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider; import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext; import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor; /** * Represents a generated, default implementation of interface {@link IProposalProvider}. * Methods are dynamically dispatched on the first parameter, i.e., you can override them * with a more concrete subtype. */ @SuppressWarnings("all") public class AbstractExpressionsProposalProvider extends TerminalsProposalProvider { public void completeEquivalent_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeImplication_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeDisjunction_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeConjunction_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeNegated_Not(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeCompare_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeAddition_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeMultiplication_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completePower_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeNumberValue_NumValue(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeBooleanValue_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeStringValue_StrValue(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeVariable_VarName(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void complete_LExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Equivalent(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Implication(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Disjunction(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Conjunction(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Negation(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Negated(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_CExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Compare(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_SomeValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_AExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Addition(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Multiplication(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Power(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_PrimaryExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_NumberValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_NUMBER(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_BooleanValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_BOOLEAN(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_StringValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Variable(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_VARIABLE_VALUE(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } }
UTF-8
Java
7,440
java
AbstractExpressionsProposalProvider.java
Java
[]
null
[]
/* * generated by Xtext */ package org.storydriven.storydiagrams.expressions.common.ui.contentassist; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.Assignment; import org.eclipse.xtext.RuleCall; import org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider; import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext; import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor; /** * Represents a generated, default implementation of interface {@link IProposalProvider}. * Methods are dynamically dispatched on the first parameter, i.e., you can override them * with a more concrete subtype. */ @SuppressWarnings("all") public class AbstractExpressionsProposalProvider extends TerminalsProposalProvider { public void completeEquivalent_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeImplication_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeDisjunction_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeConjunction_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeNegated_Not(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeCompare_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeAddition_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeMultiplication_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completePower_Right(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeNumberValue_NumValue(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeBooleanValue_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeStringValue_StrValue(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeVariable_VarName(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void complete_LExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Equivalent(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Implication(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Disjunction(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Conjunction(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Negation(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Negated(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_CExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Compare(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_SomeValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_AExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Addition(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Multiplication(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Power(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_PrimaryExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_NumberValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_NUMBER(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_BooleanValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_BOOLEAN(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_StringValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Variable(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_VARIABLE_VALUE(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } }
7,440
0.823253
0.823253
127
57.582676
56.360962
149
false
false
0
0
0
0
0
0
2.330709
false
false
4
e76ff66dc17d96c4f8c27e09e9d4775578a1a016
3,169,685,888,389
98cae1b3c34880a09a9902b21b3f26730e9f0625
/EBaySearch/src/test/java/com/companyname/prjname/qa/functionlibrary/WebNavigation.java
55332d5cb45eede58f2c592a9944659e891bfd6b
[]
no_license
thenmozhip/Ebay
https://github.com/thenmozhip/Ebay
152481ae7af1d509bd734a5edb032f7e7628d143
3b968f3892279737fd3b4f766b7cde586bf50f0c
refs/heads/master
2021-04-12T10:31:05.589000
2017-06-16T11:36:07
2017-06-16T11:36:07
94,523,977
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.companyname.prjname.qa.functionlibrary; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import java.util.List; import java.util.concurrent.TimeUnit; import static cucumber.prjname.java.tests.SharedDriver.getDriver; import static org.junit.Assert.assertTrue; public class WebNavigation { public static void openWebPage(String url) { getDriver().get(url); getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } //To Click a Link public static void clickALinkWithCssLocator(String cssLocator){ getDriver().findElement(By.cssSelector(cssLocator)).click(); } public static void enterAnyTextInAField(String cssLocator, String text){ getDriver().findElement(By.cssSelector(cssLocator)).sendKeys(text); } public static void enterAnyNumberInAField(String fieldLocator, float anyNumber){ String text = Float.toString(anyNumber); getDriver().findElement(By.cssSelector(fieldLocator)).sendKeys(text); } public static String getTextByCSS(String cssLocator) { return getDriver().findElement(By.cssSelector(cssLocator)).getText(); } public static void assertContentExists(String cssLocator, String textToBePresent){ String textToVerify = getTextByCSS(cssLocator).toUpperCase(); assertTrue(textToVerify.contains(textToBePresent.toUpperCase())); } public static boolean isElementPresent(String cssLocator) throws Throwable { try { getDriver().findElement(By.cssSelector(cssLocator)); return true; } catch (NoSuchElementException e) { return false; } } public static String getIDElement(){ WebElement div = getDriver().findElement(By.cssSelector("div.row:nth-child(2)")); String id = div.getAttribute("id"); return id; } public static void selectAnOptionFromAList(String listLocator, String listOption){ WebElement element = getDriver().findElement(By.cssSelector(listLocator)); Select dropDownList = new Select(element); dropDownList.selectByVisibleText(listOption); } public static void selectDateFromTheCalendar(String cssLocator, int dateToSelect){ WebElement dateWidget = getDriver().findElement(By.cssSelector(cssLocator)); List<WebElement> list=dateWidget.findElements(By.tagName("td")); String tempDate = String.valueOf(dateToSelect); for (WebElement cell: list){ String text = cell.getText(); if (text.equals(tempDate)){ cell.findElement(By.linkText(tempDate)).click(); break; } } } public static void closeBrowser(){ getDriver().close(); } }
UTF-8
Java
2,895
java
WebNavigation.java
Java
[]
null
[]
package com.companyname.prjname.qa.functionlibrary; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import java.util.List; import java.util.concurrent.TimeUnit; import static cucumber.prjname.java.tests.SharedDriver.getDriver; import static org.junit.Assert.assertTrue; public class WebNavigation { public static void openWebPage(String url) { getDriver().get(url); getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } //To Click a Link public static void clickALinkWithCssLocator(String cssLocator){ getDriver().findElement(By.cssSelector(cssLocator)).click(); } public static void enterAnyTextInAField(String cssLocator, String text){ getDriver().findElement(By.cssSelector(cssLocator)).sendKeys(text); } public static void enterAnyNumberInAField(String fieldLocator, float anyNumber){ String text = Float.toString(anyNumber); getDriver().findElement(By.cssSelector(fieldLocator)).sendKeys(text); } public static String getTextByCSS(String cssLocator) { return getDriver().findElement(By.cssSelector(cssLocator)).getText(); } public static void assertContentExists(String cssLocator, String textToBePresent){ String textToVerify = getTextByCSS(cssLocator).toUpperCase(); assertTrue(textToVerify.contains(textToBePresent.toUpperCase())); } public static boolean isElementPresent(String cssLocator) throws Throwable { try { getDriver().findElement(By.cssSelector(cssLocator)); return true; } catch (NoSuchElementException e) { return false; } } public static String getIDElement(){ WebElement div = getDriver().findElement(By.cssSelector("div.row:nth-child(2)")); String id = div.getAttribute("id"); return id; } public static void selectAnOptionFromAList(String listLocator, String listOption){ WebElement element = getDriver().findElement(By.cssSelector(listLocator)); Select dropDownList = new Select(element); dropDownList.selectByVisibleText(listOption); } public static void selectDateFromTheCalendar(String cssLocator, int dateToSelect){ WebElement dateWidget = getDriver().findElement(By.cssSelector(cssLocator)); List<WebElement> list=dateWidget.findElements(By.tagName("td")); String tempDate = String.valueOf(dateToSelect); for (WebElement cell: list){ String text = cell.getText(); if (text.equals(tempDate)){ cell.findElement(By.linkText(tempDate)).click(); break; } } } public static void closeBrowser(){ getDriver().close(); } }
2,895
0.689465
0.688428
85
33.058823
30.335129
89
false
false
0
0
0
0
0
0
0.470588
false
false
4
9c3f1ac8b23621a1f96311eb1aee747271ffa203
10,874,857,201,997
adfdf8c2d6a432b0beeeb473b148f48c9552d733
/aliyun-java-sdk-risk/src/main/java/com/aliyuncs/risk/model/v20150323/FindRiskRequest.java
fb3cba2a4643ee90ab77bf9597486a82e4b090f9
[ "Apache-2.0" ]
permissive
fit2cloud/aliyun-openapi-java-sdk
https://github.com/fit2cloud/aliyun-openapi-java-sdk
122b51e7a1464194a7a8ff82dbd43354d5d24d8b
c5f3dcaf5815d24ab0309547a02286c867fd54ea
refs/heads/master
2021-01-17T22:54:25.909000
2015-10-12T14:23:01
2015-10-12T14:23:01
44,109,059
0
1
null
true
2015-10-12T13:28:07
2015-10-12T13:28:06
2015-10-01T11:12:08
2015-09-08T08:16:43
600
0
0
0
null
null
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 com.aliyuncs.risk.model.v20150323; import com.aliyuncs.RpcAcsRequest; /** * @author auto create * @version */ public class FindRiskRequest extends RpcAcsRequest<FindRiskResponse> { public FindRiskRequest() { super("Risk", "2015-03-23", "FindRisk"); } private String mteeCode; private String codeType; private String idType; private String userId; private String collina; private String umidToken; private String ip; private String email; private String phone; public String getMteeCode() { return this.mteeCode; } public void setMteeCode(String mteeCode) { this.mteeCode = mteeCode; putQueryParameter("MteeCode", mteeCode); } public String getCodeType() { return this.codeType; } public void setCodeType(String codeType) { this.codeType = codeType; putQueryParameter("CodeType", codeType); } public String getIdType() { return this.idType; } public void setIdType(String idType) { this.idType = idType; putQueryParameter("IdType", idType); } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; putQueryParameter("UserId", userId); } public String getCollina() { return this.collina; } public void setCollina(String collina) { this.collina = collina; putQueryParameter("Collina", collina); } public String getUmidToken() { return this.umidToken; } public void setUmidToken(String umidToken) { this.umidToken = umidToken; putQueryParameter("UmidToken", umidToken); } public String getIp() { return this.ip; } public void setIp(String ip) { this.ip = ip; putQueryParameter("Ip", ip); } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; putQueryParameter("Email", email); } public String getPhone() { return this.phone; } public void setPhone(String phone) { this.phone = phone; putQueryParameter("Phone", phone); } @Override public Class<FindRiskResponse> getResponseClass() { return FindRiskResponse.class; } }
UTF-8
Java
2,886
java
FindRiskRequest.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 com.aliyuncs.risk.model.v20150323; import com.aliyuncs.RpcAcsRequest; /** * @author auto create * @version */ public class FindRiskRequest extends RpcAcsRequest<FindRiskResponse> { public FindRiskRequest() { super("Risk", "2015-03-23", "FindRisk"); } private String mteeCode; private String codeType; private String idType; private String userId; private String collina; private String umidToken; private String ip; private String email; private String phone; public String getMteeCode() { return this.mteeCode; } public void setMteeCode(String mteeCode) { this.mteeCode = mteeCode; putQueryParameter("MteeCode", mteeCode); } public String getCodeType() { return this.codeType; } public void setCodeType(String codeType) { this.codeType = codeType; putQueryParameter("CodeType", codeType); } public String getIdType() { return this.idType; } public void setIdType(String idType) { this.idType = idType; putQueryParameter("IdType", idType); } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; putQueryParameter("UserId", userId); } public String getCollina() { return this.collina; } public void setCollina(String collina) { this.collina = collina; putQueryParameter("Collina", collina); } public String getUmidToken() { return this.umidToken; } public void setUmidToken(String umidToken) { this.umidToken = umidToken; putQueryParameter("UmidToken", umidToken); } public String getIp() { return this.ip; } public void setIp(String ip) { this.ip = ip; putQueryParameter("Ip", ip); } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; putQueryParameter("Email", email); } public String getPhone() { return this.phone; } public void setPhone(String phone) { this.phone = phone; putQueryParameter("Phone", phone); } @Override public Class<FindRiskResponse> getResponseClass() { return FindRiskResponse.class; } }
2,886
0.723493
0.716563
137
20.065693
19.835529
70
false
false
0
0
0
0
0
0
1.20438
false
false
4
9cb88e68f9841c7bceada93cc48ffb16d44e635f
18,957,985,656,360
e7cd11fdfd2db95026e176dde7ef85404e27b33e
/doctor-client/src/main/java/com/jianke/doctor/client/dataobject/request/CookieObj.java
ad19c783b4906ca8679f86052f1c326b6ee3f348
[]
no_license
whatodo/jianke-doctor-api
https://github.com/whatodo/jianke-doctor-api
8528fc94060c609ed2e1a0b771ab8e2a1f5b59e8
6c7bc1f68f4d630fe53726d8f4d28e5a61cf4fc1
refs/heads/master
2018-01-03T09:49:59.701000
2017-02-06T10:44:39
2017-02-06T10:44:39
99,318,998
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jianke.doctor.client.dataobject.request; /** * Created by qqh on 2016/10/24. */ public class CookieObj { private String cookieName = ""; private String cookieValue = ""; public String getCookieName() { return cookieName; } public void setCookieName(String cookieName) { this.cookieName = cookieName; } public String getCookieValue() { return cookieValue; } public void setCookieValue(String cookieValue) { this.cookieValue = cookieValue; } }
UTF-8
Java
536
java
CookieObj.java
Java
[ { "context": "ctor.client.dataobject.request;\n\n/**\n * Created by qqh on 2016/10/24.\n */\npublic class CookieObj {\n\n ", "end": 75, "score": 0.9995602369308472, "start": 72, "tag": "USERNAME", "value": "qqh" } ]
null
[]
package com.jianke.doctor.client.dataobject.request; /** * Created by qqh on 2016/10/24. */ public class CookieObj { private String cookieName = ""; private String cookieValue = ""; public String getCookieName() { return cookieName; } public void setCookieName(String cookieName) { this.cookieName = cookieName; } public String getCookieValue() { return cookieValue; } public void setCookieValue(String cookieValue) { this.cookieValue = cookieValue; } }
536
0.649254
0.634328
26
19.615385
18.712557
52
false
false
0
0
0
0
0
0
0.269231
false
false
4
866156b865ef4b95bd4dd9acdf33be636db5e64a
2,697,239,483,902
a3a78982bfbf09c82cf147127293ea33c564a00e
/app/src/main/java/talosdev/permission/features/main/MainPresenter.java
8d7f4b263f341acb9184416cbe8f658bd99bd2d3
[]
no_license
VijaySnawane/clean-activities
https://github.com/VijaySnawane/clean-activities
d620a20ae06b8d69487ba865febe0bd743a4cb4e
44d506c5a448bf0e77672952bc5dcfb9872df486
refs/heads/master
2020-09-15T09:07:39.273000
2018-05-25T14:21:34
2018-05-25T14:21:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package talosdev.permission.features.main; import java.lang.ref.WeakReference; import javax.inject.Inject; public class MainPresenter implements MainContract.Presenter { private final WeakReference<MainContract.View> viewWeakReference; @Inject public MainPresenter(MainContract.View view) { viewWeakReference = new WeakReference<>(view); } @Override public void onLocationClicked() { MainContract.View view = viewWeakReference.get(); if (view != null) { view.navigateToLocation(); } } @Override public void onPhoneClicked() { MainContract.View view = viewWeakReference.get(); if (view != null) { view.navigateToPhone(); } } }
UTF-8
Java
753
java
MainPresenter.java
Java
[]
null
[]
package talosdev.permission.features.main; import java.lang.ref.WeakReference; import javax.inject.Inject; public class MainPresenter implements MainContract.Presenter { private final WeakReference<MainContract.View> viewWeakReference; @Inject public MainPresenter(MainContract.View view) { viewWeakReference = new WeakReference<>(view); } @Override public void onLocationClicked() { MainContract.View view = viewWeakReference.get(); if (view != null) { view.navigateToLocation(); } } @Override public void onPhoneClicked() { MainContract.View view = viewWeakReference.get(); if (view != null) { view.navigateToPhone(); } } }
753
0.654714
0.654714
32
22.53125
21.841738
69
false
false
0
0
0
0
0
0
0.28125
false
false
4
992ad11b9e6f26db25a18a24735c0ba0fc5b09eb
31,404,800,927,959
27bfea5e2cdd5744b5cdd5940a987aae02eec8a1
/NFV_MANO_LIBS_IFA05_VR_MGT_IF/src/main/java/it/nextworks/nfvmano/libs/ifa/vrmanagement/interfaces/messages/vresources/QueryResourceCapacityResponse.java
d338fae210f1a0283dc9c3ed867b282a1a61dc2c
[ "Apache-2.0" ]
permissive
simonrommel/nfv-ifa-libs
https://github.com/simonrommel/nfv-ifa-libs
2723306bb4808759a722aa35335db068fa3d0b37
b5d9649291affcc3672a95012dbcdc40dbe57b69
refs/heads/master
2022-08-31T02:28:34.570000
2021-02-25T18:21:21
2021-02-25T18:21:21
255,963,335
0
0
null
true
2020-04-15T15:42:53
2020-04-15T15:42:53
2020-03-14T03:19:55
2019-12-30T09:16:05
1,026
0
0
0
null
false
false
/* * Copyright 2018 Nextworks s.r.l. * * 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 it.nextworks.nfvmano.libs.ifa.vrmanagement.interfaces.messages.vresources; import it.nextworks.nfvmano.libs.ifa.common.InterfaceMessage; import it.nextworks.nfvmano.libs.ifa.common.exceptions.MalformattedElementException; import it.nextworks.nfvmano.libs.ifa.vrmanagement.interfaces.elements.CapacityInformation; /** * Query for VIM resource capacity * * REF IFA 005 v2.3.1 - section 7.3.4.2, 7.4.4.2, 7.5.4.2 * * @author nextworks * */ public class QueryResourceCapacityResponse implements InterfaceMessage { private CapacityInformation capacityResponse; public QueryResourceCapacityResponse() { } /** * Constructor * * @param capacityResponse The capacity during the requested time period. The scope is according to parameter zoneId of the request during the time interval. */ public QueryResourceCapacityResponse(CapacityInformation capacityResponse) { this.capacityResponse = capacityResponse; } /** * @return the capacityResponse */ public CapacityInformation getCapacityResponse() { return capacityResponse; } @Override public void isValid() throws MalformattedElementException { if (capacityResponse == null) throw new MalformattedElementException("Query capacity response without response element"); } }
UTF-8
Java
1,862
java
QueryResourceCapacityResponse.java
Java
[ { "context": "- section 7.3.4.2, 7.4.4.2, 7.5.4.2\n * \n * @author nextworks\n *\n */\npublic class QueryResourceCapacityResponse", "end": 1035, "score": 0.9986319541931152, "start": 1026, "tag": "USERNAME", "value": "nextworks" } ]
null
[]
/* * Copyright 2018 Nextworks s.r.l. * * 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 it.nextworks.nfvmano.libs.ifa.vrmanagement.interfaces.messages.vresources; import it.nextworks.nfvmano.libs.ifa.common.InterfaceMessage; import it.nextworks.nfvmano.libs.ifa.common.exceptions.MalformattedElementException; import it.nextworks.nfvmano.libs.ifa.vrmanagement.interfaces.elements.CapacityInformation; /** * Query for VIM resource capacity * * REF IFA 005 v2.3.1 - section 7.3.4.2, 7.4.4.2, 7.5.4.2 * * @author nextworks * */ public class QueryResourceCapacityResponse implements InterfaceMessage { private CapacityInformation capacityResponse; public QueryResourceCapacityResponse() { } /** * Constructor * * @param capacityResponse The capacity during the requested time period. The scope is according to parameter zoneId of the request during the time interval. */ public QueryResourceCapacityResponse(CapacityInformation capacityResponse) { this.capacityResponse = capacityResponse; } /** * @return the capacityResponse */ public CapacityInformation getCapacityResponse() { return capacityResponse; } @Override public void isValid() throws MalformattedElementException { if (capacityResponse == null) throw new MalformattedElementException("Query capacity response without response element"); } }
1,862
0.770677
0.756713
61
29.52459
35.516613
158
false
false
0
0
0
0
0
0
0.721311
false
false
4
927972ecdc4604da38e41386bf0c29a4b4c6a0ba
678,604,833,952
ce1f21397723c2376785be9b1c34c901028ede6a
/gangziAndroidTest/app/src/main/java/com/test/gangzi/gangziandroidtest/activity/presenter/MainActivityPresenter.java
84cd50953cb6e5101ba3482878322f2c4e9171fd
[]
no_license
ZhuGang/gangziAndroidTest
https://github.com/ZhuGang/gangziAndroidTest
a883dcb7dd7feaa8d6ee5eef9dd092f3f823ba88
571df915137bf6245ebe360353ca404cf637d808
refs/heads/master
2021-07-07T19:45:49.419000
2016-11-30T02:53:46
2016-11-30T02:53:46
56,368,755
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test.gangzi.gangziandroidtest.activity.presenter; import com.test.gangzi.gangziandroidtest.model.User; import com.test.gangzi.gangziandroidtest.activity.MainActivity; /** * Created by gangzi on 2015/6/10. */ public class MainActivityPresenter { private MainActivity mainActivity; private User user; public MainActivityPresenter(MainActivity mainActivity, User user) { this.mainActivity = mainActivity; this.user = user; } public void showUserName(){ mainActivity.setTextView(user.getName()); } }
UTF-8
Java
566
java
MainActivityPresenter.java
Java
[ { "context": "roidtest.activity.MainActivity;\n\n/**\n * Created by gangzi on 2015/6/10.\n */\npublic class MainActivityPresen", "end": 205, "score": 0.9995219111442566, "start": 199, "tag": "USERNAME", "value": "gangzi" } ]
null
[]
package com.test.gangzi.gangziandroidtest.activity.presenter; import com.test.gangzi.gangziandroidtest.model.User; import com.test.gangzi.gangziandroidtest.activity.MainActivity; /** * Created by gangzi on 2015/6/10. */ public class MainActivityPresenter { private MainActivity mainActivity; private User user; public MainActivityPresenter(MainActivity mainActivity, User user) { this.mainActivity = mainActivity; this.user = user; } public void showUserName(){ mainActivity.setTextView(user.getName()); } }
566
0.727915
0.715548
25
21.639999
23.653973
72
false
false
0
0
0
0
0
0
0.36
false
false
4
66398a9c894697cc0cd7d61018d9a647e9c0fa77
24,644,522,351,517
dce049874943f769c10fa53fbee1bbe3984d0dd7
/gaia-server-api/src/main/java/com/syltek/gaia/api/v1/response/GeneralStatusResponse.java
20b13f3d151b64ff586678008f0b73fe12d49877
[]
no_license
sgmoratilla/microservices-example
https://github.com/sgmoratilla/microservices-example
db6105077322dee90e4240b8935f4386681aacff
ef3aa834fc3a5de4fd8516f851bcedcffb14c032
refs/heads/master
2019-07-16T00:12:32.155000
2017-03-12T21:15:24
2017-03-12T21:15:24
83,727,860
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.syltek.gaia.api.v1.response; import org.springframework.util.Assert; import com.fasterxml.jackson.annotation.JsonProperty; public class GeneralStatusResponse<S> { @JsonProperty("localizedMessage") private String localizedMessage; @JsonProperty("status") private S status; public GeneralStatusResponse(@JsonProperty("status") S status, @JsonProperty("message") String localizedMessage) { Assert.notNull(status, "status == null"); Assert.notNull(localizedMessage, "statlocalizedMessageus == null"); this.status = status; this.localizedMessage = localizedMessage; } }
UTF-8
Java
597
java
GeneralStatusResponse.java
Java
[]
null
[]
package com.syltek.gaia.api.v1.response; import org.springframework.util.Assert; import com.fasterxml.jackson.annotation.JsonProperty; public class GeneralStatusResponse<S> { @JsonProperty("localizedMessage") private String localizedMessage; @JsonProperty("status") private S status; public GeneralStatusResponse(@JsonProperty("status") S status, @JsonProperty("message") String localizedMessage) { Assert.notNull(status, "status == null"); Assert.notNull(localizedMessage, "statlocalizedMessageus == null"); this.status = status; this.localizedMessage = localizedMessage; } }
597
0.778894
0.777219
18
32.166668
31.004032
115
false
false
0
0
0
0
0
0
1.5
false
false
4
cdba3c2a87b57b7d53611151921a5f619a5b9817
28,329,604,312,994
b48c876f02930cb6c2b46ff4ad13acb9013f02e5
/manager/src/main/java/com/stone/southcity/patterns/observer/Lisi.java
e047825bd0a2acf042f42da1806a39209710bc0b
[]
no_license
cchslt/southCity
https://github.com/cchslt/southCity
ba4138a998134498c613bb31fa5dc0717ae207ec
eeba0a3812e561e6a66645442b0dda0748df3363
refs/heads/master
2021-01-15T15:31:07.093000
2016-12-11T06:44:31
2016-12-11T06:44:31
54,270,288
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stone.southcity.patterns.observer; /** * Created by chenchen on 2016/3/20. */ public class Lisi implements Observer { public void update(String context) { System.out.println("李斯:韩非子有活动,赶快报告..."); this.reportToQin(context); System.out.println("李斯:一通知到"); } private void reportToQin(String context) { System.out.println("李斯:报告,妃子有活动。。。。" + context); } }
UTF-8
Java
488
java
Lisi.java
Java
[ { "context": "ne.southcity.patterns.observer;\n\n/**\n * Created by chenchen on 2016/3/20.\n */\npublic class Lisi implements Ob", "end": 74, "score": 0.9995169639587402, "start": 66, "tag": "USERNAME", "value": "chenchen" }, { "context": "ate(String context) {\n System.out.println(\"李斯:韩非子有活动,赶快报告...\");\n this.reportToQin(contex", "end": 204, "score": 0.5254182815551758, "start": 202, "tag": "NAME", "value": "李斯" } ]
null
[]
package com.stone.southcity.patterns.observer; /** * Created by chenchen on 2016/3/20. */ public class Lisi implements Observer { public void update(String context) { System.out.println("李斯:韩非子有活动,赶快报告..."); this.reportToQin(context); System.out.println("李斯:一通知到"); } private void reportToQin(String context) { System.out.println("李斯:报告,妃子有活动。。。。" + context); } }
488
0.641827
0.625
16
25
20.551764
56
false
false
0
0
0
0
0
0
0.3125
false
false
4
fe31d07d4f90b79c139f8d906da14e8e281c966c
292,057,796,511
bb0d2d29b0baba5092ae2284582b87d0fadbb23b
/Task1.java
0bfc1a744397fb71a6c74be7717e89802b9b0047
[]
no_license
alexshim11/LessonThree
https://github.com/alexshim11/LessonThree
241c22d631de7354d76b8d3c27b588c03e2a656c
f8b323cfd41a76d6bd0d4127b5652371f6f7d198
refs/heads/master
2021-09-01T15:54:12.352000
2017-12-27T20:46:01
2017-12-27T20:46:01
115,556,173
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lesson3; public class Task1 { public static void main(String[] args) { int massive[] = { 327, 381, 891, 918, 212, 848, 770, 363, 416, 736 }; int max = massive[0]; for (int i = 0; i < massive.length; i++) { if (massive[i] > max) { max = massive[i]; } } System.out.println(max); System.out.println(""); double j = 0; for (int i = 0; i < massive.length; i++) { j = (double) massive[i] / max; // ÎÊÐÓÃËÅÍÈÅ!!! j = (double) Math.round(j * 100d) / 100d; System.out.print(" " + j); } } }
WINDOWS-1252
Java
574
java
Task1.java
Java
[]
null
[]
package lesson3; public class Task1 { public static void main(String[] args) { int massive[] = { 327, 381, 891, 918, 212, 848, 770, 363, 416, 736 }; int max = massive[0]; for (int i = 0; i < massive.length; i++) { if (massive[i] > max) { max = massive[i]; } } System.out.println(max); System.out.println(""); double j = 0; for (int i = 0; i < massive.length; i++) { j = (double) massive[i] / max; // ÎÊÐÓÃËÅÍÈÅ!!! j = (double) Math.round(j * 100d) / 100d; System.out.print(" " + j); } } }
574
0.52305
0.448582
28
18.214285
18.321255
71
false
false
0
0
0
0
0
0
2.321429
false
false
4
60b9491772d234b9f8324a72077001aa30ae410e
24,575,802,868,594
93d2239d13ac0e12f2a4edd8ea51834a9e025faa
/dev/adapters/processing-nimate/HarpaNIMate_ZMQ/build-tmp/source/HarpaNIMate_ZMQ.java
9a180223ad958ba4fd2a3693e075c54c980fdab3
[]
no_license
owenhindley/harpa-lights
https://github.com/owenhindley/harpa-lights
8afa254a14bcd6092a86b2bb2557746f5b5edd5f
2eb8f2322bd22f5d3a2f160d6219a0247a60b2cf
refs/heads/master
2021-01-10T05:24:20.738000
2018-01-18T17:33:09
2018-01-18T17:33:09
46,232,566
2
2
null
false
2016-02-17T14:31:51
2015-11-15T19:35:36
2016-02-17T14:18:28
2016-02-17T14:31:51
563,775
2
2
0
Shell
null
null
import processing.core.*; import processing.data.*; import processing.event.*; import processing.opengl.*; import processing.opengl.*; import oscP5.*; import netP5.*; import org.apache.commons.codec.binary.Base64; import org.zeromq.*; import java.io.ByteArrayOutputStream; import java.io.BufferedOutputStream; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.awt.Robot; import java.awt.Rectangle; import javax.imageio.ImageIO; import java.net.*; import java.io.*; import java.nio.*; import org.apache.commons.codec.binary.*; import org.apache.commons.codec.*; import org.apache.commons.codec.digest.*; import org.apache.commons.codec.language.*; import org.apache.commons.codec.language.bm.*; import org.apache.commons.codec.net.*; import org.zeromq.*; import java.util.HashMap; import java.util.ArrayList; import java.io.File; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; public class HarpaNIMate_ZMQ extends PApplet { int harpaWidth = 77; int harpaHeight = 13; OscP5 oscP5; float ballSize = 0.01f; PImage sendImage; Skeleton s = new Skeleton(1); public void settings(){ size(harpaWidth, harpaHeight, P2D); } public void setup() { oscP5 = new OscP5(this, 7000); noStroke(); translate(width/2.0f, height/2.0f); frameRate(25); } /* incoming osc message are forwarded to the oscEvent method. */ // Here you can easily see the format of the OSC messages sent. For each user, the joints are named with // the joint named followed by user ID (head0, neck0 .... r_foot0; head1, neck1.....) public void oscEvent(OscMessage msg) { msg.print(); if (true) { if (msg.addrPattern().equals("Head")) { s.headCoords[0] = msg.get(0).floatValue(); s.headCoords[1] = msg.get(1).floatValue(); s.headCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Neck")) { s.neckCoords[0] = msg.get(0).floatValue(); s.neckCoords[1] = msg.get(1).floatValue(); s.neckCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Collar")) { s.rCollarCoords[0] = msg.get(0).floatValue(); s.rCollarCoords[1] = msg.get(1).floatValue(); s.rCollarCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Shoulder")) { s.rShoulderCoords[0] = msg.get(0).floatValue(); s.rShoulderCoords[1] = msg.get(1).floatValue(); s.rShoulderCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Elbow")) { s.rElbowCoords[0] = msg.get(0).floatValue(); s.rElbowCoords[1] = msg.get(1).floatValue(); s.rElbowCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Wrist")) { s.rWristCoords[0] = msg.get(0).floatValue(); s.rWristCoords[1] = msg.get(1).floatValue(); s.rWristCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Hand")) { s.rHandCoords[0] = msg.get(0).floatValue(); s.rHandCoords[1] = msg.get(1).floatValue(); s.rHandCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Finger")) { s.rFingerCoords[0] = msg.get(0).floatValue(); s.rFingerCoords[1] = msg.get(1).floatValue(); s.rFingerCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Collar")) { s.lCollarCoords[0] = msg.get(0).floatValue(); s.lCollarCoords[1] = msg.get(1).floatValue(); s.lCollarCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Shoulder")) { s.lShoulderCoords[0] = msg.get(0).floatValue(); s.lShoulderCoords[1] = msg.get(1).floatValue(); s.lShoulderCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Elbow")) { s.lElbowCoords[0] = msg.get(0).floatValue(); s.lElbowCoords[1] = msg.get(1).floatValue(); s.lElbowCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Wrist")) { s.lWristCoords[0] = msg.get(0).floatValue(); s.lWristCoords[1] = msg.get(1).floatValue(); s.lWristCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Hand")) { s.lHandCoords[0] = msg.get(0).floatValue(); s.lHandCoords[1] = msg.get(1).floatValue(); s.lHandCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Finger")) { s.lFingerCoords[0] = msg.get(0).floatValue(); s.lFingerCoords[1] = msg.get(1).floatValue(); s.lFingerCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Torso")) { s.torsoCoords[0] = msg.get(0).floatValue(); s.torsoCoords[1] = msg.get(1).floatValue(); s.torsoCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Hip")) { s.rHipCoords[0] = msg.get(0).floatValue(); s.rHipCoords[1] = msg.get(1).floatValue(); s.rHipCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Knee")) { s.rKneeCoords[0] = msg.get(0).floatValue(); s.rKneeCoords[1] = msg.get(1).floatValue(); s.rKneeCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Ankle")) { s.rAnkleCoords[0] = msg.get(0).floatValue(); s.rAnkleCoords[1] = msg.get(1).floatValue(); s.rAnkleCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Foot")) { s.rFootCoords[0] = msg.get(0).floatValue(); s.rFootCoords[1] = msg.get(1).floatValue(); s.rFootCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Hip")) { s.lHipCoords[0] = msg.get(0).floatValue(); s.lHipCoords[1] = msg.get(1).floatValue(); s.lHipCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Knee")) { s.lKneeCoords[0] = msg.get(0).floatValue(); s.lKneeCoords[1] = msg.get(1).floatValue(); s.lKneeCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Ankle")) { s.lAnkleCoords[0] = msg.get(0).floatValue(); s.lAnkleCoords[1] = msg.get(1).floatValue(); s.lAnkleCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Foot")) { s.lFootCoords[0] = msg.get(0).floatValue(); s.lFootCoords[1] = msg.get(1).floatValue(); s.lFootCoords[2] = msg.get(2).floatValue(); } } } public void draw() { background(255,0,255); fill(255); for (float[] j: s.allCoords) { ellipse((j[0] * width), ( j[1]*height), width * ballSize, width * ballSize); } BufferedImage b = new BufferedImage(harpaWidth,harpaHeight,BufferedImage.TYPE_INT_RGB); loadPixels(); } class HarpaImageSender { ZMQ.Context context; ZMQ.Socket sock; ByteBuffer byteBuffer; IntBuffer intBuffer; // ByteArrayOutputStream baStream; // BufferedOutputStream bos; int portNumber; HarpaImageSender(int port, int sendWidth, int sendHeight) { portNumber = port; context = ZMQ.context(1); sock = context.socket(ZMQ.PUSH); sock.bind("tcp://127.0.0.1:" + port); byteBuffer = ByteBuffer.allocate(sendWidth*sendHeight * 4); // Need these output streams to get image as bytes for UDP // baStream = new ByteArrayOutputStream(); //bos = new BufferedOutputStream(baStream); } public void sendImage(BufferedImage img) { // JPG compression into BufferedOutputStream // Requires try/catch ByteArrayOutputStream baStream = new ByteArrayOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(baStream); try { ImageIO.write(img, "png", bos); } catch (IOException e) { e.printStackTrace(); } sock.send(baStream.toByteArray(),0); } } class Skeleton { // We just use this class as a structure to store the joint coordinates sent by OSC. // The format is {x, y, z}, where x and y are in the [0.0, 1.0] interval, // and z is in the [0.0, 7.0] interval. float headCoords[] = new float[3]; float neckCoords[] = new float[3]; float rCollarCoords[] = new float[3]; float rShoulderCoords[] = new float[3]; float rElbowCoords[] = new float[3]; float rWristCoords[] = new float[3]; float rHandCoords[] = new float[3]; float rFingerCoords[] = new float[3]; float lCollarCoords[] = new float[3]; float lShoulderCoords[] = new float[3]; float lElbowCoords[] = new float[3]; float lWristCoords[] = new float[3]; float lHandCoords[] = new float[3]; float lFingerCoords[] = new float[3]; float torsoCoords[] = new float[3]; float rHipCoords[] = new float[3]; float rKneeCoords[] = new float[3]; float rAnkleCoords[] = new float[3]; float rFootCoords[] = new float[3]; float lHipCoords[] = new float[3]; float lKneeCoords[] = new float[3]; float lAnkleCoords[] = new float[3]; float lFootCoords[] = new float[3]; float[] allCoords[] = {headCoords, neckCoords, rCollarCoords, rShoulderCoords, rElbowCoords, rWristCoords, rHandCoords, rFingerCoords, lCollarCoords, lShoulderCoords, lElbowCoords, lWristCoords, lHandCoords, lFingerCoords, torsoCoords, rHipCoords, rKneeCoords, rAnkleCoords, rFootCoords, lHipCoords, lKneeCoords, lAnkleCoords, lFootCoords}; int id; //here we store the skeleton's ID as assigned by OpenNI and sent through OSC. float colors[] = {255, 255, 255};// The color of this skeleton Skeleton(int id) { this.id = id; colors[0] = random(128, 255); colors[1] = random(128, 255); colors[2] = random(128, 255); } } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "HarpaNIMate_ZMQ" }; if (passedArgs != null) { PApplet.main(concat(appletArgs, passedArgs)); } else { PApplet.main(appletArgs); } } }
UTF-8
Java
10,189
java
HarpaNIMate_ZMQ.java
Java
[ { "context": " = context.socket(ZMQ.PUSH);\n sock.bind(\"tcp://127.0.0.1:\" + port);\n byteBuffer = ByteBuffer.allocate(s", "end": 7399, "score": 0.9659484028816223, "start": 7390, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
import processing.core.*; import processing.data.*; import processing.event.*; import processing.opengl.*; import processing.opengl.*; import oscP5.*; import netP5.*; import org.apache.commons.codec.binary.Base64; import org.zeromq.*; import java.io.ByteArrayOutputStream; import java.io.BufferedOutputStream; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.awt.Robot; import java.awt.Rectangle; import javax.imageio.ImageIO; import java.net.*; import java.io.*; import java.nio.*; import org.apache.commons.codec.binary.*; import org.apache.commons.codec.*; import org.apache.commons.codec.digest.*; import org.apache.commons.codec.language.*; import org.apache.commons.codec.language.bm.*; import org.apache.commons.codec.net.*; import org.zeromq.*; import java.util.HashMap; import java.util.ArrayList; import java.io.File; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; public class HarpaNIMate_ZMQ extends PApplet { int harpaWidth = 77; int harpaHeight = 13; OscP5 oscP5; float ballSize = 0.01f; PImage sendImage; Skeleton s = new Skeleton(1); public void settings(){ size(harpaWidth, harpaHeight, P2D); } public void setup() { oscP5 = new OscP5(this, 7000); noStroke(); translate(width/2.0f, height/2.0f); frameRate(25); } /* incoming osc message are forwarded to the oscEvent method. */ // Here you can easily see the format of the OSC messages sent. For each user, the joints are named with // the joint named followed by user ID (head0, neck0 .... r_foot0; head1, neck1.....) public void oscEvent(OscMessage msg) { msg.print(); if (true) { if (msg.addrPattern().equals("Head")) { s.headCoords[0] = msg.get(0).floatValue(); s.headCoords[1] = msg.get(1).floatValue(); s.headCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Neck")) { s.neckCoords[0] = msg.get(0).floatValue(); s.neckCoords[1] = msg.get(1).floatValue(); s.neckCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Collar")) { s.rCollarCoords[0] = msg.get(0).floatValue(); s.rCollarCoords[1] = msg.get(1).floatValue(); s.rCollarCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Shoulder")) { s.rShoulderCoords[0] = msg.get(0).floatValue(); s.rShoulderCoords[1] = msg.get(1).floatValue(); s.rShoulderCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Elbow")) { s.rElbowCoords[0] = msg.get(0).floatValue(); s.rElbowCoords[1] = msg.get(1).floatValue(); s.rElbowCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Wrist")) { s.rWristCoords[0] = msg.get(0).floatValue(); s.rWristCoords[1] = msg.get(1).floatValue(); s.rWristCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Hand")) { s.rHandCoords[0] = msg.get(0).floatValue(); s.rHandCoords[1] = msg.get(1).floatValue(); s.rHandCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Finger")) { s.rFingerCoords[0] = msg.get(0).floatValue(); s.rFingerCoords[1] = msg.get(1).floatValue(); s.rFingerCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Collar")) { s.lCollarCoords[0] = msg.get(0).floatValue(); s.lCollarCoords[1] = msg.get(1).floatValue(); s.lCollarCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Shoulder")) { s.lShoulderCoords[0] = msg.get(0).floatValue(); s.lShoulderCoords[1] = msg.get(1).floatValue(); s.lShoulderCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Elbow")) { s.lElbowCoords[0] = msg.get(0).floatValue(); s.lElbowCoords[1] = msg.get(1).floatValue(); s.lElbowCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Wrist")) { s.lWristCoords[0] = msg.get(0).floatValue(); s.lWristCoords[1] = msg.get(1).floatValue(); s.lWristCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Hand")) { s.lHandCoords[0] = msg.get(0).floatValue(); s.lHandCoords[1] = msg.get(1).floatValue(); s.lHandCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Finger")) { s.lFingerCoords[0] = msg.get(0).floatValue(); s.lFingerCoords[1] = msg.get(1).floatValue(); s.lFingerCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Torso")) { s.torsoCoords[0] = msg.get(0).floatValue(); s.torsoCoords[1] = msg.get(1).floatValue(); s.torsoCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Hip")) { s.rHipCoords[0] = msg.get(0).floatValue(); s.rHipCoords[1] = msg.get(1).floatValue(); s.rHipCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Knee")) { s.rKneeCoords[0] = msg.get(0).floatValue(); s.rKneeCoords[1] = msg.get(1).floatValue(); s.rKneeCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Ankle")) { s.rAnkleCoords[0] = msg.get(0).floatValue(); s.rAnkleCoords[1] = msg.get(1).floatValue(); s.rAnkleCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Right_Foot")) { s.rFootCoords[0] = msg.get(0).floatValue(); s.rFootCoords[1] = msg.get(1).floatValue(); s.rFootCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Hip")) { s.lHipCoords[0] = msg.get(0).floatValue(); s.lHipCoords[1] = msg.get(1).floatValue(); s.lHipCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Knee")) { s.lKneeCoords[0] = msg.get(0).floatValue(); s.lKneeCoords[1] = msg.get(1).floatValue(); s.lKneeCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Ankle")) { s.lAnkleCoords[0] = msg.get(0).floatValue(); s.lAnkleCoords[1] = msg.get(1).floatValue(); s.lAnkleCoords[2] = msg.get(2).floatValue(); } else if (msg.addrPattern().equals("Left_Foot")) { s.lFootCoords[0] = msg.get(0).floatValue(); s.lFootCoords[1] = msg.get(1).floatValue(); s.lFootCoords[2] = msg.get(2).floatValue(); } } } public void draw() { background(255,0,255); fill(255); for (float[] j: s.allCoords) { ellipse((j[0] * width), ( j[1]*height), width * ballSize, width * ballSize); } BufferedImage b = new BufferedImage(harpaWidth,harpaHeight,BufferedImage.TYPE_INT_RGB); loadPixels(); } class HarpaImageSender { ZMQ.Context context; ZMQ.Socket sock; ByteBuffer byteBuffer; IntBuffer intBuffer; // ByteArrayOutputStream baStream; // BufferedOutputStream bos; int portNumber; HarpaImageSender(int port, int sendWidth, int sendHeight) { portNumber = port; context = ZMQ.context(1); sock = context.socket(ZMQ.PUSH); sock.bind("tcp://127.0.0.1:" + port); byteBuffer = ByteBuffer.allocate(sendWidth*sendHeight * 4); // Need these output streams to get image as bytes for UDP // baStream = new ByteArrayOutputStream(); //bos = new BufferedOutputStream(baStream); } public void sendImage(BufferedImage img) { // JPG compression into BufferedOutputStream // Requires try/catch ByteArrayOutputStream baStream = new ByteArrayOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(baStream); try { ImageIO.write(img, "png", bos); } catch (IOException e) { e.printStackTrace(); } sock.send(baStream.toByteArray(),0); } } class Skeleton { // We just use this class as a structure to store the joint coordinates sent by OSC. // The format is {x, y, z}, where x and y are in the [0.0, 1.0] interval, // and z is in the [0.0, 7.0] interval. float headCoords[] = new float[3]; float neckCoords[] = new float[3]; float rCollarCoords[] = new float[3]; float rShoulderCoords[] = new float[3]; float rElbowCoords[] = new float[3]; float rWristCoords[] = new float[3]; float rHandCoords[] = new float[3]; float rFingerCoords[] = new float[3]; float lCollarCoords[] = new float[3]; float lShoulderCoords[] = new float[3]; float lElbowCoords[] = new float[3]; float lWristCoords[] = new float[3]; float lHandCoords[] = new float[3]; float lFingerCoords[] = new float[3]; float torsoCoords[] = new float[3]; float rHipCoords[] = new float[3]; float rKneeCoords[] = new float[3]; float rAnkleCoords[] = new float[3]; float rFootCoords[] = new float[3]; float lHipCoords[] = new float[3]; float lKneeCoords[] = new float[3]; float lAnkleCoords[] = new float[3]; float lFootCoords[] = new float[3]; float[] allCoords[] = {headCoords, neckCoords, rCollarCoords, rShoulderCoords, rElbowCoords, rWristCoords, rHandCoords, rFingerCoords, lCollarCoords, lShoulderCoords, lElbowCoords, lWristCoords, lHandCoords, lFingerCoords, torsoCoords, rHipCoords, rKneeCoords, rAnkleCoords, rFootCoords, lHipCoords, lKneeCoords, lAnkleCoords, lFootCoords}; int id; //here we store the skeleton's ID as assigned by OpenNI and sent through OSC. float colors[] = {255, 255, 255};// The color of this skeleton Skeleton(int id) { this.id = id; colors[0] = random(128, 255); colors[1] = random(128, 255); colors[2] = random(128, 255); } } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "HarpaNIMate_ZMQ" }; if (passedArgs != null) { PApplet.main(concat(appletArgs, passedArgs)); } else { PApplet.main(appletArgs); } } }
10,189
0.636078
0.611346
325
30.350769
23.67108
110
false
false
0
0
0
0
0
0
0.695385
false
false
4
dba4ffbc01a8be0b59f948a64aa0d561584b2eef
23,270,132,865,826
0ed20fe0fc9e1cd76034d5698c4f7dcf42c47a60
/_FDM/_Examples/ExampleCommandDesignPattern/src/com/fdmgroup/TVOnCommand.java
fa6236b1f44764ab201444f70d1ab31b78afd3cc
[]
no_license
Kamurai/EclipseRepository
https://github.com/Kamurai/EclipseRepository
61371f858ff82dfdfc70c3de16fd3322222759ed
4af50d1f63a76faf3e04a15129c0ed098fc6c545
refs/heads/master
2022-12-22T13:05:13.965000
2020-11-05T03:42:09
2020-11-05T03:42:09
101,127,637
0
0
null
false
2022-12-16T13:43:14
2017-08-23T02:18:08
2022-12-16T06:51:24
2022-12-16T13:43:10
144,158
1
0
29
Java
false
false
package com.fdmgroup; //Concrete Command public class TVOnCommand implements Command { //reference to the Television class Television tv; public TVOnCommand(Television tv) { this.tv = tv; } public void execute() { tv.switchOn(); } @Override public void executeNumeric(int NumericInput) { // TODO Auto-generated method stub } }
UTF-8
Java
356
java
TVOnCommand.java
Java
[]
null
[]
package com.fdmgroup; //Concrete Command public class TVOnCommand implements Command { //reference to the Television class Television tv; public TVOnCommand(Television tv) { this.tv = tv; } public void execute() { tv.switchOn(); } @Override public void executeNumeric(int NumericInput) { // TODO Auto-generated method stub } }
356
0.705056
0.705056
25
13.24
15.018069
47
false
false
0
0
0
0
0
0
1
false
false
4
85185de069df0725b845db5d17a5c15f9ec57e37
23,270,132,864,264
5470c3f23ff6910dfa27325b061b4b406e13e2ad
/src/main/java/skunk/slack/crawler/util/ModelCreator.java
cdc5262efdc8b7c59f5d2546620420d59b6628f9
[]
no_license
liang33x/slack-crawler
https://github.com/liang33x/slack-crawler
52eea9790b53b5fdc184ff98a4c704b84a428fb6
0b351bd3419bf99686913d012b32833e26f4fe5c
refs/heads/master
2021-06-21T15:05:31.397000
2017-07-29T11:54:41
2017-07-29T11:54:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package skunk.slack.crawler.util; import java.lang.reflect.Field; import java.math.BigDecimal; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; @Slf4j public class ModelCreator { private static final Gson gson = new Gson(); private static final Set<Class<?>> NATIVE_TYPES = new HashSet<>( Arrays.asList(Integer.class, Boolean.class, Byte.class, Short.class, Long.class, BigDecimal.class, Float.class, Time.class, Date.class, Timestamp.class, String.class, UUID.class)); private static Set<String> EXCLUDED_FIELD_NAME = new HashSet<>(Arrays.asList("this$0", "ANNOTATION", "ENUM", "SYNTHETIC", "cachedConstructor", "newInstanceCallerCache", "allPermDomain", "useCaches", "reflectionData", "classRedefinedCount", "genericInfo", "serialVersionUID", "serialPersistentFields", "reflectionFactory", "initted", "enumConstants", "enumConstantDirectory", "annotationData", "annotationType", "classValueMap")); private Map<Object, Map<String, Object>> processedObjectMap = new HashMap<>(); private ModelCreator() { } public static String createJsonModelFromCollectionOfMap(Collection<Map<String, Object>> arrayOfMap) { return gson.toJson(arrayOfMap); } public static String createJsonModelFromCollection(Collection<?> arrayOfObj) { return gson.toJson(createModelFromCollection(arrayOfObj)); } public static List<Map<String, Object>> createModelFromCollection(Collection<?> arrayOfObj) { return arrayOfObj.stream().map(ModelCreator::createModel).collect(Collectors.toList()); } public static String createJsonModel(Object obj) { return gson.toJson(createModel(obj)); } public static Map<String, Object> createModel(Object obj) { return new ModelCreator().getModel(obj); } private Map<String, Object> getModel(Object obj) { Map<String, Object> map = new HashMap<>(); if (processedObjectMap.containsKey(obj)) { return processedObjectMap.get(obj); } processedObjectMap.put(obj, map); getFieldsOf(obj.getClass()).stream().forEach(field -> mapField(field, obj, map, true)); return map; } private Map<String, Object> getModelWithoutCircularReference(Object obj) { Map<String, Object> map = new HashMap<>(); if (processedObjectMap.containsKey(obj)) { return null; } processedObjectMap.put(obj, map); getFieldsOf(obj.getClass()).stream().forEach(field -> mapField(field, obj, map, false)); return map; } @SuppressWarnings("unchecked") private void mapField(Field field, Object obj, Map<String, Object> map, boolean circularReference) { Object value; try { field.setAccessible(true); value = field.get(obj); } catch (IllegalArgumentException | IllegalAccessException e1) { log.error("failed to get value of {}.{}", obj.getClass().getName(), field.getName(), e1); return; } if (Objects.isNull(value)) { map.put(field.getName(), null); } else if (isNativeTypeField(field)) { map.put(field.getName(), value); } else if (isCollectionField(field)) { map.put(field.getName(), getValueFromCollectionFiled((Collection<Object>) value)); } else if (field.getType().isEnum()) { map.put(field.getName(), value.toString()); } else { if (circularReference) { map.put(field.getName(), getModel(value)); } else { Map<String, Object> childMap = getModelWithoutCircularReference(obj); if (Objects.nonNull(childMap)) { map.put(field.getName(), childMap); } } } } private List<Object> getValueFromCollectionFiled(Collection<Object> collection) { List<Object> list = new ArrayList<>(); for (Object obj : collection) { if (NATIVE_TYPES.contains(obj.getClass())) { list.add(obj); } else { list.add(getModel(obj)); } } return list; } private static boolean isNativeTypeField(Field field) { Class<?> type = field.getType(); return NATIVE_TYPES.contains(type); } private static boolean isCollectionField(Field field) { Class<?> type = field.getType(); return Collection.class.isAssignableFrom(type); } private static List<Field> getFieldsOf(Class<?> clazz) { List<Field> fields = Arrays.asList((clazz.getDeclaredFields())).stream() .filter(f -> !EXCLUDED_FIELD_NAME.contains(f.getName())).collect(Collectors.toList()); Class<?> superClass = clazz.getSuperclass(); if (Objects.isNull(superClass) || superClass.equals(Object.class) || superClass.equals(Enum.class)) { return fields; } fields.addAll(getFieldsOf(superClass)); return fields; } }
UTF-8
Java
4,803
java
ModelCreator.java
Java
[]
null
[]
package skunk.slack.crawler.util; import java.lang.reflect.Field; import java.math.BigDecimal; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; @Slf4j public class ModelCreator { private static final Gson gson = new Gson(); private static final Set<Class<?>> NATIVE_TYPES = new HashSet<>( Arrays.asList(Integer.class, Boolean.class, Byte.class, Short.class, Long.class, BigDecimal.class, Float.class, Time.class, Date.class, Timestamp.class, String.class, UUID.class)); private static Set<String> EXCLUDED_FIELD_NAME = new HashSet<>(Arrays.asList("this$0", "ANNOTATION", "ENUM", "SYNTHETIC", "cachedConstructor", "newInstanceCallerCache", "allPermDomain", "useCaches", "reflectionData", "classRedefinedCount", "genericInfo", "serialVersionUID", "serialPersistentFields", "reflectionFactory", "initted", "enumConstants", "enumConstantDirectory", "annotationData", "annotationType", "classValueMap")); private Map<Object, Map<String, Object>> processedObjectMap = new HashMap<>(); private ModelCreator() { } public static String createJsonModelFromCollectionOfMap(Collection<Map<String, Object>> arrayOfMap) { return gson.toJson(arrayOfMap); } public static String createJsonModelFromCollection(Collection<?> arrayOfObj) { return gson.toJson(createModelFromCollection(arrayOfObj)); } public static List<Map<String, Object>> createModelFromCollection(Collection<?> arrayOfObj) { return arrayOfObj.stream().map(ModelCreator::createModel).collect(Collectors.toList()); } public static String createJsonModel(Object obj) { return gson.toJson(createModel(obj)); } public static Map<String, Object> createModel(Object obj) { return new ModelCreator().getModel(obj); } private Map<String, Object> getModel(Object obj) { Map<String, Object> map = new HashMap<>(); if (processedObjectMap.containsKey(obj)) { return processedObjectMap.get(obj); } processedObjectMap.put(obj, map); getFieldsOf(obj.getClass()).stream().forEach(field -> mapField(field, obj, map, true)); return map; } private Map<String, Object> getModelWithoutCircularReference(Object obj) { Map<String, Object> map = new HashMap<>(); if (processedObjectMap.containsKey(obj)) { return null; } processedObjectMap.put(obj, map); getFieldsOf(obj.getClass()).stream().forEach(field -> mapField(field, obj, map, false)); return map; } @SuppressWarnings("unchecked") private void mapField(Field field, Object obj, Map<String, Object> map, boolean circularReference) { Object value; try { field.setAccessible(true); value = field.get(obj); } catch (IllegalArgumentException | IllegalAccessException e1) { log.error("failed to get value of {}.{}", obj.getClass().getName(), field.getName(), e1); return; } if (Objects.isNull(value)) { map.put(field.getName(), null); } else if (isNativeTypeField(field)) { map.put(field.getName(), value); } else if (isCollectionField(field)) { map.put(field.getName(), getValueFromCollectionFiled((Collection<Object>) value)); } else if (field.getType().isEnum()) { map.put(field.getName(), value.toString()); } else { if (circularReference) { map.put(field.getName(), getModel(value)); } else { Map<String, Object> childMap = getModelWithoutCircularReference(obj); if (Objects.nonNull(childMap)) { map.put(field.getName(), childMap); } } } } private List<Object> getValueFromCollectionFiled(Collection<Object> collection) { List<Object> list = new ArrayList<>(); for (Object obj : collection) { if (NATIVE_TYPES.contains(obj.getClass())) { list.add(obj); } else { list.add(getModel(obj)); } } return list; } private static boolean isNativeTypeField(Field field) { Class<?> type = field.getType(); return NATIVE_TYPES.contains(type); } private static boolean isCollectionField(Field field) { Class<?> type = field.getType(); return Collection.class.isAssignableFrom(type); } private static List<Field> getFieldsOf(Class<?> clazz) { List<Field> fields = Arrays.asList((clazz.getDeclaredFields())).stream() .filter(f -> !EXCLUDED_FIELD_NAME.contains(f.getName())).collect(Collectors.toList()); Class<?> superClass = clazz.getSuperclass(); if (Objects.isNull(superClass) || superClass.equals(Object.class) || superClass.equals(Enum.class)) { return fields; } fields.addAll(getFieldsOf(superClass)); return fields; } }
4,803
0.723506
0.722257
142
32.823944
30.865063
110
false
false
0
0
0
0
0
0
2.450704
false
false
4
5ee04c8e80685dbc8ad284d6406b45020647a963
13,993,003,494,594
539ba246d56f0e624104b0b8a6691808bffd552c
/pac4/client/src/main/java/ss3/gui/Reparaciones.java
a668182884fdc2b0e6b9f1bb30baf2652685bc31
[]
no_license
esaugm/TDP_Grup6
https://github.com/esaugm/TDP_Grup6
a09026cb2490b6b3724ef3a62984770aa9af2d58
5e09035a3f93b43f0b8288d9eef4f26bdf9988b3
refs/heads/master
2020-07-24T19:35:07.581000
2013-05-26T21:35:45
2013-05-26T21:35:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ss3.gui; import common.rmi.Client; import java.rmi.RemoteException; import java.sql.Date; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.table.DefaultTableModel; import ss1.dao.exception.ExceptionErrorDataBase; import ss1.dao.exception.ExceptionTipoObjetoFiltroNoPermitido; import ss2.entity.Solicitud; import ss2.exception.AppException; import ss3.beans.Reparacion; import ss3.beans.Vehiculo; /** * * @author Fernando */ public class Reparaciones extends JPanel { /** * Creates new form Reparaciones */ public Client cliente; JTable jTable1; JScrollPane scrollPane; public Reparaciones(Client cli) throws ExceptionErrorDataBase, RemoteException { cliente = cli; initComponents(); jTable1 = crearTabla(); scrollPane = new JScrollPane(); scrollPane.setBounds(12, 190, 830, 125); add(scrollPane); scrollPane.setViewportView(jTable1); rellenaTabla(cliente.ConsultaTodas()); } public void rellenaTabla(ArrayList<Reparacion> repa) throws AppException, ExceptionErrorDataBase, RemoteException { try { DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel(); int rowCount = tableModel.getRowCount(); Iterator itRep = repa.iterator(); int i=0; Reparacion r1 = new Reparacion(); Solicitud s1 = new Solicitud(); Vehiculo v1 = new Vehiculo(); while (itRep.hasNext()){ r1 = (Reparacion) itRep.next(); s1 = cliente.buscaSolicitudbynumrep(r1.getIdOrden()); v1 = cliente.ConsultaReparacion(r1.getIdOrden()); if (r1.getIdOrden() > 0){ if(i==rowCount-1) tableModel.addRow(new Object[]{}); tableModel.setValueAt(r1.getIdOrden(), i, 0); tableModel.setValueAt(s1.getDataAlta(),i,1); tableModel.setValueAt(r1.getContador(),i,2); tableModel.setValueAt(v1.getMatricula(),i,3); tableModel.setValueAt(v1.getMarca(),i,4); tableModel.setValueAt(v1.getModelo(),i,5); tableModel.setValueAt(r1.getObservaciones(),i,6); if (r1.isAceptada()) tableModel.setValueAt("SI",i,7); else tableModel.setValueAt("NO",i,7); if (r1.isAsignada()) tableModel.setValueAt("SI",i,8); else tableModel.setValueAt("NO",i,8); i++; } } for (int rowIdx=i;rowIdx<rowCount ;rowIdx++){ tableModel.setValueAt("",rowIdx,0); tableModel.setValueAt("",rowIdx,1); tableModel.setValueAt("",rowIdx,2); tableModel.setValueAt("",rowIdx,3); tableModel.setValueAt("",rowIdx,4); tableModel.setValueAt("",rowIdx,5); tableModel.setValueAt("",rowIdx,6); tableModel.setValueAt("",rowIdx,7); tableModel.setValueAt("",rowIdx,8); } jTable1 = createTabla(tableModel); scrollPane.setViewportView(jTable1); } catch (ExceptionErrorDataBase exceptionErrorDataBase) { //todo pensar que se hace aqui exceptionErrorDataBase.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (RemoteException e1) { e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } private JTable crearTabla() { DefaultTableModel tableModel = (new DefaultTableModel( new Object[][] { {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, }, new String[] {"Orden","Fecha Entrada","Cont. Minutos", "Matrícula","Marca","Modelo","Observaciones","Aceptada","Asignada"} ){ Class[] columnTypes = new Class[] { Integer.class, String.class, Integer.class, String.class, String.class, String.class, String.class, String.class, String.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); return createTabla(tableModel); } private JTable createTabla(DefaultTableModel tableModel) { JTable table = new JTable(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setCellSelectionEnabled(false); table.setColumnSelectionAllowed(false); table.setModel(tableModel); table.setRowSelectionAllowed(true); table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(0).setPreferredWidth(75); table.getColumnModel().getColumn(0).setMinWidth(75); table.getColumnModel().getColumn(0).setMaxWidth(75); table.getColumnModel().getColumn(1).setResizable(false); table.getColumnModel().getColumn(1).setPreferredWidth(100); table.getColumnModel().getColumn(1).setMinWidth(100); table.getColumnModel().getColumn(1).setMaxWidth(100); table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setMinWidth(80); table.getColumnModel().getColumn(2).setMaxWidth(80); table.getColumnModel().getColumn(3).setPreferredWidth(80); table.getColumnModel().getColumn(3).setMinWidth(80); table.getColumnModel().getColumn(3).setMaxWidth(80); table.getColumnModel().getColumn(4).setPreferredWidth(80); table.getColumnModel().getColumn(4).setMinWidth(80); table.getColumnModel().getColumn(4).setMaxWidth(80); table.getColumnModel().getColumn(5).setPreferredWidth(80); table.getColumnModel().getColumn(5).setMinWidth(80); table.getColumnModel().getColumn(5).setMaxWidth(80); table.getColumnModel().getColumn(6).setPreferredWidth(205); table.getColumnModel().getColumn(6).setMinWidth(205); table.getColumnModel().getColumn(6).setMaxWidth(205); table.getColumnModel().getColumn(7).setResizable(false); table.getColumnModel().getColumn(7).setPreferredWidth(56); table.getColumnModel().getColumn(7).setMinWidth(56); table.getColumnModel().getColumn(7).setMaxWidth(56); table.getColumnModel().getColumn(8).setResizable(false); table.getColumnModel().getColumn(8).setPreferredWidth(56); table.getColumnModel().getColumn(8).setMinWidth(56); table.getColumnModel().getColumn(8).setMaxWidth(56); table.setBounds(12, 350, 830, 125); return table; } /** * 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() { jLabel1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jTextField6 = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jTextField8 = new javax.swing.JTextField(); jTextField9 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jCheckBox1 = new javax.swing.JCheckBox(); jCheckBox2 = new javax.swing.JCheckBox(); jButton8 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jButton12 = new javax.swing.JButton(); jButton13 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jTextField5 = new javax.swing.JTextField(); jTextField13 = new javax.swing.JTextField(); jTextField14 = new javax.swing.JTextField(); jTextField15 = new javax.swing.JTextField(); jTextField16 = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jTextField17 = new javax.swing.JTextField(); jTextField18 = new javax.swing.JTextField(); jTextField19 = new javax.swing.JTextField(); setLayout(null); jLabel1.setFont(new java.awt.Font("Lucida Grande", 1, 36)); // NOI18N jLabel1.setText("Reparación"); add(jLabel1); jLabel1.setBounds(324, 11, 196, 51); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel1.setLayout(null); jLabel8.setText("De (aaaa-mm-dd)"); jPanel1.add(jLabel8); jLabel8.setBounds(440, 16, 101, 14); jLabel9.setText("Hasta (aaa-mm-dd)"); jPanel1.add(jLabel9); jLabel9.setBounds(440, 57, 101, 14); jPanel1.add(jTextField6); jTextField6.setBounds(551, 13, 71, 20); jPanel1.add(jTextField7); jTextField7.setBounds(551, 54, 71, 20); jLabel10.setText("Nombre Cliente"); jPanel1.add(jLabel10); jLabel10.setBounds(632, 16, 79, 14); jLabel11.setText("Apellido Cliente"); jPanel1.add(jLabel11); jLabel11.setBounds(632, 57, 79, 14); jPanel1.add(jTextField8); jTextField8.setBounds(715, 13, 98, 20); jPanel1.add(jTextField9); jTextField9.setBounds(715, 54, 98, 20); jLabel2.setText("Nº Orden"); jPanel1.add(jLabel2); jLabel2.setBounds(20, 20, 51, 14); jPanel1.add(jTextField1); jTextField1.setBounds(70, 20, 63, 20); jLabel3.setText("Matricula"); jPanel1.add(jLabel3); jLabel3.setBounds(160, 20, 54, 14); jPanel1.add(jTextField2); jTextField2.setBounds(220, 20, 75, 20); jLabel4.setText("Marca"); jPanel1.add(jLabel4); jLabel4.setBounds(160, 50, 46, 14); jPanel1.add(jTextField3); jTextField3.setBounds(220, 50, 75, 20); jLabel5.setText("Modelo"); jPanel1.add(jLabel5); jLabel5.setBounds(160, 90, 46, 14); jPanel1.add(jTextField4); jTextField4.setBounds(220, 80, 75, 20); jCheckBox1.setText("¿Aceptada?"); jPanel1.add(jCheckBox1); jCheckBox1.setBounds(331, 12, 81, 23); jCheckBox2.setText("¿Asignada?"); jPanel1.add(jCheckBox2); jCheckBox2.setBounds(333, 53, 79, 23); add(jPanel1); jPanel1.setBounds(10, 68, 0, 120); jButton8.setText("Consultar/Filtrar"); jButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton8ActionPerformed(evt); } }); add(jButton8); jButton8.setBounds(10, 360, 140, 52); jButton9.setText("Detalle"); jButton9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton9ActionPerformed(evt); } }); add(jButton9); jButton9.setBounds(290, 360, 90, 52); jButton10.setText("Aceptar"); jButton10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton10ActionPerformed(evt); } }); add(jButton10); jButton10.setBounds(380, 360, 90, 52); jButton11.setText("Asignar"); jButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton11ActionPerformed(evt); } }); add(jButton11); jButton11.setBounds(470, 360, 100, 52); jButton12.setText("Finalizar"); jButton12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton12ActionPerformed(evt); } }); add(jButton12); jButton12.setBounds(570, 360, 90, 52); jButton13.setText("Salir"); jButton13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton13ActionPerformed(evt); } }); add(jButton13); jButton13.setBounds(750, 360, 93, 52); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jLabel6.setText("Nº Orden"); jLabel7.setText("Matricula"); jLabel12.setText("Marca"); jLabel13.setText("Modelo"); jLabel14.setText("Desde (aaaa-mm-dd)"); jLabel15.setText("Hasta (aaaa-mm-dd)"); jLabel16.setText("Nombre Cliente"); jLabel17.setText("Apellido Cliente"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(21, 21, 21) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(60, 60, 60)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE) .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField13, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE) .addComponent(jTextField16)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE) .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(34, 34, 34)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14) .addComponent(jLabel16) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12) .addComponent(jLabel15) .addComponent(jLabel17) .addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel13) .addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(19, Short.MAX_VALUE)) ); add(jPanel2); jPanel2.setBounds(10, 70, 830, 110); }// </editor-fold>//GEN-END:initComponents private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed // TODO add your handling code here: Map values = new LinkedHashMap(); try { if (!jTextField14.getText().isEmpty()) { values.put("nomCliente", jTextField14.getText()); } if (!jTextField15.getText().isEmpty()) { values.put("apeCliente", jTextField15.getText()); } if (!jTextField13.getText().isEmpty()) { values.put("desde", jTextField13.getText()); } if (!jTextField16.getText().isEmpty()) { values.put("hasta", jTextField16.getText()); } if (!jTextField5.getText().isEmpty()) { values.put("orden", jTextField5.getText()); } if (!jTextField17.getText().isEmpty()) { values.put("matricula", jTextField17.getText()); } if (!jTextField18.getText().isEmpty()) { values.put("marca", jTextField18.getText()); } if (!jTextField19.getText().isEmpty()) { values.put("modelo", jTextField19.getText()); } rellenaTabla(cliente.ConsultaReparacionesByTerms(values)); } catch (RemoteException e1) { e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } }//GEN-LAST:event_jButton8ActionPerformed private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed // TODO add your handling code here: DetalleReparacionAsig dra; try { dra = new DetalleReparacionAsig(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); dra.setVisible(true); dra.setModal(true); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } }//GEN-LAST:event_jButton9ActionPerformed private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed // TODO add your handling code here: if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("NO")) try { cliente.aceptaReparacion((Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0)); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } PiezasReparacion pr; try { pr = new PiezasReparacion(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); pr.setVisible(true); pr.setModal(true); } catch (RemoteException ex) { ex.printStackTrace(); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } }//GEN-LAST:event_jButton10ActionPerformed private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed //Si está aceptada pero no asignada a Mecanico, abrirá la pantalla AsignarAMecanico //Si está aceptada y asignada, mostrará un mensaje indicando que ya está asignada y dará la posibilidad de asignar otro //Si no está aceptada y pulsamos en ASignada, saldrá un mensaje indicando que aún no se ha aceptado la orden if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("SI")&&jTable1.getValueAt(jTable1.getSelectedRow(), 8).equals("NO")){ AsignacionAMecanico aam; try { aam = new AsignacionAMecanico(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); aam.setVisible(true); aam.setModal(true); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } catch (ExceptionTipoObjetoFiltroNoPermitido ex) { ex.printStackTrace(); } } if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("SI")&&jTable1.getValueAt(jTable1.getSelectedRow(), 8).equals("SI")){ AsignacionAMecanico aam; try { aam = new AsignacionAMecanico(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); aam.setVisible(true); aam.setModal(true); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } catch (ExceptionTipoObjetoFiltroNoPermitido ex) { ex.printStackTrace(); } Avisos av = new Avisos("Esta reparación ya asignada, sin embargo, puede cambiar al mecánico si lo desea."); av.setVisible(true); av.setModal(true); } if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("NO")){ Avisos av = new Avisos("Esta reparación aún no ha sido aceptada."); av.setVisible(true); av.setModal(true); } jButton8ActionPerformed(evt); }//GEN-LAST:event_jButton11ActionPerformed private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed // TODO add your handling code here: Avisos av=null; if(jTable1.getValueAt(jTable1.getSelectedRow(),7).equals("NO")){ av = new Avisos("Esta reparación aún no ha sido aceptada. No puede finalizarse"); av.setVisible(true); av.setModal(true); }else{ try { Solicitud sol = cliente.buscaSolicitudbynumrep((Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0)); if (sol.getFinalitzada()){ av = new Avisos("Esta reparación ya está finalizada."); av.setVisible(true); av.setModal(true); }else{ sol.setFinalitzada(true); cliente.modificaSolicitud(sol); } } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } jButton8ActionPerformed(evt); } }//GEN-LAST:event_jButton12ActionPerformed private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed // TODO add your handling code here: setVisible(false); }//GEN-LAST:event_jButton13ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton10; private javax.swing.JButton jButton11; private javax.swing.JButton jButton12; private javax.swing.JButton jButton13; private javax.swing.JButton jButton8; private javax.swing.JButton jButton9; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField13; private javax.swing.JTextField jTextField14; private javax.swing.JTextField jTextField15; private javax.swing.JTextField jTextField16; private javax.swing.JTextField jTextField17; private javax.swing.JTextField jTextField18; private javax.swing.JTextField jTextField19; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JTextField jTextField8; private javax.swing.JTextField jTextField9; // End of variables declaration//GEN-END:variables }
UTF-8
Java
33,336
java
Reparaciones.java
Java
[ { "context": "cion;\nimport ss3.beans.Vehiculo;\n/**\n *\n * @author Fernando\n */\npublic class Reparaciones extends JPanel {\n\n ", "end": 697, "score": 0.9996864795684814, "start": 689, "tag": "NAME", "value": "Fernando" }, { "context": "unds(551, 54, 71, 20);\n\n jLabel10.setText(\"Nombre Cliente\");\n jPanel1.add(jLabel10);\n jLabel1", "end": 11787, "score": 0.5766350626945496, "start": 11773, "tag": "NAME", "value": "Nombre Cliente" }, { "context": ", 16, 79, 14);\n\n jLabel11.setText(\"Apellido Cliente\");\n jPanel1.add(jLabel11);\n jLabel1", "end": 11910, "score": 0.5812897682189941, "start": 11903, "tag": "NAME", "value": "Cliente" }, { "context": "Bounds(70, 20, 63, 20);\n\n jLabel3.setText(\"Matricula\");\n jPanel1.add(jLabel3);\n jLabel3.", "end": 12381, "score": 0.9997269511222839, "start": 12372, "tag": "NAME", "value": "Matricula" }, { "context": "ounds(220, 20, 75, 20);\n\n jLabel4.setText(\"Marca\");\n jPanel1.add(jLabel4);\n jLabel4.", "end": 12572, "score": 0.999755859375, "start": 12567, "tag": "NAME", "value": "Marca" }, { "context": "l6.setText(\"Nº Orden\");\n\n jLabel7.setText(\"Matricula\");\n\n jLabel12.setText(\"Marca\");\n\n j", "end": 15372, "score": 0.9929547309875488, "start": 15363, "tag": "NAME", "value": "Matricula" }, { "context": ".setText(\"Matricula\");\n\n jLabel12.setText(\"Marca\");\n\n jLabel13.setText(\"Modelo\");\n\n ", "end": 15408, "score": 0.9967946410179138, "start": 15403, "tag": "NAME", "value": "Marca" }, { "context": "ext(\"Nombre Cliente\");\n\n jLabel17.setText(\"Apellido Cliente\");\n\n javax.swing.GroupLayout jPanel2Layout", "end": 15635, "score": 0.9944520592689514, "start": 15619, "tag": "NAME", "value": "Apellido Cliente" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ss3.gui; import common.rmi.Client; import java.rmi.RemoteException; import java.sql.Date; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.table.DefaultTableModel; import ss1.dao.exception.ExceptionErrorDataBase; import ss1.dao.exception.ExceptionTipoObjetoFiltroNoPermitido; import ss2.entity.Solicitud; import ss2.exception.AppException; import ss3.beans.Reparacion; import ss3.beans.Vehiculo; /** * * @author Fernando */ public class Reparaciones extends JPanel { /** * Creates new form Reparaciones */ public Client cliente; JTable jTable1; JScrollPane scrollPane; public Reparaciones(Client cli) throws ExceptionErrorDataBase, RemoteException { cliente = cli; initComponents(); jTable1 = crearTabla(); scrollPane = new JScrollPane(); scrollPane.setBounds(12, 190, 830, 125); add(scrollPane); scrollPane.setViewportView(jTable1); rellenaTabla(cliente.ConsultaTodas()); } public void rellenaTabla(ArrayList<Reparacion> repa) throws AppException, ExceptionErrorDataBase, RemoteException { try { DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel(); int rowCount = tableModel.getRowCount(); Iterator itRep = repa.iterator(); int i=0; Reparacion r1 = new Reparacion(); Solicitud s1 = new Solicitud(); Vehiculo v1 = new Vehiculo(); while (itRep.hasNext()){ r1 = (Reparacion) itRep.next(); s1 = cliente.buscaSolicitudbynumrep(r1.getIdOrden()); v1 = cliente.ConsultaReparacion(r1.getIdOrden()); if (r1.getIdOrden() > 0){ if(i==rowCount-1) tableModel.addRow(new Object[]{}); tableModel.setValueAt(r1.getIdOrden(), i, 0); tableModel.setValueAt(s1.getDataAlta(),i,1); tableModel.setValueAt(r1.getContador(),i,2); tableModel.setValueAt(v1.getMatricula(),i,3); tableModel.setValueAt(v1.getMarca(),i,4); tableModel.setValueAt(v1.getModelo(),i,5); tableModel.setValueAt(r1.getObservaciones(),i,6); if (r1.isAceptada()) tableModel.setValueAt("SI",i,7); else tableModel.setValueAt("NO",i,7); if (r1.isAsignada()) tableModel.setValueAt("SI",i,8); else tableModel.setValueAt("NO",i,8); i++; } } for (int rowIdx=i;rowIdx<rowCount ;rowIdx++){ tableModel.setValueAt("",rowIdx,0); tableModel.setValueAt("",rowIdx,1); tableModel.setValueAt("",rowIdx,2); tableModel.setValueAt("",rowIdx,3); tableModel.setValueAt("",rowIdx,4); tableModel.setValueAt("",rowIdx,5); tableModel.setValueAt("",rowIdx,6); tableModel.setValueAt("",rowIdx,7); tableModel.setValueAt("",rowIdx,8); } jTable1 = createTabla(tableModel); scrollPane.setViewportView(jTable1); } catch (ExceptionErrorDataBase exceptionErrorDataBase) { //todo pensar que se hace aqui exceptionErrorDataBase.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (RemoteException e1) { e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } private JTable crearTabla() { DefaultTableModel tableModel = (new DefaultTableModel( new Object[][] { {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null}, }, new String[] {"Orden","Fecha Entrada","Cont. Minutos", "Matrícula","Marca","Modelo","Observaciones","Aceptada","Asignada"} ){ Class[] columnTypes = new Class[] { Integer.class, String.class, Integer.class, String.class, String.class, String.class, String.class, String.class, String.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); return createTabla(tableModel); } private JTable createTabla(DefaultTableModel tableModel) { JTable table = new JTable(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setCellSelectionEnabled(false); table.setColumnSelectionAllowed(false); table.setModel(tableModel); table.setRowSelectionAllowed(true); table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(0).setPreferredWidth(75); table.getColumnModel().getColumn(0).setMinWidth(75); table.getColumnModel().getColumn(0).setMaxWidth(75); table.getColumnModel().getColumn(1).setResizable(false); table.getColumnModel().getColumn(1).setPreferredWidth(100); table.getColumnModel().getColumn(1).setMinWidth(100); table.getColumnModel().getColumn(1).setMaxWidth(100); table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setMinWidth(80); table.getColumnModel().getColumn(2).setMaxWidth(80); table.getColumnModel().getColumn(3).setPreferredWidth(80); table.getColumnModel().getColumn(3).setMinWidth(80); table.getColumnModel().getColumn(3).setMaxWidth(80); table.getColumnModel().getColumn(4).setPreferredWidth(80); table.getColumnModel().getColumn(4).setMinWidth(80); table.getColumnModel().getColumn(4).setMaxWidth(80); table.getColumnModel().getColumn(5).setPreferredWidth(80); table.getColumnModel().getColumn(5).setMinWidth(80); table.getColumnModel().getColumn(5).setMaxWidth(80); table.getColumnModel().getColumn(6).setPreferredWidth(205); table.getColumnModel().getColumn(6).setMinWidth(205); table.getColumnModel().getColumn(6).setMaxWidth(205); table.getColumnModel().getColumn(7).setResizable(false); table.getColumnModel().getColumn(7).setPreferredWidth(56); table.getColumnModel().getColumn(7).setMinWidth(56); table.getColumnModel().getColumn(7).setMaxWidth(56); table.getColumnModel().getColumn(8).setResizable(false); table.getColumnModel().getColumn(8).setPreferredWidth(56); table.getColumnModel().getColumn(8).setMinWidth(56); table.getColumnModel().getColumn(8).setMaxWidth(56); table.setBounds(12, 350, 830, 125); return table; } /** * 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() { jLabel1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jTextField6 = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jTextField8 = new javax.swing.JTextField(); jTextField9 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jCheckBox1 = new javax.swing.JCheckBox(); jCheckBox2 = new javax.swing.JCheckBox(); jButton8 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jButton12 = new javax.swing.JButton(); jButton13 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jTextField5 = new javax.swing.JTextField(); jTextField13 = new javax.swing.JTextField(); jTextField14 = new javax.swing.JTextField(); jTextField15 = new javax.swing.JTextField(); jTextField16 = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jTextField17 = new javax.swing.JTextField(); jTextField18 = new javax.swing.JTextField(); jTextField19 = new javax.swing.JTextField(); setLayout(null); jLabel1.setFont(new java.awt.Font("Lucida Grande", 1, 36)); // NOI18N jLabel1.setText("Reparación"); add(jLabel1); jLabel1.setBounds(324, 11, 196, 51); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel1.setLayout(null); jLabel8.setText("De (aaaa-mm-dd)"); jPanel1.add(jLabel8); jLabel8.setBounds(440, 16, 101, 14); jLabel9.setText("Hasta (aaa-mm-dd)"); jPanel1.add(jLabel9); jLabel9.setBounds(440, 57, 101, 14); jPanel1.add(jTextField6); jTextField6.setBounds(551, 13, 71, 20); jPanel1.add(jTextField7); jTextField7.setBounds(551, 54, 71, 20); jLabel10.setText("<NAME>"); jPanel1.add(jLabel10); jLabel10.setBounds(632, 16, 79, 14); jLabel11.setText("Apellido Cliente"); jPanel1.add(jLabel11); jLabel11.setBounds(632, 57, 79, 14); jPanel1.add(jTextField8); jTextField8.setBounds(715, 13, 98, 20); jPanel1.add(jTextField9); jTextField9.setBounds(715, 54, 98, 20); jLabel2.setText("Nº Orden"); jPanel1.add(jLabel2); jLabel2.setBounds(20, 20, 51, 14); jPanel1.add(jTextField1); jTextField1.setBounds(70, 20, 63, 20); jLabel3.setText("Matricula"); jPanel1.add(jLabel3); jLabel3.setBounds(160, 20, 54, 14); jPanel1.add(jTextField2); jTextField2.setBounds(220, 20, 75, 20); jLabel4.setText("Marca"); jPanel1.add(jLabel4); jLabel4.setBounds(160, 50, 46, 14); jPanel1.add(jTextField3); jTextField3.setBounds(220, 50, 75, 20); jLabel5.setText("Modelo"); jPanel1.add(jLabel5); jLabel5.setBounds(160, 90, 46, 14); jPanel1.add(jTextField4); jTextField4.setBounds(220, 80, 75, 20); jCheckBox1.setText("¿Aceptada?"); jPanel1.add(jCheckBox1); jCheckBox1.setBounds(331, 12, 81, 23); jCheckBox2.setText("¿Asignada?"); jPanel1.add(jCheckBox2); jCheckBox2.setBounds(333, 53, 79, 23); add(jPanel1); jPanel1.setBounds(10, 68, 0, 120); jButton8.setText("Consultar/Filtrar"); jButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton8ActionPerformed(evt); } }); add(jButton8); jButton8.setBounds(10, 360, 140, 52); jButton9.setText("Detalle"); jButton9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton9ActionPerformed(evt); } }); add(jButton9); jButton9.setBounds(290, 360, 90, 52); jButton10.setText("Aceptar"); jButton10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton10ActionPerformed(evt); } }); add(jButton10); jButton10.setBounds(380, 360, 90, 52); jButton11.setText("Asignar"); jButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton11ActionPerformed(evt); } }); add(jButton11); jButton11.setBounds(470, 360, 100, 52); jButton12.setText("Finalizar"); jButton12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton12ActionPerformed(evt); } }); add(jButton12); jButton12.setBounds(570, 360, 90, 52); jButton13.setText("Salir"); jButton13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton13ActionPerformed(evt); } }); add(jButton13); jButton13.setBounds(750, 360, 93, 52); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jLabel6.setText("Nº Orden"); jLabel7.setText("Matricula"); jLabel12.setText("Marca"); jLabel13.setText("Modelo"); jLabel14.setText("Desde (aaaa-mm-dd)"); jLabel15.setText("Hasta (aaaa-mm-dd)"); jLabel16.setText("Nombre Cliente"); jLabel17.setText("<NAME>"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(21, 21, 21) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(60, 60, 60)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE) .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField13, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE) .addComponent(jTextField16)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE) .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(34, 34, 34)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14) .addComponent(jLabel16) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12) .addComponent(jLabel15) .addComponent(jLabel17) .addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel13) .addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(19, Short.MAX_VALUE)) ); add(jPanel2); jPanel2.setBounds(10, 70, 830, 110); }// </editor-fold>//GEN-END:initComponents private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed // TODO add your handling code here: Map values = new LinkedHashMap(); try { if (!jTextField14.getText().isEmpty()) { values.put("nomCliente", jTextField14.getText()); } if (!jTextField15.getText().isEmpty()) { values.put("apeCliente", jTextField15.getText()); } if (!jTextField13.getText().isEmpty()) { values.put("desde", jTextField13.getText()); } if (!jTextField16.getText().isEmpty()) { values.put("hasta", jTextField16.getText()); } if (!jTextField5.getText().isEmpty()) { values.put("orden", jTextField5.getText()); } if (!jTextField17.getText().isEmpty()) { values.put("matricula", jTextField17.getText()); } if (!jTextField18.getText().isEmpty()) { values.put("marca", jTextField18.getText()); } if (!jTextField19.getText().isEmpty()) { values.put("modelo", jTextField19.getText()); } rellenaTabla(cliente.ConsultaReparacionesByTerms(values)); } catch (RemoteException e1) { e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } }//GEN-LAST:event_jButton8ActionPerformed private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed // TODO add your handling code here: DetalleReparacionAsig dra; try { dra = new DetalleReparacionAsig(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); dra.setVisible(true); dra.setModal(true); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } }//GEN-LAST:event_jButton9ActionPerformed private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed // TODO add your handling code here: if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("NO")) try { cliente.aceptaReparacion((Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0)); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } PiezasReparacion pr; try { pr = new PiezasReparacion(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); pr.setVisible(true); pr.setModal(true); } catch (RemoteException ex) { ex.printStackTrace(); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } }//GEN-LAST:event_jButton10ActionPerformed private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed //Si está aceptada pero no asignada a Mecanico, abrirá la pantalla AsignarAMecanico //Si está aceptada y asignada, mostrará un mensaje indicando que ya está asignada y dará la posibilidad de asignar otro //Si no está aceptada y pulsamos en ASignada, saldrá un mensaje indicando que aún no se ha aceptado la orden if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("SI")&&jTable1.getValueAt(jTable1.getSelectedRow(), 8).equals("NO")){ AsignacionAMecanico aam; try { aam = new AsignacionAMecanico(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); aam.setVisible(true); aam.setModal(true); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } catch (ExceptionTipoObjetoFiltroNoPermitido ex) { ex.printStackTrace(); } } if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("SI")&&jTable1.getValueAt(jTable1.getSelectedRow(), 8).equals("SI")){ AsignacionAMecanico aam; try { aam = new AsignacionAMecanico(cliente, (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 3), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 4), (String) jTable1.getValueAt(jTable1.getSelectedRow(), 5)); aam.setVisible(true); aam.setModal(true); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } catch (ExceptionTipoObjetoFiltroNoPermitido ex) { ex.printStackTrace(); } Avisos av = new Avisos("Esta reparación ya asignada, sin embargo, puede cambiar al mecánico si lo desea."); av.setVisible(true); av.setModal(true); } if (jTable1.getValueAt(jTable1.getSelectedRow(), 7).equals("NO")){ Avisos av = new Avisos("Esta reparación aún no ha sido aceptada."); av.setVisible(true); av.setModal(true); } jButton8ActionPerformed(evt); }//GEN-LAST:event_jButton11ActionPerformed private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed // TODO add your handling code here: Avisos av=null; if(jTable1.getValueAt(jTable1.getSelectedRow(),7).equals("NO")){ av = new Avisos("Esta reparación aún no ha sido aceptada. No puede finalizarse"); av.setVisible(true); av.setModal(true); }else{ try { Solicitud sol = cliente.buscaSolicitudbynumrep((Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0)); if (sol.getFinalitzada()){ av = new Avisos("Esta reparación ya está finalizada."); av.setVisible(true); av.setModal(true); }else{ sol.setFinalitzada(true); cliente.modificaSolicitud(sol); } } catch (AppException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } jButton8ActionPerformed(evt); } }//GEN-LAST:event_jButton12ActionPerformed private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed // TODO add your handling code here: setVisible(false); }//GEN-LAST:event_jButton13ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton10; private javax.swing.JButton jButton11; private javax.swing.JButton jButton12; private javax.swing.JButton jButton13; private javax.swing.JButton jButton8; private javax.swing.JButton jButton9; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField13; private javax.swing.JTextField jTextField14; private javax.swing.JTextField jTextField15; private javax.swing.JTextField jTextField16; private javax.swing.JTextField jTextField17; private javax.swing.JTextField jTextField18; private javax.swing.JTextField jTextField19; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JTextField jTextField8; private javax.swing.JTextField jTextField9; // End of variables declaration//GEN-END:variables }
33,318
0.616006
0.586348
666
49.01952
38.080772
288
false
false
0
0
0
0
0
0
1.202703
false
false
4
4c62029cc47707e347e27222425687eecb52b418
31,336,081,393,014
7e665f11b6f52dbcdc50b23bc455e3dbbc0e3428
/app/src/main/java/u/ready_wisc/Emergency_Main/ShelterAdapter.java
d4d32c7a9ffbffd67335f2611a176dc1325fcc27
[]
no_license
ozzy4654/UWP_Ready_WI
https://github.com/ozzy4654/UWP_Ready_WI
1d70a486a86e452a8b3987750c663e45d4abc5d2
2f4e28124dd527a73ed95fc239d3f9b1245b278d
refs/heads/QATesting
2021-01-01T16:50:39.837000
2015-05-26T17:24:39
2015-05-26T17:24:39
31,079,188
3
6
null
false
2015-04-28T22:48:42
2015-02-20T18:47:57
2015-04-28T20:58:01
2015-04-28T22:48:18
4,073
1
2
2
HTML
null
null
package u.ready_wisc.Emergency_Main; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import u.ready_wisc.R; import u.ready_wisc.ShelterItem; /** * Adapts shelter items into listview */ public class ShelterAdapter extends ArrayAdapter<ShelterItem> { private final Context context; private final ArrayList<ShelterItem> shelterList; public ShelterAdapter(Context context, ArrayList<ShelterItem> shelterList) { super(context, R.layout.shelter_list_adapter, shelterList); this.context = context; this.shelterList = shelterList; } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.shelter_list_adapter, parent, false); TextView nameText = (TextView) row.findViewById(R.id.shelterName); TextView addressText = (TextView) row.findViewById(R.id.shelterAddress); TextView phoneText = (TextView) row.findViewById(R.id.shelterPhone); TextView picText = (TextView) row.findViewById(R.id.shelterPerson); TextView cityText = (TextView) row.findViewById(R.id.shelterCity); ImageView shelterIcon = (ImageView) row.findViewById(R.id.shelterIcon); Log.i("Null debut", shelterList.get(position).getOrganization()); nameText.setText(shelterList.get(position).getOrganization()); addressText.setText(shelterList.get(position).getAddress()); phoneText.setText(shelterList.get(position).getPhone()); picText.setText(shelterList.get(position).getContact()); cityText.setText(shelterList.get(position).getCity()); shelterIcon.setImageResource(R.drawable.shelter_icon); return row; } }
UTF-8
Java
2,040
java
ShelterAdapter.java
Java
[]
null
[]
package u.ready_wisc.Emergency_Main; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import u.ready_wisc.R; import u.ready_wisc.ShelterItem; /** * Adapts shelter items into listview */ public class ShelterAdapter extends ArrayAdapter<ShelterItem> { private final Context context; private final ArrayList<ShelterItem> shelterList; public ShelterAdapter(Context context, ArrayList<ShelterItem> shelterList) { super(context, R.layout.shelter_list_adapter, shelterList); this.context = context; this.shelterList = shelterList; } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.shelter_list_adapter, parent, false); TextView nameText = (TextView) row.findViewById(R.id.shelterName); TextView addressText = (TextView) row.findViewById(R.id.shelterAddress); TextView phoneText = (TextView) row.findViewById(R.id.shelterPhone); TextView picText = (TextView) row.findViewById(R.id.shelterPerson); TextView cityText = (TextView) row.findViewById(R.id.shelterCity); ImageView shelterIcon = (ImageView) row.findViewById(R.id.shelterIcon); Log.i("Null debut", shelterList.get(position).getOrganization()); nameText.setText(shelterList.get(position).getOrganization()); addressText.setText(shelterList.get(position).getAddress()); phoneText.setText(shelterList.get(position).getPhone()); picText.setText(shelterList.get(position).getContact()); cityText.setText(shelterList.get(position).getCity()); shelterIcon.setImageResource(R.drawable.shelter_icon); return row; } }
2,040
0.734314
0.734314
53
37.490566
30.590801
109
false
false
0
0
0
0
0
0
0.773585
false
false
4
89b3745f04bd31dd4db516f75c0e42378ef26c94
9,216,999,819,234
fbd8a8c6ddd67a49762a3f5916cdf61755738097
/web01/src/main/java/servlet/Servlet12.java
e9b0e5918583764afc8271721f23f21cdbf4d635
[]
no_license
MoonSungRyong/Java85-1
https://github.com/MoonSungRyong/Java85-1
ae340ecb7be9662ef50f3a9be3872363c5f2d7b9
b8fbd6803c8e0dcf8a1ae2e01b3a4e38918bec97
refs/heads/master
2021-01-11T22:12:34.455000
2016-10-21T08:47:28
2016-10-21T08:47:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* 주제: 계산기 웹 애플리케이션 만들기 * => 웹 브라우저에서 서블릿에 데이터를 보내는 방법을 연습 * => 서블릿에서 클라이언트가 보낸 데이터를 꺼내는 방법을 연습 */ package servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.GenericServlet; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; @WebServlet("/servlet12") public class Servlet12 extends GenericServlet { @Override public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { int a = Integer.parseInt(request.getParameter("a")); int b = Integer.parseInt(request.getParameter("b")); String op = request.getParameter("op"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head>"); out.println("</head>"); out.println("<body>"); switch (op) { case "+": out.printf("%d %s %d = %d\n", a, op, b, a + b); break; case "-": out.printf("%d %s %d = %d\n", a, op, b, a - b); break; case "*": out.printf("%d %s %d = %d\n", a, op, b, a * b); break; case "/": out.printf("%d %s %d = %d\n", a, op, b, a / b); break; default: out.println("지원하지 않는 연산자입니다!"); } out.println("</body>"); out.println("</html>"); } } /* URL과 특수 문자 * => + : URL에서 + 문자는 공백(space)을 의미한다. * 진짜 '+' 문자를 파라미터 값으로 표현하고 싶다면 URL 인코딩 문자로 표현하라! * 예) %2B * => % : URL에서 %는 인코딩 문자의 시작 기호로 사용된다. * 예) %2B 는 '+' 문자의 코드 값을 의미한다. * * URI(Uniform Resource Identifier)? * => 인터넷 상의 특정 컴퓨터에 저장된 자원(파일)을 가리키는 식별자/주소 이다. * => 표기법 * 1) URN * 예) urn:isbn:0451450523, urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66 * 2) URL * 예) http://www.bitcamp.co.kr:8080/java85/test.txt * => 웹에서는 URI 표기법 중에서 URL을 주로 사용한다. * * URL 인코딩? * => ASCII 문자표에 없는 문자를 ASCII 문자화시키는 것을 말한다. * => URL을 작성할 때 ASCII 문자표(영어대/소문자, 숫자, 특수문자 일부)에 정의되지 않은 문자는 * 사용할 수 없다. * => ASCII 문자표에 없는 문자를 URL에 작성하려면 특별한 형식으로 변환해야 한다. * 이렇게 ASCII가 아닌 문자를 특별한 형식의 문자로 변환시키는 것을 "URL 인코딩"이라 부른다. * => 참고! * ASCII 문자 중에서도 URL 인코딩을 위해 사용되는 '%' 문자나 공백을 표현하기 위해 사용되는 * '+'와 같은 문자도 "URL 인코딩"의 대상이다. * * 왜, ASCII 문자만 URL로 작성해야 하는가? * => 게이트웨이 또는 라우터 장비 중에는 7비트 전용 장비가 존재한다. * => 한글과 같이 8비트로 표현해야 하는 데이터는 이 장비를 통과하면 데이터 손실이 발생한다. * => 그러나 ASCII 문자는 원래 7비트이기 때문에 어떤 장비를 통과하더라도 데이터 손실이 발생하지 않는다. * => 이런 이유로 한글처럼 8비트로 표현해야 하는 데이터는 ASCII 문자화시킨다. * => URL 인코딩 예) 'A가' ---> A%EA%B0%80 (UTF-8 문자표의 코드 값으로 ASCII 문자화) * => URL 디코딩 예) A%EA%B0%80 --> 'A가' */
UTF-8
Java
3,703
java
Servlet12.java
Java
[]
null
[]
/* 주제: 계산기 웹 애플리케이션 만들기 * => 웹 브라우저에서 서블릿에 데이터를 보내는 방법을 연습 * => 서블릿에서 클라이언트가 보낸 데이터를 꺼내는 방법을 연습 */ package servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.GenericServlet; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; @WebServlet("/servlet12") public class Servlet12 extends GenericServlet { @Override public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { int a = Integer.parseInt(request.getParameter("a")); int b = Integer.parseInt(request.getParameter("b")); String op = request.getParameter("op"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head>"); out.println("</head>"); out.println("<body>"); switch (op) { case "+": out.printf("%d %s %d = %d\n", a, op, b, a + b); break; case "-": out.printf("%d %s %d = %d\n", a, op, b, a - b); break; case "*": out.printf("%d %s %d = %d\n", a, op, b, a * b); break; case "/": out.printf("%d %s %d = %d\n", a, op, b, a / b); break; default: out.println("지원하지 않는 연산자입니다!"); } out.println("</body>"); out.println("</html>"); } } /* URL과 특수 문자 * => + : URL에서 + 문자는 공백(space)을 의미한다. * 진짜 '+' 문자를 파라미터 값으로 표현하고 싶다면 URL 인코딩 문자로 표현하라! * 예) %2B * => % : URL에서 %는 인코딩 문자의 시작 기호로 사용된다. * 예) %2B 는 '+' 문자의 코드 값을 의미한다. * * URI(Uniform Resource Identifier)? * => 인터넷 상의 특정 컴퓨터에 저장된 자원(파일)을 가리키는 식별자/주소 이다. * => 표기법 * 1) URN * 예) urn:isbn:0451450523, urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66 * 2) URL * 예) http://www.bitcamp.co.kr:8080/java85/test.txt * => 웹에서는 URI 표기법 중에서 URL을 주로 사용한다. * * URL 인코딩? * => ASCII 문자표에 없는 문자를 ASCII 문자화시키는 것을 말한다. * => URL을 작성할 때 ASCII 문자표(영어대/소문자, 숫자, 특수문자 일부)에 정의되지 않은 문자는 * 사용할 수 없다. * => ASCII 문자표에 없는 문자를 URL에 작성하려면 특별한 형식으로 변환해야 한다. * 이렇게 ASCII가 아닌 문자를 특별한 형식의 문자로 변환시키는 것을 "URL 인코딩"이라 부른다. * => 참고! * ASCII 문자 중에서도 URL 인코딩을 위해 사용되는 '%' 문자나 공백을 표현하기 위해 사용되는 * '+'와 같은 문자도 "URL 인코딩"의 대상이다. * * 왜, ASCII 문자만 URL로 작성해야 하는가? * => 게이트웨이 또는 라우터 장비 중에는 7비트 전용 장비가 존재한다. * => 한글과 같이 8비트로 표현해야 하는 데이터는 이 장비를 통과하면 데이터 손실이 발생한다. * => 그러나 ASCII 문자는 원래 7비트이기 때문에 어떤 장비를 통과하더라도 데이터 손실이 발생하지 않는다. * => 이런 이유로 한글처럼 8비트로 표현해야 하는 데이터는 ASCII 문자화시킨다. * => URL 인코딩 예) 'A가' ---> A%EA%B0%80 (UTF-8 문자표의 코드 값으로 ASCII 문자화) * => URL 디코딩 예) A%EA%B0%80 --> 'A가' */
3,703
0.604492
0.581652
82
30.853659
23.446941
110
false
false
0
0
0
0
0
0
0.621951
false
false
4
87295a09fb394816b7a0faa6db038c928830b61c
12,266,426,599,172
90d68a3883490fd170446f8379b066df1971ba70
/cordapp/workflows/src/test/java/com/newamerica/flow/IssueTransferFlowTests.java
a32ab02f3f9bfaeb7117678ab8096572660e2a7b
[ "Apache-2.0" ]
permissive
newamericafoundation/digi-OARS
https://github.com/newamericafoundation/digi-OARS
469c25a8ea8752948c0b03715ec84db70d9dc4b8
0e0ae942b784bc601e63b16195eaa68673aade19
refs/heads/master
2023-01-20T23:21:31.174000
2020-11-17T15:26:40
2020-11-17T15:26:40
286,832,964
0
1
null
false
2020-11-17T14:50:25
2020-08-11T19:39:14
2020-11-17T14:46:32
2020-11-17T14:50:25
16,888
0
0
0
Java
false
false
package com.newamerica.flow; import com.newamerica.contracts.TransferContract; import com.newamerica.flows.*; import com.newamerica.states.FundState; import com.newamerica.states.RequestState; import com.newamerica.states.TransferState; import net.corda.core.contracts.Command; import net.corda.core.crypto.SecureHash; import net.corda.core.identity.AbstractParty; import net.corda.core.identity.CordaX500Name; import net.corda.core.identity.Party; import net.corda.core.transactions.SignedTransaction; import net.corda.testing.node.*; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import java.math.BigDecimal; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.stream.Stream; import static com.newamerica.TestUtils.CATANMoJ; import static org.junit.Assert.assertEquals; public class IssueTransferFlowTests { private MockNetwork mockNetwork; private StartedMockNode a; private StartedMockNode b; private StartedMockNode c; private StartedMockNode d; private StartedMockNode e; private StartedMockNode f; private StartedMockNode g; SignedTransaction stx5; Party catanTreasury; private final List<AbstractParty> owners = new ArrayList<>(); private final List<AbstractParty> requiredSigners = new ArrayList<>(); private final List<AbstractParty> participants = new ArrayList<>(); private final List<AbstractParty> partialRequestParticipants = new ArrayList<>(); @Before public void setup() throws ExecutionException, InterruptedException { Map<String, String> config = new HashMap<>(); config.put("notary", "O=Notary,L=London,C=GB"); MockNetworkParameters mockNetworkParameters = new MockNetworkParameters().withCordappsForAllNodes( Arrays.asList( TestCordapp.findCordapp("com.newamerica.contracts"), TestCordapp.findCordapp("com.newamerica.flows").withConfig(config) ) ).withNotarySpecs(Collections.singletonList(new MockNetworkNotarySpec(new CordaX500Name("Notary", "London", "GB")))); mockNetwork = new MockNetwork(mockNetworkParameters); a = mockNetwork.createNode(new MockNodeParameters()); b = mockNetwork.createNode(new MockNodeParameters()); c = mockNetwork.createNode(new MockNodeParameters()); d = mockNetwork.createNode(new MockNodeParameters()); e = mockNetwork.createNode(new MockNodeParameters()); f = mockNetwork.createNode(new MockNodeParameters()); g = mockNetwork.createNode(new MockNodeParameters()); ArrayList<StartedMockNode> startedNodes = new ArrayList<>(); startedNodes.add(a); startedNodes.add(b); startedNodes.add(c); startedNodes.add(d); startedNodes.add(e); startedNodes.add(f); startedNodes.add(g); // For real nodes this happens automatically, but we have to manually register the flow for tests startedNodes.forEach(el -> el.registerInitiatedFlow(IssueFundFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssueRequestFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssueConfigFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssuePartialRequestFundFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(UpdateFundBalanceFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(ReceiveFundFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(ApproveRequestFlow.ExtraInitiatingFlowResponder.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(ApproveRequestFlow.CollectSignaturesResponder.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssueTransferFlow.ResponderFlow.class)); mockNetwork.runNetwork(); Party usDos = a.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party usDoj = b.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party catanMof = c.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party catanMoj = d.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party usCSO = e.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party catanCSO = f.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); catanTreasury = g.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); owners.add(usDoj); requiredSigners.add(catanMoj); participants.add(usDos); participants.add(usDoj); participants.add(catanMof); participants.add(catanMoj); participants.add(catanTreasury); partialRequestParticipants.add(usCSO); partialRequestParticipants.add(catanCSO); //create FundState IssueFundFlow.InitiatorFlow fundStateFlow = new IssueFundFlow.InitiatorFlow( usDoj, catanTreasury, "ABC123", owners, requiredSigners, partialRequestParticipants, BigDecimal.valueOf(5000000), ZonedDateTime.of(2020, 6, 27, 10, 30, 30, 0, ZoneId.of("America/New_York")), ZonedDateTime.of(2020, 6, 27, 10, 30, 30, 0, ZoneId.of("America/New_York")), Currency.getInstance(Locale.US), participants ); Future<SignedTransaction> future = b.startFlow(fundStateFlow); mockNetwork.runNetwork(); SignedTransaction stx = future.get(); FundState fs = (FundState) stx.getTx().getOutputStates().get(0); //acknowledge the FundState ReceiveFundFlow.InitiatorFlow receiveFundFlow = new ReceiveFundFlow.InitiatorFlow( "Ben Green", fs.getLinearId(), ZonedDateTime.of(2020, 7, 27, 10, 30, 30, 0, ZoneId.of("America/New_York")) ); Future<SignedTransaction> futureTwo = g.startFlow(receiveFundFlow); mockNetwork.runNetwork(); futureTwo.get(); IssueConfigFlow.InitiatorFlow configFlow = new IssueConfigFlow.InitiatorFlow( "US DoJ", "Catan", BigDecimal.valueOf(5000000), Currency.getInstance(Locale.US), ZonedDateTime.of(2020, 6, 26, 10,30,30,0, ZoneId.of("America/New_York")), participants ); Future<SignedTransaction> future3 = b.startFlow(configFlow); mockNetwork.runNetwork(); future3.get(); //create RequestState IssueRequestFlow.InitiatorFlow requestFlow = new IssueRequestFlow.InitiatorFlow( "Alice Bob", "Catan Ministry of Education", "1234567890", "build a school", BigDecimal.valueOf(1000000), Currency.getInstance(Locale.US), ZonedDateTime.of(2020, 8, 27, 10,30,30,0, ZoneId.of("America/New_York")), ZonedDateTime.of(2020, 8, 27, 10,30,30,0, ZoneId.of("America/New_York")), participants ); Future<SignedTransaction> futureThree = c.startFlow(requestFlow); mockNetwork.runNetwork(); SignedTransaction stx3 = futureThree.get(); RequestState rs = (RequestState) stx3.getTx().getOutputStates().get(0); //approve requestState ApproveRequestFlow.InitiatorFlow approveRequestFlow = new ApproveRequestFlow.InitiatorFlow( rs.getLinearId(), "Sam Sung", "Catan MOJ", ZonedDateTime.of(2020, 9, 27, 10,30,30,0, ZoneId.of("America/New_York")), fs.getLinearId() ); Future<SignedTransaction> futureFour = d.startFlow(approveRequestFlow); mockNetwork.runNetwork(); futureFour.get(); RequestState rs2 = (RequestState) stx3.getTx().getOutputStates().get(0); IssueTransferFlow.InitiatorFlow transferFlow = new IssueTransferFlow.InitiatorFlow( "Bob Bob", rs2.getLinearId(), participants ); Future<SignedTransaction> futureFive = g.startFlow(transferFlow); mockNetwork.runNetwork(); stx5= futureFive.get(); } @After public void tearDown() { mockNetwork.stopNodes(); } @Rule public final ExpectedException exception = ExpectedException.none(); // ensure that properly formed partially signed transactions are returned from the initiator flow @Test public void flowReturnsCorrectlyFormedPartiallySignedTransaction() throws Exception { assert (stx5.getTx().getInputs().isEmpty()); assert (stx5.getTx().getOutputs().get(0).getData() instanceof TransferState); Command command = stx5.getTx().getCommands().get(0); assert (command.getValue() instanceof TransferContract.Commands.Issue); stx5.verifySignaturesExcept(catanTreasury.getOwningKey(), mockNetwork.getDefaultNotaryNode().getInfo().getLegalIdentitiesAndCerts().get(0).getOwningKey()); } // check each party's vault for the TransferState's existence @Test public void flowRecordsTheSameTransactionInBothPartyVaults() { Stream.of(a, b, c, d, e, f, g).map(el -> el.getServices().getValidatedTransactions().getTransaction(stx5.getId()) ).filter(Objects::nonNull).forEach(el -> { SecureHash txHash = el.getId(); System.out.printf("$txHash == %h\n", stx5.getId()); assertEquals(stx5.getId(), txHash); }); } }
UTF-8
Java
9,930
java
IssueTransferFlowTests.java
Java
[ { "context": "ndCerts().get(0).getParty();\n\n\n owners.add(usDoj);\n requiredSigners.add(catanMoj);\n ", "end": 4754, "score": 0.9658753275871277, "start": 4749, "tag": "NAME", "value": "usDoj" }, { "context": " owners.add(usDoj);\n requiredSigners.add(catanMoj);\n participants.add(usDos);\n partic", "end": 4793, "score": 0.8835580945014954, "start": 4785, "tag": "NAME", "value": "catanMoj" }, { "context": "w ReceiveFundFlow.InitiatorFlow(\n \"Ben Green\",\n fs.getLinearId(),\n ", "end": 6066, "score": 0.9998511075973511, "start": 6057, "tag": "NAME", "value": "Ben Green" }, { "context": "rFlow(\n \"US DoJ\",\n \"Catan\",\n BigDecimal.valueOf(5000000),\n ", "end": 6486, "score": 0.9998680353164673, "start": 6481, "tag": "NAME", "value": "Catan" }, { "context": " IssueRequestFlow.InitiatorFlow(\n \"Alice Bob\",\n \"Catan Ministry of Education\",\n", "end": 6985, "score": 0.9997652173042297, "start": 6976, "tag": "NAME", "value": "Alice Bob" }, { "context": " rs.getLinearId(),\n \"Sam Sung\",\n \"Catan MOJ\",\n Zo", "end": 7845, "score": 0.9998247027397156, "start": 7837, "tag": "NAME", "value": "Sam Sung" }, { "context": "d(),\n \"Sam Sung\",\n \"Catan MOJ\",\n ZonedDateTime.of(2020, 9, 27, 1", "end": 7874, "score": 0.9997669458389282, "start": 7865, "tag": "NAME", "value": "Catan MOJ" }, { "context": "IssueTransferFlow.InitiatorFlow(\n \"Bob Bob\",\n rs2.getLinearId(),\n ", "end": 8359, "score": 0.9997295141220093, "start": 8352, "tag": "NAME", "value": "Bob Bob" } ]
null
[]
package com.newamerica.flow; import com.newamerica.contracts.TransferContract; import com.newamerica.flows.*; import com.newamerica.states.FundState; import com.newamerica.states.RequestState; import com.newamerica.states.TransferState; import net.corda.core.contracts.Command; import net.corda.core.crypto.SecureHash; import net.corda.core.identity.AbstractParty; import net.corda.core.identity.CordaX500Name; import net.corda.core.identity.Party; import net.corda.core.transactions.SignedTransaction; import net.corda.testing.node.*; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import java.math.BigDecimal; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.stream.Stream; import static com.newamerica.TestUtils.CATANMoJ; import static org.junit.Assert.assertEquals; public class IssueTransferFlowTests { private MockNetwork mockNetwork; private StartedMockNode a; private StartedMockNode b; private StartedMockNode c; private StartedMockNode d; private StartedMockNode e; private StartedMockNode f; private StartedMockNode g; SignedTransaction stx5; Party catanTreasury; private final List<AbstractParty> owners = new ArrayList<>(); private final List<AbstractParty> requiredSigners = new ArrayList<>(); private final List<AbstractParty> participants = new ArrayList<>(); private final List<AbstractParty> partialRequestParticipants = new ArrayList<>(); @Before public void setup() throws ExecutionException, InterruptedException { Map<String, String> config = new HashMap<>(); config.put("notary", "O=Notary,L=London,C=GB"); MockNetworkParameters mockNetworkParameters = new MockNetworkParameters().withCordappsForAllNodes( Arrays.asList( TestCordapp.findCordapp("com.newamerica.contracts"), TestCordapp.findCordapp("com.newamerica.flows").withConfig(config) ) ).withNotarySpecs(Collections.singletonList(new MockNetworkNotarySpec(new CordaX500Name("Notary", "London", "GB")))); mockNetwork = new MockNetwork(mockNetworkParameters); a = mockNetwork.createNode(new MockNodeParameters()); b = mockNetwork.createNode(new MockNodeParameters()); c = mockNetwork.createNode(new MockNodeParameters()); d = mockNetwork.createNode(new MockNodeParameters()); e = mockNetwork.createNode(new MockNodeParameters()); f = mockNetwork.createNode(new MockNodeParameters()); g = mockNetwork.createNode(new MockNodeParameters()); ArrayList<StartedMockNode> startedNodes = new ArrayList<>(); startedNodes.add(a); startedNodes.add(b); startedNodes.add(c); startedNodes.add(d); startedNodes.add(e); startedNodes.add(f); startedNodes.add(g); // For real nodes this happens automatically, but we have to manually register the flow for tests startedNodes.forEach(el -> el.registerInitiatedFlow(IssueFundFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssueRequestFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssueConfigFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssuePartialRequestFundFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(UpdateFundBalanceFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(ReceiveFundFlow.ResponderFlow.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(ApproveRequestFlow.ExtraInitiatingFlowResponder.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(ApproveRequestFlow.CollectSignaturesResponder.class)); startedNodes.forEach(el -> el.registerInitiatedFlow(IssueTransferFlow.ResponderFlow.class)); mockNetwork.runNetwork(); Party usDos = a.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party usDoj = b.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party catanMof = c.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party catanMoj = d.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party usCSO = e.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); Party catanCSO = f.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); catanTreasury = g.getInfo().getLegalIdentitiesAndCerts().get(0).getParty(); owners.add(usDoj); requiredSigners.add(catanMoj); participants.add(usDos); participants.add(usDoj); participants.add(catanMof); participants.add(catanMoj); participants.add(catanTreasury); partialRequestParticipants.add(usCSO); partialRequestParticipants.add(catanCSO); //create FundState IssueFundFlow.InitiatorFlow fundStateFlow = new IssueFundFlow.InitiatorFlow( usDoj, catanTreasury, "ABC123", owners, requiredSigners, partialRequestParticipants, BigDecimal.valueOf(5000000), ZonedDateTime.of(2020, 6, 27, 10, 30, 30, 0, ZoneId.of("America/New_York")), ZonedDateTime.of(2020, 6, 27, 10, 30, 30, 0, ZoneId.of("America/New_York")), Currency.getInstance(Locale.US), participants ); Future<SignedTransaction> future = b.startFlow(fundStateFlow); mockNetwork.runNetwork(); SignedTransaction stx = future.get(); FundState fs = (FundState) stx.getTx().getOutputStates().get(0); //acknowledge the FundState ReceiveFundFlow.InitiatorFlow receiveFundFlow = new ReceiveFundFlow.InitiatorFlow( "<NAME>", fs.getLinearId(), ZonedDateTime.of(2020, 7, 27, 10, 30, 30, 0, ZoneId.of("America/New_York")) ); Future<SignedTransaction> futureTwo = g.startFlow(receiveFundFlow); mockNetwork.runNetwork(); futureTwo.get(); IssueConfigFlow.InitiatorFlow configFlow = new IssueConfigFlow.InitiatorFlow( "US DoJ", "Catan", BigDecimal.valueOf(5000000), Currency.getInstance(Locale.US), ZonedDateTime.of(2020, 6, 26, 10,30,30,0, ZoneId.of("America/New_York")), participants ); Future<SignedTransaction> future3 = b.startFlow(configFlow); mockNetwork.runNetwork(); future3.get(); //create RequestState IssueRequestFlow.InitiatorFlow requestFlow = new IssueRequestFlow.InitiatorFlow( "<NAME>", "Catan Ministry of Education", "1234567890", "build a school", BigDecimal.valueOf(1000000), Currency.getInstance(Locale.US), ZonedDateTime.of(2020, 8, 27, 10,30,30,0, ZoneId.of("America/New_York")), ZonedDateTime.of(2020, 8, 27, 10,30,30,0, ZoneId.of("America/New_York")), participants ); Future<SignedTransaction> futureThree = c.startFlow(requestFlow); mockNetwork.runNetwork(); SignedTransaction stx3 = futureThree.get(); RequestState rs = (RequestState) stx3.getTx().getOutputStates().get(0); //approve requestState ApproveRequestFlow.InitiatorFlow approveRequestFlow = new ApproveRequestFlow.InitiatorFlow( rs.getLinearId(), "<NAME>", "<NAME>", ZonedDateTime.of(2020, 9, 27, 10,30,30,0, ZoneId.of("America/New_York")), fs.getLinearId() ); Future<SignedTransaction> futureFour = d.startFlow(approveRequestFlow); mockNetwork.runNetwork(); futureFour.get(); RequestState rs2 = (RequestState) stx3.getTx().getOutputStates().get(0); IssueTransferFlow.InitiatorFlow transferFlow = new IssueTransferFlow.InitiatorFlow( "<NAME>", rs2.getLinearId(), participants ); Future<SignedTransaction> futureFive = g.startFlow(transferFlow); mockNetwork.runNetwork(); stx5= futureFive.get(); } @After public void tearDown() { mockNetwork.stopNodes(); } @Rule public final ExpectedException exception = ExpectedException.none(); // ensure that properly formed partially signed transactions are returned from the initiator flow @Test public void flowReturnsCorrectlyFormedPartiallySignedTransaction() throws Exception { assert (stx5.getTx().getInputs().isEmpty()); assert (stx5.getTx().getOutputs().get(0).getData() instanceof TransferState); Command command = stx5.getTx().getCommands().get(0); assert (command.getValue() instanceof TransferContract.Commands.Issue); stx5.verifySignaturesExcept(catanTreasury.getOwningKey(), mockNetwork.getDefaultNotaryNode().getInfo().getLegalIdentitiesAndCerts().get(0).getOwningKey()); } // check each party's vault for the TransferState's existence @Test public void flowRecordsTheSameTransactionInBothPartyVaults() { Stream.of(a, b, c, d, e, f, g).map(el -> el.getServices().getValidatedTransactions().getTransaction(stx5.getId()) ).filter(Objects::nonNull).forEach(el -> { SecureHash txHash = el.getId(); System.out.printf("$txHash == %h\n", stx5.getId()); assertEquals(stx5.getId(), txHash); }); } }
9,918
0.666465
0.649648
233
41.618027
31.319275
125
false
false
0
0
0
0
0
0
0.95279
false
false
4
8212393fc49439b9d5422e0bf72f587731d6ec82
21,199,958,575,621
65ddf195abfab893845c893df16b8956d1ff919b
/src/myweb2/ViewServlet.java
a53b3b5ceefd73de16db8c13c22e3a118be431cd
[]
no_license
hjhearts/jsp-spring
https://github.com/hjhearts/jsp-spring
9945be1f14ba6b8496e32a88a1891c19dddc4c45
2a604ad5216bea12ebb7a9268afee4cb9042c6ab
refs/heads/master
2021-05-20T19:39:10.620000
2020-04-07T05:22:33
2020-04-07T05:22:33
252,393,613
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package myweb2; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; //@WebServlet("/viewMembers") public class ViewServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ List<MemberBean> memberList = (List)request.getAttribute("memberList"); PrintWriter out = response.getWriter(); out.print("<html><body>"); out.print("<table border=1><tr align='center'>"); out.print("<td>ID</td><td>PASSWORD</td><td>NAME</td><td>EMAIL</td>" + "<td>JoinDate</td><td>Menu</td></tr>"); for (int i = 0; i < memberList.size(); i++) { MemberBean curMember = memberList.get(i); out.print("<tr>"); out.print("<td>" + curMember.getId() + "</td>"); out.print("<td>" + curMember.getPwd() + "</td>"); out.print("<td>" + curMember.getName() + "</td>"); out.print("<td>" + curMember.getEmail() + "</td>"); out.print("<td>" + curMember.getJoinDate() + "</td>"); out.print("<td><a href='/member2?command=deleteMember&id="+ curMember.getId() +"'>DELETE</a></td>"); out.print("</tr>"); } out.print("</table><a href='/myweb1/memberConfirm.html'>ADD MEMBER</a>" + "</body></html>"); } }
UTF-8
Java
1,609
java
ViewServlet.java
Java
[]
null
[]
package myweb2; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; //@WebServlet("/viewMembers") public class ViewServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ List<MemberBean> memberList = (List)request.getAttribute("memberList"); PrintWriter out = response.getWriter(); out.print("<html><body>"); out.print("<table border=1><tr align='center'>"); out.print("<td>ID</td><td>PASSWORD</td><td>NAME</td><td>EMAIL</td>" + "<td>JoinDate</td><td>Menu</td></tr>"); for (int i = 0; i < memberList.size(); i++) { MemberBean curMember = memberList.get(i); out.print("<tr>"); out.print("<td>" + curMember.getId() + "</td>"); out.print("<td>" + curMember.getPwd() + "</td>"); out.print("<td>" + curMember.getName() + "</td>"); out.print("<td>" + curMember.getEmail() + "</td>"); out.print("<td>" + curMember.getJoinDate() + "</td>"); out.print("<td><a href='/member2?command=deleteMember&id="+ curMember.getId() +"'>DELETE</a></td>"); out.print("</tr>"); } out.print("</table><a href='/myweb1/memberConfirm.html'>ADD MEMBER</a>" + "</body></html>"); } }
1,609
0.604723
0.601616
36
43.694443
25.367104
112
false
false
0
0
0
0
0
0
0.777778
false
false
4
d96e96774ab6d481da2ddb36d8937f4aafae8e13
13,838,384,647,384
61094f3c9c9340c826215a7193793e7043ee27fd
/src/jd/gui/swing/jdgui/views/settings/components/ComboBox.java
75cca9ec3865c454790c77ab7abf76329736ffb2
[]
no_license
i17c/JDownloader-2
https://github.com/i17c/JDownloader-2
a2965704173500bce94b21f3bf1ca110c1c1e368
16c3fad5a204bbcbde9975ff4a7c0d2bd8961470
refs/heads/master
2020-05-31T06:01:36.797000
2011-05-29T21:15:27
2011-05-29T21:15:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jd.gui.swing.jdgui.views.settings.components; import java.awt.Component; import javax.swing.JComboBox; import javax.swing.JList; import javax.swing.ListCellRenderer; public class ComboBox<T> extends JComboBox implements SettingsComponent { private static final long serialVersionUID = -1580999899097054630L; private ListCellRenderer orgRenderer; private String[] translations; public ComboBox(T... options) { super(options); // this.setSelectedIndex(selection); } @SuppressWarnings("unchecked") public T getValue() { return (T) getSelectedItem(); } public void setValue(T selected) { this.setSelectedItem(selected); } public ComboBox(T[] values, String[] names) { super(values); orgRenderer = getRenderer(); this.translations = names; this.setRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (index == -1) index = getSelectedIndex(); return orgRenderer.getListCellRendererComponent(list, translations[index], index, isSelected, cellHasFocus); } }); } public String getConstraints() { return null; } public boolean isMultiline() { return false; } }
UTF-8
Java
1,447
java
ComboBox.java
Java
[]
null
[]
package jd.gui.swing.jdgui.views.settings.components; import java.awt.Component; import javax.swing.JComboBox; import javax.swing.JList; import javax.swing.ListCellRenderer; public class ComboBox<T> extends JComboBox implements SettingsComponent { private static final long serialVersionUID = -1580999899097054630L; private ListCellRenderer orgRenderer; private String[] translations; public ComboBox(T... options) { super(options); // this.setSelectedIndex(selection); } @SuppressWarnings("unchecked") public T getValue() { return (T) getSelectedItem(); } public void setValue(T selected) { this.setSelectedItem(selected); } public ComboBox(T[] values, String[] names) { super(values); orgRenderer = getRenderer(); this.translations = names; this.setRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (index == -1) index = getSelectedIndex(); return orgRenderer.getListCellRendererComponent(list, translations[index], index, isSelected, cellHasFocus); } }); } public String getConstraints() { return null; } public boolean isMultiline() { return false; } }
1,447
0.638563
0.624741
48
28.145834
29.404499
138
false
false
0
0
0
0
0
0
0.604167
false
false
4
d9b50ae7fae10a27bcea62473124c3114ab89820
26,826,365,778,329
81352e170705fdebdf0c63cf0abe7047dcd8ce79
/src/main/java/fr/imag/adele/cadse/util/ArraysUtil.java
a0eacb43617b355abd36f3ccfaa778fe3cb1431b
[ "Apache-2.0" ]
permissive
chomats/cadse.util
https://github.com/chomats/cadse.util
6ad776496cac8479c7fd2e9585f263517e63d905
c768b6ef327adb53691f40eae4a650ce69f2b78a
refs/heads/master
2021-01-10T13:40:58.632000
2010-09-07T20:29:04
2010-09-07T20:29:04
53,582,800
0
0
null
null
null
null
null
null
null
null
null
null
null
null
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. * * Copyright (C) 2006-2010 Adele Team/LIG/Grenoble University, France */ package fr.imag.adele.cadse.util; import java.lang.reflect.Array; import java.util.List; import java.util.NoSuchElementException; /** * The Class ArraysUtil. * * @author <a href="mailto:stephane.chomat@imag.fr">Stephane Chomat</a> */ public class ArraysUtil { /** * Merge. * * @param clazz * the clazz (not null) * @param one * the one (not null) * @param two * the two (not null) * * @return the t[] */ public static <T> T[] merge(Class<T> clazz, T[] one, T[] two) { T[] ret = (T[]) Array.newInstance(clazz, one.length + two.length); System.arraycopy(one, 0, ret, 0, one.length); System.arraycopy(two, 0, ret, one.length, two.length); return ret; } /** * Adds the list. * * @param clazz * the clazz * @param array * the array * @param addObject * the add object. Ne peut pas etre null * * @return the t[] */ public static <T> T[] addList(Class<T> clazz, T[] array, T[] addObject) { if (addObject == null || addObject.length == 0) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, addObject.length); System.arraycopy(addObject, 0, ret, 0, addObject.length); return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + addObject.length); System.arraycopy(array, 0, tmp, 0, i); System.arraycopy(addObject, 0, tmp, i, addObject.length); return tmp; } } public static <T> T[] addList2(Class<T> clazz, T[] array, T... addObject) { if (addObject == null || addObject.length == 0) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, addObject.length); System.arraycopy(addObject, 0, ret, 0, addObject.length); return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + addObject.length); System.arraycopy(array, 0, tmp, 0, i); System.arraycopy(addObject, 0, tmp, i, addObject.length); return tmp; } } /** * Adds the list. * * @param clazz * the clazz * @param array * the array * @param addObject * the add object * * @return the t[] */ public static <T> T[] addList(Class<T> clazz, T[] array, List<T> addObject) { if (addObject == null || addObject.size() == 0) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, addObject.size()); ret = addObject.toArray(ret); return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + addObject.size()); System.arraycopy(array, 0, tmp, 0, i); for (int j = 0; j < addObject.size(); j++, i++) { tmp[i] = addObject.get(j); } return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * * @return the t[] */ static public <T> T[] add(Class<T> clazz, T[] array, T l) { if (l == null) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, 1); ret[0] = l; return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + 1); System.arraycopy(array, 0, tmp, 0, i); tmp[i] = l; return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * * @return the t[] */ static public int[] add(int[] array, int l) { if (array == null) { // if this is the first listener added, // initialize the lists int[] ret = new int[1]; ; ret[0] = l; return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; int[] tmp = new int[i + 1]; System.arraycopy(array, 0, tmp, 0, i); tmp[i] = l; return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * * @return the t[] */ static public int[] add(int[] array, int[] l) { if (l == null) { return array; } if (array == null) { // if this is the first listener added, // initialize the lists return l.clone(); } else { // Otherwise copy the array and add the new listener int i = array.length; int[] tmp = new int[i + l.length]; System.arraycopy(array, 0, tmp, 0, i); System.arraycopy(l, 0, tmp, i, l.length); return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * @parem index position � mettre l'�l�ment � copier * * @return the t[] */ static public <T> T[] add(Class<T> clazz, T[] array, T l, int index) { if (l == null) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { if (index != 0) { throw new NoSuchElementException(); } // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, 1); ret[0] = l; return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; if (index < -1 || index > i) { throw new NoSuchElementException(); } T[] tmp = (T[]) Array.newInstance(clazz, i + 1); if (index == 0) { System.arraycopy(array, 0, tmp, 1, i); } else if (index == i) { System.arraycopy(array, 0, tmp, 0, i); } else { System.arraycopy(array, 0, tmp, 0, index); System.arraycopy(array, index, tmp, index + 1, i - index); } tmp[index] = l; return tmp; } } /** * Removes the listener as a listener of the specified type. * * @param l * the listener to be removed * @param clazz * the clazz * @param array * the array * * @return the t[] */ static public <T> T[] remove(Class<T> clazz, T[] array, T l) { if (l == null) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { return array; } // Is l on the list? int index = indexOfEquals(array, l); return remove(clazz, array, index); } public static <T> T[] remove(Class<T> clazz, T[] array, int index, int count) { // If so, remove it if (index != -1) { if (array.length == count) { return null; } T[] tmp = (T[]) Array.newInstance(clazz, array.length - count); // Copy the list up to index System.arraycopy(array, 0, tmp, 0, index); // Copy from two past the index, up to // the end of tmp (which is two elements // shorter than the old list) if (index < tmp.length) { System.arraycopy(array, index + count, tmp, index, tmp.length - index); } return tmp; } return array; } public static <T> T[] remove(Class<T> clazz, T[] array, int index) { // If so, remove it if (index != -1) { if (array.length == 1) { return null; } T[] tmp = (T[]) Array.newInstance(clazz, array.length - 1); // Copy the list up to index System.arraycopy(array, 0, tmp, 0, index); // Copy from two past the index, up to // the end of tmp (which is two elements // shorter than the old list) if (index < tmp.length) { System.arraycopy(array, index + 1, tmp, index, tmp.length - index); } // set the listener array to the new array or null return tmp; } return array; } public static int[] remove(int[] array, int index) { // If so, remove it if (index != -1) { if (array.length == 1) { return null; } int[] tmp = new int[array.length - 1]; // Copy the list up to index System.arraycopy(array, 0, tmp, 0, index); // Copy from two past the index, up to // the end of tmp (which is two elements // shorter than the old list) if (index < tmp.length) { System.arraycopy(array, index + 1, tmp, index, tmp.length - index); } // set the listener array to the new array or null return tmp; } return array; } /** * Inverser. * * @param array * the array */ public static <T> void inverser(T[] array) { int l = array.length; int mid = l / 2; l--; for (int i = 0; i < mid; i++) { T tmp = array[i]; array[i] = array[l - i]; array[l - i] = tmp; } } /** * Return l'index de l � partir de la fin du tableau en utilisant le * comparateur == * * @param <T> * Le type du tableau * @param array * le tableau qui peut etre null * @param l * l'element � rechercher qui peut etre null; * @return l'index de l'element ou -1 si non trouv�. */ public static <T> int indexOf(T[] array, T l) { if (array != null) { for (int i = array.length - 1; i >= 0; i -= 1) { if (array[i] == l) { return i; } } } return -1; } /** * Return l'index de l � partir de la fin du tableau en utilisant le * comparateur equals * * @param <T> * Le type du tableau * @param array * le tableau qui peut etre null * @param l * l'element � rechercher. si l est null retourne -1. * @return l'index de l'element ou -1 si non trouv�. */ public static <T> int indexOfEquals(T[] array, T l) { if (array != null && l != null) { for (int i = array.length - 1; i >= 0; i -= 1) { if ((array[i].equals(l) == true)) { return i; } } } return -1; } public static <T> boolean move(OrderWay kind, T[] array, T e1, T e2) { if (e2 == e1) { return false; } int i1 = indexOf(array, e1); int i2 = indexOf(array, e2); if (i1 == -1) { throw new IllegalArgumentException("Bad object: " + e1); //$NON-NLS-1$ } if (i2 == -1) { throw new IllegalArgumentException("Bad object: " + e2); //$NON-NLS-1$ } if (kind == OrderWay.move_after) { if (i1 == i2 + 1) { return false; // nothing to do; } if (i1 < i2) { moveDown(array, e1, i1, i2); } else { moveUp(array, e1, i2 + 1, i1); } } else { if (i1 == i2 - 1) { return false; // nothing to do; } if (i1 < i2) { moveDown(array, e1, i1, i2 - 1); } else { // i2 < i1 moveUp(array, e1, i2, i1); } } // TODO Auto-generated method stub return true; } /** * Je d�cale d'un cran vers le haut du tableau les �lement allant de begin � * end-1 � begin. Et met dans end, l'�l�ment e. Je met le i-1 dans le i en * partant de la fin (begin) to au d�but (end) * * @param <T> * @param array * @param e * @param end * @param begin */ private static <T> void moveUp(T[] array, T e, int begin, int end) { assert end > begin; for (int i = end; i > begin; i--) { array[i] = array[i - 1]; } array[begin] = e; } /** * Je d�cale d'un cran vers le bas du tableau les �lement allant de begin+1 � * end. Et met dans end l'�l�ment e. * * Je prend le [i+1] et le met dans le [i] en partant du d�but � la fin * * @param <T> * @param array * @param e * @param begin * @param end */ private static <T> void moveDown(T[] array, T e, int begin, int end) { assert begin < end; for (int i = begin; i < end; i++) { array[i] = array[i + 1]; } array[end] = e; } public static <T> T[] clone(T[] array) { if (array == null) { return null; } return array.clone(); } }
UTF-8
Java
13,416
java
ArraysUtil.java
Java
[ { "context": " Class ArraysUtil.\n * \n * @author <a href=\"mailto:stephane.chomat@imag.fr\">Stephane Chomat</a>\n */\npublic class ArraysUtil ", "end": 1096, "score": 0.9996370673179626, "start": 1073, "tag": "EMAIL", "value": "stephane.chomat@imag.fr" }, { "context": " @author <a href=\"mailto:stephane.chomat@imag.fr\">Stephane Chomat</a>\n */\npublic class ArraysUtil {\n\n\t/**\n\t * Merge", "end": 1113, "score": 0.9998648166656494, "start": 1098, "tag": "NAME", "value": "Stephane Chomat" } ]
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. * * Copyright (C) 2006-2010 Adele Team/LIG/Grenoble University, France */ package fr.imag.adele.cadse.util; import java.lang.reflect.Array; import java.util.List; import java.util.NoSuchElementException; /** * The Class ArraysUtil. * * @author <a href="mailto:<EMAIL>"><NAME></a> */ public class ArraysUtil { /** * Merge. * * @param clazz * the clazz (not null) * @param one * the one (not null) * @param two * the two (not null) * * @return the t[] */ public static <T> T[] merge(Class<T> clazz, T[] one, T[] two) { T[] ret = (T[]) Array.newInstance(clazz, one.length + two.length); System.arraycopy(one, 0, ret, 0, one.length); System.arraycopy(two, 0, ret, one.length, two.length); return ret; } /** * Adds the list. * * @param clazz * the clazz * @param array * the array * @param addObject * the add object. Ne peut pas etre null * * @return the t[] */ public static <T> T[] addList(Class<T> clazz, T[] array, T[] addObject) { if (addObject == null || addObject.length == 0) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, addObject.length); System.arraycopy(addObject, 0, ret, 0, addObject.length); return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + addObject.length); System.arraycopy(array, 0, tmp, 0, i); System.arraycopy(addObject, 0, tmp, i, addObject.length); return tmp; } } public static <T> T[] addList2(Class<T> clazz, T[] array, T... addObject) { if (addObject == null || addObject.length == 0) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, addObject.length); System.arraycopy(addObject, 0, ret, 0, addObject.length); return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + addObject.length); System.arraycopy(array, 0, tmp, 0, i); System.arraycopy(addObject, 0, tmp, i, addObject.length); return tmp; } } /** * Adds the list. * * @param clazz * the clazz * @param array * the array * @param addObject * the add object * * @return the t[] */ public static <T> T[] addList(Class<T> clazz, T[] array, List<T> addObject) { if (addObject == null || addObject.size() == 0) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, addObject.size()); ret = addObject.toArray(ret); return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + addObject.size()); System.arraycopy(array, 0, tmp, 0, i); for (int j = 0; j < addObject.size(); j++, i++) { tmp[i] = addObject.get(j); } return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * * @return the t[] */ static public <T> T[] add(Class<T> clazz, T[] array, T l) { if (l == null) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, 1); ret[0] = l; return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; T[] tmp = (T[]) Array.newInstance(clazz, i + 1); System.arraycopy(array, 0, tmp, 0, i); tmp[i] = l; return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * * @return the t[] */ static public int[] add(int[] array, int l) { if (array == null) { // if this is the first listener added, // initialize the lists int[] ret = new int[1]; ; ret[0] = l; return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; int[] tmp = new int[i + 1]; System.arraycopy(array, 0, tmp, 0, i); tmp[i] = l; return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * * @return the t[] */ static public int[] add(int[] array, int[] l) { if (l == null) { return array; } if (array == null) { // if this is the first listener added, // initialize the lists return l.clone(); } else { // Otherwise copy the array and add the new listener int i = array.length; int[] tmp = new int[i + l.length]; System.arraycopy(array, 0, tmp, 0, i); System.arraycopy(l, 0, tmp, i, l.length); return tmp; } } /** * Adds the. * * @param clazz * the clazz * @param array * the array * @param l * the l * @parem index position � mettre l'�l�ment � copier * * @return the t[] */ static public <T> T[] add(Class<T> clazz, T[] array, T l, int index) { if (l == null) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { if (index != 0) { throw new NoSuchElementException(); } // if this is the first listener added, // initialize the lists T[] ret = (T[]) Array.newInstance(clazz, 1); ret[0] = l; return ret; } else { // Otherwise copy the array and add the new listener int i = array.length; if (index < -1 || index > i) { throw new NoSuchElementException(); } T[] tmp = (T[]) Array.newInstance(clazz, i + 1); if (index == 0) { System.arraycopy(array, 0, tmp, 1, i); } else if (index == i) { System.arraycopy(array, 0, tmp, 0, i); } else { System.arraycopy(array, 0, tmp, 0, index); System.arraycopy(array, index, tmp, index + 1, i - index); } tmp[index] = l; return tmp; } } /** * Removes the listener as a listener of the specified type. * * @param l * the listener to be removed * @param clazz * the clazz * @param array * the array * * @return the t[] */ static public <T> T[] remove(Class<T> clazz, T[] array, T l) { if (l == null) { // In an ideal world, we would do an assertion here // to help developers know they are probably doing // something wrong return array; } if (array == null) { return array; } // Is l on the list? int index = indexOfEquals(array, l); return remove(clazz, array, index); } public static <T> T[] remove(Class<T> clazz, T[] array, int index, int count) { // If so, remove it if (index != -1) { if (array.length == count) { return null; } T[] tmp = (T[]) Array.newInstance(clazz, array.length - count); // Copy the list up to index System.arraycopy(array, 0, tmp, 0, index); // Copy from two past the index, up to // the end of tmp (which is two elements // shorter than the old list) if (index < tmp.length) { System.arraycopy(array, index + count, tmp, index, tmp.length - index); } return tmp; } return array; } public static <T> T[] remove(Class<T> clazz, T[] array, int index) { // If so, remove it if (index != -1) { if (array.length == 1) { return null; } T[] tmp = (T[]) Array.newInstance(clazz, array.length - 1); // Copy the list up to index System.arraycopy(array, 0, tmp, 0, index); // Copy from two past the index, up to // the end of tmp (which is two elements // shorter than the old list) if (index < tmp.length) { System.arraycopy(array, index + 1, tmp, index, tmp.length - index); } // set the listener array to the new array or null return tmp; } return array; } public static int[] remove(int[] array, int index) { // If so, remove it if (index != -1) { if (array.length == 1) { return null; } int[] tmp = new int[array.length - 1]; // Copy the list up to index System.arraycopy(array, 0, tmp, 0, index); // Copy from two past the index, up to // the end of tmp (which is two elements // shorter than the old list) if (index < tmp.length) { System.arraycopy(array, index + 1, tmp, index, tmp.length - index); } // set the listener array to the new array or null return tmp; } return array; } /** * Inverser. * * @param array * the array */ public static <T> void inverser(T[] array) { int l = array.length; int mid = l / 2; l--; for (int i = 0; i < mid; i++) { T tmp = array[i]; array[i] = array[l - i]; array[l - i] = tmp; } } /** * Return l'index de l � partir de la fin du tableau en utilisant le * comparateur == * * @param <T> * Le type du tableau * @param array * le tableau qui peut etre null * @param l * l'element � rechercher qui peut etre null; * @return l'index de l'element ou -1 si non trouv�. */ public static <T> int indexOf(T[] array, T l) { if (array != null) { for (int i = array.length - 1; i >= 0; i -= 1) { if (array[i] == l) { return i; } } } return -1; } /** * Return l'index de l � partir de la fin du tableau en utilisant le * comparateur equals * * @param <T> * Le type du tableau * @param array * le tableau qui peut etre null * @param l * l'element � rechercher. si l est null retourne -1. * @return l'index de l'element ou -1 si non trouv�. */ public static <T> int indexOfEquals(T[] array, T l) { if (array != null && l != null) { for (int i = array.length - 1; i >= 0; i -= 1) { if ((array[i].equals(l) == true)) { return i; } } } return -1; } public static <T> boolean move(OrderWay kind, T[] array, T e1, T e2) { if (e2 == e1) { return false; } int i1 = indexOf(array, e1); int i2 = indexOf(array, e2); if (i1 == -1) { throw new IllegalArgumentException("Bad object: " + e1); //$NON-NLS-1$ } if (i2 == -1) { throw new IllegalArgumentException("Bad object: " + e2); //$NON-NLS-1$ } if (kind == OrderWay.move_after) { if (i1 == i2 + 1) { return false; // nothing to do; } if (i1 < i2) { moveDown(array, e1, i1, i2); } else { moveUp(array, e1, i2 + 1, i1); } } else { if (i1 == i2 - 1) { return false; // nothing to do; } if (i1 < i2) { moveDown(array, e1, i1, i2 - 1); } else { // i2 < i1 moveUp(array, e1, i2, i1); } } // TODO Auto-generated method stub return true; } /** * Je d�cale d'un cran vers le haut du tableau les �lement allant de begin � * end-1 � begin. Et met dans end, l'�l�ment e. Je met le i-1 dans le i en * partant de la fin (begin) to au d�but (end) * * @param <T> * @param array * @param e * @param end * @param begin */ private static <T> void moveUp(T[] array, T e, int begin, int end) { assert end > begin; for (int i = end; i > begin; i--) { array[i] = array[i - 1]; } array[begin] = e; } /** * Je d�cale d'un cran vers le bas du tableau les �lement allant de begin+1 � * end. Et met dans end l'�l�ment e. * * Je prend le [i+1] et le met dans le [i] en partant du d�but � la fin * * @param <T> * @param array * @param e * @param begin * @param end */ private static <T> void moveDown(T[] array, T e, int begin, int end) { assert begin < end; for (int i = begin; i < end; i++) { array[i] = array[i + 1]; } array[end] = e; } public static <T> T[] clone(T[] array) { if (array == null) { return null; } return array.clone(); } }
13,391
0.578546
0.568522
549
23.349728
20.850445
80
false
false
0
0
0
0
0
0
2.382514
false
false
4
890ddedcd277772dd146c8b960a0006bee1f0394
1,194,000,958,435
028d6009f3beceba80316daa84b628496a210f8d
/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/SingleSettingTextHandler.java
bb955fd977003c41e79cc1e3b6dac4a2dbecc317
[]
no_license
JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
https://github.com/JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
fa50cafa69d3e317abf0db0f4e3e557150fd88b3
4420f338bc4e522c563f8899d81201857236a66a
refs/heads/master
2020-12-30T16:45:28.474000
2010-10-20T16:19:31
2010-10-20T16:19:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ package com.nokia.carbide.cpp.internal.project.ui.mmpEditor; import java.util.Map; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.swt.widgets.Control; import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; import com.nokia.carbide.cpp.internal.project.ui.editors.common.ControlHandler; import com.nokia.carbide.cpp.internal.project.ui.mmpEditor.commands.ChangeSingleSettingOperation; import com.nokia.cpp.internal.api.utils.ui.editor.IEditingContext; /** * Specialization of ControlHandler that corresponds to a value * in IMMPView's single argument settings map. * Populates the control from the setting and creates operations * to modify the mmp view when the control values is changed. */ public class SingleSettingTextHandler extends ControlHandler { private EMMPStatement statement; private IEditingContext editingContext; private MMPEditorContext editorContext; public SingleSettingTextHandler(Control control, IEditingContext editingContext, IValidator validator, EMMPStatement statement, MMPEditorContext editorContext) { super(control, validator); this.statement = statement; this.editorContext = editorContext; this.editingContext = editingContext; addListener(new ControlHandlerAdapter() { @Override public void valueModified(Control control) { makeOperation(control); } }); } public SingleSettingTextHandler(StructuredViewer viewer, IEditingContext editingContext, EMMPStatement statement, MMPEditorContext editorContext, boolean caseSensitive) { super(viewer, caseSensitive); this.statement = statement; this.editorContext = editorContext; this.editingContext = editingContext; addListener(new ControlHandlerAdapter() { @Override public void valueModified(Control control) { makeOperation(control); } }); } private void makeOperation(Control control) { ChangeSingleSettingOperation op = new ChangeSingleSettingOperation( editorContext.mmpView, editingContext, control, statement, getControlText(control)); editorContext.executeOperation(op); } public void refresh() { Map<EMMPStatement, String> sas = editorContext.mmpView.getSingleArgumentSettings(); String value = sas.get(statement); storeText(value); } }
UTF-8
Java
2,821
java
SingleSettingTextHandler.java
Java
[]
null
[]
/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ package com.nokia.carbide.cpp.internal.project.ui.mmpEditor; import java.util.Map; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.swt.widgets.Control; import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; import com.nokia.carbide.cpp.internal.project.ui.editors.common.ControlHandler; import com.nokia.carbide.cpp.internal.project.ui.mmpEditor.commands.ChangeSingleSettingOperation; import com.nokia.cpp.internal.api.utils.ui.editor.IEditingContext; /** * Specialization of ControlHandler that corresponds to a value * in IMMPView's single argument settings map. * Populates the control from the setting and creates operations * to modify the mmp view when the control values is changed. */ public class SingleSettingTextHandler extends ControlHandler { private EMMPStatement statement; private IEditingContext editingContext; private MMPEditorContext editorContext; public SingleSettingTextHandler(Control control, IEditingContext editingContext, IValidator validator, EMMPStatement statement, MMPEditorContext editorContext) { super(control, validator); this.statement = statement; this.editorContext = editorContext; this.editingContext = editingContext; addListener(new ControlHandlerAdapter() { @Override public void valueModified(Control control) { makeOperation(control); } }); } public SingleSettingTextHandler(StructuredViewer viewer, IEditingContext editingContext, EMMPStatement statement, MMPEditorContext editorContext, boolean caseSensitive) { super(viewer, caseSensitive); this.statement = statement; this.editorContext = editorContext; this.editingContext = editingContext; addListener(new ControlHandlerAdapter() { @Override public void valueModified(Control control) { makeOperation(control); } }); } private void makeOperation(Control control) { ChangeSingleSettingOperation op = new ChangeSingleSettingOperation( editorContext.mmpView, editingContext, control, statement, getControlText(control)); editorContext.executeOperation(op); } public void refresh() { Map<EMMPStatement, String> sas = editorContext.mmpView.getSingleArgumentSettings(); String value = sas.get(statement); storeText(value); } }
2,821
0.753988
0.751152
89
29.696629
24.257702
97
false
false
0
0
0
0
0
0
1.741573
false
false
4
e1e93a1c63fc391175b429bda1737a68a41b1dee
23,029,614,641,381
c3c6298329d948c8266c706e97fdbc8939e83553
/src/com/structure/DirectedGraph.java
9e5ac8ef5975e458089fdd2f8a97173c243b1732
[]
no_license
junranhuigu/Structure
https://github.com/junranhuigu/Structure
bbe3ce1715158b7910dd8a373a262f62881c0083
4aa00d474bf5de23d0034b0f7de0be7c6cf8c414
refs/heads/master
2021-01-21T12:16:03.446000
2020-02-03T12:51:06
2020-02-03T12:51:06
91,783,758
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.structure; import java.util.ArrayList; import java.util.List; import java.util.Stack; /** * 单边有向图 本类非线程安全 * */ public class DirectedGraph { private List<Node> nodes; public DirectedGraph() { this.nodes = new ArrayList<>(); } /** * 添加节点 * */ public void addNode(Object attachment){ Node node = new Node(attachment); this.nodes.add(node); } /** * 删除节点 * */ public void removeNode(Object attachment){ Node from = get(attachment); if(from != null){ //关闭连接 for(Connection c : from.getConnections2Others()){ c.getTo().getConnections2Self().remove(c); } for(Connection c : from.getConnections2Self()){ c.getFrom().getConnections2Others().remove(c); } from.getConnections2Others().clear(); from.getConnections2Self().clear(); //删除节点 nodes.remove(from); } } /** * 设置连接 * */ public void connect(Node from, Node to){ Connection c = new Connection(from, to); from.connect(c); to.connected(c); } /** * 关闭连接 * */ public void closeConnect(Node from, Node to){ Connection connection = null; for(Connection c : from.getConnections2Others()){ if(c.getTo().equals(to)){ connection = c; break; } } if(connection != null){ from.getConnections2Others().remove(connection); to.getConnections2Self().remove(connection); } } /** * 查找某个节点 * */ public Node get(Object attachment){ for(Node n : nodes){ if(attachment.equals(n.getAttachment())){ return n; } } return null; } public List<Node> getNodes() { return nodes; } /** * 验证是否存在闭合 * */ public boolean hasCircle(){ if(size() == 0){ return false; } Stack<Node> stack = new Stack<>(); List<Node> ends = endNodes(); if(ends.isEmpty()){//无终点 必然存在闭合 return true; } List<Node> begins = beginNodes(); if(begins.isEmpty()){//无起点 必然存在闭合 return true; } for(Node begin : begins){ stack.add(begin); if(hasCircle(stack)){ return true; } } return false; } private boolean hasCircle(Stack<Node> stack){ if(stack.isEmpty()){ return false; } boolean hasCircle = false; Node node = stack.peek(); if(!node.getConnections2Others().isEmpty()){//非终点 for(Connection con : node.getConnections2Others()){ if(stack.contains(con.getTo())){//验证是否存在闭环 hasCircle = true; break; } else { stack.add(con.getTo()); hasCircle = hasCircle || hasCircle(stack); } } } stack.pop(); return hasCircle; } /** * 获取有向图所有的起始节点 * */ public List<Node> beginNodes() { //入度为0的节点 List<Node> list = new ArrayList<>(); for(Node node : nodes){ if(node.getConnections2Self().isEmpty()){ list.add(node); } } return list; } /** * 获取有向图所有的终结节点 * */ public List<Node> endNodes() { //出度为0的节点 List<Node> list = new ArrayList<>(); for(Node node : nodes){ if(node.getConnections2Others().isEmpty()){ list.add(node); } } return list; } /** * 节点数量 * */ public int size(){ return nodes.size(); } /** * 最长路线 * */ public int wayMaxLength(){ if(hasCircle()){//存在闭环 则不存在最长路线 return -1; } Stack<Node> stack = new Stack<>(); int len = 0; for(Node begin : beginNodes()){ stack.add(begin); len = Math.max(wayMaxLength(stack), len); } return len; } private int wayMaxLength(Stack<Node> stack){ if(stack.isEmpty()){ return 0; } Node node = stack.peek(); int len = 0; if(node.getConnections2Others().isEmpty()){//终点 len = Math.max(stack.size(), len); } else { for(Connection con : node.getConnections2Others()){ stack.add(con.getTo()); len = Math.max(len, wayMaxLength(stack)); } } stack.pop(); return len; } /** * 有向图节点 * */ public class Node{ private Object attachment;//附件 private ArrayList<Connection> cons_self2others;//连接 - 从自己到其他节点 private ArrayList<Connection> cons_others2self;//连接 - 从其他节点到自己 public Node(Object attachment) { this.attachment = attachment; this.cons_self2others = new ArrayList<>(); this.cons_others2self = new ArrayList<>(); } public Object getAttachment() { return attachment; } /** * 获取从自己到其他节点的连接 * */ public ArrayList<Connection> getConnections2Others() { return cons_self2others; } /** * 获取从其他节点到自己的连接 * */ public ArrayList<Connection> getConnections2Self() { return cons_others2self; } /** * 记录连接到其他节点 * */ public void connect(Connection c){ cons_self2others.add(c); } /** * 记录其他节点连接到自己 * */ public void connected(Connection c){ cons_others2self.add(c); } } /** * 表示两个节点的连接 * */ public class Connection{ private Node from; private Node to; public Connection(Node from, Node to) { this.from = from; this.to = to; } public Node getFrom() { return from; } public Node getTo() { return to; } } }
UTF-8
Java
5,501
java
DirectedGraph.java
Java
[]
null
[]
package com.structure; import java.util.ArrayList; import java.util.List; import java.util.Stack; /** * 单边有向图 本类非线程安全 * */ public class DirectedGraph { private List<Node> nodes; public DirectedGraph() { this.nodes = new ArrayList<>(); } /** * 添加节点 * */ public void addNode(Object attachment){ Node node = new Node(attachment); this.nodes.add(node); } /** * 删除节点 * */ public void removeNode(Object attachment){ Node from = get(attachment); if(from != null){ //关闭连接 for(Connection c : from.getConnections2Others()){ c.getTo().getConnections2Self().remove(c); } for(Connection c : from.getConnections2Self()){ c.getFrom().getConnections2Others().remove(c); } from.getConnections2Others().clear(); from.getConnections2Self().clear(); //删除节点 nodes.remove(from); } } /** * 设置连接 * */ public void connect(Node from, Node to){ Connection c = new Connection(from, to); from.connect(c); to.connected(c); } /** * 关闭连接 * */ public void closeConnect(Node from, Node to){ Connection connection = null; for(Connection c : from.getConnections2Others()){ if(c.getTo().equals(to)){ connection = c; break; } } if(connection != null){ from.getConnections2Others().remove(connection); to.getConnections2Self().remove(connection); } } /** * 查找某个节点 * */ public Node get(Object attachment){ for(Node n : nodes){ if(attachment.equals(n.getAttachment())){ return n; } } return null; } public List<Node> getNodes() { return nodes; } /** * 验证是否存在闭合 * */ public boolean hasCircle(){ if(size() == 0){ return false; } Stack<Node> stack = new Stack<>(); List<Node> ends = endNodes(); if(ends.isEmpty()){//无终点 必然存在闭合 return true; } List<Node> begins = beginNodes(); if(begins.isEmpty()){//无起点 必然存在闭合 return true; } for(Node begin : begins){ stack.add(begin); if(hasCircle(stack)){ return true; } } return false; } private boolean hasCircle(Stack<Node> stack){ if(stack.isEmpty()){ return false; } boolean hasCircle = false; Node node = stack.peek(); if(!node.getConnections2Others().isEmpty()){//非终点 for(Connection con : node.getConnections2Others()){ if(stack.contains(con.getTo())){//验证是否存在闭环 hasCircle = true; break; } else { stack.add(con.getTo()); hasCircle = hasCircle || hasCircle(stack); } } } stack.pop(); return hasCircle; } /** * 获取有向图所有的起始节点 * */ public List<Node> beginNodes() { //入度为0的节点 List<Node> list = new ArrayList<>(); for(Node node : nodes){ if(node.getConnections2Self().isEmpty()){ list.add(node); } } return list; } /** * 获取有向图所有的终结节点 * */ public List<Node> endNodes() { //出度为0的节点 List<Node> list = new ArrayList<>(); for(Node node : nodes){ if(node.getConnections2Others().isEmpty()){ list.add(node); } } return list; } /** * 节点数量 * */ public int size(){ return nodes.size(); } /** * 最长路线 * */ public int wayMaxLength(){ if(hasCircle()){//存在闭环 则不存在最长路线 return -1; } Stack<Node> stack = new Stack<>(); int len = 0; for(Node begin : beginNodes()){ stack.add(begin); len = Math.max(wayMaxLength(stack), len); } return len; } private int wayMaxLength(Stack<Node> stack){ if(stack.isEmpty()){ return 0; } Node node = stack.peek(); int len = 0; if(node.getConnections2Others().isEmpty()){//终点 len = Math.max(stack.size(), len); } else { for(Connection con : node.getConnections2Others()){ stack.add(con.getTo()); len = Math.max(len, wayMaxLength(stack)); } } stack.pop(); return len; } /** * 有向图节点 * */ public class Node{ private Object attachment;//附件 private ArrayList<Connection> cons_self2others;//连接 - 从自己到其他节点 private ArrayList<Connection> cons_others2self;//连接 - 从其他节点到自己 public Node(Object attachment) { this.attachment = attachment; this.cons_self2others = new ArrayList<>(); this.cons_others2self = new ArrayList<>(); } public Object getAttachment() { return attachment; } /** * 获取从自己到其他节点的连接 * */ public ArrayList<Connection> getConnections2Others() { return cons_self2others; } /** * 获取从其他节点到自己的连接 * */ public ArrayList<Connection> getConnections2Self() { return cons_others2self; } /** * 记录连接到其他节点 * */ public void connect(Connection c){ cons_self2others.add(c); } /** * 记录其他节点连接到自己 * */ public void connected(Connection c){ cons_others2self.add(c); } } /** * 表示两个节点的连接 * */ public class Connection{ private Node from; private Node to; public Connection(Node from, Node to) { this.from = from; this.to = to; } public Node getFrom() { return from; } public Node getTo() { return to; } } }
5,501
0.590164
0.583844
249
18.333334
15.643792
64
false
false
0
0
0
0
0
0
2.317269
false
false
4
1af5c8c2c53f72446b44c6def7106f926a1d9567
30,434,138,269,895
eb0684847d978b320875217b4144162e1131b934
/src/sample/source/imap/iStop.java
94f24c3c927c9251054c2c80b91a344cdb7017e3
[]
no_license
PaTresS13/ija-app
https://github.com/PaTresS13/ija-app
731bec9869da0a167c3e4678952f554c3fa539eb
c8ad3b4097792dd5c72e244af93a9d8d4d5309b5
refs/heads/master
2022-11-18T04:11:24.823000
2020-07-05T12:55:02
2020-07-05T12:55:02
277,298,022
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** - PROJECT: Simulacia liniek MHD - Authors: Maroš Geffert <xgeffe00>, Patrik Tomov <xtomov02> - Date: 10.5.2020 - School: VUT Brno */ /* Package */ package sample.source.imap; /* Imports */ import sample.source.map.Coordinate; import sample.source.map.Street; public interface iStop { /************************************** * Get street of stop (getter for yaml) * @return street where is stop **************************************/ Street getStreet(); /******************** * Set street to stop * @param s street ********************/ void setStreet(Street s); /************************************* * Return id of stop (getter for yaml) * @return id *************************************/ String getId(); /******************************************* * Get coordinates of stop (getter for yaml) * @return coordinate *******************************************/ Coordinate getCoordinate(); /******************************************* * Override equal function * @param obj stop to compare * @return return true if stops are equal *******************************************/ boolean equals(Object obj); /************************** * Return ID of stop * @return string format **************************/ String toString(); }
UTF-8
Java
1,449
java
iStop.java
Java
[ { "context": "*\r\n - PROJECT: Simulacia liniek MHD\r\n - Authors: Maroš Geffert <xgeffe00>, Patrik Tomov <xtomov02>\r\n - Date: 10", "end": 66, "score": 0.9998732209205627, "start": 53, "tag": "NAME", "value": "Maroš Geffert" }, { "context": "Simulacia liniek MHD\r\n - Authors: Maroš Geffert <xgeffe00>, Patrik Tomov <xtomov02>\r\n - Date: 10.5.2020\r\n ", "end": 76, "score": 0.9994684457778931, "start": 68, "tag": "USERNAME", "value": "xgeffe00" }, { "context": "liniek MHD\r\n - Authors: Maroš Geffert <xgeffe00>, Patrik Tomov <xtomov02>\r\n - Date: 10.5.2020\r\n - School: VUT ", "end": 91, "score": 0.9998732805252075, "start": 79, "tag": "NAME", "value": "Patrik Tomov" }, { "context": " Authors: Maroš Geffert <xgeffe00>, Patrik Tomov <xtomov02>\r\n - Date: 10.5.2020\r\n - School: VUT Brno\r\n */\r", "end": 101, "score": 0.9994328618049622, "start": 93, "tag": "USERNAME", "value": "xtomov02" } ]
null
[]
/** - PROJECT: Simulacia liniek MHD - Authors: <NAME> <xgeffe00>, <NAME> <xtomov02> - Date: 10.5.2020 - School: VUT Brno */ /* Package */ package sample.source.imap; /* Imports */ import sample.source.map.Coordinate; import sample.source.map.Street; public interface iStop { /************************************** * Get street of stop (getter for yaml) * @return street where is stop **************************************/ Street getStreet(); /******************** * Set street to stop * @param s street ********************/ void setStreet(Street s); /************************************* * Return id of stop (getter for yaml) * @return id *************************************/ String getId(); /******************************************* * Get coordinates of stop (getter for yaml) * @return coordinate *******************************************/ Coordinate getCoordinate(); /******************************************* * Override equal function * @param obj stop to compare * @return return true if stops are equal *******************************************/ boolean equals(Object obj); /************************** * Return ID of stop * @return string format **************************/ String toString(); }
1,435
0.401934
0.394337
54
24.777779
16.82884
62
false
false
0
0
0
0
0
0
0.185185
false
false
4
947f35eea5e69b57cc58c09fc8d936bf38f45ba4
20,890,720,990,827
0d879a40784323d366cb12dd735880d05be4253b
/emoji-java-common/src/main/java/com/vdurmont/emoji/EmojiSet.java
06c51e26b96b939471c6bd56450cefb2bc85b5e8
[ "MIT" ]
permissive
fuze/sdk-emoji-java
https://github.com/fuze/sdk-emoji-java
6075f03070296b9f3a8ec008ca5d922882a37bc6
635fdde31f9918d1adf2de7b71496427a1c69182
refs/heads/master
2021-09-02T12:28:22.199000
2018-01-02T16:23:46
2018-01-02T16:23:46
115,666,333
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vdurmont.emoji; public enum EmojiSet { /** * Set provided by the emoji-java project at https://github.com/vdurmont/emoji-java */ EMOJI_JAVA, /** * Set provided by unicodey at https://unicodey.com/emoji-data/table.htm */ UNICODEY, /** * Custom json set in the same format as this file: https://github.com/vdurmont/emoji-java/blob/8cf5fbe0d7c1020b926791f2b342a263ed07bb0f/src/main/resources/emojis.json */ CUSTOM }
UTF-8
Java
483
java
EmojiSet.java
Java
[ { "context": "d by the emoji-java project at https://github.com/vdurmont/emoji-java\n */\n EMOJI_JAVA,\n\n /**\n ", "end": 137, "score": 0.9993980526924133, "start": 129, "tag": "USERNAME", "value": "vdurmont" }, { "context": " the same format as this file: https://github.com/vdurmont/emoji-java/blob/8cf5fbe0d7c1020b926791f2b342a263e", "end": 373, "score": 0.999457061290741, "start": 365, "tag": "USERNAME", "value": "vdurmont" } ]
null
[]
package com.vdurmont.emoji; public enum EmojiSet { /** * Set provided by the emoji-java project at https://github.com/vdurmont/emoji-java */ EMOJI_JAVA, /** * Set provided by unicodey at https://unicodey.com/emoji-data/table.htm */ UNICODEY, /** * Custom json set in the same format as this file: https://github.com/vdurmont/emoji-java/blob/8cf5fbe0d7c1020b926791f2b342a263ed07bb0f/src/main/resources/emojis.json */ CUSTOM }
483
0.670807
0.621118
19
24.421053
41.837173
171
false
false
0
0
0
0
76
0.15735
0.157895
false
false
4
b5d697fd9c31c841df8ff841c53bc4f50492fcc8
13,271,448,960,826
fef6dfa25cc4a32319347596c0a88bd363230204
/com/planet_ink/coffee_mud/Abilities/Languages/Dwarven.java
8faa3e86a8cb6fa81a6f4804b624e3b38e4107d0
[ "Apache-2.0" ]
permissive
robjcaskey/Unofficial-Coffee-Mud-Upstream
https://github.com/robjcaskey/Unofficial-Coffee-Mud-Upstream
50dfb4e482d81b95f5b354ed807b30c7c2fc76af
bd153d552972ba4a0eb53c7d5c19050a383f910f
refs/heads/master
2017-12-22T04:18:29.821000
2011-01-29T23:20:30
2011-01-29T23:20:30
1,307,420
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.planet_ink.coffee_mud.Abilities.Languages; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2000-2010 Bo Zimmerman 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. */ @SuppressWarnings("unchecked") public class Dwarven extends StdLanguage { public String ID() { return "Dwarven"; } public String name(){ return "Dwarven";} public static Vector wordLists=null; private static boolean mapped=false; public Dwarven() { super(); if(!mapped){mapped=true; CMLib.ableMapper().addCharAbilityMapping("All",1,ID(),false);} } public Vector translationVector(String language) { if(wordLists==null) { String[] one={"o"}; String[] two={"`ai","`oi","`ul"}; String[] three={"aya","dum","mim","oyo","tum"}; String[] four={"menu","bund","ibun","khim","nala","rukhs","dumu","zirik","gunud","gabil","gamil"}; String[] five={"kibil","celeb","mahal","narag","zaram","sigin","tarag","uzbad","zigil","zirak","aglab","baraz","baruk","bizar","felak"}; String[] six={"azanul","bundushathur","morthond","felagund","gabilan","ganthol","khazad","kheled","khuzud","mazarbul","khuzdul"}; wordLists=new Vector(); wordLists.addElement(one); wordLists.addElement(two); wordLists.addElement(three); wordLists.addElement(four); wordLists.addElement(five); wordLists.addElement(six); } return wordLists; } }
UTF-8
Java
2,605
java
Dwarven.java
Java
[ { "context": "import java.util.*;\r\n\r\n/* \r\n Copyright 2000-2010 Bo Zimmerman\r\n\r\n Licensed under the Apache License, Version ", "end": 829, "score": 0.9998143911361694, "start": 817, "tag": "NAME", "value": "Bo Zimmerman" }, { "context": "nu\",\"bund\",\"ibun\",\"khim\",\"nala\",\"rukhs\",\"dumu\",\"zirik\",\"gunud\",\"gabil\",\"gamil\"};\r\n\t\t\tString[] five={\"ki", "end": 2050, "score": 0.5220305919647217, "start": 2047, "tag": "NAME", "value": "rik" }, { "context": "\",\"ibun\",\"khim\",\"nala\",\"rukhs\",\"dumu\",\"zirik\",\"gunud\",\"gabil\",\"gamil\"};\r\n\t\t\tString[] five={\"kibil\",\"ce", "end": 2058, "score": 0.5376843810081482, "start": 2056, "tag": "NAME", "value": "ud" }, { "context": "un\",\"khim\",\"nala\",\"rukhs\",\"dumu\",\"zirik\",\"gunud\",\"gabil\",\"gamil\"};\r\n\t\t\tString[] five={\"kibil\",\"celeb\",\"ma", "end": 2066, "score": 0.7870301008224487, "start": 2061, "tag": "NAME", "value": "gabil" }, { "context": "\"nala\",\"rukhs\",\"dumu\",\"zirik\",\"gunud\",\"gabil\",\"gamil\"};\r\n\t\t\tString[] five={\"kibil\",\"celeb\",\"mahal\",\"na", "end": 2074, "score": 0.7109202742576599, "start": 2072, "tag": "NAME", "value": "il" }, { "context": "z\",\"baruk\",\"bizar\",\"felak\"};\r\n\t\t\tString[] six={\"azanul\",\"bundushathur\",\"morthond\",\"felagund\",\"gabilan\",\"", "end": 2244, "score": 0.7214328050613403, "start": 2240, "tag": "NAME", "value": "anul" }, { "context": "uk\",\"bizar\",\"felak\"};\r\n\t\t\tString[] six={\"azanul\",\"bundushathur\",\"morthond\",\"felagund\",\"gabilan\",\"ganthol\",\"khaza", "end": 2259, "score": 0.896791934967041, "start": 2247, "tag": "NAME", "value": "bundushathur" }, { "context": "lak\"};\r\n\t\t\tString[] six={\"azanul\",\"bundushathur\",\"morthond\",\"felagund\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\"", "end": 2270, "score": 0.9730741381645203, "start": 2262, "tag": "NAME", "value": "morthond" }, { "context": "String[] six={\"azanul\",\"bundushathur\",\"morthond\",\"felagund\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\",\"khuzud\",\"", "end": 2281, "score": 0.9271724820137024, "start": 2273, "tag": "NAME", "value": "felagund" }, { "context": "x={\"azanul\",\"bundushathur\",\"morthond\",\"felagund\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\",\"khuzud\",\"mazarbul\",", "end": 2291, "score": 0.9282286167144775, "start": 2284, "tag": "NAME", "value": "gabilan" }, { "context": "bundushathur\",\"morthond\",\"felagund\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\",\"khuzud\",\"mazarbul\",\"khuzdul\"}", "end": 2301, "score": 0.890109121799469, "start": 2297, "tag": "NAME", "value": "thol" }, { "context": "athur\",\"morthond\",\"felagund\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\",\"khuzud\",\"mazarbul\",\"khuzdul\"};\r\n\t\t\twor", "end": 2310, "score": 0.79025799036026, "start": 2304, "tag": "NAME", "value": "khazad" }, { "context": "orthond\",\"felagund\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\",\"khuzud\",\"mazarbul\",\"khuzdul\"};\r\n\t\t\twordLists=ne", "end": 2319, "score": 0.8637893199920654, "start": 2313, "tag": "NAME", "value": "kheled" }, { "context": "lagund\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\",\"khuzud\",\"mazarbul\",\"khuzdul\"};\r\n\t\t\twordLists=new Vector(", "end": 2328, "score": 0.6399379968643188, "start": 2325, "tag": "NAME", "value": "zud" }, { "context": "\",\"gabilan\",\"ganthol\",\"khazad\",\"kheled\",\"khuzud\",\"mazarbul\",\"khuzdul\"};\r\n\t\t\twordLists=new Vector();\r\n\t\t\tword", "end": 2339, "score": 0.6839798092842102, "start": 2331, "tag": "NAME", "value": "mazarbul" } ]
null
[]
package com.planet_ink.coffee_mud.Abilities.Languages; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2000-2010 <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. */ @SuppressWarnings("unchecked") public class Dwarven extends StdLanguage { public String ID() { return "Dwarven"; } public String name(){ return "Dwarven";} public static Vector wordLists=null; private static boolean mapped=false; public Dwarven() { super(); if(!mapped){mapped=true; CMLib.ableMapper().addCharAbilityMapping("All",1,ID(),false);} } public Vector translationVector(String language) { if(wordLists==null) { String[] one={"o"}; String[] two={"`ai","`oi","`ul"}; String[] three={"aya","dum","mim","oyo","tum"}; String[] four={"menu","bund","ibun","khim","nala","rukhs","dumu","zirik","gunud","gabil","gamil"}; String[] five={"kibil","celeb","mahal","narag","zaram","sigin","tarag","uzbad","zigil","zirak","aglab","baraz","baruk","bizar","felak"}; String[] six={"azanul","bundushathur","morthond","felagund","gabilan","ganthol","khazad","kheled","khuzud","mazarbul","khuzdul"}; wordLists=new Vector(); wordLists.addElement(one); wordLists.addElement(two); wordLists.addElement(three); wordLists.addElement(four); wordLists.addElement(five); wordLists.addElement(six); } return wordLists; } }
2,599
0.702879
0.697889
68
36.323528
29.58708
139
false
false
0
0
0
0
0
0
2.205882
false
false
4
b1391945240f291e308cba1085fa2317a6ee2b51
13,271,448,960,732
ff7acf94ad6932d32f5e05b8cf5d506f589a5255
/Sorting.java
7d14416d077be92388d5657ec0a5aa027b03929c
[]
no_license
abirsaha/CodeSample
https://github.com/abirsaha/CodeSample
6ab3c5eb17d739fa72bf79e9b07ff75d5cbfe50e
8e04b27cb2f75b4c1ad5270dc63403098aac0b43
refs/heads/master
2021-01-10T14:49:25.391000
2016-03-15T23:13:33
2016-03-15T23:13:33
52,421,367
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package abir.java.program; public class Sorting { public static void main(String[] args) { // TODO Auto-generated method stub int[] arr = { 3, 2, 1 }; //int[] sortedArrayB = bubbleSort(arr); int[] sortedArrayI = insertionSort(arr); int[] sortedArrayS = selectionSort(arr); // for (int i = 0; i < sortedArrayB.length; i++) { // System.out.print(sortedArrayB[i] + " "); // } System.out.println(); for (int i = 0; i < sortedArrayI.length; i++) { System.out.print(sortedArrayI[i] + " "); } System.out.println(); for (int i = 0; i < sortedArrayS.length; i++) { System.out.print(sortedArrayS[i] + " "); } } private static int[] bubbleSort(int[] arr) { // TODO Auto-generated method stub int i, j, temp = 0; for (i = 0; i < arr.length - 1; i++) { for (j = 0; j < arr.length - 1 - i; j++) { if (arr[j] > arr[j + 1]) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } return arr; } private static int[] insertionSort(int[] arr) { // TODO Auto-generated method stub int i, j, key, temp; for (i = 1; i < arr.length; i++) { key = arr[i]; j = i - 1; while (j >= 0 && key < arr[j]) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; j--; } } return arr; } private static int[] selectionSort(int[] arr) { // TODO Auto-generated method stub int i, j, minVal,minIndex, temp=0; for (i = 0; i < arr.length; i++) { minVal= arr[i]; minIndex = i; for(j=i;j<arr.length;j++){ if(arr[j]<minVal){ minVal = arr[j]; minIndex = j; } } if(minVal < arr[i]){ temp= arr[minIndex]; arr[minIndex]=arr[i]; arr[i] = temp; } } return arr; } }
UTF-8
Java
1,717
java
Sorting.java
Java
[]
null
[]
package abir.java.program; public class Sorting { public static void main(String[] args) { // TODO Auto-generated method stub int[] arr = { 3, 2, 1 }; //int[] sortedArrayB = bubbleSort(arr); int[] sortedArrayI = insertionSort(arr); int[] sortedArrayS = selectionSort(arr); // for (int i = 0; i < sortedArrayB.length; i++) { // System.out.print(sortedArrayB[i] + " "); // } System.out.println(); for (int i = 0; i < sortedArrayI.length; i++) { System.out.print(sortedArrayI[i] + " "); } System.out.println(); for (int i = 0; i < sortedArrayS.length; i++) { System.out.print(sortedArrayS[i] + " "); } } private static int[] bubbleSort(int[] arr) { // TODO Auto-generated method stub int i, j, temp = 0; for (i = 0; i < arr.length - 1; i++) { for (j = 0; j < arr.length - 1 - i; j++) { if (arr[j] > arr[j + 1]) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } return arr; } private static int[] insertionSort(int[] arr) { // TODO Auto-generated method stub int i, j, key, temp; for (i = 1; i < arr.length; i++) { key = arr[i]; j = i - 1; while (j >= 0 && key < arr[j]) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; j--; } } return arr; } private static int[] selectionSort(int[] arr) { // TODO Auto-generated method stub int i, j, minVal,minIndex, temp=0; for (i = 0; i < arr.length; i++) { minVal= arr[i]; minIndex = i; for(j=i;j<arr.length;j++){ if(arr[j]<minVal){ minVal = arr[j]; minIndex = j; } } if(minVal < arr[i]){ temp= arr[minIndex]; arr[minIndex]=arr[i]; arr[i] = temp; } } return arr; } }
1,717
0.535818
0.523588
83
19.686747
16.264328
51
false
false
0
0
0
0
0
0
2.927711
false
false
4
d4ad4e8f177427b0bfe79725e8d13977c4bb0a8d
30,374,008,718,575
a0e41303fcdd8a1101edea10a95703b56ee2e9b5
/src/SokobanMain.java
d84602ae4f8178897a8459817c0e68d642b20c40
[]
no_license
ayoubzaabali/SokobanSolver
https://github.com/ayoubzaabali/SokobanSolver
5d4fb4f0cc4fff1f006b74c0c6b21e3b47128254
c9759ab6245458a7d6a553956e19d5c4b7a8302e
refs/heads/master
2022-02-18T14:36:20.699000
2018-02-05T18:19:35
2018-02-05T18:19:35
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Assignment 1 Sokoban Solver * Forrest Knight - CS480 - Artificial Intelligence * Fall 2017 */ public class SokobanMain { /** * @param args */ public static void main(String[] args) { SokobanSolver.parseArguments(args); } }
UTF-8
Java
248
java
SokobanMain.java
Java
[ { "context": "/**\n \t* Assignment 1 Sokoban Solver\n \t* Forrest Knight - CS480 - Artificial Intelligence\n \t* Fall 2017\n ", "end": 54, "score": 0.9998753666877747, "start": 40, "tag": "NAME", "value": "Forrest Knight" } ]
null
[]
/** * Assignment 1 Sokoban Solver * <NAME> - CS480 - Artificial Intelligence * Fall 2017 */ public class SokobanMain { /** * @param args */ public static void main(String[] args) { SokobanSolver.parseArguments(args); } }
240
0.66129
0.629032
15
15.533334
16.788355
52
false
false
0
0
0
0
0
0
0.8
false
false
4
f2a1d0080b07025739692cacc0706106063af897
2,113,123,976,534
c53cc41d667827bb23d20a9b6fc78a3812b42336
/app/src/main/java/de/boehm/garderobia/data/bottoms/Jeans.java
95a0101422b0a39a6a617cfacfe5ffc83ebc6a97
[]
no_license
boehmers/Garderobia
https://github.com/boehmers/Garderobia
8541bf376e4ad22c614af752cf0883408830968d
2121f2fcbcba99dd870899847839f8abf5d8f759
refs/heads/master
2016-09-06T03:21:23.721000
2014-10-24T10:58:17
2014-10-24T10:58:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.boehm.garderobia.data.bottoms; import de.boehm.garderobia.data.Bottom; /** * Created by Manuel on 15.10.2014. */ public class Jeans extends Bottom { }
UTF-8
Java
166
java
Jeans.java
Java
[ { "context": "e.boehm.garderobia.data.Bottom;\n\n/**\n * Created by Manuel on 15.10.2014.\n */\npublic class Jeans extends Bot", "end": 108, "score": 0.9984143972396851, "start": 102, "tag": "NAME", "value": "Manuel" } ]
null
[]
package de.boehm.garderobia.data.bottoms; import de.boehm.garderobia.data.Bottom; /** * Created by Manuel on 15.10.2014. */ public class Jeans extends Bottom { }
166
0.73494
0.686747
9
17.444445
18.049999
41
false
false
0
0
0
0
0
0
0.222222
false
false
4
8e6f9e1e9f033c547338999358c76ba22158682b
33,122,787,810,761
2de24c76b932c74b915f4461ad789d8a8db1d068
/FaqActivity.java
9e8747f3c454a677c7337274dcd19ebb9e0087b4
[]
no_license
kudarukuni/M.G.A
https://github.com/kudarukuni/M.G.A
37661234c2d8958f04b3d80a0b9b1bbbde450682
73460797cf1cbe69b2c572a6954842749069d66e
refs/heads/main
2023-03-07T20:10:33.425000
2021-02-23T12:43:45
2021-02-23T12:43:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rukuni.mga; class FaqActivity { }
UTF-8
Java
51
java
FaqActivity.java
Java
[]
null
[]
package com.rukuni.mga; class FaqActivity { }
51
0.686275
0.686275
4
10.75
10.35314
23
false
false
0
0
0
0
0
0
0.25
false
false
4
41200a57f3e02269d0f8b681ab33de08e8cb3f11
30,210,799,963,115
950d268221c6957fdb8f49b3cbb2e904bb78baa3
/src/main/java/com/mylearning/delegate/SetupDelegate.java
a78be4f5dbb5a52a97e8d3817c12fa6df07cd80b
[]
no_license
PadmavathiSundaram/site-clearing-simulator
https://github.com/PadmavathiSundaram/site-clearing-simulator
f59fc0f202bfde531d5e9cd24da70037e66e43c3
b4deaf3fb602b758338f6e3a83fca54232dd43e8
refs/heads/master
2020-04-03T22:23:41.469000
2018-10-31T17:52:45
2018-10-31T17:52:45
155,600,128
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mylearning.delegate; import com.mylearning.constants.SimulatorConstants; import com.mylearning.controller.GlobalExceptionController; import com.mylearning.exception.InValidDataException; import com.mylearning.service.GridSetupService; import com.mylearning.service.impl.GridSetupServiceImpl; import com.mylearning.utils.FileLoaderUtil; import com.mylearning.utils.StaticDataLoaderUtil; /** * Governs the Sequence of items involved in loading the simulator */ public class SetupDelegate { private GridSetupService gridSetupService; /** * Loads and process the file to generate the site map * Loads config and static content * @param filename * @throws InValidDataException */ public void setupSimulator(String[] filename) throws InValidDataException { setUpExceptionController(); FileLoaderUtil.populateProperties(SimulatorConstants.CONTENT_FILE_PATH, SimulatorConstants.TEXT); FileLoaderUtil.populateProperties(SimulatorConstants.CONFIG_PATH, SimulatorConstants.PROPERTIES); ValidateFile(filename); gridSetupService = new GridSetupServiceImpl(filename[0]); gridSetupService.loadSquares(); gridSetupService.display(); } private void ValidateFile(String[] filename) throws InValidDataException { if (filename == null || filename.length == 0 || filename[0] == null) { String message = StaticDataLoaderUtil.getConfigValueAsString(SimulatorConstants.ErrorCode_E1003); throw new InValidDataException(SimulatorConstants.ErrorCode_E1003 , message); } } private void setUpExceptionController() { GlobalExceptionController globalExceptionController = new GlobalExceptionController(); Thread.setDefaultUncaughtExceptionHandler(globalExceptionController); } }
UTF-8
Java
1,845
java
SetupDelegate.java
Java
[]
null
[]
package com.mylearning.delegate; import com.mylearning.constants.SimulatorConstants; import com.mylearning.controller.GlobalExceptionController; import com.mylearning.exception.InValidDataException; import com.mylearning.service.GridSetupService; import com.mylearning.service.impl.GridSetupServiceImpl; import com.mylearning.utils.FileLoaderUtil; import com.mylearning.utils.StaticDataLoaderUtil; /** * Governs the Sequence of items involved in loading the simulator */ public class SetupDelegate { private GridSetupService gridSetupService; /** * Loads and process the file to generate the site map * Loads config and static content * @param filename * @throws InValidDataException */ public void setupSimulator(String[] filename) throws InValidDataException { setUpExceptionController(); FileLoaderUtil.populateProperties(SimulatorConstants.CONTENT_FILE_PATH, SimulatorConstants.TEXT); FileLoaderUtil.populateProperties(SimulatorConstants.CONFIG_PATH, SimulatorConstants.PROPERTIES); ValidateFile(filename); gridSetupService = new GridSetupServiceImpl(filename[0]); gridSetupService.loadSquares(); gridSetupService.display(); } private void ValidateFile(String[] filename) throws InValidDataException { if (filename == null || filename.length == 0 || filename[0] == null) { String message = StaticDataLoaderUtil.getConfigValueAsString(SimulatorConstants.ErrorCode_E1003); throw new InValidDataException(SimulatorConstants.ErrorCode_E1003 , message); } } private void setUpExceptionController() { GlobalExceptionController globalExceptionController = new GlobalExceptionController(); Thread.setDefaultUncaughtExceptionHandler(globalExceptionController); } }
1,845
0.755014
0.749052
50
35.900002
33.275368
109
false
false
0
0
0
0
0
0
0.54
false
false
4
bce8da19f340a683436ccf502c241cd9319d4608
22,007,412,465,830
31c307ada35fa6619a808175be8dc575463d1914
/Framework/src/types/CodeToUser.java
1dcfb22b95f6a017433806476fb16f4c397dbaa6
[]
no_license
FaissalCh/Dar_projet_framework
https://github.com/FaissalCh/Dar_projet_framework
7b9a97ff4e238e40965e6a06ef39314028b92cfc
2c147a453eca86d5f2cee0a98fea69e7775267bc
refs/heads/master
2019-12-17T22:01:42.551000
2017-03-20T14:37:02
2017-03-20T14:37:02
84,188,737
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package types; public enum CodeToUser { _100 ("Continue"), _101 ("Switching Protocols") , _102 ("Processing") , _200 ("OK") , _201 ("Created") , _202 ("Accepted") , _203 ("Non-Authoritative Information") , _204 ("No Content") , _205 ("Reset Content") , _206 ("Partial Content") , _207 ("Multi-status"), _300 ("Multiple Choices") , _301 ("Moved Permanently") , _302 ("Found") , _303 ("See Other") , _304 ("Not Modified") , _305 ("Use Proxy") , _306 ("(Unused)") , _307 ("Temporary Redirect") , _400 ("Bad Request") , _401 ("Unauthorized") , _402 ("Payment Required") , _403 ("Forbidden") , _404 ("Not Found") , _405 ("Method Not Allowed") , _406 ("Not Acceptable") , _407 ("Proxy Authentication Required") , _408 ("Request Timeout") , _409 ("Conflict") , _410 ("Gone") , _411 ("Length Required") , _412 ("Precondition Failed") , _413 ("Request Entity Too Large") , _414 ("Request-URI Too Long") , _415 ("Unsupported Media Type") , _416 ("Requested Range Not Satisfiable") , _417 ("Expectation Failed") , _422 ("Unprocessable Entity") , _423 ("Locked") , _424 ("Failed Dependency") , _426 ("Upgrade Required") , _500 ("Internal Server Error") , _501 ("Not Implemented") , _502 ("Bad Gateway") , _503 ("Service Not Available") , _504 ("Gateway Timeout") , _505 ("HTTP Version Not Supported") , _507 ("Insufficient Storage") ; public String codeToReason() { return code; } public int codeToInteger() { int codeRetour = Integer.parseInt(this.name().replaceFirst("_", "")); return codeRetour; } private String code; private CodeToUser(String s) { code = s; } }
UTF-8
Java
1,635
java
CodeToUser.java
Java
[]
null
[]
package types; public enum CodeToUser { _100 ("Continue"), _101 ("Switching Protocols") , _102 ("Processing") , _200 ("OK") , _201 ("Created") , _202 ("Accepted") , _203 ("Non-Authoritative Information") , _204 ("No Content") , _205 ("Reset Content") , _206 ("Partial Content") , _207 ("Multi-status"), _300 ("Multiple Choices") , _301 ("Moved Permanently") , _302 ("Found") , _303 ("See Other") , _304 ("Not Modified") , _305 ("Use Proxy") , _306 ("(Unused)") , _307 ("Temporary Redirect") , _400 ("Bad Request") , _401 ("Unauthorized") , _402 ("Payment Required") , _403 ("Forbidden") , _404 ("Not Found") , _405 ("Method Not Allowed") , _406 ("Not Acceptable") , _407 ("Proxy Authentication Required") , _408 ("Request Timeout") , _409 ("Conflict") , _410 ("Gone") , _411 ("Length Required") , _412 ("Precondition Failed") , _413 ("Request Entity Too Large") , _414 ("Request-URI Too Long") , _415 ("Unsupported Media Type") , _416 ("Requested Range Not Satisfiable") , _417 ("Expectation Failed") , _422 ("Unprocessable Entity") , _423 ("Locked") , _424 ("Failed Dependency") , _426 ("Upgrade Required") , _500 ("Internal Server Error") , _501 ("Not Implemented") , _502 ("Bad Gateway") , _503 ("Service Not Available") , _504 ("Gateway Timeout") , _505 ("HTTP Version Not Supported") , _507 ("Insufficient Storage") ; public String codeToReason() { return code; } public int codeToInteger() { int codeRetour = Integer.parseInt(this.name().replaceFirst("_", "")); return codeRetour; } private String code; private CodeToUser(String s) { code = s; } }
1,635
0.611009
0.522936
70
22.357143
12.77166
71
false
false
0
0
0
0
0
0
1.757143
false
false
4
09f6394525cac9d53ca8c1e3910eabe0753520e4
773,094,160,563
9cd964eb091471b0458a2c8523f0b0f2cc8dceec
/webapp/src/main/java/image/exifweb/pyload/PyLoadService.java
63a4443ea293279d2866868f2f3e0da3057221ec
[ "MIT" ]
permissive
adrhc/photos-server
https://github.com/adrhc/photos-server
343565b12a244e7796f4d2e3cd3e19ce93a5f69a
0b89f4178cc855df01f2d2aa6b2629f8608d014b
refs/heads/master
2021-06-04T05:29:11.238000
2020-01-25T11:40:50
2020-01-25T11:40:50
125,556,386
0
0
MIT
false
2021-08-11T18:02:39
2018-03-16T18:41:31
2021-08-11T18:00:16
2021-08-11T18:02:38
13,395
0
0
2
Java
false
false
package image.exifweb.pyload; import image.exifweb.appmanager.AppManagerService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; /** * Created with IntelliJ IDEA. * User: Adrian * Date: 12/1/14 * Time: 3:39 PM * To change this template use File | Settings | File Templates. */ @Service public class PyLoadService extends AppManagerService { @Value("${pyLoadCore.path}") String pyLoadCorePath; @PostConstruct public void postConstruct() { this.appProcName = "pyLoad"; this.appStatus = new ProcessBuilder("pgrep", "-f", this.pyLoadCorePath); this.appStart = new ProcessBuilder("python", this.pyLoadCorePath, "--no-remote", "--daemon"); } @Override protected String getPID() throws IOException, InterruptedException { return this.processInfoService.pgrep(this.pyLoadCorePath, true); } }
UTF-8
Java
936
java
PyLoadService.java
Java
[ { "context": "tion;\n\n/**\n * Created with IntelliJ IDEA.\n * User: Adrian\n * Date: 12/1/14\n * Time: 3:39 PM\n * To change th", "end": 307, "score": 0.9860856533050537, "start": 301, "tag": "NAME", "value": "Adrian" } ]
null
[]
package image.exifweb.pyload; import image.exifweb.appmanager.AppManagerService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; /** * Created with IntelliJ IDEA. * User: Adrian * Date: 12/1/14 * Time: 3:39 PM * To change this template use File | Settings | File Templates. */ @Service public class PyLoadService extends AppManagerService { @Value("${pyLoadCore.path}") String pyLoadCorePath; @PostConstruct public void postConstruct() { this.appProcName = "pyLoad"; this.appStatus = new ProcessBuilder("pgrep", "-f", this.pyLoadCorePath); this.appStart = new ProcessBuilder("python", this.pyLoadCorePath, "--no-remote", "--daemon"); } @Override protected String getPID() throws IOException, InterruptedException { return this.processInfoService.pgrep(this.pyLoadCorePath, true); } }
936
0.759615
0.751068
33
27.363636
25.90053
95
false
false
0
0
0
0
0
0
1.090909
false
false
4
2a3f461bc844de8a179b9862fc113ad7aaaf638f
14,688,788,195,711
219440234d156d9d8e09179a5957775801bca91b
/gmo-server/src/main/java/cn/geoportal/gmo/server/service/impl/SysNationServiceImpl.java
0428f316a7a87117f3269ddbb898831909de8506
[]
no_license
chiangbt/GMO
https://github.com/chiangbt/GMO
4b33c6fa06035636ff51a1649c41fa4ad37d5d85
3163a008b037d47028087e70037860efe136ed68
refs/heads/master
2023-06-26T17:36:14.931000
2021-07-23T09:50:53
2021-07-23T09:50:53
372,407,561
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.geoportal.gmo.server.service.impl; import cn.geoportal.gmo.server.entity.SysNation; import cn.geoportal.gmo.server.mapper.SysNationMapper; import cn.geoportal.gmo.server.service.SysNationService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * */ @Service public class SysNationServiceImpl extends ServiceImpl<SysNationMapper, SysNation> implements SysNationService { @Autowired SysNationMapper sysNationMapper; @Override public List<SysNation> getAllNation() { return sysNationMapper.selectList(null); } }
UTF-8
Java
715
java
SysNationServiceImpl.java
Java
[]
null
[]
package cn.geoportal.gmo.server.service.impl; import cn.geoportal.gmo.server.entity.SysNation; import cn.geoportal.gmo.server.mapper.SysNationMapper; import cn.geoportal.gmo.server.service.SysNationService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * */ @Service public class SysNationServiceImpl extends ServiceImpl<SysNationMapper, SysNation> implements SysNationService { @Autowired SysNationMapper sysNationMapper; @Override public List<SysNation> getAllNation() { return sysNationMapper.selectList(null); } }
715
0.793007
0.793007
24
28.625
28.792089
111
false
false
0
0
0
0
0
0
0.458333
false
false
4
3cf6f8240ca924ed7f1feb66b560d34392af266f
25,228,637,940,041
35b864c1c2cdd30530b2bb5539dbf069b1fa0100
/trabalho1/AgentesReflexo/src/br/ufrj/dcc/ia201102/trabalho1/view/EnvironmentActionListener.java
e90f73217645639791c94321d9727d105eb42227
[]
no_license
pplupo/ia201102
https://github.com/pplupo/ia201102
f72f84709c2c7844ac2c6b38f86bf8d9852a5ea9
1664e95e1a60ed8ef4225d696358585da5595d5c
refs/heads/master
2021-05-16T03:03:20.608000
2011-11-20T19:44:29
2011-11-20T19:44:29
33,789,186
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.ufrj.dcc.ia201102.trabalho1.view; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import br.ufrj.dcc.ia201102.trabalho1.model.environment.Environment; public class EnvironmentActionListener implements ActionListener { private ReflexAgents reflexAgents; public EnvironmentActionListener(ReflexAgents reflexAgents) { this.reflexAgents = reflexAgents; } @Override public void actionPerformed(ActionEvent e) { Environment env = null; StepsActionListener actionListener = new StepsActionListener(reflexAgents); if (reflexAgents.rdbtnReflexAgent.isSelected()) { env = reflexAgents.agentsController.newEnvironment(actionListener); } else if (reflexAgents.rdbtnBrokenSensorReflex.isSelected()) { env = reflexAgents.agentsController.newEnvironmentAgentBrokenSensor(actionListener); } else if (reflexAgents.rdbtnDrywashAgents.isSelected()) { env = reflexAgents.agentsController.newDryWashEnvironment(actionListener); } if (env != null) { reflexAgents.setEnvironment(env); } } }
UTF-8
Java
1,087
java
EnvironmentActionListener.java
Java
[]
null
[]
package br.ufrj.dcc.ia201102.trabalho1.view; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import br.ufrj.dcc.ia201102.trabalho1.model.environment.Environment; public class EnvironmentActionListener implements ActionListener { private ReflexAgents reflexAgents; public EnvironmentActionListener(ReflexAgents reflexAgents) { this.reflexAgents = reflexAgents; } @Override public void actionPerformed(ActionEvent e) { Environment env = null; StepsActionListener actionListener = new StepsActionListener(reflexAgents); if (reflexAgents.rdbtnReflexAgent.isSelected()) { env = reflexAgents.agentsController.newEnvironment(actionListener); } else if (reflexAgents.rdbtnBrokenSensorReflex.isSelected()) { env = reflexAgents.agentsController.newEnvironmentAgentBrokenSensor(actionListener); } else if (reflexAgents.rdbtnDrywashAgents.isSelected()) { env = reflexAgents.agentsController.newDryWashEnvironment(actionListener); } if (env != null) { reflexAgents.setEnvironment(env); } } }
1,087
0.770009
0.75713
34
29.970589
28.915174
87
false
false
0
0
0
0
0
0
1.529412
false
false
4
59ce63ef81dc79e6713e00850f5a8aad36c1133e
31,370,441,178,776
3bf7a72152abfdc22dfa7ae112ad1fe154c0957d
/app/src/main/java/com/nest/model/VisitorsData.java
ff27e9304021ea9b881c8c9384d992ba748192ae
[ "Apache-2.0" ]
permissive
yash786agg/JsonInternalStore
https://github.com/yash786agg/JsonInternalStore
d43ed70347db1bdc07f4492fdce9b12d950a35da
bd66d3580580b12c8dced7794b266243b575b063
refs/heads/master
2021-04-06T14:32:50.869000
2018-03-11T15:19:14
2018-03-11T15:19:14
124,769,240
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nest.model; import android.os.Parcel; import android.os.Parcelable; /* * Created by Yash on 11/3/18. */ public class VisitorsData implements Parcelable { private String name; private String email; private String phone; private String time; private String date; private String visitStatus; public VisitorsData() {} public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getVisitStatus() { return visitStatus; } public void setVisitStatus(String visitStatus) { this.visitStatus = visitStatus; } @Override public String toString() { return "VisitorsData{" + "name='" + name + '\'' + "email='" + email + '\'' + "phone='" + phone + '\'' + "time='" + time + '\'' + "date='" + date + '\'' + ", visitStatus='" + visitStatus + '\'' + '}'; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(name); dest.writeString(email); dest.writeString(phone); dest.writeString(time); dest.writeString(date); dest.writeString(visitStatus); } public VisitorsData(Parcel in) { name = in.readString(); email = in.readString(); phone = in.readString(); time = in.readString(); date = in.readString(); visitStatus = in.readString(); } public static final Parcelable.Creator<VisitorsData> CREATOR = new Parcelable.Creator<VisitorsData>() { @Override public VisitorsData createFromParcel(Parcel in) { return new VisitorsData(in); } @Override public VisitorsData[] newArray(int size) { return new VisitorsData[size]; } }; }
UTF-8
Java
2,548
java
VisitorsData.java
Java
[ { "context": "l;\nimport android.os.Parcelable;\n\n/*\n * Created by Yash on 11/3/18.\n */\n\npublic class VisitorsData implem", "end": 103, "score": 0.9979404211044312, "start": 99, "tag": "NAME", "value": "Yash" } ]
null
[]
package com.nest.model; import android.os.Parcel; import android.os.Parcelable; /* * Created by Yash on 11/3/18. */ public class VisitorsData implements Parcelable { private String name; private String email; private String phone; private String time; private String date; private String visitStatus; public VisitorsData() {} public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getVisitStatus() { return visitStatus; } public void setVisitStatus(String visitStatus) { this.visitStatus = visitStatus; } @Override public String toString() { return "VisitorsData{" + "name='" + name + '\'' + "email='" + email + '\'' + "phone='" + phone + '\'' + "time='" + time + '\'' + "date='" + date + '\'' + ", visitStatus='" + visitStatus + '\'' + '}'; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(name); dest.writeString(email); dest.writeString(phone); dest.writeString(time); dest.writeString(date); dest.writeString(visitStatus); } public VisitorsData(Parcel in) { name = in.readString(); email = in.readString(); phone = in.readString(); time = in.readString(); date = in.readString(); visitStatus = in.readString(); } public static final Parcelable.Creator<VisitorsData> CREATOR = new Parcelable.Creator<VisitorsData>() { @Override public VisitorsData createFromParcel(Parcel in) { return new VisitorsData(in); } @Override public VisitorsData[] newArray(int size) { return new VisitorsData[size]; } }; }
2,548
0.548666
0.546311
120
20.233334
17.873039
107
false
false
0
0
0
0
0
0
0.333333
false
false
4
9202da8e172c67d09b78d1f6ef27c1fb21ace247
15,298,673,558,362
ac9fb6a54ac12762a4a8430b749299fe73bc4692
/spring-in-action-5-samples-master/ch06/tacocloud-api/src/main/java/tacos/web/api/IngredientResource.java
803a21f6a98671919c310615a21317fe7eddc4b4
[ "Apache-2.0", "MIT" ]
permissive
PotoYang/spring-in-action-v5-translate
https://github.com/PotoYang/spring-in-action-v5-translate
e16aa600dce127a7e13bf2e57ef98b8497a9cd5b
b7237abf840139ab06c46f34d309f7e3aac4499c
refs/heads/master
2023-08-29T04:10:02.428000
2023-08-12T22:57:55
2023-08-12T22:57:55
199,817,598
1,130
313
MIT
false
2023-02-14T01:51:30
2019-07-31T08:51:23
2023-02-07T14:49:24
2023-02-14T01:51:29
16,028
971
288
0
Java
false
false
package tacos.web.api; import org.springframework.hateoas.ResourceSupport; import lombok.Getter; import tacos.Ingredient; import tacos.Ingredient.Type; public class IngredientResource extends ResourceSupport { @Getter private String name; @Getter private Type type; public IngredientResource(Ingredient ingredient) { this.name = ingredient.getName(); this.type = ingredient.getType(); } }
UTF-8
Java
418
java
IngredientResource.java
Java
[]
null
[]
package tacos.web.api; import org.springframework.hateoas.ResourceSupport; import lombok.Getter; import tacos.Ingredient; import tacos.Ingredient.Type; public class IngredientResource extends ResourceSupport { @Getter private String name; @Getter private Type type; public IngredientResource(Ingredient ingredient) { this.name = ingredient.getName(); this.type = ingredient.getType(); } }
418
0.758373
0.758373
22
18
18.544786
57
false
false
0
0
0
0
0
0
0.409091
false
false
4
60dea3fc527641e2d2ceecba6dbf686f89ccb628
13,116,830,189,418
d4e63721f018a0041d820f662ce5afb62ea03a0b
/app/src/main/java/com/example/mangaapp/activity_phyk.java
c60d9b4cb0309402e8fea06b29a83a2415713a0b
[]
no_license
vuvanthanh2311/MangaApp
https://github.com/vuvanthanh2311/MangaApp
19a08e23a2823f19af8873efc1ccf850020c22b0
82321acda8b8f26291387641712fd3511683308e
refs/heads/main
2023-02-13T11:13:35.791000
2021-01-16T15:52:13
2021-01-16T15:52:13
313,806,130
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mangaapp; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.Date; import java.util.HashMap; public class activity_phyk extends AppCompatActivity { DatabaseReference mData = FirebaseDatabase.getInstance().getReference(); private TextView name, email, content,phyk; private EditText edtname, edtemail, edtcontent; private Button btn, btnquaylai; private ImageView back; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_phyk); name =findViewById(R.id.tvname); email = findViewById(R.id.tvemail); content = findViewById(R.id.tvcontent); edtcontent = findViewById(R.id.phyk_content); edtemail = findViewById(R.id.phyk_email); edtname = findViewById(R.id.phyk_name); btn = findViewById(R.id.btn_phyk); btnquaylai = findViewById(R.id.btn_quaylai); phyk =findViewById(R.id.tvphyk); back =findViewById(R.id.img_phyk_back); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (edtname.getText().toString().isEmpty()){ Toast.makeText(activity_phyk.this,"Hãy nhập tên",Toast.LENGTH_SHORT).show(); }else { if (edtemail.getText().toString().isEmpty()){ Toast.makeText(activity_phyk.this,"Hãy nhập email",Toast.LENGTH_SHORT).show(); }else { if (edtcontent.getText().toString().isEmpty()){ Toast.makeText(activity_phyk.this,"Hãy viết ý kiến phản hồi",Toast.LENGTH_SHORT).show(); }else { HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("name", edtname.getText().toString()); hashMap.put("content",edtcontent.getText().toString()); hashMap.put("email",edtemail.getText().toString()); mData.child("phanhoi").push().setValue(hashMap); name.setVisibility(View.GONE); email.setVisibility(View.GONE); content.setVisibility(View.GONE); edtname.setVisibility(View.GONE); edtcontent.setVisibility(View.GONE); edtemail.setVisibility(View.GONE); btn.setVisibility(View.GONE); phyk.setText("Cảm ơn ý kiến của bạn "+ edtname.getText().toString()+ " !"); phyk.setVisibility(View.VISIBLE); btnquaylai.setVisibility(View.VISIBLE); } } } } }); btnquaylai.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { edtcontent.setText(""); edtname.setText(""); edtemail.setText(""); name.setVisibility(View.VISIBLE); email.setVisibility(View.VISIBLE); content.setVisibility(View.VISIBLE); edtname.setVisibility(View.VISIBLE); edtcontent.setVisibility(View.VISIBLE); email.setVisibility(View.VISIBLE); btn.setVisibility(View.VISIBLE); phyk.setVisibility(View.GONE); btnquaylai.setVisibility(View.GONE); } }); } }
UTF-8
Java
4,215
java
activity_phyk.java
Java
[]
null
[]
package com.example.mangaapp; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.Date; import java.util.HashMap; public class activity_phyk extends AppCompatActivity { DatabaseReference mData = FirebaseDatabase.getInstance().getReference(); private TextView name, email, content,phyk; private EditText edtname, edtemail, edtcontent; private Button btn, btnquaylai; private ImageView back; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_phyk); name =findViewById(R.id.tvname); email = findViewById(R.id.tvemail); content = findViewById(R.id.tvcontent); edtcontent = findViewById(R.id.phyk_content); edtemail = findViewById(R.id.phyk_email); edtname = findViewById(R.id.phyk_name); btn = findViewById(R.id.btn_phyk); btnquaylai = findViewById(R.id.btn_quaylai); phyk =findViewById(R.id.tvphyk); back =findViewById(R.id.img_phyk_back); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (edtname.getText().toString().isEmpty()){ Toast.makeText(activity_phyk.this,"Hãy nhập tên",Toast.LENGTH_SHORT).show(); }else { if (edtemail.getText().toString().isEmpty()){ Toast.makeText(activity_phyk.this,"Hãy nhập email",Toast.LENGTH_SHORT).show(); }else { if (edtcontent.getText().toString().isEmpty()){ Toast.makeText(activity_phyk.this,"Hãy viết ý kiến phản hồi",Toast.LENGTH_SHORT).show(); }else { HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("name", edtname.getText().toString()); hashMap.put("content",edtcontent.getText().toString()); hashMap.put("email",edtemail.getText().toString()); mData.child("phanhoi").push().setValue(hashMap); name.setVisibility(View.GONE); email.setVisibility(View.GONE); content.setVisibility(View.GONE); edtname.setVisibility(View.GONE); edtcontent.setVisibility(View.GONE); edtemail.setVisibility(View.GONE); btn.setVisibility(View.GONE); phyk.setText("Cảm ơn ý kiến của bạn "+ edtname.getText().toString()+ " !"); phyk.setVisibility(View.VISIBLE); btnquaylai.setVisibility(View.VISIBLE); } } } } }); btnquaylai.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { edtcontent.setText(""); edtname.setText(""); edtemail.setText(""); name.setVisibility(View.VISIBLE); email.setVisibility(View.VISIBLE); content.setVisibility(View.VISIBLE); edtname.setVisibility(View.VISIBLE); edtcontent.setVisibility(View.VISIBLE); email.setVisibility(View.VISIBLE); btn.setVisibility(View.VISIBLE); phyk.setVisibility(View.GONE); btnquaylai.setVisibility(View.GONE); } }); } }
4,215
0.560649
0.560649
107
38.149532
26.58079
116
false
false
0
0
0
0
0
0
0.747664
false
false
4
9cd7a8c75dda3052b75a4a9a59688e460b9a397e
2,104,533,977,467
3af2c61331b9460ee3c4038139e24c3307126857
/BAMSim/src/org/jrobin/core/RrdNioByteBufferBackend.java
81a9bcc148cc9a06991361747ea4ad8c9d029c03
[]
no_license
rfreale/BAMSim
https://github.com/rfreale/BAMSim
a6f0a89a7b40677f49f7d343c0f3cfe10ebb1898
3d3ca559ae7bc2d26f642fb6f8fdbe2f3f8c8a67
refs/heads/master
2023-06-07T23:12:36.298000
2019-02-21T03:20:44
2019-02-21T03:20:44
69,345,617
0
0
null
false
2021-06-22T20:50:27
2016-09-27T10:30:18
2020-10-27T13:49:50
2021-06-22T20:48:38
200,350
0
0
1
HTML
false
false
/******************************************************************************* * Copyright (c) 2001-2005 Sasa Markovic and Ciaran Treanor. * Copyright (c) 2011 The OpenNMS Group, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *******************************************************************************/ package org.jrobin.core; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; /** * JRobin backend which is used to store RRD data to ordinary disk files * by using fast java.nio.* package. This is the default backend engine since JRobin 1.4.0. */ public class RrdNioByteBufferBackend extends RrdFileBackend { private ByteBuffer m_byteBuffer; private FileChannel m_ch; private static final ReadWriteLock m_readWritelock = new ReentrantReadWriteLock(); private static final Lock m_readLock = m_readWritelock.readLock(); private static final Lock m_writeLock = m_readWritelock.writeLock(); /** * Creates RrdFileBackend object for the given file path, backed by java.nio.* classes. * * @param path Path to a file * @param m_readOnly True, if file should be open in a read-only mode. False otherwise * @param syncPeriod See {@link RrdNioBackendFactory#setSyncPeriod(int)} for explanation * @throws IOException Thrown in case of I/O error */ protected RrdNioByteBufferBackend(final String path, final boolean readOnly) throws IOException, IllegalStateException { super(path, readOnly); if (file != null) { m_ch = file.getChannel(); m_byteBuffer = ByteBuffer.allocate((int) m_ch.size()); m_ch.read(m_byteBuffer, 0); } else { throw new IllegalStateException("File in base class is null."); } } /** * Sets length of the underlying RRD file. This method is called only once, immediately * after a new RRD file gets created. * * @param newLength Length of the RRD file * @throws IOException * @throws IOException Thrown in case of I/O error. */ @Override protected void setLength(final long newLength) throws IOException { m_writeLock.lock(); try { super.setLength(newLength); m_ch = file.getChannel(); m_byteBuffer = ByteBuffer.allocate((int) newLength); m_ch.read(m_byteBuffer, 0); m_byteBuffer.position(0); } finally { m_writeLock.unlock(); } } /** * Writes bytes to the underlying RRD file on the disk * * @param offset Starting file offset * @param b Bytes to be written. */ @Override protected void write(final long offset, final byte[] b) { m_writeLock.lock(); try { m_byteBuffer.position((int) offset); m_byteBuffer.put(b); } finally { m_writeLock.unlock(); } } /** * Reads a number of bytes from the RRD file on the disk * * @param offset Starting file offset * @param b Buffer which receives bytes read from the file. */ @Override protected void read(final long offset, final byte[] b) { m_readLock.lock(); try { m_byteBuffer.position((int) offset); m_byteBuffer.get(b); } finally { m_readLock.unlock(); } } /** * Closes the underlying RRD file. * * @throws IOException Thrown in case of I/O error */ public void close() throws IOException { m_writeLock.lock(); try { m_byteBuffer.position(0); if (!isReadOnly()) m_ch.write(m_byteBuffer, 0); //just calling close here because the super calls close //on the File object and Java calls close on the channel super.close(); } finally { m_writeLock.unlock(); } } }
UTF-8
Java
4,421
java
RrdNioByteBufferBackend.java
Java
[ { "context": "***********************\n * Copyright (c) 2001-2005 Sasa Markovic and Ciaran Treanor.\n * Copyright (c) 2011 The Ope", "end": 121, "score": 0.999853789806366, "start": 108, "tag": "NAME", "value": "Sasa Markovic" }, { "context": "*****\n * Copyright (c) 2001-2005 Sasa Markovic and Ciaran Treanor.\n * Copyright (c) 2011 The OpenNMS Group, Inc.\n *", "end": 140, "score": 0.9998804330825806, "start": 126, "tag": "NAME", "value": "Ciaran Treanor" } ]
null
[]
/******************************************************************************* * Copyright (c) 2001-2005 <NAME> and <NAME>. * Copyright (c) 2011 The OpenNMS Group, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *******************************************************************************/ package org.jrobin.core; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; /** * JRobin backend which is used to store RRD data to ordinary disk files * by using fast java.nio.* package. This is the default backend engine since JRobin 1.4.0. */ public class RrdNioByteBufferBackend extends RrdFileBackend { private ByteBuffer m_byteBuffer; private FileChannel m_ch; private static final ReadWriteLock m_readWritelock = new ReentrantReadWriteLock(); private static final Lock m_readLock = m_readWritelock.readLock(); private static final Lock m_writeLock = m_readWritelock.writeLock(); /** * Creates RrdFileBackend object for the given file path, backed by java.nio.* classes. * * @param path Path to a file * @param m_readOnly True, if file should be open in a read-only mode. False otherwise * @param syncPeriod See {@link RrdNioBackendFactory#setSyncPeriod(int)} for explanation * @throws IOException Thrown in case of I/O error */ protected RrdNioByteBufferBackend(final String path, final boolean readOnly) throws IOException, IllegalStateException { super(path, readOnly); if (file != null) { m_ch = file.getChannel(); m_byteBuffer = ByteBuffer.allocate((int) m_ch.size()); m_ch.read(m_byteBuffer, 0); } else { throw new IllegalStateException("File in base class is null."); } } /** * Sets length of the underlying RRD file. This method is called only once, immediately * after a new RRD file gets created. * * @param newLength Length of the RRD file * @throws IOException * @throws IOException Thrown in case of I/O error. */ @Override protected void setLength(final long newLength) throws IOException { m_writeLock.lock(); try { super.setLength(newLength); m_ch = file.getChannel(); m_byteBuffer = ByteBuffer.allocate((int) newLength); m_ch.read(m_byteBuffer, 0); m_byteBuffer.position(0); } finally { m_writeLock.unlock(); } } /** * Writes bytes to the underlying RRD file on the disk * * @param offset Starting file offset * @param b Bytes to be written. */ @Override protected void write(final long offset, final byte[] b) { m_writeLock.lock(); try { m_byteBuffer.position((int) offset); m_byteBuffer.put(b); } finally { m_writeLock.unlock(); } } /** * Reads a number of bytes from the RRD file on the disk * * @param offset Starting file offset * @param b Buffer which receives bytes read from the file. */ @Override protected void read(final long offset, final byte[] b) { m_readLock.lock(); try { m_byteBuffer.position((int) offset); m_byteBuffer.get(b); } finally { m_readLock.unlock(); } } /** * Closes the underlying RRD file. * * @throws IOException Thrown in case of I/O error */ public void close() throws IOException { m_writeLock.lock(); try { m_byteBuffer.position(0); if (!isReadOnly()) m_ch.write(m_byteBuffer, 0); //just calling close here because the super calls close //on the File object and Java calls close on the channel super.close(); } finally { m_writeLock.unlock(); } } }
4,406
0.670437
0.662972
138
31.036232
27.974731
121
false
false
0
0
0
0
0
0
1.427536
false
false
4
6c430e5b9e614a646c6906deea570e954a91f4c5
14,620,068,734,142
03cbd368282b5e4b5ca302a38ce8b5d586193531
/src/main/java/com/pycogroup/superblog/service/ArticleService.java
dba7290c1b95a39d241f53a164bbed0480fca0e6
[]
no_license
c4phesua/spring-mongo-data-training
https://github.com/c4phesua/spring-mongo-data-training
bd60b49705352dff266d39e590666e6e98807b40
c6d64fe7d438a89f844b6b63e17e94e21c16aa11
refs/heads/master
2023-04-04T01:07:01.598000
2021-04-12T08:54:11
2021-04-12T08:54:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pycogroup.superblog.service; import com.pycogroup.superblog.model.Article; import com.pycogroup.superblog.model.Category; import java.util.List; public interface ArticleService { List<Article> getAllArticles(); Article createArticle(Article article); Article findArticleById(String id); void deactivateArticleById(String id); void activateArticleById(String id); void updateArticleContentById(String id, String content); void updateArticleTitleById(String id, String title); void updateArticleCategoriesById(String id, List<Category> categories); }
UTF-8
Java
603
java
ArticleService.java
Java
[]
null
[]
package com.pycogroup.superblog.service; import com.pycogroup.superblog.model.Article; import com.pycogroup.superblog.model.Category; import java.util.List; public interface ArticleService { List<Article> getAllArticles(); Article createArticle(Article article); Article findArticleById(String id); void deactivateArticleById(String id); void activateArticleById(String id); void updateArticleContentById(String id, String content); void updateArticleTitleById(String id, String title); void updateArticleCategoriesById(String id, List<Category> categories); }
603
0.777778
0.777778
24
24.125
24.066423
75
false
false
0
0
0
0
0
0
0.625
false
false
4
c84d9f9772dfe5fb9aef05ccdcfa1d6a8bb1ec06
26,371,099,258,476
9b9bda78c051ef84d47595f8e3b7460a44d267ff
/springcloud-parent/consumer/src/main/java/com/zl/controller/QuestionController.java
445fdd663b4e10954787a397e36d7b43b02bba43
[]
no_license
NBBC1/NBBC
https://github.com/NBBC1/NBBC
5a94ec63875ab9cd813c0c016673ae387fdf482c
b12fa53bbb23319b0274c9c6c196cb13a5a5c7a4
refs/heads/master
2023-01-12T10:40:53.595000
2020-11-13T01:25:54
2020-11-13T01:25:55
312,437,852
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zl.controller; import com.zl.feign.QuestionFeign; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/feign") public class QuestionController { @Autowired private QuestionFeign QuestionFeign; @RequestMapping("/select") public String selectQuestion(String question) { String anoswer = QuestionFeign.selectQuestion(question); System.out.println("111"); System.out.println(2222); System.out.println(anoswer); return anoswer; } }
UTF-8
Java
676
java
QuestionController.java
Java
[]
null
[]
package com.zl.controller; import com.zl.feign.QuestionFeign; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/feign") public class QuestionController { @Autowired private QuestionFeign QuestionFeign; @RequestMapping("/select") public String selectQuestion(String question) { String anoswer = QuestionFeign.selectQuestion(question); System.out.println("111"); System.out.println(2222); System.out.println(anoswer); return anoswer; } }
676
0.744083
0.733728
26
25
21.963257
64
false
false
0
0
0
0
0
0
0.423077
false
false
4
580907b4769742f700b20715cba37a7a75746f40
38,225,208,945,353
914a8162ad0890db14fe67ceedb9db890398a080
/ani4.java
41fddd1e01cefe3f78f944bd867a15ab728643d3
[]
no_license
razaviimran/Java-Examples
https://github.com/razaviimran/Java-Examples
fa37bcf79a66053337408aacda18f3958ac9befe
b465d2ee375dc997e501dbcd1d579b856e57b275
refs/heads/master
2021-08-04T04:16:45.417000
2017-08-26T12:47:52
2017-08-26T12:47:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class ayub { public static void myfun() { System.out.println("This is my function"); } } class ani4 { public static void main( String args[] ) { System.out.println( "Hi dost" ); ayub.myfun(); } }
UTF-8
Java
222
java
ani4.java
Java
[]
null
[]
class ayub { public static void myfun() { System.out.println("This is my function"); } } class ani4 { public static void main( String args[] ) { System.out.println( "Hi dost" ); ayub.myfun(); } }
222
0.594595
0.59009
22
9.045455
13.907085
44
false
false
0
0
0
0
0
0
0.954545
false
false
4
7c6750194210eb90e6f8e174f5a4340430080654
35,716,948,074,967
4840eb3591bd1353935cdb01c74e2bdc2f7e64a0
/homework4/src/homework4/SumOfNumbers.java
b90b523f29a0b8e8be642ca7b5525185b8a856e4
[]
no_license
smpark222/homework4
https://github.com/smpark222/homework4
e75d78baf360e9429028a56470e749625ae48866
5f603e84e79dd7b51ba5777f333242c252cef557
refs/heads/master
2020-02-26T15:18:35.689000
2016-10-19T10:23:15
2016-10-19T10:23:15
70,212,675
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package homework4; public class SumOfNumbers { void A01() { int sum = 0; while (true) { System.out.println("마지막 수를 입력(Q:종료) >> "); String input = new ExamForWhile().input(); if (input.equalsIgnoreCase("q")) { break; } int inputNum = Integer.parseInt(input); if (inputNum >= 1) sum = inputNum * (1 + inputNum) / 2; else sum = (2 - inputNum) * (1 + inputNum) / 2; System.out.println("총 합은 " + sum + "입니다.\n"); } return; } }
UHC
Java
519
java
SumOfNumbers.java
Java
[]
null
[]
package homework4; public class SumOfNumbers { void A01() { int sum = 0; while (true) { System.out.println("마지막 수를 입력(Q:종료) >> "); String input = new ExamForWhile().input(); if (input.equalsIgnoreCase("q")) { break; } int inputNum = Integer.parseInt(input); if (inputNum >= 1) sum = inputNum * (1 + inputNum) / 2; else sum = (2 - inputNum) * (1 + inputNum) / 2; System.out.println("총 합은 " + sum + "입니다.\n"); } return; } }
519
0.550102
0.529652
21
21.380953
17.008335
49
false
false
0
0
0
0
0
0
2.666667
false
false
4
f6fec8c7b9eeb591b8129f54c68c81d7d46f4259
60,129,595,229
432aa9481c449b27fd2f416bbdb6f454859f40c1
/backend-spring/src/main/java/io/springdemo/conference/conference/ConferenceService.java
3e0c461d320a8cdcea51d8e113ed6a3e232dc550
[]
no_license
marco76/java-demo
https://github.com/marco76/java-demo
b2f2441a63ce70d3f9bc952aa31a4397d44678b8
990431879114d0bc776a79baa19605dea7c9ee14
refs/heads/master
2022-03-15T07:28:32.660000
2022-02-09T10:53:47
2022-02-09T10:53:47
87,008,059
62
30
null
false
2022-01-21T23:29:42
2017-04-02T18:50:58
2021-06-18T19:05:18
2022-01-21T23:29:41
2,956
56
25
32
TypeScript
false
false
package io.springdemo.conference.conference; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.util.List; /** * Created by marcomolteni on 23.04.17. */ @Service public class ConferenceService { private final Integer CONFERENCES_TO_SHOW = 15; private ConferenceRepository conferenceRepository; public ConferenceService(ConferenceRepository conferenceRepository) { this.conferenceRepository = conferenceRepository; } public List<Conference> getNextConferenceList () { //return conferenceRepository.getNextActiveConferenceList(CONFERENCES_TO_SHOW, LocalDate.now()); return conferenceRepository.findByEndGreaterThanOrderByEndAsc(LocalDate.now()); } public Conference save(Conference conference) { return conferenceRepository.save(conference); } }
UTF-8
Java
855
java
ConferenceService.java
Java
[ { "context": "calDate;\nimport java.util.List;\n\n/**\n * Created by marcomolteni on 23.04.17.\n */\n@Service\npublic class Conference", "end": 176, "score": 0.999481201171875, "start": 164, "tag": "USERNAME", "value": "marcomolteni" } ]
null
[]
package io.springdemo.conference.conference; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.util.List; /** * Created by marcomolteni on 23.04.17. */ @Service public class ConferenceService { private final Integer CONFERENCES_TO_SHOW = 15; private ConferenceRepository conferenceRepository; public ConferenceService(ConferenceRepository conferenceRepository) { this.conferenceRepository = conferenceRepository; } public List<Conference> getNextConferenceList () { //return conferenceRepository.getNextActiveConferenceList(CONFERENCES_TO_SHOW, LocalDate.now()); return conferenceRepository.findByEndGreaterThanOrderByEndAsc(LocalDate.now()); } public Conference save(Conference conference) { return conferenceRepository.save(conference); } }
855
0.761404
0.752047
31
26.580645
29.441877
104
false
false
0
0
0
0
0
0
0.354839
false
false
4
bbee33cb9a7d3430cd14e7db0f74b3574f7bd0c5
39,479,339,386,713
5a03a4004569ea45818b9417454d41593ed00a86
/Collections_Project/src/main/java/SetPack/TreeSetClass.java
922181553d40fe4948306d76e2e9bb114bf174a4
[]
no_license
rakshitharamesh/SampleProject
https://github.com/rakshitharamesh/SampleProject
a8f8a54247a7c6897e88151009854282f2bf78f5
7ea47c7e210e01ae650e8ec6d8f3fb2021dee8fd
refs/heads/master
2022-12-07T09:10:56.184000
2019-11-19T06:25:41
2019-11-19T06:25:41
152,192,310
0
0
null
false
2022-11-24T09:48:01
2018-10-09T05:24:45
2019-11-19T06:26:09
2022-11-24T09:47:58
30,654
0
0
6
Java
false
false
package SetPack; import java.util.TreeSet; public class TreeSetClass { public static void main(String[] args) { //Tree Set will not accept even one null value //It will follow Asscending Order whether the data in integer or string. //Index can not be used to get data though its following Ascending order //As we can't use index Normal For and While Loops Can not be used. //Enhanced for loop (For Each) and iterator can be used //If we Try to add Duplicate Values it will override existing value. //Tree Set will changes the connections and connects the data once a value in the middle is removed //IMP: TreeSet should always be with generics, without generics we cant create TreeSet //IMP: When we don't mention the type it will by default consider <Integer> TreeSetClass oBj = new TreeSetClass(); oBj.Without_Generics(); oBj.With_Generics(); oBj.With_String(); } public void Without_Generics(){ TreeSet TSet=new TreeSet(); TSet.add(20); TSet.add(28); TSet.add(524001); // TSet.add(null); -- Treeset will not accept Null values TSet.add(28); TSet.add(30); TSet.remove(30); // Here Value 30 will not be considered as index in set, will be considered as Object and deletes it. System.out.print(TSet+"\n"); // System.out.println("Name of the Employee : "+TSet.get(1)); // -- Can not use get(index) here Though TreeSet will follow Ascending order } public void With_String(){ TreeSet<String> TSet=new TreeSet(); TSet.add("Suresh"); TSet.add("Karnataka"); TSet.add("India"); TSet.add("Nellore"); // TSet.add(null); -- Treeset will not accept Null values TSet.remove("Nellore"); System.out.print(TSet+"\n"); } public void With_Generics(){ TreeSet<Integer> TSet=new TreeSet<Integer>(); TSet.add(10); TSet.add(28); TSet.add(524001); TSet.add(524002); // TSet.add(null); -- TreeSet will not accept null values TSet.add(28); TSet.add(30); TSet.remove(524001); TSet.remove(30); // Here Value 30 will not be considered as index in set, will be considered as Object and deletes it. System.out.print(TSet+"\n"); System.out.println("Set Size is : "+TSet.size()); } }
UTF-8
Java
2,531
java
TreeSetClass.java
Java
[]
null
[]
package SetPack; import java.util.TreeSet; public class TreeSetClass { public static void main(String[] args) { //Tree Set will not accept even one null value //It will follow Asscending Order whether the data in integer or string. //Index can not be used to get data though its following Ascending order //As we can't use index Normal For and While Loops Can not be used. //Enhanced for loop (For Each) and iterator can be used //If we Try to add Duplicate Values it will override existing value. //Tree Set will changes the connections and connects the data once a value in the middle is removed //IMP: TreeSet should always be with generics, without generics we cant create TreeSet //IMP: When we don't mention the type it will by default consider <Integer> TreeSetClass oBj = new TreeSetClass(); oBj.Without_Generics(); oBj.With_Generics(); oBj.With_String(); } public void Without_Generics(){ TreeSet TSet=new TreeSet(); TSet.add(20); TSet.add(28); TSet.add(524001); // TSet.add(null); -- Treeset will not accept Null values TSet.add(28); TSet.add(30); TSet.remove(30); // Here Value 30 will not be considered as index in set, will be considered as Object and deletes it. System.out.print(TSet+"\n"); // System.out.println("Name of the Employee : "+TSet.get(1)); // -- Can not use get(index) here Though TreeSet will follow Ascending order } public void With_String(){ TreeSet<String> TSet=new TreeSet(); TSet.add("Suresh"); TSet.add("Karnataka"); TSet.add("India"); TSet.add("Nellore"); // TSet.add(null); -- Treeset will not accept Null values TSet.remove("Nellore"); System.out.print(TSet+"\n"); } public void With_Generics(){ TreeSet<Integer> TSet=new TreeSet<Integer>(); TSet.add(10); TSet.add(28); TSet.add(524001); TSet.add(524002); // TSet.add(null); -- TreeSet will not accept null values TSet.add(28); TSet.add(30); TSet.remove(524001); TSet.remove(30); // Here Value 30 will not be considered as index in set, will be considered as Object and deletes it. System.out.print(TSet+"\n"); System.out.println("Set Size is : "+TSet.size()); } }
2,531
0.596602
0.577242
74
32.202702
29.396166
109
false
false
0
0
0
0
0
0
0.527027
false
false
4
e23beccaf994136df1c9f49d3d7252548a00c889
34,050,500,775,823
ba4f1509e80e40bf4af39be44febf118573558f3
/src/main/java/com/rodrigueza/Entities/NewMain.java
4439fea5ed8fd9832d2748f554717d34556a887a
[]
no_license
artur5522/JavaProyectoPropio3
https://github.com/artur5522/JavaProyectoPropio3
fb78e3172ae535fd16c24b927cddbd05962f0727
0bae312f35921ac6398922b35e1700f58e3e88e2
refs/heads/main
2023-08-24T07:15:25.750000
2021-10-16T17:08:53
2021-10-16T17:08:53
405,660,494
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rodrigueza.Entities; import com.rodrigueza.orm.Gestor; import com.rodrigueza.Validations.Validations; import java.util.Scanner; /** * * @author Elpo */ public class NewMain { public static void main(String[] args) { Gestor gestor = new Gestor(); gestor.creaSession(); Computadora compu = creaCompu(); insertaDatoComputadora(gestor, compu); gestor.closeSession(); gestor=null; } public static Computadora creaCompu() { Scanner sc = new Scanner(System.in); Computadora compu = new Computadora(); String decision = null; System.out.println("Ingrese los datos de la computadora a persistir:"); System.out.println("Ingrese el nombre de la marca:"); decision = Validations.validaNombre(); compu.setMarca(decision); System.out.println("Ingrese el nombre del modelo:"); decision = Validations.validaNombre(); compu.setModelo(decision); System.out.println("Introduzca el codigo: "); decision = String.valueOf(Validations.validaNumero()); compu.setCodigo(decision); System.out.println("Ingrese el/los componentes asociados a esta computadora:"); while (true) { Componente compo = null; int cuentaComponentes = 1; System.out.println("Ingrese el componente -> " + cuentaComponentes); cuentaComponentes++; compo = creaComponentes(); compu.agregaComponentes(compo); System.out.println("Desea agregar otro componente? S/N"); String continuar = sc.nextLine(); if (continuar.equalsIgnoreCase("n")) { System.out.println("Hemos terminado de brindar informacion. \n"); break; } else { System.out.println("Continuemos con el siguiente componente.."); } } return compu; } public static Componente creaComponentes() { Componente compo = new Componente(); String decision = ""; Scanner sc = new Scanner(System.in); System.out.println("Ingrese nombre del componente:"); decision = Validations.validaNombre(); compo.setNombre(decision); System.out.println("Ingrese numero de serie:"); decision = String.valueOf(Validations.validaNumero()); compo.setNroSerie(decision); return compo; } public static void insertaDatoComputadora(Gestor gestor, Computadora compu){ try { gestor.guardar(compu); } catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
2,866
java
NewMain.java
Java
[ { "context": "\r\nimport java.util.Scanner;\r\n\r\n/**\r\n *\r\n * @author Elpo\r\n */\r\npublic class NewMain {\r\n\r\n public static v", "end": 172, "score": 0.8568449020385742, "start": 168, "tag": "NAME", "value": "Elpo" } ]
null
[]
package com.rodrigueza.Entities; import com.rodrigueza.orm.Gestor; import com.rodrigueza.Validations.Validations; import java.util.Scanner; /** * * @author Elpo */ public class NewMain { public static void main(String[] args) { Gestor gestor = new Gestor(); gestor.creaSession(); Computadora compu = creaCompu(); insertaDatoComputadora(gestor, compu); gestor.closeSession(); gestor=null; } public static Computadora creaCompu() { Scanner sc = new Scanner(System.in); Computadora compu = new Computadora(); String decision = null; System.out.println("Ingrese los datos de la computadora a persistir:"); System.out.println("Ingrese el nombre de la marca:"); decision = Validations.validaNombre(); compu.setMarca(decision); System.out.println("Ingrese el nombre del modelo:"); decision = Validations.validaNombre(); compu.setModelo(decision); System.out.println("Introduzca el codigo: "); decision = String.valueOf(Validations.validaNumero()); compu.setCodigo(decision); System.out.println("Ingrese el/los componentes asociados a esta computadora:"); while (true) { Componente compo = null; int cuentaComponentes = 1; System.out.println("Ingrese el componente -> " + cuentaComponentes); cuentaComponentes++; compo = creaComponentes(); compu.agregaComponentes(compo); System.out.println("Desea agregar otro componente? S/N"); String continuar = sc.nextLine(); if (continuar.equalsIgnoreCase("n")) { System.out.println("Hemos terminado de brindar informacion. \n"); break; } else { System.out.println("Continuemos con el siguiente componente.."); } } return compu; } public static Componente creaComponentes() { Componente compo = new Componente(); String decision = ""; Scanner sc = new Scanner(System.in); System.out.println("Ingrese nombre del componente:"); decision = Validations.validaNombre(); compo.setNombre(decision); System.out.println("Ingrese numero de serie:"); decision = String.valueOf(Validations.validaNumero()); compo.setNroSerie(decision); return compo; } public static void insertaDatoComputadora(Gestor gestor, Computadora compu){ try { gestor.guardar(compu); } catch (Exception e) { e.printStackTrace(); } } }
2,866
0.568737
0.568388
84
32.119049
23.435528
87
false
false
0
0
0
0
0
0
0.595238
false
false
4
55525c6b3a4f939c5bdd7fa5cc4db6b5593cb94e
11,708,080,906,696
6c2187e84585c000c4a4bf8d7585a2183b91a4eb
/app/src/main/java/com/example/lathifrdp/demoapp/fragment/post/sharing/PostSharingFragment.java
81e6ba07fed60157a77af7150bcec217147f9ad0
[]
no_license
lathifrdp/ipb_connect
https://github.com/lathifrdp/ipb_connect
ef98325e7c07c879432d7c75425df5c64740b878
700ab82dee1e7e39f2697248f3b298fa43e984a6
refs/heads/master
2020-03-31T02:07:33.993000
2019-03-27T13:08:11
2019-03-27T13:08:11
151,809,352
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.lathifrdp.demoapp.fragment.post.sharing; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.example.lathifrdp.demoapp.R; import com.example.lathifrdp.demoapp.adapter.SharingAdapter; import com.example.lathifrdp.demoapp.adapter.SharingPostAdapter; import com.example.lathifrdp.demoapp.api.ApiClient; import com.example.lathifrdp.demoapp.api.ApiInterface; import com.example.lathifrdp.demoapp.helper.SessionManager; import com.example.lathifrdp.demoapp.model.KnowledgeSharing; import com.example.lathifrdp.demoapp.response.SharingResponse; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class PostSharingFragment extends Fragment{ private RecyclerView recyclerView; private List<KnowledgeSharing> sharingArrayList; TextView Disconnected, kosong; private KnowledgeSharing mov; //ProgressDialog pd; private SwipeRefreshLayout swipeContainer; ApiInterface apiService; SessionManager sessionManager; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_post_sharing,null); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("Berbagi Ilmu"); sessionManager = new SessionManager(getActivity()); kosong = (TextView) getActivity().findViewById(R.id.kosongnya); initViewsTerbaru(); swipeContainer = (SwipeRefreshLayout) getView().findViewById(R.id.swipeContainer); swipeContainer.setColorSchemeResources(android.R.color.holo_orange_dark); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadKnowledge(); //Toast.makeText(getActivity(),"Terbaru List Refreshed.", Toast.LENGTH_SHORT).show(); } }); } private void initViewsTerbaru(){ // pd = new ProgressDialog(getActivity()); // pd.setMessage("Fetching Data..."); // pd.setCancelable(false); // pd.show(); recyclerView=(RecyclerView) getView().findViewById(R.id.recyclerView); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.smoothScrollToPosition(0); loadKnowledge(); } private void loadKnowledge() { Disconnected = (TextView) getView().findViewById(R.id.disconnected); try { apiService = ApiClient.getClient().create(ApiInterface.class); final Integer limit = 10; final String createdBy = sessionManager.getKeyId(); Call<SharingResponse> call = apiService.getKnowledgePost("JWT "+ sessionManager.getKeyToken(),createdBy,limit); call.enqueue(new Callback<SharingResponse>() { @Override public void onResponse(Call<SharingResponse> call, final Response<SharingResponse> response) { if (response.isSuccessful()) { if(response.body().getMessage()!=null) { kosong.setText("Tidak ada data"); } if(response.body().getTotal()!="0"){ sharingArrayList = response.body().getKnowledgeSharings(); recyclerView.setAdapter(new SharingPostAdapter(getActivity(), sharingArrayList)); recyclerView.smoothScrollToPosition(0); //Toast.makeText(getActivity(), movieArrayList.toString(), Toast.LENGTH_SHORT).show(); swipeContainer.setRefreshing(false); //pd.hide(); } } } @Override public void onFailure(Call<SharingResponse> call, Throwable t) { Log.d("Error", t.getMessage()); Toast.makeText(getActivity(), "Error Fetching Data!", Toast.LENGTH_SHORT).show(); Disconnected.setVisibility(View.VISIBLE); //pd.hide(); } }); } catch (Exception e) { Log.d("Error", e.getMessage()); Toast.makeText(getActivity(), e.toString(), Toast.LENGTH_SHORT).show(); } } }
UTF-8
Java
5,005
java
PostSharingFragment.java
Java
[]
null
[]
package com.example.lathifrdp.demoapp.fragment.post.sharing; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.example.lathifrdp.demoapp.R; import com.example.lathifrdp.demoapp.adapter.SharingAdapter; import com.example.lathifrdp.demoapp.adapter.SharingPostAdapter; import com.example.lathifrdp.demoapp.api.ApiClient; import com.example.lathifrdp.demoapp.api.ApiInterface; import com.example.lathifrdp.demoapp.helper.SessionManager; import com.example.lathifrdp.demoapp.model.KnowledgeSharing; import com.example.lathifrdp.demoapp.response.SharingResponse; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class PostSharingFragment extends Fragment{ private RecyclerView recyclerView; private List<KnowledgeSharing> sharingArrayList; TextView Disconnected, kosong; private KnowledgeSharing mov; //ProgressDialog pd; private SwipeRefreshLayout swipeContainer; ApiInterface apiService; SessionManager sessionManager; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_post_sharing,null); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("Berbagi Ilmu"); sessionManager = new SessionManager(getActivity()); kosong = (TextView) getActivity().findViewById(R.id.kosongnya); initViewsTerbaru(); swipeContainer = (SwipeRefreshLayout) getView().findViewById(R.id.swipeContainer); swipeContainer.setColorSchemeResources(android.R.color.holo_orange_dark); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadKnowledge(); //Toast.makeText(getActivity(),"Terbaru List Refreshed.", Toast.LENGTH_SHORT).show(); } }); } private void initViewsTerbaru(){ // pd = new ProgressDialog(getActivity()); // pd.setMessage("Fetching Data..."); // pd.setCancelable(false); // pd.show(); recyclerView=(RecyclerView) getView().findViewById(R.id.recyclerView); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.smoothScrollToPosition(0); loadKnowledge(); } private void loadKnowledge() { Disconnected = (TextView) getView().findViewById(R.id.disconnected); try { apiService = ApiClient.getClient().create(ApiInterface.class); final Integer limit = 10; final String createdBy = sessionManager.getKeyId(); Call<SharingResponse> call = apiService.getKnowledgePost("JWT "+ sessionManager.getKeyToken(),createdBy,limit); call.enqueue(new Callback<SharingResponse>() { @Override public void onResponse(Call<SharingResponse> call, final Response<SharingResponse> response) { if (response.isSuccessful()) { if(response.body().getMessage()!=null) { kosong.setText("Tidak ada data"); } if(response.body().getTotal()!="0"){ sharingArrayList = response.body().getKnowledgeSharings(); recyclerView.setAdapter(new SharingPostAdapter(getActivity(), sharingArrayList)); recyclerView.smoothScrollToPosition(0); //Toast.makeText(getActivity(), movieArrayList.toString(), Toast.LENGTH_SHORT).show(); swipeContainer.setRefreshing(false); //pd.hide(); } } } @Override public void onFailure(Call<SharingResponse> call, Throwable t) { Log.d("Error", t.getMessage()); Toast.makeText(getActivity(), "Error Fetching Data!", Toast.LENGTH_SHORT).show(); Disconnected.setVisibility(View.VISIBLE); //pd.hide(); } }); } catch (Exception e) { Log.d("Error", e.getMessage()); Toast.makeText(getActivity(), e.toString(), Toast.LENGTH_SHORT).show(); } } }
5,005
0.657343
0.654745
125
39.040001
30.627674
123
false
false
0
0
0
0
0
0
0.744
false
false
4
5f66dc8a4e0f2e0bfeb010c043147557d397e7fe
24,129,126,307,208
1c6ad7fb063db2ae20a0accf1d95857ed766f6d2
/src/main/java/com/zxx/demorepository/utils/CharsetUtil.java
d0b4af5940ea397f7bb411981df0821c86bc02a9
[]
no_license
kamjin1996/DemoRepository
https://github.com/kamjin1996/DemoRepository
b7857cd98871ccfb05dca69092babe99093d5b54
a87680a6710897f39ebfb7b50f03e2062508be70
refs/heads/master
2023-04-07T02:26:31.684000
2022-12-06T06:46:40
2022-12-06T06:46:40
156,940,034
0
0
null
false
2023-03-27T22:22:16
2018-11-10T02:29:12
2021-10-20T03:15:33
2023-03-27T22:22:12
17,170
0
0
5
Java
false
false
package com.zxx.demorepository.utils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.Iterator; import java.util.Objects; /** * @auther: tuosen * @date: 15:47 2019-09-05 * @description: 字符编码集工具类 */ @Slf4j public class CharsetUtil { private static Iterator<String> charsetIterator; /** * 将任何字符转成对应编码集 * * @param str * @param charsetName * @return */ public static String encode(String str, String charsetName) { try { return new String(str.getBytes(CharsetUtil.getCharsetName(str)), charsetName); } catch (UnsupportedEncodingException e) { log.error("字符串:{},字符集转换为:{}失败", str, charsetName); } return str; } /** * 获取字符的编码集 * * @param str * @return */ public static String getCharsetName(String str) { charsetIterator = Arrays.asList("GBK", "GB2312", "UTF-8", "ISO-8859-1").iterator(); return matchCharsetName(str, charsetIterator.next()); } private static String matchCharsetName(String str, String charsetName) { if (StringUtils.isNotBlank(str)) { try { boolean equals = Objects.equals(str, new String(str.getBytes(charsetName), charsetName)); return equals ? charsetName : matchCharsetName(str, charsetIterator.next()); } catch (Exception ignored) { } } return ""; } public static void main(String[] args) { String response = "响应内容响应内容响应内容"; System.out.println("原字符: " + response); String responseCharsetName = CharsetUtil.getCharsetName(response); System.out.println("原编码集: " + responseCharsetName); String coverterAfter = "UTF-8"; String encode = CharsetUtil.encode(response, coverterAfter); System.out.println("新字符: " + encode); System.out.println("新编码集: " + coverterAfter); } }
UTF-8
Java
2,175
java
CharsetUtil.java
Java
[ { "context": "erator;\nimport java.util.Objects;\n\n/**\n * @auther: tuosen\n * @date: 15:47 2019-09-05\n * @description: 字符编码集", "end": 265, "score": 0.9995907545089722, "start": 259, "tag": "USERNAME", "value": "tuosen" } ]
null
[]
package com.zxx.demorepository.utils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.Iterator; import java.util.Objects; /** * @auther: tuosen * @date: 15:47 2019-09-05 * @description: 字符编码集工具类 */ @Slf4j public class CharsetUtil { private static Iterator<String> charsetIterator; /** * 将任何字符转成对应编码集 * * @param str * @param charsetName * @return */ public static String encode(String str, String charsetName) { try { return new String(str.getBytes(CharsetUtil.getCharsetName(str)), charsetName); } catch (UnsupportedEncodingException e) { log.error("字符串:{},字符集转换为:{}失败", str, charsetName); } return str; } /** * 获取字符的编码集 * * @param str * @return */ public static String getCharsetName(String str) { charsetIterator = Arrays.asList("GBK", "GB2312", "UTF-8", "ISO-8859-1").iterator(); return matchCharsetName(str, charsetIterator.next()); } private static String matchCharsetName(String str, String charsetName) { if (StringUtils.isNotBlank(str)) { try { boolean equals = Objects.equals(str, new String(str.getBytes(charsetName), charsetName)); return equals ? charsetName : matchCharsetName(str, charsetIterator.next()); } catch (Exception ignored) { } } return ""; } public static void main(String[] args) { String response = "响应内容响应内容响应内容"; System.out.println("原字符: " + response); String responseCharsetName = CharsetUtil.getCharsetName(response); System.out.println("原编码集: " + responseCharsetName); String coverterAfter = "UTF-8"; String encode = CharsetUtil.encode(response, coverterAfter); System.out.println("新字符: " + encode); System.out.println("新编码集: " + coverterAfter); } }
2,175
0.625184
0.611955
71
27.746479
26.691095
105
false
false
0
0
0
0
0
0
0.535211
false
false
4
3e7686685f105e2b50b585fce2a8227cb58b02e4
27,101,243,700,011
5575a1b8cc1800594e356fcdfbee0a8b5be32b34
/app/src/main/java/org/hamm/h1kemaps/app/view/DialogOrderTypeFragment.java
3b8d15cb6c1514bba4280a2dc1a8aafb849ad595
[]
no_license
YomiIsayama/FootprintMap
https://github.com/YomiIsayama/FootprintMap
51a3e892293533267a1b2d6ee5ac4badcf80b722
8bd7ff4cf3d9d76e7679fc52f5e7c602e20b4e1f
refs/heads/master
2021-05-17T23:55:23.353000
2020-03-29T11:09:33
2020-03-29T11:09:33
251,011,297
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.hamm.h1kemaps.app.view; import android.app.DialogFragment; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.TextView; import org.hamm.h1kemaps.app.R; public class DialogOrderTypeFragment extends DialogFragment implements View.OnClickListener{ TextView baidu; TextView gaode; TextView cancel; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); View view = inflater.inflate(R.layout.activity_daohangdialog, null); baidu=(TextView)view.findViewById(R.id.baidu_tv); gaode=(TextView)view.findViewById(R.id.gaode_tv); cancel=(TextView)view.findViewById(R.id.cancel_tv); baidu.setOnClickListener(this); gaode.setOnClickListener(this); return view; } public OnDialogListener mlistener; @Override public void onClick(View view) { switch (view.getId()) { case R.id.baidu_tv: mlistener.onDialogClick("百度地图","0"); dismiss(); break; case R.id.gaode_tv: mlistener.onDialogClick("高德地图","1"); dismiss(); break; case R.id.cancel_tv: mlistener.onDialogClick("取消","2"); dismiss(); break; } } public interface OnDialogListener { void onDialogClick(String person, String code); } public void setOnDialogListener(OnDialogListener dialogListener){ this.mlistener = dialogListener; } @Override public void onStart() { super.onStart(); Window window = getDialog().getWindow(); WindowManager.LayoutParams params = window.getAttributes(); params.gravity = Gravity.BOTTOM; params.width = WindowManager.LayoutParams.MATCH_PARENT; window.setAttributes(params); //设置背景透明 window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); } }
UTF-8
Java
2,414
java
DialogOrderTypeFragment.java
Java
[]
null
[]
package org.hamm.h1kemaps.app.view; import android.app.DialogFragment; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.TextView; import org.hamm.h1kemaps.app.R; public class DialogOrderTypeFragment extends DialogFragment implements View.OnClickListener{ TextView baidu; TextView gaode; TextView cancel; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); View view = inflater.inflate(R.layout.activity_daohangdialog, null); baidu=(TextView)view.findViewById(R.id.baidu_tv); gaode=(TextView)view.findViewById(R.id.gaode_tv); cancel=(TextView)view.findViewById(R.id.cancel_tv); baidu.setOnClickListener(this); gaode.setOnClickListener(this); return view; } public OnDialogListener mlistener; @Override public void onClick(View view) { switch (view.getId()) { case R.id.baidu_tv: mlistener.onDialogClick("百度地图","0"); dismiss(); break; case R.id.gaode_tv: mlistener.onDialogClick("高德地图","1"); dismiss(); break; case R.id.cancel_tv: mlistener.onDialogClick("取消","2"); dismiss(); break; } } public interface OnDialogListener { void onDialogClick(String person, String code); } public void setOnDialogListener(OnDialogListener dialogListener){ this.mlistener = dialogListener; } @Override public void onStart() { super.onStart(); Window window = getDialog().getWindow(); WindowManager.LayoutParams params = window.getAttributes(); params.gravity = Gravity.BOTTOM; params.width = WindowManager.LayoutParams.MATCH_PARENT; window.setAttributes(params); //设置背景透明 window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); } }
2,414
0.662888
0.660789
77
29.935064
23.017406
103
false
false
0
0
0
0
0
0
0.662338
false
false
4
b20c9a1cff858c5b7c025dd1b8e08e4a075b2fe8
31,473,520,391,841
b94ed45c1ea9c1124faaf2a4d4d9d12acbad3efe
/src/com/pm360/cepm360/entity/P_WBRGNR_DIR.java
e7d0a6f2c09fa66bb99784bbd62f23226d939be6
[]
no_license
bellmit/CEPM360
https://github.com/bellmit/CEPM360
5c559744e4650e9c9c9e6e40005ffbcf77f24e30
9dc080f7af451908b7c9a4180cc780a95b5c0d89
refs/heads/master
2022-02-16T10:27:17.936000
2018-02-26T13:46:58
2018-02-26T13:46:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pm360.cepm360.entity; import java.io.Serializable; /** * 外包人工内容目录 * * @author Andy * */ public class P_WBRGNR_DIR extends Expandable implements Serializable { /** * */ private static final long serialVersionUID = -6476323805119845566L; private int wbrgnr_dir_id; private String name; private int p_wbrgnr_dir_id; private int tenant_id; public int getWbrgnr_dir_id() { return wbrgnr_dir_id; } public void setWbrgnr_dir_id(int wbrgnr_dir_id) { this.wbrgnr_dir_id = wbrgnr_dir_id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getP_wbrgnr_dir_id() { return p_wbrgnr_dir_id; } public void setP_wbrgnr_dir_id(int p_wbrgnr_dir_id) { this.p_wbrgnr_dir_id = p_wbrgnr_dir_id; } public int getTenant_id() { return tenant_id; } public void setTenant_id(int tenant_id) { this.tenant_id = tenant_id; } @Override public int getId() { // TODO Auto-generated method stub return wbrgnr_dir_id; } @Override public int getParents_id() { // TODO Auto-generated method stub return p_wbrgnr_dir_id; } @Override public void setParentsId(int parent_id) { p_wbrgnr_dir_id = parent_id; } }
UTF-8
Java
1,318
java
P_WBRGNR_DIR.java
Java
[ { "context": "a.io.Serializable;\n\n/**\n * 外包人工内容目录\n * \n * @author Andy\n * \n */\npublic class P_WBRGNR_DIR extends Expanda", "end": 100, "score": 0.997468113899231, "start": 96, "tag": "NAME", "value": "Andy" } ]
null
[]
package com.pm360.cepm360.entity; import java.io.Serializable; /** * 外包人工内容目录 * * @author Andy * */ public class P_WBRGNR_DIR extends Expandable implements Serializable { /** * */ private static final long serialVersionUID = -6476323805119845566L; private int wbrgnr_dir_id; private String name; private int p_wbrgnr_dir_id; private int tenant_id; public int getWbrgnr_dir_id() { return wbrgnr_dir_id; } public void setWbrgnr_dir_id(int wbrgnr_dir_id) { this.wbrgnr_dir_id = wbrgnr_dir_id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getP_wbrgnr_dir_id() { return p_wbrgnr_dir_id; } public void setP_wbrgnr_dir_id(int p_wbrgnr_dir_id) { this.p_wbrgnr_dir_id = p_wbrgnr_dir_id; } public int getTenant_id() { return tenant_id; } public void setTenant_id(int tenant_id) { this.tenant_id = tenant_id; } @Override public int getId() { // TODO Auto-generated method stub return wbrgnr_dir_id; } @Override public int getParents_id() { // TODO Auto-generated method stub return p_wbrgnr_dir_id; } @Override public void setParentsId(int parent_id) { p_wbrgnr_dir_id = parent_id; } }
1,318
0.641321
0.62212
72
17.083334
17.659393
71
false
false
0
0
0
0
0
0
0.486111
false
false
4
a019e3a897863bd1e04f39615d84cdbd47aafa41
14,233,521,667,734
183f7d1956e34bcb4506ec4d145d06c69102a9cd
/business-logic/src/com/kesdip/business/domain/admin/generated/Site.java
d7ee11edac5f27d95f1c8110928e61abfb94bc9d
[]
no_license
omnispot-ds/omnispot
https://github.com/omnispot-ds/omnispot
2004c76694bfbca3125d1d71d85209f394810f8b
13e19ca626c2c04350fa6b6778a1e8a8e2872240
refs/heads/master
2021-01-23T07:02:51.823000
2010-07-22T13:02:06
2010-07-22T13:02:06
13,643,184
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kesdip.business.domain.admin.generated; // Generated 7 Μαϊ 2010 12:09:18 πμ by Hibernate Tools 3.2.0.b9 import java.util.HashSet; import java.util.Set; /** * Domain object for the 'Site' entity. Auto-generated * code. <strong>Do not modify manually.</strong> * @author gerogias * */ public class Site implements java.io.Serializable { /** * Primary, surrogate key. * */ private Long id; /** * The name of the customer. * */ private String name; /** * Comments for this customer. * */ private String comments; /** * If the customer active or not. * */ private boolean active; /** * The parent customer. */ private Customer customer; /** * The installations of the site. * */ private Set<Installation> installations = new HashSet<Installation>(0); /** * The current status of the site. * It is equal to minimum status of its active installations. * It can be null if this site has no installations. * */ private Short currentStatus; public Site() { } public Site(String name, boolean active, Customer customer) { this.name = name; this.active = active; this.customer = customer; } public Site(String name, String comments, boolean active, Customer customer, Set<Installation> installations) { this.name = name; this.comments = comments; this.active = active; this.customer = customer; this.installations = installations; } /** * * Primary, surrogate key. * */ public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } /** * * The name of the customer. * */ public String getName() { return this.name; } public void setName(String name) { this.name = name; } /** * * Comments for this customer. * */ public String getComments() { return this.comments; } public void setComments(String comments) { this.comments = comments; } /** * * If the customer active or not. * */ public boolean isActive() { return this.active; } public void setActive(boolean active) { this.active = active; } /** * * The parent customer. */ public Customer getCustomer() { return this.customer; } public void setCustomer(Customer customer) { this.customer = customer; } /** * * The installations of the site. * */ public Set<Installation> getInstallations() { return this.installations; } public void setInstallations(Set<Installation> installations) { this.installations = installations; } /** * * The current status of the site. * It is equal to minimum status of its active installations. * It can be null if this site has no installations. * */ public Short getCurrentStatus() { return this.currentStatus; } public void setCurrentStatus(Short currentStatus) { this.currentStatus = currentStatus; } /** * toString * @return String */ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); buffer.append("id").append("='").append(getId()).append("' "); buffer.append("name").append("='").append(getName()).append("' "); buffer.append("comments").append("='").append(getComments()).append("' "); buffer.append("active").append("='").append(isActive()).append("' "); buffer.append("customer").append("='").append(getCustomer()).append("' "); buffer.append("currentStatus").append("='").append(getCurrentStatus()).append("' "); buffer.append("]"); return buffer.toString(); } public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof Site) ) return false; Site castOther = ( Site ) other; return ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) ); } public int hashCode() { int result = 17; result = 37 * result + ( getId() == null ? 0 : this.getId().hashCode() ); return result; } }
UTF-8
Java
5,106
java
Site.java
Java
[ { "context": "ong>Do not modify manually.</strong>\n * \t\t\t@author gerogias\n * \t\t\r\n */\r\npublic class Site implements java.io", "end": 312, "score": 0.9993390440940857, "start": 304, "tag": "USERNAME", "value": "gerogias" } ]
null
[]
package com.kesdip.business.domain.admin.generated; // Generated 7 Μαϊ 2010 12:09:18 πμ by Hibernate Tools 3.2.0.b9 import java.util.HashSet; import java.util.Set; /** * Domain object for the 'Site' entity. Auto-generated * code. <strong>Do not modify manually.</strong> * @author gerogias * */ public class Site implements java.io.Serializable { /** * Primary, surrogate key. * */ private Long id; /** * The name of the customer. * */ private String name; /** * Comments for this customer. * */ private String comments; /** * If the customer active or not. * */ private boolean active; /** * The parent customer. */ private Customer customer; /** * The installations of the site. * */ private Set<Installation> installations = new HashSet<Installation>(0); /** * The current status of the site. * It is equal to minimum status of its active installations. * It can be null if this site has no installations. * */ private Short currentStatus; public Site() { } public Site(String name, boolean active, Customer customer) { this.name = name; this.active = active; this.customer = customer; } public Site(String name, String comments, boolean active, Customer customer, Set<Installation> installations) { this.name = name; this.comments = comments; this.active = active; this.customer = customer; this.installations = installations; } /** * * Primary, surrogate key. * */ public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } /** * * The name of the customer. * */ public String getName() { return this.name; } public void setName(String name) { this.name = name; } /** * * Comments for this customer. * */ public String getComments() { return this.comments; } public void setComments(String comments) { this.comments = comments; } /** * * If the customer active or not. * */ public boolean isActive() { return this.active; } public void setActive(boolean active) { this.active = active; } /** * * The parent customer. */ public Customer getCustomer() { return this.customer; } public void setCustomer(Customer customer) { this.customer = customer; } /** * * The installations of the site. * */ public Set<Installation> getInstallations() { return this.installations; } public void setInstallations(Set<Installation> installations) { this.installations = installations; } /** * * The current status of the site. * It is equal to minimum status of its active installations. * It can be null if this site has no installations. * */ public Short getCurrentStatus() { return this.currentStatus; } public void setCurrentStatus(Short currentStatus) { this.currentStatus = currentStatus; } /** * toString * @return String */ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); buffer.append("id").append("='").append(getId()).append("' "); buffer.append("name").append("='").append(getName()).append("' "); buffer.append("comments").append("='").append(getComments()).append("' "); buffer.append("active").append("='").append(isActive()).append("' "); buffer.append("customer").append("='").append(getCustomer()).append("' "); buffer.append("currentStatus").append("='").append(getCurrentStatus()).append("' "); buffer.append("]"); return buffer.toString(); } public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof Site) ) return false; Site castOther = ( Site ) other; return ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) ); } public int hashCode() { int result = 17; result = 37 * result + ( getId() == null ? 0 : this.getId().hashCode() ); return result; } }
5,106
0.518134
0.514017
192
24.645834
24.417795
143
false
false
0
0
0
0
0
0
0.994792
false
false
4
dc4cdfa09aaacdb3d4009ed447d0f019bcb3e32d
22,548,578,364,468
bcf9c93934786d7d8b9d9e4e8006e1fb71aafb29
/stamp/src/main/java/com/slf/tc/config/CookieConfiguration.java
5b7767e4a2ef11004a6769ea4af60785e86c407d
[]
no_license
esorTT/time_stamp
https://github.com/esorTT/time_stamp
cba3c346269a4a90d93b03c742a4dbdcd430088e
55a452656f4473846ab407b373165681fbf5ef22
refs/heads/master
2020-04-06T04:09:56.968000
2018-04-30T10:03:24
2018-04-30T10:03:24
83,030,533
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.slf.tc.config; import com.slf.tc.cookie.Crypto; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.Cookie; import java.lang.reflect.Method; import java.util.regex.Pattern; /** * Created by xiaobin on 2017-1-28. */ public class CookieConfiguration { private static final Logger logger = LoggerFactory.getLogger(CookieConfiguration.class); private static final Integer DEFAULT_EXPIRED_TIME = -1; private static final Integer DEFAULT_RANDOM_CHAR = 0; private static final String DEFAULT_PATH = "/"; private static boolean HTTP_ONLY_SUPPORT = false; private static Pattern IPV4_PATTERN; private String name; private String clientName; private String path; private String domain; private Crypto crypto; private boolean httpOnly = false; private Integer expiredTime = DEFAULT_EXPIRED_TIME; private Integer randomChar = DEFAULT_RANDOM_CHAR; static { try { Method m = Cookie.class.getDeclaredMethod("isHttpOnly", new Class[0]); if (m != null) { HTTP_ONLY_SUPPORT = true; } } catch (Exception e) { logger.error("cookie configuration reflection method[Cookie.isHttpOnly] invoke exception, exception " + "detail {}", e); } IPV4_PATTERN = Pattern.compile("^\\.?((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)\\.){3}" + "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)$"); } public Cookie getCookie(String cookieValue) { Cookie c = new Cookie(getClientName(), getClientValue(cookieValue)); c.setPath(StringUtils.isBlank(path) ? DEFAULT_PATH : path); if (StringUtils.isNotBlank(cookieValue)) { c.setMaxAge(expiredTime == null ? DEFAULT_EXPIRED_TIME : expiredTime); } else { // 删除cookie c.setMaxAge(0); } if (setDomain()) { c.setDomain(domain); } if (this.isSetHttpOnly()) { c.setHttpOnly(true); } return c; } protected boolean setDomain() { return StringUtils.isNotBlank(domain) && !".localhost".equals(domain.toLowerCase()) && !"localhost".equals(domain.toLowerCase()); } protected boolean isSetHttpOnly() { return this.httpOnly && HTTP_ONLY_SUPPORT; } public String getUncryptValue(String encryptedValue) { if (StringUtils.isBlank(encryptedValue)) { return StringUtils.EMPTY; } String decryptedValue = encryptedValue; if (crypto != null) { decryptedValue = crypto.decrypt(encryptedValue); } if (randomChar.intValue() > 0) { decryptedValue = decryptedValue.substring(0, (decryptedValue.length() - randomChar)); } return decryptedValue; } private String getClientValue(String cookieValue) { if (StringUtils.isBlank(cookieValue)) { return null; } StringBuilder clientValue = new StringBuilder(cookieValue); if (randomChar.intValue() > 0) { clientValue = clientValue.append(RandomStringUtils.random(randomChar.intValue())); } // 是否加密 if (crypto != null) { return crypto.encrypt(clientValue.toString()); } return clientValue.toString(); } public String getClientName() { return clientName; } public String getName() { return name; } public String getPath() { return path; } public String getDomain() { return domain; } public boolean isHttpOnly() { return httpOnly; } public Integer getExpiredTime() { return expiredTime; } public Integer getRandomChar() { return randomChar; } public void setName(String name) { this.name = name; } public void setClientName(String clientName) { this.clientName = clientName; } public void setPath(String path) { this.path = path; } public void setDomain(String domain) { this.domain = domain; } public void setCrypto(Crypto crypto) { this.crypto = crypto; } public void setHttpOnly(boolean httpOnly) { this.httpOnly = httpOnly; } public void setExpiredTime(Integer expiredTime) { this.expiredTime = expiredTime; } public void setRandomChar(Integer randomChar) { this.randomChar = randomChar; } }
UTF-8
Java
4,654
java
CookieConfiguration.java
Java
[ { "context": "import java.util.regex.Pattern;\n\n/**\n * Created by xiaobin on 2017-1-28.\n */\npublic class CookieConfiguratio", "end": 338, "score": 0.9994416832923889, "start": 331, "tag": "USERNAME", "value": "xiaobin" } ]
null
[]
package com.slf.tc.config; import com.slf.tc.cookie.Crypto; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.Cookie; import java.lang.reflect.Method; import java.util.regex.Pattern; /** * Created by xiaobin on 2017-1-28. */ public class CookieConfiguration { private static final Logger logger = LoggerFactory.getLogger(CookieConfiguration.class); private static final Integer DEFAULT_EXPIRED_TIME = -1; private static final Integer DEFAULT_RANDOM_CHAR = 0; private static final String DEFAULT_PATH = "/"; private static boolean HTTP_ONLY_SUPPORT = false; private static Pattern IPV4_PATTERN; private String name; private String clientName; private String path; private String domain; private Crypto crypto; private boolean httpOnly = false; private Integer expiredTime = DEFAULT_EXPIRED_TIME; private Integer randomChar = DEFAULT_RANDOM_CHAR; static { try { Method m = Cookie.class.getDeclaredMethod("isHttpOnly", new Class[0]); if (m != null) { HTTP_ONLY_SUPPORT = true; } } catch (Exception e) { logger.error("cookie configuration reflection method[Cookie.isHttpOnly] invoke exception, exception " + "detail {}", e); } IPV4_PATTERN = Pattern.compile("^\\.?((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)\\.){3}" + "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)$"); } public Cookie getCookie(String cookieValue) { Cookie c = new Cookie(getClientName(), getClientValue(cookieValue)); c.setPath(StringUtils.isBlank(path) ? DEFAULT_PATH : path); if (StringUtils.isNotBlank(cookieValue)) { c.setMaxAge(expiredTime == null ? DEFAULT_EXPIRED_TIME : expiredTime); } else { // 删除cookie c.setMaxAge(0); } if (setDomain()) { c.setDomain(domain); } if (this.isSetHttpOnly()) { c.setHttpOnly(true); } return c; } protected boolean setDomain() { return StringUtils.isNotBlank(domain) && !".localhost".equals(domain.toLowerCase()) && !"localhost".equals(domain.toLowerCase()); } protected boolean isSetHttpOnly() { return this.httpOnly && HTTP_ONLY_SUPPORT; } public String getUncryptValue(String encryptedValue) { if (StringUtils.isBlank(encryptedValue)) { return StringUtils.EMPTY; } String decryptedValue = encryptedValue; if (crypto != null) { decryptedValue = crypto.decrypt(encryptedValue); } if (randomChar.intValue() > 0) { decryptedValue = decryptedValue.substring(0, (decryptedValue.length() - randomChar)); } return decryptedValue; } private String getClientValue(String cookieValue) { if (StringUtils.isBlank(cookieValue)) { return null; } StringBuilder clientValue = new StringBuilder(cookieValue); if (randomChar.intValue() > 0) { clientValue = clientValue.append(RandomStringUtils.random(randomChar.intValue())); } // 是否加密 if (crypto != null) { return crypto.encrypt(clientValue.toString()); } return clientValue.toString(); } public String getClientName() { return clientName; } public String getName() { return name; } public String getPath() { return path; } public String getDomain() { return domain; } public boolean isHttpOnly() { return httpOnly; } public Integer getExpiredTime() { return expiredTime; } public Integer getRandomChar() { return randomChar; } public void setName(String name) { this.name = name; } public void setClientName(String clientName) { this.clientName = clientName; } public void setPath(String path) { this.path = path; } public void setDomain(String domain) { this.domain = domain; } public void setCrypto(Crypto crypto) { this.crypto = crypto; } public void setHttpOnly(boolean httpOnly) { this.httpOnly = httpOnly; } public void setExpiredTime(Integer expiredTime) { this.expiredTime = expiredTime; } public void setRandomChar(Integer randomChar) { this.randomChar = randomChar; } }
4,654
0.607712
0.59888
175
25.525715
24.199602
115
false
false
0
0
0
0
0
0
0.422857
false
false
4
8d4dc898097e2553a5254fcd7b9416437515f56c
21,586,505,664,989
cf8a55b57a120926cbadd3c123f8d30d5a93de45
/src/main/java/com/jumplus/eCommerce/model/User.java
14b2601c534cac1a1ebe68641a203eb869b93d03
[]
no_license
tamera-brown/SpringEcommerceProject
https://github.com/tamera-brown/SpringEcommerceProject
48e7262b2416c26755c7f098caed7aeed408c3b8
f81f384f853b0e69bd81f6e27910915726b8b22b
refs/heads/master
2023-01-29T15:58:34.648000
2020-12-11T22:47:24
2020-12-11T22:47:24
310,428,004
2
1
null
false
2020-11-10T21:06:30
2020-11-05T22:04:35
2020-11-09T20:27:33
2020-11-10T21:06:30
23
1
0
0
Java
false
false
package com.jumplus.eCommerce.model; import java.util.ArrayList; import java.util.List; public class User { public enum ROLE{ USER,ADMIN } private String username; private String name; private String password; private String email; private ROLE role; public List<Invoice> purchases; public User() { this("N/A, 'N/A", "N/A", "N/A", "N/A",ROLE.USER, new ArrayList<Invoice>()); } public User(String username, String name, String password, String email, ROLE role, List<Invoice> invoice) { super(); this.username = username; this.name = name; this.password = password; this.email = email; this.role = role; this.purchases = invoice; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public ROLE getRole() { return role; } public void setRole(ROLE role) { this.role = role; } public List<Invoice> getPurchases() { return purchases; } public void setPurchases(List<Invoice> purchases) { this.purchases = purchases; } @Override public String toString() { return "User [username=" + username + ", name=" + name + ", password=" + password + ", email=" + email + ", role=" + role + ", purchases=" + purchases + "]"; } }
UTF-8
Java
1,635
java
User.java
Java
[ { "context": "t<Invoice> invoice) {\n\t\tsuper();\n\t\tthis.username = username;\n\t\tthis.name = name;\n\t\tthis.password = password;\n", "end": 551, "score": 0.9968780279159546, "start": 543, "tag": "USERNAME", "value": "username" }, { "context": " = username;\n\t\tthis.name = name;\n\t\tthis.password = password;\n\t\tthis.email = email;\n\t\tthis.role = role;\n\t\tthis", "end": 599, "score": 0.9973782300949097, "start": 591, "tag": "PASSWORD", "value": "password" }, { "context": "e;\n\t}\n\n\n\t\n\n\tpublic String getUsername() {\n\t\treturn username;\n\t}\n\n\n\tpublic void setUsername(String username) {", "end": 727, "score": 0.9308978915214539, "start": 719, "tag": "USERNAME", "value": "username" }, { "context": "d setUsername(String username) {\n\t\tthis.username = username;\n\t}\n\n\n\tpublic String getName() {\n\t\treturn name;\n\t", "end": 804, "score": 0.9784956574440002, "start": 796, "tag": "USERNAME", "value": "username" }, { "context": "c String toString() {\n\t\treturn \"User [username=\" + username + \", name=\" + name + \", password=\" + password + \"", "end": 1497, "score": 0.9834455847740173, "start": 1489, "tag": "USERNAME", "value": "username" }, { "context": "=\" + username + \", name=\" + name + \", password=\" + password + \", email=\" + email\n\t\t\t\t+ \", role=\" + role + \", ", "end": 1543, "score": 0.8525248169898987, "start": 1535, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.jumplus.eCommerce.model; import java.util.ArrayList; import java.util.List; public class User { public enum ROLE{ USER,ADMIN } private String username; private String name; private String password; private String email; private ROLE role; public List<Invoice> purchases; public User() { this("N/A, 'N/A", "N/A", "N/A", "N/A",ROLE.USER, new ArrayList<Invoice>()); } public User(String username, String name, String password, String email, ROLE role, List<Invoice> invoice) { super(); this.username = username; this.name = name; this.password = <PASSWORD>; this.email = email; this.role = role; this.purchases = invoice; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public ROLE getRole() { return role; } public void setRole(ROLE role) { this.role = role; } public List<Invoice> getPurchases() { return purchases; } public void setPurchases(List<Invoice> purchases) { this.purchases = purchases; } @Override public String toString() { return "User [username=" + username + ", name=" + name + ", password=" + <PASSWORD> + ", email=" + email + ", role=" + role + ", purchases=" + purchases + "]"; } }
1,639
0.659939
0.659939
106
14.424528
19.86746
109
false
false
0
0
0
0
0
0
1.349057
false
false
4
0a37479f7e2efba88b04863c96eb3ce6f41f699a
13,331,578,553,964
e318e1efd8a5b7772cd99a068efde02ebd0c43a9
/src/main/java/edu/scu/domain/MailList.java
e797175ca2ccb92bda956e65dd6fd55b45a4a7dd
[]
no_license
lazyZhou1997/EmailClient
https://github.com/lazyZhou1997/EmailClient
e8404092815548d1f9e00972ea75a5e8304b0d2d
19987ce09035edac4c2c06ebd4e06548828bca1c
refs/heads/master
2021-04-06T08:14:52.740000
2018-03-13T02:10:21
2018-03-13T02:10:21
124,977,910
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.scu.domain; import edu.scu.domain.GetMailInfo; import java.util.LinkedList; /** * 列表用于保存收到的邮件信息 * * @author 周秦春 * @date 2017-11-30 */ public class MailList { LinkedList<GetMailInfo> mails; /** * 构造函数,创建一个邮件列表 */ public MailList() { mails = new LinkedList<GetMailInfo>(); } /** * 放入一个邮件信息对象到邮件列表末尾 * * @param mail 要存储的邮件信息对象 */ public void putMail(GetMailInfo mail) { mails.push(mail); } /** * 移除邮件链表的第一个邮件信息对象,并且返回该邮件信息对象 * * @return 列表中的第一个邮件信息对象 */ public GetMailInfo getMail() { return mails.pop(); } /** * 返回当前列表中存储的邮件信息对象个数 * * @return 当前存储的邮件信息对象个数 */ public int mailCount() { return mails.size(); } }
UTF-8
Java
1,042
java
MailList.java
Java
[ { "context": "l.LinkedList;\n\n/**\n * 列表用于保存收到的邮件信息\n *\n * @author 周秦春\n * @date 2017-11-30\n */\npublic class MailList {\n\n", "end": 129, "score": 0.9998114705085754, "start": 126, "tag": "NAME", "value": "周秦春" } ]
null
[]
package edu.scu.domain; import edu.scu.domain.GetMailInfo; import java.util.LinkedList; /** * 列表用于保存收到的邮件信息 * * @author 周秦春 * @date 2017-11-30 */ public class MailList { LinkedList<GetMailInfo> mails; /** * 构造函数,创建一个邮件列表 */ public MailList() { mails = new LinkedList<GetMailInfo>(); } /** * 放入一个邮件信息对象到邮件列表末尾 * * @param mail 要存储的邮件信息对象 */ public void putMail(GetMailInfo mail) { mails.push(mail); } /** * 移除邮件链表的第一个邮件信息对象,并且返回该邮件信息对象 * * @return 列表中的第一个邮件信息对象 */ public GetMailInfo getMail() { return mails.pop(); } /** * 返回当前列表中存储的邮件信息对象个数 * * @return 当前存储的邮件信息对象个数 */ public int mailCount() { return mails.size(); } }
1,042
0.561069
0.550891
50
14.74
13.064165
46
false
false
0
0
0
0
0
0
0.16
false
false
4
212b13bdcb34b9b4500b30be97b598d450677803
13,975,823,620,056
c3addcf14ab78c98903af5587b8cd7399f6cc1b5
/src/MegaBytesConverter.java
c71cbb5ef0b34975be15726796345de3caf8a081
[]
no_license
mattrorvick/MegaBytesConverter
https://github.com/mattrorvick/MegaBytesConverter
014956a3fe2c3ff4016c256819bf2fca186175e2
9ea0b0902e3c0d3bc9a3caf5b015bda2198a78b1
refs/heads/main
2023-02-19T06:44:03.593000
2021-01-26T00:06:59
2021-01-26T00:06:59
332,920,327
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class MegaBytesConverter { // // 1 MB = 1024 KB // int kiloBytes; // // public static long toMegaBytes(int kiloBytes) { // if (kiloBytes < 0) { // return -1; // } // return Math.round(kiloBytes / 1024 ); // } // // // // public static void printMegaBytesAndKiloBytes(int kiloBytes){ // // int megaB = 1024; // int remainder = kiloBytes % megaB; // // if(kiloBytes < 0){ // System.out.println("Invalid Value"); // } else { // long megaBytes = toMegaBytes(kiloBytes); // System.out.println(kiloBytes + " KB = " + megaBytes + " MB and " + remainder + " KB"); // } // // // } int kiloBytes; public static void printMegaBytesAndKiloBytes(int kiloBytes){ int remainder = kiloBytes % 1024; int quotient = kiloBytes / 1024; if(kiloBytes < 0){ System.out.println("Invalid Value"); } else { System.out.println(kiloBytes + " KB = " + quotient + " MB and " + remainder + " KB"); } } }
UTF-8
Java
1,087
java
MegaBytesConverter.java
Java
[]
null
[]
public class MegaBytesConverter { // // 1 MB = 1024 KB // int kiloBytes; // // public static long toMegaBytes(int kiloBytes) { // if (kiloBytes < 0) { // return -1; // } // return Math.round(kiloBytes / 1024 ); // } // // // // public static void printMegaBytesAndKiloBytes(int kiloBytes){ // // int megaB = 1024; // int remainder = kiloBytes % megaB; // // if(kiloBytes < 0){ // System.out.println("Invalid Value"); // } else { // long megaBytes = toMegaBytes(kiloBytes); // System.out.println(kiloBytes + " KB = " + megaBytes + " MB and " + remainder + " KB"); // } // // // } int kiloBytes; public static void printMegaBytesAndKiloBytes(int kiloBytes){ int remainder = kiloBytes % 1024; int quotient = kiloBytes / 1024; if(kiloBytes < 0){ System.out.println("Invalid Value"); } else { System.out.println(kiloBytes + " KB = " + quotient + " MB and " + remainder + " KB"); } } }
1,087
0.521619
0.49862
49
21.183674
25.243851
100
false
false
0
0
0
0
0
0
0.265306
false
false
4
edf1c77ef9ce520d59778d09f814a23dbb839558
2,396,591,756,352
b5472221e67233a1830be78499f52751c0426778
/main-operation/src/main/java/com/xiaoze/springcloud/service/impl/CourseTypeServiceImpl.java
dfba58c4d6f21986818f60b879ff52f5789bff5d
[]
no_license
tanbinh123/upgrade-school-springcloud-springboot
https://github.com/tanbinh123/upgrade-school-springcloud-springboot
f4b09cef1940daba14978d827861aa1748707532
75b2ef9bddfeed8c38f99489dbcd96b9238f43a2
refs/heads/master
2022-04-02T22:09:12.311000
2020-01-08T14:53:53
2020-01-08T14:53:53
461,421,382
1
0
null
true
2022-02-20T07:58:28
2022-02-20T07:58:27
2020-01-08T14:55:15
2020-01-08T14:54:40
127,350
0
0
0
null
false
false
package com.xiaoze.springcloud.service.impl; import com.xiaoze.springcloud.dao.CourseTypeDao; import com.xiaoze.springcloud.entity.CourseType; import com.xiaoze.springcloud.entity.Page; import com.xiaoze.springcloud.service.CourseTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * CourseTypeServiceImpl * * @author xiaoze * @date 2018/6/3 * */ @Service public class CourseTypeServiceImpl implements CourseTypeService { @Autowired private CourseTypeDao courseTypeDao; @Override public void addCourseType(CourseType courseType) { String str = courseTypeDao.addCourseType(courseType); System.out.println("增加:" + str); } @Override public void removeCourseType(Integer typeId) { String str = courseTypeDao.removeCourseType(typeId); System.out.println("删除:" + str); } @Override public void updateCourseType(CourseType courseType) { String str = courseTypeDao.updateCourseType(courseType); System.out.println("更新:" + str); } @Override public CourseType getCourseTypeById(Integer typeId) { return courseTypeDao.getCourseTypeById(typeId); } @Override public Page<CourseType> loadByPageNo(Integer pageNo) { return courseTypeDao.loadByPageNo(pageNo); } }
UTF-8
Java
1,420
java
CourseTypeServiceImpl.java
Java
[ { "context": ".List;\n\n/**\n * CourseTypeServiceImpl\n *\n * @author xiaoze\n * @date 2018/6/3\n *\n */\n@Service\npublic class Co", "end": 428, "score": 0.9996182918548584, "start": 422, "tag": "USERNAME", "value": "xiaoze" } ]
null
[]
package com.xiaoze.springcloud.service.impl; import com.xiaoze.springcloud.dao.CourseTypeDao; import com.xiaoze.springcloud.entity.CourseType; import com.xiaoze.springcloud.entity.Page; import com.xiaoze.springcloud.service.CourseTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * CourseTypeServiceImpl * * @author xiaoze * @date 2018/6/3 * */ @Service public class CourseTypeServiceImpl implements CourseTypeService { @Autowired private CourseTypeDao courseTypeDao; @Override public void addCourseType(CourseType courseType) { String str = courseTypeDao.addCourseType(courseType); System.out.println("增加:" + str); } @Override public void removeCourseType(Integer typeId) { String str = courseTypeDao.removeCourseType(typeId); System.out.println("删除:" + str); } @Override public void updateCourseType(CourseType courseType) { String str = courseTypeDao.updateCourseType(courseType); System.out.println("更新:" + str); } @Override public CourseType getCourseTypeById(Integer typeId) { return courseTypeDao.getCourseTypeById(typeId); } @Override public Page<CourseType> loadByPageNo(Integer pageNo) { return courseTypeDao.loadByPageNo(pageNo); } }
1,420
0.721113
0.716833
62
21.612904
23.480503
65
false
false
0
0
0
0
0
0
0.274194
false
false
4
92e5a18421fa39831ebcff09a49fe2b999305c75
7,962,869,432,523
5c9e6a47c03be6fe81bc46fc748610fae5300282
/web-beans/src/main/java/com/wejoyclass/itops/local/dto/MonitorDetailSettingPageDto.java
bbe9d0491310b4170a6c522d9c0b0c216eda59e8
[]
no_license
Sololan/itops-native-web-api
https://github.com/Sololan/itops-native-web-api
8ae4a706d4a4053ad4f183bb7b4ad707bd4c3a19
f3b140c915917eb1d697b32150d5c11a0650ae04
refs/heads/master
2022-04-25T03:17:25.932000
2020-04-17T05:49:55
2020-04-17T05:49:55
256,412,257
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wejoyclass.itops.local.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import java.util.Date; import java.util.List; @Getter @Setter public class MonitorDetailSettingPageDto { @ApiModelProperty(notes = "监控id") private Long id; @ApiModelProperty(notes = "监控名称") private String monitorName; @ApiModelProperty(notes = "用途") private String businessSystemName; @ApiModelProperty(notes = "是否启用") private Integer isValid; @ApiModelProperty(notes = "设备id") private Long equipmentId; @ApiModelProperty(notes = "设备编号") private String equipmentCode; @ApiModelProperty(notes = "设备类型") private String equipmentTypeName; @ApiModelProperty(notes = "设备子类型") private String equipmentSubTypeName; @ApiModelProperty(notes = "设备品牌") private String brandName; @ApiModelProperty(notes = "设备型号") private String equipmentMode; @ApiModelProperty(notes = "服务编号") private String serviceNumber; @ApiModelProperty(notes = "购入日期") private Date purchaseDate; @ApiModelProperty(notes = "质保截止日期") private Date expiration; @ApiModelProperty(notes = "供应商名称") private String supplierName; @ApiModelProperty(notes = "主机id") private String hostid; @ApiModelProperty(notes = "监控项列表") private List<ItemDto> itemList; }
UTF-8
Java
1,508
java
MonitorDetailSettingPageDto.java
Java
[]
null
[]
package com.wejoyclass.itops.local.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import java.util.Date; import java.util.List; @Getter @Setter public class MonitorDetailSettingPageDto { @ApiModelProperty(notes = "监控id") private Long id; @ApiModelProperty(notes = "监控名称") private String monitorName; @ApiModelProperty(notes = "用途") private String businessSystemName; @ApiModelProperty(notes = "是否启用") private Integer isValid; @ApiModelProperty(notes = "设备id") private Long equipmentId; @ApiModelProperty(notes = "设备编号") private String equipmentCode; @ApiModelProperty(notes = "设备类型") private String equipmentTypeName; @ApiModelProperty(notes = "设备子类型") private String equipmentSubTypeName; @ApiModelProperty(notes = "设备品牌") private String brandName; @ApiModelProperty(notes = "设备型号") private String equipmentMode; @ApiModelProperty(notes = "服务编号") private String serviceNumber; @ApiModelProperty(notes = "购入日期") private Date purchaseDate; @ApiModelProperty(notes = "质保截止日期") private Date expiration; @ApiModelProperty(notes = "供应商名称") private String supplierName; @ApiModelProperty(notes = "主机id") private String hostid; @ApiModelProperty(notes = "监控项列表") private List<ItemDto> itemList; }
1,508
0.712843
0.712843
60
22.1
16.52846
47
false
false
0
0
0
0
0
0
0.366667
false
false
4
ffcb1e04c28a16d36385109575f52861ca4eecdf
10,402,410,834,636
3ec2635f5d63099e1abeb829086d97354944f945
/src/main/java/com/cafe24/phoenixooo/crm/businessManagement/Controller/BusinessManagementSettingController.java
fef91fa9168707c5628150418bd0e1aa7d28deb1
[]
no_license
aranlgfm/phoenix
https://github.com/aranlgfm/phoenix
f50a89d51eaaeec2c20182325bf5ac411738f960
9d827e5872ef9ae76d598a34165253ac106d79d2
refs/heads/master
2022-12-22T15:09:09.092000
2020-02-18T07:33:58
2020-02-18T07:33:58
63,932,945
0
4
null
false
2022-12-16T04:24:46
2016-07-22T07:26:44
2020-02-18T07:34:25
2022-12-16T04:24:45
10,814
0
0
6
Java
false
false
package com.cafe24.phoenixooo.crm.businessManagement.Controller; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import com.cafe24.phoenixooo.community.Model.UserCustomer; import com.cafe24.phoenixooo.crm.businessManagement.Model.ProcedureItem; import com.cafe24.phoenixooo.crm.businessManagement.Model.ProcedureItemDesign; import com.cafe24.phoenixooo.crm.businessManagement.Service.BusinessManagementSettingService; /** 영업관리 * 0.임시 메인페이지 * 1-1.영업관리 메인화면 * 1-2.시술품목(아이템) 등록 이자 영업관리 메인화면 * 1-3.시술품목(아이템)등록 처리 컨트롤러 * 2-1.시술품목디자인 (아이템세부) 화면 * 2-2.시술품목디자인 (아이템세부) 처리 * 3-1.시술품목(아이템) 셀렉 * 3-2.시술품목(아이템) 수정 * 4-1.시술품목디자인(아이템세부) 수정전에 셀렉 * 4-2.4-2시술품목디자인 수정. * @author 201-04 * */ //영업관리 컨트롤러 @Controller public class BusinessManagementSettingController { @Autowired BusinessManagementSettingService service; /** * 1-1. 영업관리 설정관리 요청시 처음 나오는 페이지 컨트롤러 * 기본값으로 불러오는 페이지가 시술품목에 대한 값임. * 해당 화면이 불러올때 리스트가 나와야함 * 서비스의 selectItemList(shopCode) 로 리스트 받음. * selectItemList에 바로 shopCode * @return */ @RequestMapping(value="/phoenix/crm/form/businessManagementSetting", method = RequestMethod.GET) public String businessManagementSetting(HttpSession session,Model model) { UserCustomer user = (UserCustomer)session.getAttribute("user"); String shopCode = user.getShopCode(); List<ProcedureItem> list = service.selectItemList(shopCode); model.addAttribute("item", list); return "/phoenix/crm/businessManagement/procedureItemSetting"; } /** * 1-2. 기본값 말고 시술품목 등록에 대한 컨트롤러 * 같은페이지 호출이나 다른항목에 있다가 클릭할수 있으니까~ * 해당 화면이 불러올때 리스트가 나와야함 * 서비스의 selectItemList(shopCode) 로 리스트 받음. * @return */ @RequestMapping(value="/phoenix/crm/form/procedureItemSetting", method = RequestMethod.GET) public String procedureItemSetting(HttpSession session,Model model) { UserCustomer user = (UserCustomer)session.getAttribute("user"); String shopCode = user.getShopCode(); List<ProcedureItem> list = service.selectItemList(shopCode); model.addAttribute("item", list); return "/phoenix/crm/businessManagement/procedureItemSetting"; } /** * 1-3. 시술품목(아이템)등록 처리 컨트롤러 * 제대로 수행시 다시 시술품목 정하는 페이지로 넘어감. * 아이템을 등록하는것임. 회원가입과 다를바가 없음. * item의 커맨드 객체알아서 으이? * @param item * @return */ @RequestMapping(value="/phoenix/crm/process/insertProcedureItem",method = RequestMethod.POST) public String insertProcedureItem(ProcedureItem item){ service.insertProcedureItem(item); service.selectItemList(item.getShopCode()); return "redirect:/phoenix/crm/form/procedureItemSetting"; } /** * 2-1. 기본값 말고 시술품목의 세부 아이템(디자인)등록에 대한 컨트롤러 * 요청받을시 바로 해당샾의 아이템 리스트를 뿌려줘야함. * Session에서 shopCode받아온다 * 받은 shopCode를 매개변수로 selectItemList와 selectItemDesignList를 호출한다. * 각각의 맞는 변수에 담는다. * 모델에 담는다. * 리다이렉트로 넘긴다. * 화면에서 받는다. * 세션으로 받고 * @param session * @param model * @return */ @RequestMapping(value="/phoenix/crm/form/procedureItemDesignSetting", method = RequestMethod.GET) public String procedureDesignSetting(HttpSession session,Model model) { UserCustomer user = (UserCustomer)session.getAttribute("user"); String shopCode = user.getShopCode(); List<ProcedureItem> list = service.selectItemList(shopCode);//아이템리스트 List<ProcedureItemDesign> listDesign = service.selectItemDesignList(shopCode); model.addAttribute("item", list); model.addAttribute("itemDesign", listDesign); return "/phoenix/crm/businessManagement/procedureItemDesignSetting"; } /** * 2-2.시술품목디자인(아이템의세부) 등록에 대한 처리 컨트롤러 * 회원가입과 다를바가 없음 으이으이? * @param item * @param model * @return */ @RequestMapping(value="/phoenix/crm/process/insertProcedureItemDesign", method = RequestMethod.POST) public String procedureDesignSetting(ProcedureItemDesign item,Model model) { service.insertProcedureItemDesign(item); return "redirect:/phoenix/crm/form/procedureItemDesignSetting"; } /** * 3-1 시술품목 수정전 SELECT * @param itemCode * @param modelro * @return */ @RequestMapping(value="/phoenix/crm/form/modifyProcedureItem", method = RequestMethod.GET) public String modifyProcedureItem(@RequestParam("itemCode") String itemCode,Model model) { model.addAttribute("item", service.selectItem(itemCode)); return "/phoenix/crm/businessManagement/procedureItemModify"; } @RequestMapping(value="/phoenix/crm/process/modifyProcedureItem", method = RequestMethod.POST) public String modifyProcedure(ProcedureItem item,Model model) { service.modifyItem(item); return "redirect:/phoenix/crm/form/pcedureItemSetting"; } /** * 4-1 시술품목디자인 수정전에 SELECT * @param itemDesignCode * @param model * @return */ @RequestMapping(value="/phoenix/crm/form/modifyProcedureItemDesign", method = RequestMethod.GET) public String modifyProcedureDesign(@RequestParam("itemDesignCode") String itemDesignCode,Model model) { model.addAttribute("item", service.selectItemDesign(itemDesignCode)); return "/phoenix/crm/businessManagement/procedureItemDesignModify"; } /** * 4-2시술품목디자인 수정. * @param item * @param model * @return */ @RequestMapping(value="/phoenix/crm/process/modifyProcedureItemDesign", method = RequestMethod.POST) public String modifyProcedureDesign(ProcedureItemDesign item,Model model) { service.modifyItemDesign(item); return "redirect:/phoenix/crm/form/procedureItemDesignSetting"; } /** * 5-1 시술품목 삭제. * 받는 리퀘스트객체가 ProcedureItem이 아니라 ProcedureItemDesign입니다. * 맵퍼에 너무 하나셀렉할때마다 쓰는것 같아서 * 이런 쓰레기같은 방법으로도 할수 있구나 해서 해놓은것입니다. * Design으로 객체를 받아서 * 서비스에서 시술품목디자인(아이템상세)를 삭제하고 * 받은 매개변수값을 다시 시술품목(아이템)삭제합니다. * 나중에 정상적인 방법으로 바꿀께용~~~ * @param item * @return */ @RequestMapping(value="/phoenix/crm/process/deleteProcedureItem", method = RequestMethod.GET) public String deleteProcedure(ProcedureItemDesign item){ service.deleteItem(item); return "redirect:/phoenix/crm/form/procedureItemSetting"; } /** * 5-2시술품목디자인 삭제. * @param itemDesignCode * @return */ @RequestMapping(value="/phoenix/crm/process/deleteProcedureItemDesign", method = RequestMethod.GET) public String deleteProcedureDesign(ProcedureItemDesign item){ service.deleteItemDesign(item); return "redirect:/phoenix/crm/form/procedureItemDesignSetting"; } }
UTF-8
Java
7,898
java
BusinessManagementSettingController.java
Java
[]
null
[]
package com.cafe24.phoenixooo.crm.businessManagement.Controller; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import com.cafe24.phoenixooo.community.Model.UserCustomer; import com.cafe24.phoenixooo.crm.businessManagement.Model.ProcedureItem; import com.cafe24.phoenixooo.crm.businessManagement.Model.ProcedureItemDesign; import com.cafe24.phoenixooo.crm.businessManagement.Service.BusinessManagementSettingService; /** 영업관리 * 0.임시 메인페이지 * 1-1.영업관리 메인화면 * 1-2.시술품목(아이템) 등록 이자 영업관리 메인화면 * 1-3.시술품목(아이템)등록 처리 컨트롤러 * 2-1.시술품목디자인 (아이템세부) 화면 * 2-2.시술품목디자인 (아이템세부) 처리 * 3-1.시술품목(아이템) 셀렉 * 3-2.시술품목(아이템) 수정 * 4-1.시술품목디자인(아이템세부) 수정전에 셀렉 * 4-2.4-2시술품목디자인 수정. * @author 201-04 * */ //영업관리 컨트롤러 @Controller public class BusinessManagementSettingController { @Autowired BusinessManagementSettingService service; /** * 1-1. 영업관리 설정관리 요청시 처음 나오는 페이지 컨트롤러 * 기본값으로 불러오는 페이지가 시술품목에 대한 값임. * 해당 화면이 불러올때 리스트가 나와야함 * 서비스의 selectItemList(shopCode) 로 리스트 받음. * selectItemList에 바로 shopCode * @return */ @RequestMapping(value="/phoenix/crm/form/businessManagementSetting", method = RequestMethod.GET) public String businessManagementSetting(HttpSession session,Model model) { UserCustomer user = (UserCustomer)session.getAttribute("user"); String shopCode = user.getShopCode(); List<ProcedureItem> list = service.selectItemList(shopCode); model.addAttribute("item", list); return "/phoenix/crm/businessManagement/procedureItemSetting"; } /** * 1-2. 기본값 말고 시술품목 등록에 대한 컨트롤러 * 같은페이지 호출이나 다른항목에 있다가 클릭할수 있으니까~ * 해당 화면이 불러올때 리스트가 나와야함 * 서비스의 selectItemList(shopCode) 로 리스트 받음. * @return */ @RequestMapping(value="/phoenix/crm/form/procedureItemSetting", method = RequestMethod.GET) public String procedureItemSetting(HttpSession session,Model model) { UserCustomer user = (UserCustomer)session.getAttribute("user"); String shopCode = user.getShopCode(); List<ProcedureItem> list = service.selectItemList(shopCode); model.addAttribute("item", list); return "/phoenix/crm/businessManagement/procedureItemSetting"; } /** * 1-3. 시술품목(아이템)등록 처리 컨트롤러 * 제대로 수행시 다시 시술품목 정하는 페이지로 넘어감. * 아이템을 등록하는것임. 회원가입과 다를바가 없음. * item의 커맨드 객체알아서 으이? * @param item * @return */ @RequestMapping(value="/phoenix/crm/process/insertProcedureItem",method = RequestMethod.POST) public String insertProcedureItem(ProcedureItem item){ service.insertProcedureItem(item); service.selectItemList(item.getShopCode()); return "redirect:/phoenix/crm/form/procedureItemSetting"; } /** * 2-1. 기본값 말고 시술품목의 세부 아이템(디자인)등록에 대한 컨트롤러 * 요청받을시 바로 해당샾의 아이템 리스트를 뿌려줘야함. * Session에서 shopCode받아온다 * 받은 shopCode를 매개변수로 selectItemList와 selectItemDesignList를 호출한다. * 각각의 맞는 변수에 담는다. * 모델에 담는다. * 리다이렉트로 넘긴다. * 화면에서 받는다. * 세션으로 받고 * @param session * @param model * @return */ @RequestMapping(value="/phoenix/crm/form/procedureItemDesignSetting", method = RequestMethod.GET) public String procedureDesignSetting(HttpSession session,Model model) { UserCustomer user = (UserCustomer)session.getAttribute("user"); String shopCode = user.getShopCode(); List<ProcedureItem> list = service.selectItemList(shopCode);//아이템리스트 List<ProcedureItemDesign> listDesign = service.selectItemDesignList(shopCode); model.addAttribute("item", list); model.addAttribute("itemDesign", listDesign); return "/phoenix/crm/businessManagement/procedureItemDesignSetting"; } /** * 2-2.시술품목디자인(아이템의세부) 등록에 대한 처리 컨트롤러 * 회원가입과 다를바가 없음 으이으이? * @param item * @param model * @return */ @RequestMapping(value="/phoenix/crm/process/insertProcedureItemDesign", method = RequestMethod.POST) public String procedureDesignSetting(ProcedureItemDesign item,Model model) { service.insertProcedureItemDesign(item); return "redirect:/phoenix/crm/form/procedureItemDesignSetting"; } /** * 3-1 시술품목 수정전 SELECT * @param itemCode * @param modelro * @return */ @RequestMapping(value="/phoenix/crm/form/modifyProcedureItem", method = RequestMethod.GET) public String modifyProcedureItem(@RequestParam("itemCode") String itemCode,Model model) { model.addAttribute("item", service.selectItem(itemCode)); return "/phoenix/crm/businessManagement/procedureItemModify"; } @RequestMapping(value="/phoenix/crm/process/modifyProcedureItem", method = RequestMethod.POST) public String modifyProcedure(ProcedureItem item,Model model) { service.modifyItem(item); return "redirect:/phoenix/crm/form/pcedureItemSetting"; } /** * 4-1 시술품목디자인 수정전에 SELECT * @param itemDesignCode * @param model * @return */ @RequestMapping(value="/phoenix/crm/form/modifyProcedureItemDesign", method = RequestMethod.GET) public String modifyProcedureDesign(@RequestParam("itemDesignCode") String itemDesignCode,Model model) { model.addAttribute("item", service.selectItemDesign(itemDesignCode)); return "/phoenix/crm/businessManagement/procedureItemDesignModify"; } /** * 4-2시술품목디자인 수정. * @param item * @param model * @return */ @RequestMapping(value="/phoenix/crm/process/modifyProcedureItemDesign", method = RequestMethod.POST) public String modifyProcedureDesign(ProcedureItemDesign item,Model model) { service.modifyItemDesign(item); return "redirect:/phoenix/crm/form/procedureItemDesignSetting"; } /** * 5-1 시술품목 삭제. * 받는 리퀘스트객체가 ProcedureItem이 아니라 ProcedureItemDesign입니다. * 맵퍼에 너무 하나셀렉할때마다 쓰는것 같아서 * 이런 쓰레기같은 방법으로도 할수 있구나 해서 해놓은것입니다. * Design으로 객체를 받아서 * 서비스에서 시술품목디자인(아이템상세)를 삭제하고 * 받은 매개변수값을 다시 시술품목(아이템)삭제합니다. * 나중에 정상적인 방법으로 바꿀께용~~~ * @param item * @return */ @RequestMapping(value="/phoenix/crm/process/deleteProcedureItem", method = RequestMethod.GET) public String deleteProcedure(ProcedureItemDesign item){ service.deleteItem(item); return "redirect:/phoenix/crm/form/procedureItemSetting"; } /** * 5-2시술품목디자인 삭제. * @param itemDesignCode * @return */ @RequestMapping(value="/phoenix/crm/process/deleteProcedureItemDesign", method = RequestMethod.GET) public String deleteProcedureDesign(ProcedureItemDesign item){ service.deleteItemDesign(item); return "redirect:/phoenix/crm/form/procedureItemDesignSetting"; } }
7,898
0.748856
0.740311
203
31.285715
28.930138
105
false
false
0
0
0
0
0
0
1.428571
false
false
4
46e15a14cf6818c68a40eabdb79019f30898ecb7
29,386,166,260,750
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/12/12_0ac1f41d8e3a72d333d6ddad1f90ce0d126b939c/MavenEnvironmentImpl/12_0ac1f41d8e3a72d333d6ddad1f90ce0d126b939c_MavenEnvironmentImpl_s.java
6eed79df2abb859cdfc29074f442d4208c734c23
[]
no_license
zhongxingyu/Seer
https://github.com/zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516000
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
false
2023-06-22T07:55:57
2020-04-28T11:07:49
2023-06-21T00:53:27
2023-06-22T07:55:57
2,849,868
2
2
0
null
false
false
/* * JBoss, Home of Professional Open Source. * Copyright 2011, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.shrinkwrap.resolver.impl.maven; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.maven.model.Model; import org.apache.maven.model.Repository; import org.apache.maven.model.building.DefaultModelBuilderFactory; import org.apache.maven.model.building.ModelBuilder; import org.apache.maven.model.building.ModelBuildingException; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelBuildingResult; import org.apache.maven.model.building.ModelProblem; import org.apache.maven.settings.Activation; import org.apache.maven.settings.Mirror; import org.apache.maven.settings.Profile; import org.apache.maven.settings.Settings; import org.apache.maven.settings.building.SettingsBuildingRequest; import org.jboss.shrinkwrap.resolver.api.ResolutionException; import org.jboss.shrinkwrap.resolver.api.maven.MavenDependency; import org.jboss.shrinkwrap.resolver.api.maven.MavenResolutionFilter; import org.sonatype.aether.RepositorySystemSession; import org.sonatype.aether.artifact.ArtifactTypeRegistry; import org.sonatype.aether.collection.CollectRequest; import org.sonatype.aether.repository.RemoteRepository; import org.sonatype.aether.resolution.ArtifactRequest; import org.sonatype.aether.resolution.ArtifactResolutionException; import org.sonatype.aether.resolution.ArtifactResult; import org.sonatype.aether.resolution.DependencyResolutionException; import org.sonatype.aether.util.repository.DefaultMirrorSelector; /** * An implementation of Maven Environment required for resolver to have a place where to store intermediate data * * @author <a href="kpiwko@redhat.com">Karel Piwko</a> * */ class MavenEnvironmentImpl implements MavenEnvironment { private static final Logger log = Logger.getLogger(MavenEnvironmentImpl.class.getName()); // creates a link to Maven Central Repository private static final RemoteRepository MAVEN_CENTRAL = new RemoteRepository("central", "default", "http://repo1.maven.org/maven2"); private MavenRepositorySystem system; private Settings settings; // private MavenDependencyResolverSettings settings; private RepositorySystemSession session; private Stack<MavenDependency> dependencies; private Set<MavenDependency> versionManagement; private Model model; private List<RemoteRepository> remoteRepositories; private boolean useMavenCentralRepository; /** * Constructs a new instance of MavenEnvironment */ public MavenEnvironmentImpl() { this.system = new MavenRepositorySystem(); this.settings = new MavenSettingsBuilder().buildDefaultSettings(); this.dependencies = new Stack<MavenDependency>(); this.versionManagement = new LinkedHashSet<MavenDependency>(); this.remoteRepositories = new ArrayList<RemoteRepository>(); // get session to spare time this.session = system.getSession(settings); } @Override public Set<MavenDependency> getVersionManagement() { return versionManagement; } @Override public Stack<MavenDependency> getDependencies() { return dependencies; } @Override public MavenEnvironment regenerateSession() { this.session = system.getSession(settings); return this; } @Override public MavenEnvironment execute(ModelBuildingRequest request) { request.setModelResolver(new MavenModelResolver(system, session, getRemoteRepositories())); ModelBuilder builder = new DefaultModelBuilderFactory().newInstance(); ModelBuildingResult result; try { result = builder.build(request); } // wrap exception message catch (ModelBuildingException e) { String pomPath = request.getPomFile().getAbsolutePath(); StringBuilder sb = new StringBuilder("Found ").append(e.getProblems().size()) .append(" problems while building POM model from ").append(pomPath); int counter = 1; for (ModelProblem problem : e.getProblems()) { sb.append(counter++).append("/ ").append(problem).append("\n"); } throw new ResolutionException(sb.toString(), e); } // get and update model Model model = result.getEffectiveModel(); this.model = model; // update model repositories for (Repository repository : model.getRepositories()) { remoteRepositories.add(MavenConverter.asRemoteRepository(repository)); } return this; } @Override public MavenEnvironment execute(SettingsBuildingRequest request) { MavenSettingsBuilder builder = new MavenSettingsBuilder(); this.settings = builder.buildSettings(request); // propagate offline settings from system properties return goOffline(settings.isOffline()); } @Override public Collection<ArtifactResult> execute(CollectRequest request, MavenResolutionFilter filter) throws DependencyResolutionException { return system.resolveDependencies(session, request, filter); } @Override public ArtifactResult execute(ArtifactRequest request) throws ArtifactResolutionException { return system.resolveArtifact(session, request); } @SuppressWarnings("unchecked") @Override public List<RemoteRepository> getRemoteRepositories() { // disable repositories if working offline if (settings.isOffline()) { return Collections.emptyList(); } List<String> actives = settings.getActiveProfiles(); Set<RemoteRepository> enhancedRepos = new LinkedHashSet<RemoteRepository>(); for (Map.Entry<String, Profile> profile : (Set<Map.Entry<String, Profile>>) settings.getProfilesAsMap().entrySet()) { Activation activation = profile.getValue().getActivation(); if (actives.contains(profile.getKey()) || (activation != null && activation.isActiveByDefault())) { for (org.apache.maven.settings.Repository repo : profile.getValue().getRepositories()) { enhancedRepos.add(MavenConverter.asRemoteRepository(repo)); } } } // add repositories from model enhancedRepos.addAll(remoteRepositories); // add maven central if selected if (useMavenCentralRepository) { enhancedRepos.add(MAVEN_CENTRAL); } if (settings.getMirrors().size() == 0) { return new ArrayList<RemoteRepository>(enhancedRepos); } // use mirrors if any to do the mirroring stuff DefaultMirrorSelector dms = new DefaultMirrorSelector(); // fill in mirrors for (Mirror mirror : settings.getMirrors()) { // Repository manager flag is set to false // Maven does not support specifying it in the settings.xml dms.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } Set<RemoteRepository> mirroredRepos = new LinkedHashSet<RemoteRepository>(); for (RemoteRepository repository : enhancedRepos) { RemoteRepository mirror = dms.getMirror(repository); if (mirror != null) { mirroredRepos.add(mirror); } else { mirroredRepos.add(repository); } } return new ArrayList<RemoteRepository>(mirroredRepos); } /** * Gets registry of the known artifact types based on underlying session * * @return the registry */ @Override public ArtifactTypeRegistry getArtifactTypeRegistry() { return session.getArtifactTypeRegistry(); } @Override public Model getModel() { return model; } @Override public MavenEnvironment goOffline(boolean value) { String goOffline = SecurityActions.getProperty(MavenSettingsBuilder.ALT_MAVEN_OFFLINE); if (goOffline != null) { this.settings.setOffline(Boolean.valueOf(goOffline)); if (log.isLoggable(Level.FINER)) { log.finer("Offline settings is set via a system property. The new offline flag value is: " + settings.isOffline()); } } else { settings.setOffline(value); } return this; } @Override public MavenEnvironment useCentralRepository(boolean useCentralRepository) { this.useMavenCentralRepository = useCentralRepository; return this; } }
UTF-8
Java
10,196
java
12_0ac1f41d8e3a72d333d6ddad1f90ce0d126b939c_MavenEnvironmentImpl_s.java
Java
[ { "context": " store intermediate data\n *\n * @author <a href=\"kpiwko@redhat.com\">Karel Piwko</a>\n *\n */\n class MavenEnvironment", "end": 2973, "score": 0.9999261498451233, "start": 2956, "tag": "EMAIL", "value": "kpiwko@redhat.com" }, { "context": " data\n *\n * @author <a href=\"kpiwko@redhat.com\">Karel Piwko</a>\n *\n */\n class MavenEnvironmentImpl implemen", "end": 2986, "score": 0.9998884797096252, "start": 2975, "tag": "NAME", "value": "Karel Piwko" } ]
null
[]
/* * JBoss, Home of Professional Open Source. * Copyright 2011, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.shrinkwrap.resolver.impl.maven; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.maven.model.Model; import org.apache.maven.model.Repository; import org.apache.maven.model.building.DefaultModelBuilderFactory; import org.apache.maven.model.building.ModelBuilder; import org.apache.maven.model.building.ModelBuildingException; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelBuildingResult; import org.apache.maven.model.building.ModelProblem; import org.apache.maven.settings.Activation; import org.apache.maven.settings.Mirror; import org.apache.maven.settings.Profile; import org.apache.maven.settings.Settings; import org.apache.maven.settings.building.SettingsBuildingRequest; import org.jboss.shrinkwrap.resolver.api.ResolutionException; import org.jboss.shrinkwrap.resolver.api.maven.MavenDependency; import org.jboss.shrinkwrap.resolver.api.maven.MavenResolutionFilter; import org.sonatype.aether.RepositorySystemSession; import org.sonatype.aether.artifact.ArtifactTypeRegistry; import org.sonatype.aether.collection.CollectRequest; import org.sonatype.aether.repository.RemoteRepository; import org.sonatype.aether.resolution.ArtifactRequest; import org.sonatype.aether.resolution.ArtifactResolutionException; import org.sonatype.aether.resolution.ArtifactResult; import org.sonatype.aether.resolution.DependencyResolutionException; import org.sonatype.aether.util.repository.DefaultMirrorSelector; /** * An implementation of Maven Environment required for resolver to have a place where to store intermediate data * * @author <a href="<EMAIL>"><NAME></a> * */ class MavenEnvironmentImpl implements MavenEnvironment { private static final Logger log = Logger.getLogger(MavenEnvironmentImpl.class.getName()); // creates a link to Maven Central Repository private static final RemoteRepository MAVEN_CENTRAL = new RemoteRepository("central", "default", "http://repo1.maven.org/maven2"); private MavenRepositorySystem system; private Settings settings; // private MavenDependencyResolverSettings settings; private RepositorySystemSession session; private Stack<MavenDependency> dependencies; private Set<MavenDependency> versionManagement; private Model model; private List<RemoteRepository> remoteRepositories; private boolean useMavenCentralRepository; /** * Constructs a new instance of MavenEnvironment */ public MavenEnvironmentImpl() { this.system = new MavenRepositorySystem(); this.settings = new MavenSettingsBuilder().buildDefaultSettings(); this.dependencies = new Stack<MavenDependency>(); this.versionManagement = new LinkedHashSet<MavenDependency>(); this.remoteRepositories = new ArrayList<RemoteRepository>(); // get session to spare time this.session = system.getSession(settings); } @Override public Set<MavenDependency> getVersionManagement() { return versionManagement; } @Override public Stack<MavenDependency> getDependencies() { return dependencies; } @Override public MavenEnvironment regenerateSession() { this.session = system.getSession(settings); return this; } @Override public MavenEnvironment execute(ModelBuildingRequest request) { request.setModelResolver(new MavenModelResolver(system, session, getRemoteRepositories())); ModelBuilder builder = new DefaultModelBuilderFactory().newInstance(); ModelBuildingResult result; try { result = builder.build(request); } // wrap exception message catch (ModelBuildingException e) { String pomPath = request.getPomFile().getAbsolutePath(); StringBuilder sb = new StringBuilder("Found ").append(e.getProblems().size()) .append(" problems while building POM model from ").append(pomPath); int counter = 1; for (ModelProblem problem : e.getProblems()) { sb.append(counter++).append("/ ").append(problem).append("\n"); } throw new ResolutionException(sb.toString(), e); } // get and update model Model model = result.getEffectiveModel(); this.model = model; // update model repositories for (Repository repository : model.getRepositories()) { remoteRepositories.add(MavenConverter.asRemoteRepository(repository)); } return this; } @Override public MavenEnvironment execute(SettingsBuildingRequest request) { MavenSettingsBuilder builder = new MavenSettingsBuilder(); this.settings = builder.buildSettings(request); // propagate offline settings from system properties return goOffline(settings.isOffline()); } @Override public Collection<ArtifactResult> execute(CollectRequest request, MavenResolutionFilter filter) throws DependencyResolutionException { return system.resolveDependencies(session, request, filter); } @Override public ArtifactResult execute(ArtifactRequest request) throws ArtifactResolutionException { return system.resolveArtifact(session, request); } @SuppressWarnings("unchecked") @Override public List<RemoteRepository> getRemoteRepositories() { // disable repositories if working offline if (settings.isOffline()) { return Collections.emptyList(); } List<String> actives = settings.getActiveProfiles(); Set<RemoteRepository> enhancedRepos = new LinkedHashSet<RemoteRepository>(); for (Map.Entry<String, Profile> profile : (Set<Map.Entry<String, Profile>>) settings.getProfilesAsMap().entrySet()) { Activation activation = profile.getValue().getActivation(); if (actives.contains(profile.getKey()) || (activation != null && activation.isActiveByDefault())) { for (org.apache.maven.settings.Repository repo : profile.getValue().getRepositories()) { enhancedRepos.add(MavenConverter.asRemoteRepository(repo)); } } } // add repositories from model enhancedRepos.addAll(remoteRepositories); // add maven central if selected if (useMavenCentralRepository) { enhancedRepos.add(MAVEN_CENTRAL); } if (settings.getMirrors().size() == 0) { return new ArrayList<RemoteRepository>(enhancedRepos); } // use mirrors if any to do the mirroring stuff DefaultMirrorSelector dms = new DefaultMirrorSelector(); // fill in mirrors for (Mirror mirror : settings.getMirrors()) { // Repository manager flag is set to false // Maven does not support specifying it in the settings.xml dms.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } Set<RemoteRepository> mirroredRepos = new LinkedHashSet<RemoteRepository>(); for (RemoteRepository repository : enhancedRepos) { RemoteRepository mirror = dms.getMirror(repository); if (mirror != null) { mirroredRepos.add(mirror); } else { mirroredRepos.add(repository); } } return new ArrayList<RemoteRepository>(mirroredRepos); } /** * Gets registry of the known artifact types based on underlying session * * @return the registry */ @Override public ArtifactTypeRegistry getArtifactTypeRegistry() { return session.getArtifactTypeRegistry(); } @Override public Model getModel() { return model; } @Override public MavenEnvironment goOffline(boolean value) { String goOffline = SecurityActions.getProperty(MavenSettingsBuilder.ALT_MAVEN_OFFLINE); if (goOffline != null) { this.settings.setOffline(Boolean.valueOf(goOffline)); if (log.isLoggable(Level.FINER)) { log.finer("Offline settings is set via a system property. The new offline flag value is: " + settings.isOffline()); } } else { settings.setOffline(value); } return this; } @Override public MavenEnvironment useCentralRepository(boolean useCentralRepository) { this.useMavenCentralRepository = useCentralRepository; return this; } }
10,181
0.678403
0.676344
265
37.471699
29.388872
126
false
false
0
0
0
0
0
0
0.50566
false
false
4
223e626d24bf248d2164d8fcc7cb4a3ce8f90631
9,740,985,838,043
e4698a4410963596173827ffc8d901f15ad9ebd3
/1406/a7&a8/assignment8/catchOpponent.java
ba4823cc5ec7cfd0f519b32a5d053ed51cef616c
[]
no_license
strollingorange/CarletonPrograms
https://github.com/strollingorange/CarletonPrograms
3f153ce286e67056bdafaba3a2af1b43e861d580
74545dd439bca0f7ba0b1b4472114cdaa27c1ddf
refs/heads/master
2020-03-28T20:01:25.562000
2020-03-28T02:46:08
2020-03-28T02:46:08
149,030,883
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//Players that try to catch opponents (so that they go to jail). //This is the only player that is allowed to catch other players public class catchOpponent extends Player{ private final double speed = 2.5; private Entity a; public void getTarget(Field field){ if (field.getTeam1().size()!=0 && field.getTeam.get(this).equals(new Integer(2))){ a= field.getTeam1().get((int)(Math.random()*field.getTeam1().size())); }else { a=null; } if(field.getTeam2().size() !=0 && field.getTeam.get(this).equals(new Integer(1)) ){ a= field.getTeam2().get((int)(Math.random()*field.getTeam2().size())); }else{ a=null; } } @Override public void play(Field field){ // play is the logic for the player // you should make changes to the player's speed here // you should not update position int Jailx,Jaily; if(a== null){ if(field.getTeam.get(this).equals(new Integer(1))){ a = field.getTeam2().get(0); } else{ a = field.getTeam1().get(0); } } double distance = Math.hypot( this.getX() - a.getX(), this.getY() - a.getY()); if (!this.catchOpponent(((Player)a), field)){ this.speedX = speed*(a.getX()-this.getX())/distance; this.speedY = speed*(a.getY()-this.getY())/distance; } else { a.setX(this.x, a.id); a.setY(this.y, a.id); //This catcher Player start to get the caught player to the jail Entity jail = field.jail1; if( field.getTeam.get(this).equals(new Integer(2)) ){ jail = field.jail2; } Jailx=jail.getX(); Jaily=jail.getY(); //Calculate the speedX and speedY of this player that //always moves towards its team's jail. double jailDistance = Math.hypot( this.getX() - Jailx, this.getY() - Jaily); if (jailDistance > field.ARMS_LENGTH){ if(x > Jailx){ this.setSpeedX(Math.random()*-1, this.id); } else if (x < Jailx){ this.setSpeedX(Math.random()*1, this.id); } else{ this.setSpeedX(0.0, this.id); } if(y > Jaily){ this.setSpeedY(Math.random()*-1, this.id); } else if (y < Jaily){ this.setSpeedY(Math.random()*1, this.id); } else{ a.setSpeedX(0,a.id); a.setSpeedY(0,a.id); this.getTarget(field); } } // // should not update position here // updatePosition(1,field); // this is now removed. // } } @Override public void update(Field field){} /** create a player that has some random motion * <p> * the player starts in a random direction * * @param f is the field the player will be playing on * @param side is the side of the field the player will play on * @param name is this player's name * @param number is this player's number * @param team is this player's team's name * @param symbol is a character representation of this player * @param x is the initial x position of this player * @param y is the initial y position of this player */ public catchOpponent(Field f, int side, String name, int number, String team,char symbol, double x, double y){ super(f, side, name, number, team, symbol, x, y); this.getTarget(f); } }
UTF-8
Java
3,495
java
catchOpponent.java
Java
[]
null
[]
//Players that try to catch opponents (so that they go to jail). //This is the only player that is allowed to catch other players public class catchOpponent extends Player{ private final double speed = 2.5; private Entity a; public void getTarget(Field field){ if (field.getTeam1().size()!=0 && field.getTeam.get(this).equals(new Integer(2))){ a= field.getTeam1().get((int)(Math.random()*field.getTeam1().size())); }else { a=null; } if(field.getTeam2().size() !=0 && field.getTeam.get(this).equals(new Integer(1)) ){ a= field.getTeam2().get((int)(Math.random()*field.getTeam2().size())); }else{ a=null; } } @Override public void play(Field field){ // play is the logic for the player // you should make changes to the player's speed here // you should not update position int Jailx,Jaily; if(a== null){ if(field.getTeam.get(this).equals(new Integer(1))){ a = field.getTeam2().get(0); } else{ a = field.getTeam1().get(0); } } double distance = Math.hypot( this.getX() - a.getX(), this.getY() - a.getY()); if (!this.catchOpponent(((Player)a), field)){ this.speedX = speed*(a.getX()-this.getX())/distance; this.speedY = speed*(a.getY()-this.getY())/distance; } else { a.setX(this.x, a.id); a.setY(this.y, a.id); //This catcher Player start to get the caught player to the jail Entity jail = field.jail1; if( field.getTeam.get(this).equals(new Integer(2)) ){ jail = field.jail2; } Jailx=jail.getX(); Jaily=jail.getY(); //Calculate the speedX and speedY of this player that //always moves towards its team's jail. double jailDistance = Math.hypot( this.getX() - Jailx, this.getY() - Jaily); if (jailDistance > field.ARMS_LENGTH){ if(x > Jailx){ this.setSpeedX(Math.random()*-1, this.id); } else if (x < Jailx){ this.setSpeedX(Math.random()*1, this.id); } else{ this.setSpeedX(0.0, this.id); } if(y > Jaily){ this.setSpeedY(Math.random()*-1, this.id); } else if (y < Jaily){ this.setSpeedY(Math.random()*1, this.id); } else{ a.setSpeedX(0,a.id); a.setSpeedY(0,a.id); this.getTarget(field); } } // // should not update position here // updatePosition(1,field); // this is now removed. // } } @Override public void update(Field field){} /** create a player that has some random motion * <p> * the player starts in a random direction * * @param f is the field the player will be playing on * @param side is the side of the field the player will play on * @param name is this player's name * @param number is this player's number * @param team is this player's team's name * @param symbol is a character representation of this player * @param x is the initial x position of this player * @param y is the initial y position of this player */ public catchOpponent(Field f, int side, String name, int number, String team,char symbol, double x, double y){ super(f, side, name, number, team, symbol, x, y); this.getTarget(f); } }
3,495
0.563949
0.555651
111
29.504505
24.877312
112
false
false
0
0
0
0
0
0
0.522523
false
false
4
8efc08cfcd4849d7db07d8ca4dea66a0bda4a7e7
31,791,347,976,492
cdfa4b4be11bb2d110492a787368f89b0c4cc43a
/src/main/java/net/tmhub/obj/TM.java
c5481f9f900baf604c1fd6338d6f1f84531ba185
[]
no_license
UNS/tmHub
https://github.com/UNS/tmHub
de6e649738e289c820424b19caf8049fa3c554c1
03372aa7aa8277042ecd439d2a8d582f7484f142
refs/heads/master
2020-04-04T17:43:06.387000
2015-10-22T09:19:47
2015-10-22T09:19:47
8,754,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.tmhub.obj; import java.io.Serializable; import java.util.Set; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; /** * * @author remal */ @Entity public class TM implements Serializable { private static long serialVersionUID = 1L; /** * @return the serialVersionUID */ public static long getSerialVersionUID() { return serialVersionUID; } /** * @param aSerialVersionUID the serialVersionUID to set */ public static void setSerialVersionUID(long aSerialVersionUID) { serialVersionUID = aSerialVersionUID; } @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String description; @ManyToOne private Profile owner; @ManyToOne(fetch = FetchType.EAGER) private Problem problem; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Problem getProblem() { return problem; } public void setProblem(Problem p) { this.problem = p; } @Override public int hashCode() { int hash = 0; hash += (getId() != null ? getId().hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TM)) { return false; } TM other = (TM) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "net.tmhub.obj.TM[ id=" + getId() + " ]"; } /** * @return the description */ public String getDescription() { return description; } /** * @param description the description to set */ public void setDescription(String description) { this.description = description; } /** * @return the owner */ public Profile getOwner() { return owner; } /** * @param owner the owner to set */ public void setOwner(Profile owner) { this.owner = owner; } }
UTF-8
Java
2,249
java
TM.java
Java
[ { "context": "avax.persistence.ManyToOne;\r\n\r\n/**\r\n *\r\n * @author remal\r\n */\r\n@Entity\r\npublic class TM implements Seriali", "end": 328, "score": 0.9992470741271973, "start": 323, "tag": "USERNAME", "value": "remal" } ]
null
[]
package net.tmhub.obj; import java.io.Serializable; import java.util.Set; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; /** * * @author remal */ @Entity public class TM implements Serializable { private static long serialVersionUID = 1L; /** * @return the serialVersionUID */ public static long getSerialVersionUID() { return serialVersionUID; } /** * @param aSerialVersionUID the serialVersionUID to set */ public static void setSerialVersionUID(long aSerialVersionUID) { serialVersionUID = aSerialVersionUID; } @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String description; @ManyToOne private Profile owner; @ManyToOne(fetch = FetchType.EAGER) private Problem problem; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Problem getProblem() { return problem; } public void setProblem(Problem p) { this.problem = p; } @Override public int hashCode() { int hash = 0; hash += (getId() != null ? getId().hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TM)) { return false; } TM other = (TM) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "net.tmhub.obj.TM[ id=" + getId() + " ]"; } /** * @return the description */ public String getDescription() { return description; } /** * @param description the description to set */ public void setDescription(String description) { this.description = description; } /** * @return the owner */ public Profile getOwner() { return owner; } /** * @param owner the owner to set */ public void setOwner(Profile owner) { this.owner = owner; } }
2,249
0.649177
0.647843
114
17.728069
19.350546
111
false
false
0
0
0
0
0
0
1.210526
false
false
4
c3e3cf6fbbdda2889b36410f8ef8750717be3966
15,831,249,472,894
7d0fda90884c1b8799d1cff414051d9f4eded239
/app/src/main/java/com/example/ezycommerce/EzyCommerceDatabase.java
8a3060bb4936a3fc1d67ad6bfbc45cbea2d3efab
[]
no_license
vlouise1609/EzyCommerce
https://github.com/vlouise1609/EzyCommerce
1409d4207a64eb09ea46ac0d526d10a9c9f4ab1b
6c1d4314246b1cfe2dd27f93bea9980d1ef72440
refs/heads/master
2023-03-01T16:54:18.735000
2021-02-06T09:29:46
2021-02-06T09:29:46
336,458,633
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.ezycommerce; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import androidx.annotation.Nullable; public class EzyCommerceDatabase extends SQLiteOpenHelper { private EzyCommerceDatabase ezDb; private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "EzyCommerce"; //nama db //nama tabel public static final String TABLE_CART = "Carts"; //nama kolom tabel user public static final String KEY_ID = "id"; public static final String KEY_NAME = "name"; public static final String KEY_PRICE = "price"; public static final String KEY_AUTHOR = "author"; public static final String KEY_TYPE = "type"; public static final String KEY_IMAGE = "img"; public static final String KEY_QUANTITY= "quantity"; public static final String KEY_INCART = "in_cart"; public static final String KEY_CATEGORY = "category"; public EzyCommerceDatabase(@Nullable Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public EzyCommerceDatabase(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) { super(context, name, factory, version); } @Override public void onCreate(SQLiteDatabase sqLiteDatabase) { String CREATE_CART_TABLE = "CREATE TABLE " + TABLE_CART+ "(" + KEY_ID + " INTEGER, " + KEY_NAME + " TEXT," + KEY_PRICE + " INTEGER," + KEY_AUTHOR + " TEXT," + KEY_TYPE + " TEXT, " + KEY_IMAGE + " TEXT," + KEY_QUANTITY + " INTEGER," + KEY_INCART + " TEXT, " + KEY_CATEGORY + " TEXT " + ")"; sqLiteDatabase.execSQL(CREATE_CART_TABLE); } @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { } }
UTF-8
Java
1,883
java
EzyCommerceDatabase.java
Java
[]
null
[]
package com.example.ezycommerce; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import androidx.annotation.Nullable; public class EzyCommerceDatabase extends SQLiteOpenHelper { private EzyCommerceDatabase ezDb; private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "EzyCommerce"; //nama db //nama tabel public static final String TABLE_CART = "Carts"; //nama kolom tabel user public static final String KEY_ID = "id"; public static final String KEY_NAME = "name"; public static final String KEY_PRICE = "price"; public static final String KEY_AUTHOR = "author"; public static final String KEY_TYPE = "type"; public static final String KEY_IMAGE = "img"; public static final String KEY_QUANTITY= "quantity"; public static final String KEY_INCART = "in_cart"; public static final String KEY_CATEGORY = "category"; public EzyCommerceDatabase(@Nullable Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public EzyCommerceDatabase(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) { super(context, name, factory, version); } @Override public void onCreate(SQLiteDatabase sqLiteDatabase) { String CREATE_CART_TABLE = "CREATE TABLE " + TABLE_CART+ "(" + KEY_ID + " INTEGER, " + KEY_NAME + " TEXT," + KEY_PRICE + " INTEGER," + KEY_AUTHOR + " TEXT," + KEY_TYPE + " TEXT, " + KEY_IMAGE + " TEXT," + KEY_QUANTITY + " INTEGER," + KEY_INCART + " TEXT, " + KEY_CATEGORY + " TEXT " + ")"; sqLiteDatabase.execSQL(CREATE_CART_TABLE); } @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { } }
1,883
0.684015
0.682953
49
37.42857
35.713142
172
false
false
0
0
0
0
0
0
0.836735
false
false
4
68543103e11b1286c313300de7b5e0a630f7e2b6
15,264,313,817,725
9211886c9631c072d3aa6e8dfe642af0a3e78919
/src/main/java/com/write/annotation/transaction/aop/BrianAopTransaction.java
1c052569585c0687179160479d1ec22c0d18d667
[]
no_license
showkawa/spring-annotation
https://github.com/showkawa/spring-annotation
ee3e286e9a1c2c7706e527caf56d9f1e499db60f
1a04b7d5a32bcfb2e074dba5ea3362643a3d6d30
refs/heads/master
2022-08-09T16:47:20.174000
2022-07-06T09:57:44
2022-07-06T09:57:44
150,225,788
30
5
null
false
2022-06-28T06:15:10
2018-09-25T07:38:05
2022-06-28T06:14:52
2022-06-28T06:15:09
96
27
4
0
Java
false
false
package com.write.annotation.transaction.aop; import com.write.annotation.transaction.BrianTransaction; import com.write.annotation.transaction.TransactionUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.TransactionStatus; import java.lang.reflect.Method; /** * 自定义事务注解 */ @Aspect @Component public class BrianAopTransaction { @Autowired private TransactionUtils transactionUtils; @AfterThrowing("execution(* com.write.annotation.transaction.service.*.*(..))") public void afterThrowing(){ transactionUtils.rollback(); } @Around("execution(* com.write.annotation.transaction.service.*.*(..))") public void around(ProceedingJoinPoint pjp) throws Throwable { // 1.获取代理对象 Method method = getMethod(pjp); // 2.获取该方法上是否有加上指定的注解 TransactionStatus ts = null; BrianTransaction anno = method.getDeclaredAnnotation(BrianTransaction.class); if(anno != null){ // 3.如果存在事务注解则开启事务注解 ts = transactionUtils.begin(); } // 4. 调用目标代理对象方法 pjp.proceed(); // 5.获取该方法上是否有加上指定的注解 if(ts != null){ // 6.如果存在事务注解则提交事务 transactionUtils.commit(ts); } } private Method getMethod(ProceedingJoinPoint pjp) throws NoSuchMethodException { //1.1 获取方法名称 String name = pjp.getSignature().getName(); //1.2 获取目标对象 Class<?> cla = pjp.getTarget().getClass(); //1.3 获取目标对象类型 Class[] parameterTypes = ((MethodSignature) pjp.getSignature()).getParameterTypes(); //1.4 获取目标对象的方法 Method method = cla.getMethod(name, parameterTypes); return method; } }
UTF-8
Java
2,216
java
BrianAopTransaction.java
Java
[]
null
[]
package com.write.annotation.transaction.aop; import com.write.annotation.transaction.BrianTransaction; import com.write.annotation.transaction.TransactionUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.TransactionStatus; import java.lang.reflect.Method; /** * 自定义事务注解 */ @Aspect @Component public class BrianAopTransaction { @Autowired private TransactionUtils transactionUtils; @AfterThrowing("execution(* com.write.annotation.transaction.service.*.*(..))") public void afterThrowing(){ transactionUtils.rollback(); } @Around("execution(* com.write.annotation.transaction.service.*.*(..))") public void around(ProceedingJoinPoint pjp) throws Throwable { // 1.获取代理对象 Method method = getMethod(pjp); // 2.获取该方法上是否有加上指定的注解 TransactionStatus ts = null; BrianTransaction anno = method.getDeclaredAnnotation(BrianTransaction.class); if(anno != null){ // 3.如果存在事务注解则开启事务注解 ts = transactionUtils.begin(); } // 4. 调用目标代理对象方法 pjp.proceed(); // 5.获取该方法上是否有加上指定的注解 if(ts != null){ // 6.如果存在事务注解则提交事务 transactionUtils.commit(ts); } } private Method getMethod(ProceedingJoinPoint pjp) throws NoSuchMethodException { //1.1 获取方法名称 String name = pjp.getSignature().getName(); //1.2 获取目标对象 Class<?> cla = pjp.getTarget().getClass(); //1.3 获取目标对象类型 Class[] parameterTypes = ((MethodSignature) pjp.getSignature()).getParameterTypes(); //1.4 获取目标对象的方法 Method method = cla.getMethod(name, parameterTypes); return method; } }
2,216
0.694277
0.687249
64
30.125
24.491388
91
false
false
0
0
0
0
0
0
0.40625
false
false
4
cd25c0fe181aae97e2034bfd2f54093ef8362d4f
9,234,179,718,859
f23ac0ff4666e0ac85a42c68d31e830b5700a95d
/pl/coderslab/collections/Main3.java
4bd2e2ad6fcc584a17fb6c7c8b1ffe4dd5fce746
[]
no_license
AdamKlimek76/Homework1
https://github.com/AdamKlimek76/Homework1
6ed2a6295a56532f2448f56b64eb3dc749684c56
f7c7f59fbf5019e3bfe0c6f93938795024975459
refs/heads/master
2020-12-20T11:12:23.202000
2020-01-24T18:45:29
2020-01-24T18:45:29
236,054,585
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.coderslab.collections; import java.util.regex.Pattern; public class Main3 { public static void main(String[] args) { String email="_bcBB123de1-"; System.out.println(verifyLogin(email)); } static boolean verifyLogin(String email) { return verifyNumberLoginCases(email) && verifyLoginCases(email) && verifyLoginFirstCase(email); } static boolean verifyNumberLoginCases(String email) { return Pattern.matches(".{5,}", email); } static boolean verifyLoginCases(String email) { return Pattern.matches("(\\w*\\-*)+", email); } static boolean verifyLoginFirstCase(String email) { return Pattern.matches("\\D.+", email); } }
UTF-8
Java
724
java
Main3.java
Java
[]
null
[]
package pl.coderslab.collections; import java.util.regex.Pattern; public class Main3 { public static void main(String[] args) { String email="_bcBB123de1-"; System.out.println(verifyLogin(email)); } static boolean verifyLogin(String email) { return verifyNumberLoginCases(email) && verifyLoginCases(email) && verifyLoginFirstCase(email); } static boolean verifyNumberLoginCases(String email) { return Pattern.matches(".{5,}", email); } static boolean verifyLoginCases(String email) { return Pattern.matches("(\\w*\\-*)+", email); } static boolean verifyLoginFirstCase(String email) { return Pattern.matches("\\D.+", email); } }
724
0.657459
0.649171
28
24.857143
26.419304
103
false
false
0
0
0
0
0
0
0.428571
false
false
4
a8fe416a89b46746b871016f9f3650f95663f7c7
9,234,179,718,226
f64b57bbdc02d5ebb7bc3fff957403a365a0aa41
/app/src/main/java/com/caregrowtht/app/adapter/CourserReleaseAdapter.java
1bd7eba2330531d34ea7056e51c927729d18fc62
[]
no_license
1373939387/CareGrowthT
https://github.com/1373939387/CareGrowthT
7f325ad599026af10434aa7a4344e16f6ddf0228
ec849584755119c522e886742ee507a7fc7e6dfa
refs/heads/master
2020-04-26T02:28:31.646000
2020-01-03T08:58:00
2020-01-03T08:58:00
139,004,138
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.caregrowtht.app.adapter; import android.content.Context; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.caregrowtht.app.R; import com.caregrowtht.app.user.UploadModule; import com.caregrowtht.app.view.xrecyclerview.xrecycleradapter.XrecyclerAdapter; import com.caregrowtht.app.view.xrecyclerview.xrecycleradapter.XrecyclerViewHolder; import java.io.File; import java.util.ArrayList; import java.util.List; import butterknife.BindView; /** * haoruigang on 2018-7-11 10:41:47 * 发布课程 附件预览 适配器 */ public class CourserReleaseAdapter extends XrecyclerAdapter { @BindView(R.id.iv_atter) ImageView ivAtter; @BindView(R.id.iv_del) ImageView ivDel; @BindView(R.id.tv_atter_name) TextView tvAtterName; private Context mContext; public List<UploadModule> uploadModules = new ArrayList<>(); public List<String> pngOravis = new ArrayList<>(); public static int img = 0; public CourserReleaseAdapter(List datas, Context context) { super(datas, context); this.mContext = context; this.uploadModules.addAll(datas); } @Override public void convert(XrecyclerViewHolder holder, int position, Context context) { UploadModule uploadModule = uploadModules.get(position); String path = uploadModule.getPicPath(); String picType = uploadModule.getPictureType(); if (picType.contains("image") || picType.contains("jpg") || picType.contains("jpeg")) {//图片 Glide.with(mContext).load(path).into(ivAtter); } else if (picType.contains("video") || picType.contains("mp4")) {//视频 Glide.with(mContext).load(path).into(ivAtter); } else if (picType.contains("pdf")) {//PDF Glide.with(mContext).load(R.mipmap.icon_pdf).into(ivAtter); } else if (picType.contains("doc")) {//WORD Glide.with(mContext).load(R.mipmap.icon_word).into(ivAtter); } else if (picType.contains("ppt")) {//PPT Glide.with(mContext).load(R.mipmap.icon_ppt).into(ivAtter); } else if (picType.contains("xlsx")) {//EXCEL Glide.with(mContext).load(R.mipmap.icon_excel).into(ivAtter); } else { Glide.with(mContext).load(R.mipmap.icon_file).into(ivAtter); } tvAtterName.setText(new File(path).getName()); ivDel.setOnClickListener(v -> { if (img > 0) img--; pngOravis.remove(position); uploadModules.remove(position); notifyItemRemoved(position); notifyItemRangeChanged(position, uploadModules.size()); }); } // public void setData(List<UploadModule> uploadModules) { // this.uploadModules.clear(); // this.uploadModules.addAll(uploadModules); // notifyDataSetChanged(); // } @Override public int getItemCount() { return uploadModules.size(); } @Override public int getLayoutResId() { return R.layout.item_atter_preview; } }
UTF-8
Java
3,079
java
CourserReleaseAdapter.java
Java
[ { "context": "a.util.List;\n\nimport butterknife.BindView;\n\n/**\n * haoruigang on 2018-7-11 10:41:47\n * 发布课程 附件预览 适配器\n */\npub", "end": 528, "score": 0.5825395584106445, "start": 521, "tag": "USERNAME", "value": "haoruig" } ]
null
[]
package com.caregrowtht.app.adapter; import android.content.Context; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.caregrowtht.app.R; import com.caregrowtht.app.user.UploadModule; import com.caregrowtht.app.view.xrecyclerview.xrecycleradapter.XrecyclerAdapter; import com.caregrowtht.app.view.xrecyclerview.xrecycleradapter.XrecyclerViewHolder; import java.io.File; import java.util.ArrayList; import java.util.List; import butterknife.BindView; /** * haoruigang on 2018-7-11 10:41:47 * 发布课程 附件预览 适配器 */ public class CourserReleaseAdapter extends XrecyclerAdapter { @BindView(R.id.iv_atter) ImageView ivAtter; @BindView(R.id.iv_del) ImageView ivDel; @BindView(R.id.tv_atter_name) TextView tvAtterName; private Context mContext; public List<UploadModule> uploadModules = new ArrayList<>(); public List<String> pngOravis = new ArrayList<>(); public static int img = 0; public CourserReleaseAdapter(List datas, Context context) { super(datas, context); this.mContext = context; this.uploadModules.addAll(datas); } @Override public void convert(XrecyclerViewHolder holder, int position, Context context) { UploadModule uploadModule = uploadModules.get(position); String path = uploadModule.getPicPath(); String picType = uploadModule.getPictureType(); if (picType.contains("image") || picType.contains("jpg") || picType.contains("jpeg")) {//图片 Glide.with(mContext).load(path).into(ivAtter); } else if (picType.contains("video") || picType.contains("mp4")) {//视频 Glide.with(mContext).load(path).into(ivAtter); } else if (picType.contains("pdf")) {//PDF Glide.with(mContext).load(R.mipmap.icon_pdf).into(ivAtter); } else if (picType.contains("doc")) {//WORD Glide.with(mContext).load(R.mipmap.icon_word).into(ivAtter); } else if (picType.contains("ppt")) {//PPT Glide.with(mContext).load(R.mipmap.icon_ppt).into(ivAtter); } else if (picType.contains("xlsx")) {//EXCEL Glide.with(mContext).load(R.mipmap.icon_excel).into(ivAtter); } else { Glide.with(mContext).load(R.mipmap.icon_file).into(ivAtter); } tvAtterName.setText(new File(path).getName()); ivDel.setOnClickListener(v -> { if (img > 0) img--; pngOravis.remove(position); uploadModules.remove(position); notifyItemRemoved(position); notifyItemRangeChanged(position, uploadModules.size()); }); } // public void setData(List<UploadModule> uploadModules) { // this.uploadModules.clear(); // this.uploadModules.addAll(uploadModules); // notifyDataSetChanged(); // } @Override public int getItemCount() { return uploadModules.size(); } @Override public int getLayoutResId() { return R.layout.item_atter_preview; } }
3,079
0.661528
0.656281
90
32.877777
25.247147
99
false
false
0
0
0
0
0
0
0.622222
false
false
4
f4820db623ebf03185b0ed1673e13a7f55fd85f8
9,586,367,041,704
b7524f982c132165b9bad3bd3439f2bcb1f3065c
/src/main/java/com/bunflp/serviceImpl/UserLoginImpl.java
16180a1a857de20735bc573fb8d8eea43c50a245
[]
no_license
yuanzc-2020/springweb
https://github.com/yuanzc-2020/springweb
9808d2bbd73110ee1c974d6f1a3bf54f96a3c859
ec0d8ed11ca9bde5f7d8324e6f5386c997c76e63
refs/heads/master
2022-11-05T07:06:40.686000
2020-06-21T01:36:32
2020-06-21T01:36:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bunflp.serviceImpl; import com.bunflp.bean.User; import com.bunflp.dao.UserLogin; import com.bunflp.service.UserLoginService; import javax.annotation.Resource; import java.util.List; public class UserLoginImpl implements UserLoginService { @Resource private UserLogin userLogin; @Override public List<User> getUser(User user) { return userLogin.getUser(user); } }
UTF-8
Java
409
java
UserLoginImpl.java
Java
[]
null
[]
package com.bunflp.serviceImpl; import com.bunflp.bean.User; import com.bunflp.dao.UserLogin; import com.bunflp.service.UserLoginService; import javax.annotation.Resource; import java.util.List; public class UserLoginImpl implements UserLoginService { @Resource private UserLogin userLogin; @Override public List<User> getUser(User user) { return userLogin.getUser(user); } }
409
0.753056
0.753056
19
20.526316
17.762671
56
false
false
0
0
0
0
0
0
0.421053
false
false
4
49c43821a3c04c01975cba287c5b02a9426b0128
28,329,604,348,218
c7731b10d1024eaa297ca453a6296e4656ec28f7
/app/src/main/java/com/riviere/MusicStreaming/Network/QueueServerRequest.java
325fe11241900a9908d15b125734d5d8eb7c979d
[]
no_license
Zolac-san/StreamingMusic
https://github.com/Zolac-san/StreamingMusic
1390c766b9d788459df636e4958538e78485c675
4ac8f0d60ef3bc2d937232c0852ecf95b61e5c9b
refs/heads/master
2020-04-22T19:07:48.805000
2019-04-23T19:56:51
2019-04-23T19:56:51
170,598,669
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.riviere.MusicStreaming.Network; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; import com.riviere.MusicStreaming.MyApp; /** * Classe permettant de stocker les requete pour la librairie Volley */ public class QueueServerRequest { private static QueueServerRequest instance = null; private RequestQueue queue; /** * Constructeur */ private QueueServerRequest(){ queue = Volley.newRequestQueue(MyApp.getAppContext()); } /** * Recupere l'instance de la classe * @return instance */ public static QueueServerRequest getInstance(){ if (instance == null) instance = new QueueServerRequest(); return instance; } /** * Rajoute une requete * @param request * @param <T> */ public <T> void addRequest(Request<T> request){ queue.add(request); } }
UTF-8
Java
959
java
QueueServerRequest.java
Java
[]
null
[]
package com.riviere.MusicStreaming.Network; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; import com.riviere.MusicStreaming.MyApp; /** * Classe permettant de stocker les requete pour la librairie Volley */ public class QueueServerRequest { private static QueueServerRequest instance = null; private RequestQueue queue; /** * Constructeur */ private QueueServerRequest(){ queue = Volley.newRequestQueue(MyApp.getAppContext()); } /** * Recupere l'instance de la classe * @return instance */ public static QueueServerRequest getInstance(){ if (instance == null) instance = new QueueServerRequest(); return instance; } /** * Rajoute une requete * @param request * @param <T> */ public <T> void addRequest(Request<T> request){ queue.add(request); } }
959
0.655892
0.655892
42
21.833334
19.618889
68
false
false
0
0
0
0
0
0
0.261905
false
false
4
890ed80464fbb138b8da2740158d8c937d41161f
13,211,319,438,496
6320d6511c35d7fe6c39f42b68d7c3bf50044938
/src/MainTests.java
b8aec933b71a665854701cab506db9028d0c5d58
[]
no_license
a-water/JavaTest2
https://github.com/a-water/JavaTest2
414e405c537e46c832ed6211c1960f32a6ea6d95
61adb511470c757c3f53109aa071497bc6b80d91
refs/heads/master
2021-05-27T11:18:43.159000
2014-08-14T05:29:47
2014-08-14T05:29:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import org.junit.*; import static org.junit.Assert.*; public class MainTests { @Test public void testGarageCreation(){ Garage testGarage = new Garage(5); assertTrue(testGarage.getGarageSize() == 5); } @Test public void testOldestCarInGarage(){ Garage testGarage = new Garage(5); for(int i=0; i<5; i++){ Car car = new Car(2000 + (int)(Math.random() * ((2000 - 2000) + 1)), "test"); testGarage.addCarToGarage(car, i); } assertTrue(2000 == testGarage.getOldestCar().getYear()); } }
UTF-8
Java
508
java
MainTests.java
Java
[]
null
[]
import org.junit.*; import static org.junit.Assert.*; public class MainTests { @Test public void testGarageCreation(){ Garage testGarage = new Garage(5); assertTrue(testGarage.getGarageSize() == 5); } @Test public void testOldestCarInGarage(){ Garage testGarage = new Garage(5); for(int i=0; i<5; i++){ Car car = new Car(2000 + (int)(Math.random() * ((2000 - 2000) + 1)), "test"); testGarage.addCarToGarage(car, i); } assertTrue(2000 == testGarage.getOldestCar().getYear()); } }
508
0.663386
0.620079
22
22.09091
21.712814
80
false
false
0
0
0
0
0
0
1.681818
false
false
4
0812e6b8d206da080e37c5e7d6b5cd2b7900c88f
21,114,059,275,163
fa6eea49e5e693ef464bd4e688da137732ec5d9f
/src/main/java/com/qnvip/luck/controller/HomeController.java
94418b6efc69ceaf53ab8e7419189ba4d8d9cf82
[]
no_license
linzy410/luck-page
https://github.com/linzy410/luck-page
7b1cec43e6361ed0683c073c334aaac794cad71e
2b62dc6280b6470ffe34b19e9218e829ab70d1a2
refs/heads/master
2022-06-25T18:34:48.308000
2019-11-12T03:29:33
2019-11-12T03:29:33
236,918,180
0
0
null
false
2022-06-17T02:54:51
2020-01-29T06:25:24
2020-01-29T06:27:24
2022-06-17T02:54:49
2,205
0
0
1
Java
false
false
package com.qnvip.luck.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; /** * @Author EricLin * @Date 2019/10/28 21:20 */ @Controller public class HomeController { @GetMapping(value = {"/", "/index.html"}) public String index() { return "manage/index"; } @GetMapping("/dashborad") public String dashborad() { return "manage/dashborad"; } }
UTF-8
Java
462
java
HomeController.java
Java
[ { "context": "rk.web.bind.annotation.GetMapping;\n\n/**\n * @Author EricLin\n * @Date 2019/10/28 21:20\n */\n@Controller\npublic ", "end": 168, "score": 0.996919572353363, "start": 161, "tag": "USERNAME", "value": "EricLin" } ]
null
[]
package com.qnvip.luck.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; /** * @Author EricLin * @Date 2019/10/28 21:20 */ @Controller public class HomeController { @GetMapping(value = {"/", "/index.html"}) public String index() { return "manage/index"; } @GetMapping("/dashborad") public String dashborad() { return "manage/dashborad"; } }
462
0.664502
0.638528
25
17.48
17.747383
58
false
false
0
0
0
0
0
0
0.24
false
false
4
3ee6afe1d60d2587462024418d73b24fadae230e
23,433,341,572,851
6fc799c1d3bb5ba5b01588072ca30a9557405d46
/src/main/java/br/ufc/npi/joyn/repository/UsuarioRepository.java
767bad1370d7864d6ed362a0de12cc2198002f04
[]
no_license
npi-ufc-qxd/joyn2
https://github.com/npi-ufc-qxd/joyn2
350a7ec75bd545ca76163185838e88b4a96e6882
abf04ca0b1d7de850de69d51e133f7eff59d617b
refs/heads/master
2020-12-30T17:50:58.995000
2017-11-20T18:07:55
2017-11-20T18:07:55
88,076,123
1
0
null
false
2017-11-20T18:07:56
2017-04-12T16:59:05
2017-09-13T12:43:38
2017-11-20T18:07:56
25,549
1
0
31
CSS
false
null
package br.ufc.npi.joyn.repository; import javax.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import br.ufc.npi.joyn.model.Usuario; @Repository @Transactional public interface UsuarioRepository extends JpaRepository<Usuario, Long> { public Usuario findByEmail(String email); }
UTF-8
Java
377
java
UsuarioRepository.java
Java
[]
null
[]
package br.ufc.npi.joyn.repository; import javax.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import br.ufc.npi.joyn.model.Usuario; @Repository @Transactional public interface UsuarioRepository extends JpaRepository<Usuario, Long> { public Usuario findByEmail(String email); }
377
0.830239
0.830239
15
24.133333
24.374485
73
false
false
0
0
0
0
0
0
0.533333
false
false
4
32c54fee28ca80631c01ab1cac60e1b709f6738d
15,410,342,692,011
53efe8db7ae25542968fff7fac1c14a1d8c19648
/Deitel/com/deitel/capitulo03/exercicio15/AccountTest.java
a23719c25c9b4ba1e310e1f9641d4efe89d234bc
[]
no_license
m2leal/deitel
https://github.com/m2leal/deitel
b2be996e367ce6fad086034e2de718288c891eff
d4a62dca2b5e5932cdbdac408c2f10830e376773
refs/heads/master
2023-06-06T20:16:40.905000
2021-06-28T18:00:09
2021-06-28T18:00:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.deitel.capitulo03.exercicio15; //Figura 3.9: AccountTest.Java // Entrada e saída de números de ponto flutuante com objetos Account. import java.util.Scanner; public class AccountTest { public static void main(String[] args) { Account account1 = new Account("Jane Green", 50.00); Account account2 = new Account("John Blue", -7.53); // exibe saldo inicial de cada objeto displayAccount(account1); displayAccount(account2); // cria um Scanner para obter entrada a partir da janela de comando Scanner input = new Scanner(System.in); System.out.print("Enter deposit amount for account1: "); // prompt double depositAmount = input.nextDouble(); // obtém a entrada do usuário System.out.printf("%nadding %.2f to account1 balance%n%n", depositAmount); account1.deposit(depositAmount); // adiciona o saldo de account1ÿ // exibe os saldos displayAccount(account1); displayAccount(account2); System.out.print("Enter deposit amount for account2: "); // prompt depositAmount = input.nextDouble(); // obtém a entrada do usuário System.out.printf("%nadding %.2f to account2 balance%n%n", depositAmount); account2.deposit(depositAmount); // adiciona ao saldo de account2 // exibe os saldos displayAccount(account1); displayAccount(account2); input.close(); } // fim de main public static void displayAccount(Account accountToDisplay) { System.out.printf("%s balance: $%.2f %n", accountToDisplay.getName(),accountToDisplay.getBalance()); } } // fim da classe AccountTest
UTF-8
Java
1,552
java
AccountTest.java
Java
[ { "context": "ring[] args)\n\t{\n\t\tAccount account1 = new Account(\"Jane Green\", 50.00);\n\t\tAccount account2 = new Account(\"John ", "end": 286, "score": 0.999866783618927, "start": 276, "tag": "NAME", "value": "Jane Green" }, { "context": "Green\", 50.00);\n\t\tAccount account2 = new Account(\"John Blue\", -7.53);\n\n\t\t// exibe saldo inicial de cada objet", "end": 340, "score": 0.9998350739479065, "start": 331, "tag": "NAME", "value": "John Blue" } ]
null
[]
package com.deitel.capitulo03.exercicio15; //Figura 3.9: AccountTest.Java // Entrada e saída de números de ponto flutuante com objetos Account. import java.util.Scanner; public class AccountTest { public static void main(String[] args) { Account account1 = new Account("<NAME>", 50.00); Account account2 = new Account("<NAME>", -7.53); // exibe saldo inicial de cada objeto displayAccount(account1); displayAccount(account2); // cria um Scanner para obter entrada a partir da janela de comando Scanner input = new Scanner(System.in); System.out.print("Enter deposit amount for account1: "); // prompt double depositAmount = input.nextDouble(); // obtém a entrada do usuário System.out.printf("%nadding %.2f to account1 balance%n%n", depositAmount); account1.deposit(depositAmount); // adiciona o saldo de account1ÿ // exibe os saldos displayAccount(account1); displayAccount(account2); System.out.print("Enter deposit amount for account2: "); // prompt depositAmount = input.nextDouble(); // obtém a entrada do usuário System.out.printf("%nadding %.2f to account2 balance%n%n", depositAmount); account2.deposit(depositAmount); // adiciona ao saldo de account2 // exibe os saldos displayAccount(account1); displayAccount(account2); input.close(); } // fim de main public static void displayAccount(Account accountToDisplay) { System.out.printf("%s balance: $%.2f %n", accountToDisplay.getName(),accountToDisplay.getBalance()); } } // fim da classe AccountTest
1,545
0.726861
0.706149
49
30.55102
24.804592
74
false
false
0
0
0
0
0
0
1.979592
false
false
4
cf9c3710d07a00eeddde86e94c5273bafe5e3c74
15,410,342,694,926
7bcd55e0150922f98e28cb5f72524c27b0c61fee
/opcode/MOV.java
2779a361cd9d857e85b8f9524099d25ac634462b
[]
no_license
Imtiaz-Masodi/MicroprocessorEmulator
https://github.com/Imtiaz-Masodi/MicroprocessorEmulator
6607bcbecd47f58312cb49792b93c094ca8c9e98
eab6c9efe62a118a101de53c488e13bd4d641099
refs/heads/master
2021-01-01T17:33:54.950000
2017-07-23T12:42:33
2017-07-23T12:42:33
98,097,133
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.microprocessoremulator.opcode; import com.microprocessoremulator.EmulatorFragment; import com.microprocessoremulator.MyHex; public class MOV { public static int requiredOperands = 2; public static void execute(String registerDestination, String registerSource) throws Exception { boolean isSourceRegister, isDestinationRegister; int source = 0, destination = 0; if (registerDestination.length() == 1) { isDestinationRegister = true; switch (registerDestination) { case "A": destination = 0; break; case "B": destination = 1; break; case "C": destination = 2; break; case "D": destination = 3; break; case "E": destination = 4; break; case "H": destination = 5; break; case "L": destination = 6; break; default: throw new Exception("There is no such register '" + registerDestination + "'"); } } else if (registerDestination.length() == 4) { isDestinationRegister = false; if (MyHex.invalidate(registerDestination)) { destination = Integer.parseInt(registerDestination, 16); } else { throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } } else { throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } if (registerSource.length() == 1) { isSourceRegister = true; switch (registerSource) { case "A": source = 0; break; case "B": source = 1; break; case "C": source = 2; break; case "D": source = 3; break; case "E": source = 4; break; case "H": source = 5; break; case "L": source = 6; break; case "M": isSourceRegister = false; source = Integer.parseInt((EmulatorFragment.reg[5]+EmulatorFragment.reg[6]), 16); break; default: throw new Exception("There is no such register '" + registerSource + "'"); } } else if (registerSource.length() == 4) { isSourceRegister = false; if (MyHex.invalidate(registerSource)) { source = Integer.parseInt(registerSource, 16); } else throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } else { throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } /*if (EmulatorFragment.reg[source] == null) { EmulatorFragment.reg[source] = "00"; } if (EmulatorFragment.memoryAddress[source] == null) { EmulatorFragment.memoryAddress[source] = "00"; }*/ if (isDestinationRegister && isSourceRegister) { EmulatorFragment.reg[destination] = EmulatorFragment.reg[source]; } else if (isDestinationRegister && !(isSourceRegister)) { EmulatorFragment.reg[destination] = EmulatorFragment.memoryAddress[source]; } else if (!(isDestinationRegister) && isSourceRegister) { EmulatorFragment.memoryAddress[destination] = EmulatorFragment.reg[source]; } else { EmulatorFragment.memoryAddress[destination] = EmulatorFragment.memoryAddress[source]; } } }
UTF-8
Java
4,149
java
MOV.java
Java
[]
null
[]
package com.microprocessoremulator.opcode; import com.microprocessoremulator.EmulatorFragment; import com.microprocessoremulator.MyHex; public class MOV { public static int requiredOperands = 2; public static void execute(String registerDestination, String registerSource) throws Exception { boolean isSourceRegister, isDestinationRegister; int source = 0, destination = 0; if (registerDestination.length() == 1) { isDestinationRegister = true; switch (registerDestination) { case "A": destination = 0; break; case "B": destination = 1; break; case "C": destination = 2; break; case "D": destination = 3; break; case "E": destination = 4; break; case "H": destination = 5; break; case "L": destination = 6; break; default: throw new Exception("There is no such register '" + registerDestination + "'"); } } else if (registerDestination.length() == 4) { isDestinationRegister = false; if (MyHex.invalidate(registerDestination)) { destination = Integer.parseInt(registerDestination, 16); } else { throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } } else { throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } if (registerSource.length() == 1) { isSourceRegister = true; switch (registerSource) { case "A": source = 0; break; case "B": source = 1; break; case "C": source = 2; break; case "D": source = 3; break; case "E": source = 4; break; case "H": source = 5; break; case "L": source = 6; break; case "M": isSourceRegister = false; source = Integer.parseInt((EmulatorFragment.reg[5]+EmulatorFragment.reg[6]), 16); break; default: throw new Exception("There is no such register '" + registerSource + "'"); } } else if (registerSource.length() == 4) { isSourceRegister = false; if (MyHex.invalidate(registerSource)) { source = Integer.parseInt(registerSource, 16); } else throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } else { throw new Exception("Invalid memory location. Memory Location should be from 0000 to 0FFF"); } /*if (EmulatorFragment.reg[source] == null) { EmulatorFragment.reg[source] = "00"; } if (EmulatorFragment.memoryAddress[source] == null) { EmulatorFragment.memoryAddress[source] = "00"; }*/ if (isDestinationRegister && isSourceRegister) { EmulatorFragment.reg[destination] = EmulatorFragment.reg[source]; } else if (isDestinationRegister && !(isSourceRegister)) { EmulatorFragment.reg[destination] = EmulatorFragment.memoryAddress[source]; } else if (!(isDestinationRegister) && isSourceRegister) { EmulatorFragment.memoryAddress[destination] = EmulatorFragment.reg[source]; } else { EmulatorFragment.memoryAddress[destination] = EmulatorFragment.memoryAddress[source]; } } }
4,149
0.491926
0.479152
108
37.416668
26.289036
108
false
false
0
0
0
0
0
0
0.564815
false
false
4
bfdfc5699bf191ea70da858ba0a0e1e2b5c51c60
15,410,342,694,645
ecbf056943e6707f920f5c4e8a1ff0a54c1810d5
/taxation-calculator/src/main/java/com/tjaz/calculator/impl/TaxationCalculatorImpl.java
94f0e2051597695d9c3fdc1a83c6729fd71df69d
[]
no_license
tspegel/taxation
https://github.com/tspegel/taxation
2007d421dc7efe8350cacb4b7c9a94c31eb12825
854f1ca01054f84ba3a0e1114e5106402c480036
refs/heads/development
2022-12-27T10:19:08.399000
2020-10-14T07:39:45
2020-10-14T07:39:45
302,963,901
0
0
null
false
2020-10-11T20:15:53
2020-10-10T18:19:10
2020-10-11T20:15:07
2020-10-11T20:15:52
12
0
0
5
Java
false
false
package com.tjaz.calculator.impl; import com.tjaz.calculator.entities.Trader; import com.tjaz.calculator.impl.exception.TaxationCalculatorException; import com.tjaz.calculator.impl.output.TaxationOutput; import com.tjaz.calculator.impl.validators.TraderValidation; import com.tjaz.calculator.repositiories.TraderRepository; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @Slf4j @Service @NoArgsConstructor public class TaxationCalculatorImpl { public static final String TYPE_GENERAL = "general"; public static final String TYPE_WINNINGS = "winnings"; public static final String METHOD_RATE = "rate"; public static final String METHOD_AMOUNT = "amount"; private TraderRepository traderRepository; private TraderValidation validator; @Autowired public TaxationCalculatorImpl(final TraderRepository traderRepository, final TraderValidation validator) { this.traderRepository = traderRepository; this.validator = validator; } /** * Calculate Tax. OOutput is based on type (general/winnings) */ public TaxationOutput taxationCalculator(final String traderId, final Double playedAmount, final Double odd) throws TaxationCalculatorException { if (StringUtils.isEmpty(traderId) || playedAmount == null || odd == null) { log.error("Trader id or playedAmount or odd param is missing."); throw new TaxationCalculatorException("One or more params are missing."); } final Double possibleReturnAmount = playedAmount * odd; final Trader trader = traderRepository.fetchTrader(traderId); validator.validateTrader(trader, traderId); final String type = trader.getType(); if (TYPE_GENERAL.equalsIgnoreCase(type)) { return processGeneralTaxation(trader, possibleReturnAmount); } else if (TYPE_WINNINGS.equalsIgnoreCase(type)) { return processWinningTaxation(trader, possibleReturnAmount); } else { log.error(String.format("Trader with traderId %s is missing type", traderId)); throw new TaxationCalculatorException("Type is missing."); } } /** * Process General taxation. Output is based on method (rate/amount) */ private TaxationOutput processGeneralTaxation(final Trader trader, final Double possibleReturnAmount) throws TaxationCalculatorException { final String method = trader.getMethod(); if (METHOD_RATE.equalsIgnoreCase(method)) { return rate(trader, possibleReturnAmount); } else if (METHOD_AMOUNT.equalsIgnoreCase(method)) { return amount(trader, possibleReturnAmount); } else { log.error(String.format("Method is missing from vendor with traderId %s", trader.getTraderId())); throw new TaxationCalculatorException("Method is missing."); } } /** * Process Winning taxation. Output is based on method (rate/amount) */ private TaxationOutput processWinningTaxation(final Trader trader, final Double possibleReturnAmount) { final String method = trader.getMethod(); final Double winningAmount = trader.getWinningAmount(); final Double winningsPossibleReturnAmount = possibleReturnAmount - winningAmount; if (METHOD_RATE.equalsIgnoreCase(method)) { return rate(trader, possibleReturnAmount, winningsPossibleReturnAmount); } else if (METHOD_AMOUNT.equalsIgnoreCase(method)) { return amount(trader, winningsPossibleReturnAmount); } else { log.error(String.format("Method is missing from vendor with traderId %s", trader.getTraderId())); return null; } } public TaxationOutput rate(final Trader trader, final Double possibleReturnAmount) { return rate(trader, possibleReturnAmount, null); } /** * Calculate taxation based on percentage specific to Trader * It's calculated different if "winningsPossibleReturnAmount" is present */ public TaxationOutput rate(final Trader trader, final Double possibleReturnAmount, final Double winningsPossibleReturnAmount) { final double taxRate = trader.getRate(); final Double taxAmount; if (winningsPossibleReturnAmount == null) { taxAmount = possibleReturnAmount * (taxRate / 100); } else { taxAmount = winningsPossibleReturnAmount * (taxRate / 100); } final double possibleReturnAmountAfterTax = possibleReturnAmount - taxAmount; return new TaxationOutput(possibleReturnAmountAfterTax, possibleReturnAmount, possibleReturnAmountAfterTax, taxRate, taxAmount); } /** * Calculate taxation based on fixed amount */ public TaxationOutput amount(final Trader trader, final Double possibleReturnAmount) { final Double taxRate = trader.getRate(); final double possibleReturnAmountAfterTax = possibleReturnAmount - taxRate; return new TaxationOutput(possibleReturnAmountAfterTax, possibleReturnAmount, possibleReturnAmountAfterTax, taxRate, taxRate); } }
UTF-8
Java
5,683
java
TaxationCalculatorImpl.java
Java
[]
null
[]
package com.tjaz.calculator.impl; import com.tjaz.calculator.entities.Trader; import com.tjaz.calculator.impl.exception.TaxationCalculatorException; import com.tjaz.calculator.impl.output.TaxationOutput; import com.tjaz.calculator.impl.validators.TraderValidation; import com.tjaz.calculator.repositiories.TraderRepository; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @Slf4j @Service @NoArgsConstructor public class TaxationCalculatorImpl { public static final String TYPE_GENERAL = "general"; public static final String TYPE_WINNINGS = "winnings"; public static final String METHOD_RATE = "rate"; public static final String METHOD_AMOUNT = "amount"; private TraderRepository traderRepository; private TraderValidation validator; @Autowired public TaxationCalculatorImpl(final TraderRepository traderRepository, final TraderValidation validator) { this.traderRepository = traderRepository; this.validator = validator; } /** * Calculate Tax. OOutput is based on type (general/winnings) */ public TaxationOutput taxationCalculator(final String traderId, final Double playedAmount, final Double odd) throws TaxationCalculatorException { if (StringUtils.isEmpty(traderId) || playedAmount == null || odd == null) { log.error("Trader id or playedAmount or odd param is missing."); throw new TaxationCalculatorException("One or more params are missing."); } final Double possibleReturnAmount = playedAmount * odd; final Trader trader = traderRepository.fetchTrader(traderId); validator.validateTrader(trader, traderId); final String type = trader.getType(); if (TYPE_GENERAL.equalsIgnoreCase(type)) { return processGeneralTaxation(trader, possibleReturnAmount); } else if (TYPE_WINNINGS.equalsIgnoreCase(type)) { return processWinningTaxation(trader, possibleReturnAmount); } else { log.error(String.format("Trader with traderId %s is missing type", traderId)); throw new TaxationCalculatorException("Type is missing."); } } /** * Process General taxation. Output is based on method (rate/amount) */ private TaxationOutput processGeneralTaxation(final Trader trader, final Double possibleReturnAmount) throws TaxationCalculatorException { final String method = trader.getMethod(); if (METHOD_RATE.equalsIgnoreCase(method)) { return rate(trader, possibleReturnAmount); } else if (METHOD_AMOUNT.equalsIgnoreCase(method)) { return amount(trader, possibleReturnAmount); } else { log.error(String.format("Method is missing from vendor with traderId %s", trader.getTraderId())); throw new TaxationCalculatorException("Method is missing."); } } /** * Process Winning taxation. Output is based on method (rate/amount) */ private TaxationOutput processWinningTaxation(final Trader trader, final Double possibleReturnAmount) { final String method = trader.getMethod(); final Double winningAmount = trader.getWinningAmount(); final Double winningsPossibleReturnAmount = possibleReturnAmount - winningAmount; if (METHOD_RATE.equalsIgnoreCase(method)) { return rate(trader, possibleReturnAmount, winningsPossibleReturnAmount); } else if (METHOD_AMOUNT.equalsIgnoreCase(method)) { return amount(trader, winningsPossibleReturnAmount); } else { log.error(String.format("Method is missing from vendor with traderId %s", trader.getTraderId())); return null; } } public TaxationOutput rate(final Trader trader, final Double possibleReturnAmount) { return rate(trader, possibleReturnAmount, null); } /** * Calculate taxation based on percentage specific to Trader * It's calculated different if "winningsPossibleReturnAmount" is present */ public TaxationOutput rate(final Trader trader, final Double possibleReturnAmount, final Double winningsPossibleReturnAmount) { final double taxRate = trader.getRate(); final Double taxAmount; if (winningsPossibleReturnAmount == null) { taxAmount = possibleReturnAmount * (taxRate / 100); } else { taxAmount = winningsPossibleReturnAmount * (taxRate / 100); } final double possibleReturnAmountAfterTax = possibleReturnAmount - taxAmount; return new TaxationOutput(possibleReturnAmountAfterTax, possibleReturnAmount, possibleReturnAmountAfterTax, taxRate, taxAmount); } /** * Calculate taxation based on fixed amount */ public TaxationOutput amount(final Trader trader, final Double possibleReturnAmount) { final Double taxRate = trader.getRate(); final double possibleReturnAmountAfterTax = possibleReturnAmount - taxRate; return new TaxationOutput(possibleReturnAmountAfterTax, possibleReturnAmount, possibleReturnAmountAfterTax, taxRate, taxRate); } }
5,683
0.665318
0.663734
132
42.053032
30.775166
112
false
false
0
0
0
0
0
0
0.643939
false
false
4