blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
61a211d32d6c619e1977a89c8f2f73e51ff133e1
| 22,308,060,142,189 |
3b0f554dd2f25276029a868169dd4369b3f87e86
|
/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/mapper/ContactInformationMapper.java
|
287dc2f91bdd8eac5b5ec6ef861d0dce7f1b3017
|
[] |
no_license
|
UW-Madison-DoIT/my-profile
|
https://github.com/UW-Madison-DoIT/my-profile
|
99c35a35ac256f50068c90cae781993833c0ab29
|
0627885ec245fba997480b8af0ed1117ed7d26c2
|
refs/heads/master
| 2023-02-16T19:15:59.978000 | 2023-02-03T16:36:13 | 2023-02-03T16:36:20 | 29,696,774 | 2 | 6 | null | false | 2022-12-16T01:23:58 | 2015-01-22T19:46:17 | 2020-05-05T18:41:35 | 2022-12-16T01:23:55 | 615 | 1 | 4 | 11 |
JavaScript
| false | false |
package edu.wisc.my.profile.mapper;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.wisc.my.profile.model.ContactAddress;
import edu.wisc.my.profile.model.ContactInformation;
import edu.wisc.my.profile.model.TypeValue;
public final class ContactInformationMapper {
protected static final Logger logger = LoggerFactory.getLogger(ContactInformationMapper.class);
public static String getCleanString(String dirty) {
return StringEscapeUtils.escapeJson(dirty);
}
public static String getDirtyString(JSONObject obj, String key) {
String result = null;
if (null != obj) {
// try {
result = obj.getString(key);
// } catch (JSONException e) {
// // We should really be catching these here.
// }
}
if (null != result) {
result = StringEscapeUtils.unescapeJson(StringEscapeUtils.unescapeJson(result));
}
return result;
}
public static ContactInformation[] convertToEmergencyContactInformation(JSONObject json) {
List <ContactInformation> eci = new ArrayList<ContactInformation>();
try {
for(int i = 1; i <=3; i++) {
JSONObject jcontact = json.getJSONObject("EMERGENCY COUNT " + i);
if(jcontact != null) {
ContactInformation ci = new ContactInformation();
ci.setPreferredName(getDirtyString(jcontact, "EMERGENCY NAME"));
ci.setRelationship(getDirtyString(jcontact, "RELATION"));
ci.setComments(getDirtyString(jcontact, "RELATION COMMENT"));
//le emailz
try {
for(int j = 1; j <=3; j++) {
JSONObject jemail = jcontact.getJSONObject("EMERGENCY EMAIL COUNT "+ j);
String email = getDirtyString(jemail, "EMERGENCY EMAIL ADDRESS");
String value = getDirtyString(jemail, "EMERGENCY EMAIL COMMENT");
ci.getEmails().add(new TypeValue(value, email));
}
} catch (JSONException ex) {
// logger.trace("Error parsing, probably just someone who doesn't have the max",ex);
//nothing to see here, move along
}
//le phonz
try {
for(int j = 1; j <=3; j++) {
JSONObject jphone = jcontact.getJSONObject("EMERGENCY PHONE COUNT "+ j);
String phone = getDirtyString(jphone, "EMERGENCY PHONE NUMBER");
String comment = getDirtyString(jphone, "EMERGENCY PHONE COMMENT");
ci.getPhoneNumbers().add(new TypeValue(comment, phone));
}
} catch (JSONException ex) {
// logger.trace("Error parsing, probably just someone who doesn't have the max",ex);
}
//add to parent
eci.add(ci);
}
}
} catch (JSONException ex) {
// logger.trace("Error parsing, probably just someone who doesn't have the max",ex);
}
return eci.toArray(new ContactInformation[0]);
}
public static ContactInformation convertToLocalContactInformation(JSONObject json, ContactInformation ci) {
if(json != null) {
ci.setId(json.get("NETID").toString());
//addresses
for(int i = 1 ; i <= 3; i++) {
try {
JSONObject address = json.getJSONObject("ADDRESS COUNT " + i);
if (address != null) {
ContactAddress ca = new ContactAddress () ;
for (int j = 1; j <= 4; j++) {
try {
String addressLine = getDirtyString(address, "ADDRESS LINE " + j);
if(StringUtils.isNotBlank(addressLine)) {
ca.getAddressLines().add(addressLine);
}
} catch(JSONException ex) {
// logger.trace(ex.getMessage());
//eat exception as its probably that they just didn't have 4 address lines
}
}
ca.setCity(getDirtyString(address, "CITY"));
ca.setState(getDirtyString(address, "STATE"));
ca.setPostalCode(getDirtyString(address, "ZIP"));
ca.setCountry(getDirtyString(address, "COUNTRY"));
ca.setComment(getDirtyString(address, "ADDRESS COMMENT"));
ca.setType(getDirtyString(address, "ADDRESS TYPE"));
ci.getAddresses().add(ca);
}
} catch (JSONException ex) {
// logger.trace(ex.getMessage());
//eat exception as its probably that they just didn't have 3 addresses
}
}
}
return ci;
}
/**
* Extracts Phone Number from JSONObject
* @param json
* @return A TypeValue representing phone numbers, TypeValue may be empty if
* no phone number exists, may return null if parameter is null
*/
public static TypeValue[] convertToEmergencyPhoneNumber(JSONObject json){
if(json == null){
return null;
}
List<TypeValue> phoneNumbers = new ArrayList<TypeValue>();
//phoneNumbers
for(int i=1; i<=3; i++){
try {
JSONObject phoneNumberLine = json.getJSONObject("PHONE COUNT " + i);
if(phoneNumberLine != null){
TypeValue phoneNumber = new TypeValue();
phoneNumber.setValue(getDirtyString(phoneNumberLine, "PHONE NUMBER"));
phoneNumber.setType(getDirtyString(phoneNumberLine, "PHONE COMMENT"));
phoneNumbers.add(phoneNumber);
}
}catch(JSONException ex){
//Probably safe. Will throw exception if PHONE COUNT +i does not return object
// logger.trace(ex.getMessage());
}
}
return phoneNumbers.toArray(new TypeValue[phoneNumbers.size()]);
}
public static JSONObject convertToJSONObject(ContactInformation[] emergencyContacts, ContactInformation ci, TypeValue[] phoneNumbers) {
JSONObject json = new JSONObject();
//populate local contact info
int count=1;
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd-MMM-YY");
for(ContactAddress ca : ci.getAddresses()) {
JSONObject address = new JSONObject();
int alcount = 1;
for(String al : ca.getAddressLines()) {
address.put("ADDRESS LINE " + alcount++, getCleanString(al));
}
address.put("CITY", getCleanString(ca.getCity()));
address.put("STATE", getCleanString(ca.getState()));
address.put("ZIP", getCleanString(ca.getPostalCode()));
address.put("COUNTRY", getCleanString(ca.getCountry()));
if(ca.getComment()!=null && !ca.getComment().isEmpty()){
StringBuilder addressComment = new StringBuilder(ca.getComment());
if(addressComment.toString().endsWith("\"")){
addressComment.append(" ");
}
address.put("ADDRESS COMMENT", getCleanString(addressComment.toString()));
}else{
address.put("ADDRESS COMMENT", getCleanString(ca.getComment()));
}
address.put("ADDRESS PRIORITY", count);
address.put("ADDRESS DTTM", formatter.print(ci.getLastModified()));
json.put("ADDRESS COUNT " + count++, address);
}
//Add Emergency Phone Number
count = 1;
for(TypeValue phoneNumber: phoneNumbers){
if(phoneNumber.getType()!=null && phoneNumber.getValue()!=null){
JSONObject emergencyPhoneNumber = new JSONObject();
emergencyPhoneNumber.put("PHONE PRIORITY", count);
emergencyPhoneNumber.put("PHONE NUMBER", getCleanString(phoneNumber.getValue()));
emergencyPhoneNumber.put("PHONE COMMENT", getCleanString(phoneNumber.getType()));
emergencyPhoneNumber.put("PHONE DTTM", formatter.print(phoneNumber.getLastModified()));
json.put("PHONE COUNT "+count, emergencyPhoneNumber);
}
}
//populate emergency contact info
count = 1;
for(ContactInformation eci : emergencyContacts) {
JSONObject emergencyContact = jsonifyEmergencyContact(eci);
emergencyContact.put("EMERGENCY CONTACT PRIORITY", count);
json.put("EMERGENCY COUNT " + count++, emergencyContact);
}
return json;
}
private static JSONObject jsonifyEmergencyContact(ContactInformation eci) {
JSONObject emergencyContact = new JSONObject();
emergencyContact.put("EMERGENCY NAME", getCleanString(eci.getPreferredName()));
emergencyContact.put("RELATION", getCleanString(eci.getRelationship()));
if(eci.getComments()!=null && !eci.getComments().isEmpty()){
StringBuilder relationComment = new StringBuilder(eci.getComments());
if(relationComment.toString().endsWith("\"")){
relationComment.append(" ");
}
emergencyContact.put("RELATION COMMENT", getCleanString(relationComment.toString()));
}else{
emergencyContact.put("RELATION COMMENT", getCleanString(eci.getComments()));
}
//TODO: Get language from eci
//emergencyContact.put("LANGUAGE SPOKEN 1", eci.get);
//emergencyContact.put("LANGUAGE SPOKEN 2", eci.get);
emergencyContact.put("LANGUAGE SPOKEN 1", "ENG");//todo : bad, no ugh
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd-MMM-YY");
emergencyContact.put("EMERGENCY CONTACT DTTM", formatter.print(DateTime.now()));
int pcount = 1;
for(TypeValue phone : eci.getPhoneNumbers()) {
if(!phone.isEmpty()) {
JSONObject jphone = new JSONObject();
jphone.put("EMERGENCY PHONE PRIORITY", pcount);
jphone.put("EMERGENCY PHONE NUMBER", getCleanString(phone.getValue()));
jphone.put("EMERGENCY PHONE COMMENT", getCleanString(phone.getType()));
jphone.put("EMERGENCY PHONE DTTM", formatter.print(DateTime.now()));
emergencyContact.put("EMERGENCY PHONE COUNT " + pcount++, jphone);
}
}
int ecount = 1;
for(TypeValue email : eci.getEmails()) {
JSONObject jemail = new JSONObject();
jemail.put("EMERGENCY EMAIL PRIORITY", 1);
jemail.put("EMERGENCY EMAIL ADDRESS", getCleanString(email.getValue()));
jemail.put("EMERGENCY EMAIL COMMENT", getCleanString(email.getType()));
jemail.put("EMERGENCY EMAIL DTTM", formatter.print(DateTime.now()));
emergencyContact.put("EMERGENCY EMAIL COUNT " + ecount++, jemail);
}
return emergencyContact;
}
}
|
UTF-8
|
Java
| 10,607 |
java
|
ContactInformationMapper.java
|
Java
|
[] | null |
[] |
package edu.wisc.my.profile.mapper;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.wisc.my.profile.model.ContactAddress;
import edu.wisc.my.profile.model.ContactInformation;
import edu.wisc.my.profile.model.TypeValue;
public final class ContactInformationMapper {
protected static final Logger logger = LoggerFactory.getLogger(ContactInformationMapper.class);
public static String getCleanString(String dirty) {
return StringEscapeUtils.escapeJson(dirty);
}
public static String getDirtyString(JSONObject obj, String key) {
String result = null;
if (null != obj) {
// try {
result = obj.getString(key);
// } catch (JSONException e) {
// // We should really be catching these here.
// }
}
if (null != result) {
result = StringEscapeUtils.unescapeJson(StringEscapeUtils.unescapeJson(result));
}
return result;
}
public static ContactInformation[] convertToEmergencyContactInformation(JSONObject json) {
List <ContactInformation> eci = new ArrayList<ContactInformation>();
try {
for(int i = 1; i <=3; i++) {
JSONObject jcontact = json.getJSONObject("EMERGENCY COUNT " + i);
if(jcontact != null) {
ContactInformation ci = new ContactInformation();
ci.setPreferredName(getDirtyString(jcontact, "EMERGENCY NAME"));
ci.setRelationship(getDirtyString(jcontact, "RELATION"));
ci.setComments(getDirtyString(jcontact, "RELATION COMMENT"));
//le emailz
try {
for(int j = 1; j <=3; j++) {
JSONObject jemail = jcontact.getJSONObject("EMERGENCY EMAIL COUNT "+ j);
String email = getDirtyString(jemail, "EMERGENCY EMAIL ADDRESS");
String value = getDirtyString(jemail, "EMERGENCY EMAIL COMMENT");
ci.getEmails().add(new TypeValue(value, email));
}
} catch (JSONException ex) {
// logger.trace("Error parsing, probably just someone who doesn't have the max",ex);
//nothing to see here, move along
}
//le phonz
try {
for(int j = 1; j <=3; j++) {
JSONObject jphone = jcontact.getJSONObject("EMERGENCY PHONE COUNT "+ j);
String phone = getDirtyString(jphone, "EMERGENCY PHONE NUMBER");
String comment = getDirtyString(jphone, "EMERGENCY PHONE COMMENT");
ci.getPhoneNumbers().add(new TypeValue(comment, phone));
}
} catch (JSONException ex) {
// logger.trace("Error parsing, probably just someone who doesn't have the max",ex);
}
//add to parent
eci.add(ci);
}
}
} catch (JSONException ex) {
// logger.trace("Error parsing, probably just someone who doesn't have the max",ex);
}
return eci.toArray(new ContactInformation[0]);
}
public static ContactInformation convertToLocalContactInformation(JSONObject json, ContactInformation ci) {
if(json != null) {
ci.setId(json.get("NETID").toString());
//addresses
for(int i = 1 ; i <= 3; i++) {
try {
JSONObject address = json.getJSONObject("ADDRESS COUNT " + i);
if (address != null) {
ContactAddress ca = new ContactAddress () ;
for (int j = 1; j <= 4; j++) {
try {
String addressLine = getDirtyString(address, "ADDRESS LINE " + j);
if(StringUtils.isNotBlank(addressLine)) {
ca.getAddressLines().add(addressLine);
}
} catch(JSONException ex) {
// logger.trace(ex.getMessage());
//eat exception as its probably that they just didn't have 4 address lines
}
}
ca.setCity(getDirtyString(address, "CITY"));
ca.setState(getDirtyString(address, "STATE"));
ca.setPostalCode(getDirtyString(address, "ZIP"));
ca.setCountry(getDirtyString(address, "COUNTRY"));
ca.setComment(getDirtyString(address, "ADDRESS COMMENT"));
ca.setType(getDirtyString(address, "ADDRESS TYPE"));
ci.getAddresses().add(ca);
}
} catch (JSONException ex) {
// logger.trace(ex.getMessage());
//eat exception as its probably that they just didn't have 3 addresses
}
}
}
return ci;
}
/**
* Extracts Phone Number from JSONObject
* @param json
* @return A TypeValue representing phone numbers, TypeValue may be empty if
* no phone number exists, may return null if parameter is null
*/
public static TypeValue[] convertToEmergencyPhoneNumber(JSONObject json){
if(json == null){
return null;
}
List<TypeValue> phoneNumbers = new ArrayList<TypeValue>();
//phoneNumbers
for(int i=1; i<=3; i++){
try {
JSONObject phoneNumberLine = json.getJSONObject("PHONE COUNT " + i);
if(phoneNumberLine != null){
TypeValue phoneNumber = new TypeValue();
phoneNumber.setValue(getDirtyString(phoneNumberLine, "PHONE NUMBER"));
phoneNumber.setType(getDirtyString(phoneNumberLine, "PHONE COMMENT"));
phoneNumbers.add(phoneNumber);
}
}catch(JSONException ex){
//Probably safe. Will throw exception if PHONE COUNT +i does not return object
// logger.trace(ex.getMessage());
}
}
return phoneNumbers.toArray(new TypeValue[phoneNumbers.size()]);
}
public static JSONObject convertToJSONObject(ContactInformation[] emergencyContacts, ContactInformation ci, TypeValue[] phoneNumbers) {
JSONObject json = new JSONObject();
//populate local contact info
int count=1;
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd-MMM-YY");
for(ContactAddress ca : ci.getAddresses()) {
JSONObject address = new JSONObject();
int alcount = 1;
for(String al : ca.getAddressLines()) {
address.put("ADDRESS LINE " + alcount++, getCleanString(al));
}
address.put("CITY", getCleanString(ca.getCity()));
address.put("STATE", getCleanString(ca.getState()));
address.put("ZIP", getCleanString(ca.getPostalCode()));
address.put("COUNTRY", getCleanString(ca.getCountry()));
if(ca.getComment()!=null && !ca.getComment().isEmpty()){
StringBuilder addressComment = new StringBuilder(ca.getComment());
if(addressComment.toString().endsWith("\"")){
addressComment.append(" ");
}
address.put("ADDRESS COMMENT", getCleanString(addressComment.toString()));
}else{
address.put("ADDRESS COMMENT", getCleanString(ca.getComment()));
}
address.put("ADDRESS PRIORITY", count);
address.put("ADDRESS DTTM", formatter.print(ci.getLastModified()));
json.put("ADDRESS COUNT " + count++, address);
}
//Add Emergency Phone Number
count = 1;
for(TypeValue phoneNumber: phoneNumbers){
if(phoneNumber.getType()!=null && phoneNumber.getValue()!=null){
JSONObject emergencyPhoneNumber = new JSONObject();
emergencyPhoneNumber.put("PHONE PRIORITY", count);
emergencyPhoneNumber.put("PHONE NUMBER", getCleanString(phoneNumber.getValue()));
emergencyPhoneNumber.put("PHONE COMMENT", getCleanString(phoneNumber.getType()));
emergencyPhoneNumber.put("PHONE DTTM", formatter.print(phoneNumber.getLastModified()));
json.put("PHONE COUNT "+count, emergencyPhoneNumber);
}
}
//populate emergency contact info
count = 1;
for(ContactInformation eci : emergencyContacts) {
JSONObject emergencyContact = jsonifyEmergencyContact(eci);
emergencyContact.put("EMERGENCY CONTACT PRIORITY", count);
json.put("EMERGENCY COUNT " + count++, emergencyContact);
}
return json;
}
private static JSONObject jsonifyEmergencyContact(ContactInformation eci) {
JSONObject emergencyContact = new JSONObject();
emergencyContact.put("EMERGENCY NAME", getCleanString(eci.getPreferredName()));
emergencyContact.put("RELATION", getCleanString(eci.getRelationship()));
if(eci.getComments()!=null && !eci.getComments().isEmpty()){
StringBuilder relationComment = new StringBuilder(eci.getComments());
if(relationComment.toString().endsWith("\"")){
relationComment.append(" ");
}
emergencyContact.put("RELATION COMMENT", getCleanString(relationComment.toString()));
}else{
emergencyContact.put("RELATION COMMENT", getCleanString(eci.getComments()));
}
//TODO: Get language from eci
//emergencyContact.put("LANGUAGE SPOKEN 1", eci.get);
//emergencyContact.put("LANGUAGE SPOKEN 2", eci.get);
emergencyContact.put("LANGUAGE SPOKEN 1", "ENG");//todo : bad, no ugh
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd-MMM-YY");
emergencyContact.put("EMERGENCY CONTACT DTTM", formatter.print(DateTime.now()));
int pcount = 1;
for(TypeValue phone : eci.getPhoneNumbers()) {
if(!phone.isEmpty()) {
JSONObject jphone = new JSONObject();
jphone.put("EMERGENCY PHONE PRIORITY", pcount);
jphone.put("EMERGENCY PHONE NUMBER", getCleanString(phone.getValue()));
jphone.put("EMERGENCY PHONE COMMENT", getCleanString(phone.getType()));
jphone.put("EMERGENCY PHONE DTTM", formatter.print(DateTime.now()));
emergencyContact.put("EMERGENCY PHONE COUNT " + pcount++, jphone);
}
}
int ecount = 1;
for(TypeValue email : eci.getEmails()) {
JSONObject jemail = new JSONObject();
jemail.put("EMERGENCY EMAIL PRIORITY", 1);
jemail.put("EMERGENCY EMAIL ADDRESS", getCleanString(email.getValue()));
jemail.put("EMERGENCY EMAIL COMMENT", getCleanString(email.getType()));
jemail.put("EMERGENCY EMAIL DTTM", formatter.print(DateTime.now()));
emergencyContact.put("EMERGENCY EMAIL COUNT " + ecount++, jemail);
}
return emergencyContact;
}
}
| 10,607 | 0.633072 | 0.630338 | 261 | 39.639847 | 29.725317 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.762452 | false | false |
3
|
e2596894f2f7bbf5edfa8b511d59fe9b6df05414
| 28,106,266,041,632 |
c034c9391b8d939b5f41cb3eada3a89ec98601cd
|
/epam-intro-unit1/src/by/epam/intro/unit1_1/loop/Task9.java
|
84167a17e5307eb48d9157dbb57b1852a7ff406d
|
[] |
no_license
|
KatsiarynaZhalabkevich/IntroToJavaEpam
|
https://github.com/KatsiarynaZhalabkevich/IntroToJavaEpam
|
b0bc5ecc692cf057317032cd8fcb24d0a2ab2962
|
481a5ef91cc5c8af5537082325b0a6ab393bf41a
|
refs/heads/master
| 2020-07-31T17:06:52.748000 | 2019-10-06T09:29:49 | 2019-10-06T09:29:49 | 210,686,091 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.epam.intro.unit1_1.loop;
/*сумма квадратов первых 100 чисел*/
public class Task9 {
public static void main(String[] args) {
int sum=0;
for (int i = 1; i <=100 ; i++) {
sum+=i*i;
}
System.out.println("Результат "+sum);
}
}
|
UTF-8
|
Java
| 340 |
java
|
Task9.java
|
Java
|
[] | null |
[] |
package by.epam.intro.unit1_1.loop;
/*сумма квадратов первых 100 чисел*/
public class Task9 {
public static void main(String[] args) {
int sum=0;
for (int i = 1; i <=100 ; i++) {
sum+=i*i;
}
System.out.println("Результат "+sum);
}
}
| 340 | 0.506536 | 0.470588 | 17 | 16 | 16.712095 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false |
3
|
492bf863da7daa264f8f2140bbdcc804e9c73053
| 29,523,605,259,649 |
d85eea278f53c2d60197a0b479c074b5a52bdf1e
|
/Services/msk-product/src/main/java/com/msk/product/bean/PD14210101Bean.java
|
203281570baf4355f5d8d1fee02c6bfd33255532
|
[] |
no_license
|
YuanChenM/xcdv1.5
|
https://github.com/YuanChenM/xcdv1.5
|
baeaab6e566236d0f3e170ceae186b6d2999c989
|
77bf0e90102f5704fe186140e1792396b7ade91d
|
refs/heads/master
| 2021-05-26T04:51:12.441000 | 2017-08-14T03:06:07 | 2017-08-14T03:06:07 | 100,221,981 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.msk.product.bean;
import com.msk.core.entity.BaseEntity;
/**
* PD14210101Bean
*
* @author xhy
*/
public class PD14210101Bean extends BaseEntity {
private static final long serialVersionUID = 1L;
private String machiningName;
private String breedName;
private String scientificName;
private String localName;
private String classestreeCode;
/**
* Getter method for property <tt>classestreeCode</tt>.
*
* @return property value of classestreeCode
*/
public String getClassestreeCode() {
return classestreeCode;
}
/**
* Setter method for property <tt>classestreeCode</tt>.
*
* @param classestreeCode value to be assigned to property classestreeCode
*/
public void setClassestreeCode(String classestreeCode) {
this.classestreeCode = classestreeCode;
}
/**
* Getter method for property <tt>machiningName</tt>.
*
* @return property value of machiningName
*/
public String getMachiningName() {
return machiningName;
}
/**
* Setter method for property <tt>machiningName</tt>.
*
* @param machiningName value to be assigned to property machiningName
*/
public void setMachiningName(String machiningName) {
this.machiningName = machiningName;
}
/**
* Getter method for property <tt>breedName</tt>.
*
* @return property value of breedName
*/
public String getBreedName() {
return breedName;
}
/**
* Setter method for property <tt>breedName</tt>.
*
* @param breedName value to be assigned to property breedName
*/
public void setBreedName(String breedName) {
this.breedName = breedName;
}
/**
* Getter method for property <tt>scientificName</tt>.
*
* @return property value of scientificName
*/
public String getScientificName() {
return scientificName;
}
/**
* Setter method for property <tt>scientificName</tt>.
*
* @param scientificName value to be assigned to property scientificName
*/
public void setScientificName(String scientificName) {
this.scientificName = scientificName;
}
/**
* Getter method for property <tt>localName</tt>.
*
* @return property value of localName
*/
public String getLocalName() {
return localName;
}
/**
* Setter method for property <tt>localName</tt>.
*
* @param localName value to be assigned to property localName
*/
public void setLocalName(String localName) {
this.localName = localName;
}
}
|
UTF-8
|
Java
| 2,677 |
java
|
PD14210101Bean.java
|
Java
|
[
{
"context": "y.BaseEntity;\n\n/**\n * PD14210101Bean\n *\n * @author xhy\n */\npublic class PD14210101Bean extends BaseEntit",
"end": 110,
"score": 0.9995542764663696,
"start": 107,
"tag": "USERNAME",
"value": "xhy"
}
] | null |
[] |
package com.msk.product.bean;
import com.msk.core.entity.BaseEntity;
/**
* PD14210101Bean
*
* @author xhy
*/
public class PD14210101Bean extends BaseEntity {
private static final long serialVersionUID = 1L;
private String machiningName;
private String breedName;
private String scientificName;
private String localName;
private String classestreeCode;
/**
* Getter method for property <tt>classestreeCode</tt>.
*
* @return property value of classestreeCode
*/
public String getClassestreeCode() {
return classestreeCode;
}
/**
* Setter method for property <tt>classestreeCode</tt>.
*
* @param classestreeCode value to be assigned to property classestreeCode
*/
public void setClassestreeCode(String classestreeCode) {
this.classestreeCode = classestreeCode;
}
/**
* Getter method for property <tt>machiningName</tt>.
*
* @return property value of machiningName
*/
public String getMachiningName() {
return machiningName;
}
/**
* Setter method for property <tt>machiningName</tt>.
*
* @param machiningName value to be assigned to property machiningName
*/
public void setMachiningName(String machiningName) {
this.machiningName = machiningName;
}
/**
* Getter method for property <tt>breedName</tt>.
*
* @return property value of breedName
*/
public String getBreedName() {
return breedName;
}
/**
* Setter method for property <tt>breedName</tt>.
*
* @param breedName value to be assigned to property breedName
*/
public void setBreedName(String breedName) {
this.breedName = breedName;
}
/**
* Getter method for property <tt>scientificName</tt>.
*
* @return property value of scientificName
*/
public String getScientificName() {
return scientificName;
}
/**
* Setter method for property <tt>scientificName</tt>.
*
* @param scientificName value to be assigned to property scientificName
*/
public void setScientificName(String scientificName) {
this.scientificName = scientificName;
}
/**
* Getter method for property <tt>localName</tt>.
*
* @return property value of localName
*/
public String getLocalName() {
return localName;
}
/**
* Setter method for property <tt>localName</tt>.
*
* @param localName value to be assigned to property localName
*/
public void setLocalName(String localName) {
this.localName = localName;
}
}
| 2,677 | 0.635413 | 0.629062 | 115 | 22.278261 | 22.682131 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.156522 | false | false |
3
|
cf4f7c27b9d444f07cc286915a1f05d43a2c6014
| 10,866,267,282,420 |
3c716be11a4b84946139487c740dacd75cdc5869
|
/src/main/java/it/polito/applied/smiled/exception/UserNotFoundException.java
|
9c04329210be29c6bfafb46074a7c3e6661ba7a1
|
[] |
no_license
|
m04ph3u5/smiled
|
https://github.com/m04ph3u5/smiled
|
6e76b5ba9d20025ed81cc247de858fa0e362b9ec
|
d682b52a4585ffbcfbc3f09202a088396b9f174c
|
refs/heads/master
| 2020-12-15T08:33:54.283000 | 2016-10-14T13:47:14 | 2016-10-14T13:47:14 | 36,792,798 | 2 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package it.polito.applied.smiled.exception;
public class UserNotFoundException extends Exception{
private String message;
public UserNotFoundException() {
super();
}
public UserNotFoundException(String email) {
super();
this.message = "User with email '"+email+"' not found";
}
public UserNotFoundException(Throwable cause) {
super(cause);
}
@Override
public String toString() {
return message;
}
@Override
public String getMessage() {
return message;
}
}
|
UTF-8
|
Java
| 489 |
java
|
UserNotFoundException.java
|
Java
|
[] | null |
[] |
package it.polito.applied.smiled.exception;
public class UserNotFoundException extends Exception{
private String message;
public UserNotFoundException() {
super();
}
public UserNotFoundException(String email) {
super();
this.message = "User with email '"+email+"' not found";
}
public UserNotFoundException(Throwable cause) {
super(cause);
}
@Override
public String toString() {
return message;
}
@Override
public String getMessage() {
return message;
}
}
| 489 | 0.719836 | 0.719836 | 30 | 15.3 | 17.955778 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.1 | false | false |
3
|
649afe71dec98a2978cf80003f6518d7555b3ca5
| 10,866,267,280,404 |
b1dfed7d921508b85f485fffa1339eb5e6f7cb4b
|
/src/DataClasses/Professional.java
|
de41fb463f5486cbc46354623c58924cc8b2ee8c
|
[] |
no_license
|
RaghWizardBeard/SaveTimeApp
|
https://github.com/RaghWizardBeard/SaveTimeApp
|
b1545fae79419ae76b461531c145d3dcd43b7750
|
46958c82fef0b4b54d8b8c9126f213f595497d9c
|
refs/heads/master
| 2021-07-11T14:33:13.822000 | 2017-10-14T21:37:26 | 2017-10-14T21:37:26 | 104,578,005 | 0 | 0 | null | true | 2017-09-23T15:31:20 | 2017-09-23T15:31:20 | 2017-09-17T15:59:20 | 2017-09-17T16:01:51 | 1 | 0 | 0 | 0 | null | null | null |
package DataClasses;
import java.util.Date;
public class Professional extends Client
{
private String businessName;
private int businessPhoneNumber;
private String businessAddress;
public Professional(String firstName, String lastName, String userName, int ID, Date date, Date dob, String email, String address, String city, String state, int zipCode, String country, int phoneNumber) {
super(firstName, lastName, userName, ID, date, dob, email, address, city, state, zipCode, country, phoneNumber);
}
@Override
public String toString()
{
super.toString();
return "Professional{" +
"businessName='" + businessName + '\'' +
", businessPhoneNumber=" + businessPhoneNumber +
", businessAddress='" + businessAddress + '\'' +
'}';
}
public String getBusinessName()
{
return businessName;
}
public void setBusinessName(String businessName)
{
this.businessName = businessName;
}
public int getBusinessPhoneNumber()
{
return businessPhoneNumber;
}
public void setBusinessPhoneNumber(int businessPhoneNumber)
{
this.businessPhoneNumber = businessPhoneNumber;
}
public String getBusinessAddress()
{
return businessAddress;
}
public void setBusinessAddress(String businessAddress)
{
this.businessAddress = businessAddress;
}
}
|
UTF-8
|
Java
| 1,470 |
java
|
Professional.java
|
Java
|
[
{
"context": "g businessAddress;\n\n public Professional(String firstName, String lastName, String userName, int ID, Date d",
"end": 236,
"score": 0.997959315776825,
"start": 227,
"tag": "NAME",
"value": "firstName"
},
{
"context": "\n\n public Professional(String firstName, String lastName, String userName, int ID, Date date, Date dob, St",
"end": 253,
"score": 0.99820876121521,
"start": 245,
"tag": "NAME",
"value": "lastName"
},
{
"context": "essional(String firstName, String lastName, String userName, int ID, Date date, Date dob, String email, Strin",
"end": 270,
"score": 0.7558391690254211,
"start": 262,
"tag": "USERNAME",
"value": "userName"
},
{
"context": " String country, int phoneNumber) {\n super(firstName, lastName, userName, ID, date, dob, email, addres",
"end": 429,
"score": 0.9982965588569641,
"start": 420,
"tag": "NAME",
"value": "firstName"
},
{
"context": "untry, int phoneNumber) {\n super(firstName, lastName, userName, ID, date, dob, email, address, city, s",
"end": 439,
"score": 0.9989737272262573,
"start": 431,
"tag": "NAME",
"value": "lastName"
},
{
"context": " phoneNumber) {\n super(firstName, lastName, userName, ID, date, dob, email, address, city, state, zipC",
"end": 449,
"score": 0.8650678992271423,
"start": 441,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package DataClasses;
import java.util.Date;
public class Professional extends Client
{
private String businessName;
private int businessPhoneNumber;
private String businessAddress;
public Professional(String firstName, String lastName, String userName, int ID, Date date, Date dob, String email, String address, String city, String state, int zipCode, String country, int phoneNumber) {
super(firstName, lastName, userName, ID, date, dob, email, address, city, state, zipCode, country, phoneNumber);
}
@Override
public String toString()
{
super.toString();
return "Professional{" +
"businessName='" + businessName + '\'' +
", businessPhoneNumber=" + businessPhoneNumber +
", businessAddress='" + businessAddress + '\'' +
'}';
}
public String getBusinessName()
{
return businessName;
}
public void setBusinessName(String businessName)
{
this.businessName = businessName;
}
public int getBusinessPhoneNumber()
{
return businessPhoneNumber;
}
public void setBusinessPhoneNumber(int businessPhoneNumber)
{
this.businessPhoneNumber = businessPhoneNumber;
}
public String getBusinessAddress()
{
return businessAddress;
}
public void setBusinessAddress(String businessAddress)
{
this.businessAddress = businessAddress;
}
}
| 1,470 | 0.64966 | 0.64966 | 55 | 25.727272 | 34.778496 | 209 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false |
3
|
568a5fef5eaf9db09b3a1089d17d8c41433f8463
| 19,052,474,975,193 |
bf8e69b267531315c72f91a8e255896a36a349d2
|
/Dominos/src/main/java/dominos/demo/controller/SessionManager.java
|
777530b39f74e4964c21a02b010fc49f33f8eac7
|
[] |
no_license
|
elichka2507/Dominos-Spring
|
https://github.com/elichka2507/Dominos-Spring
|
19ff0e2bf04b4169c6cb2024bed82c2478fa5cb7
|
2aa4f0e7d4ac94af7037adf1bcf946ef8ea3124d
|
refs/heads/master
| 2020-04-28T04:35:25.369000 | 2019-03-11T11:09:08 | 2019-03-11T11:09:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dominos.demo.controller;
import dominos.demo.model.pojos.users.User;
import dominos.demo.util.exceptions.InvalidLogInException;
import javax.servlet.http.HttpSession;
public class SessionManager {
public static final String LOGGED = "logged";
public static final String SHOPPING_CART = "cart";
public static final String PIZZA = "pizza";
public static final String PIZZA_INGREDIENTS = "ingredients";
public static boolean isLoggedIn(HttpSession session) {
if(session.isNew() || session.getAttribute(LOGGED) == null) {
return false;
}
return true;
}
public static void logUser(HttpSession session, User user) {
session.setAttribute(LOGGED, user);
}
protected static boolean validateLoginAdmin(HttpSession session)throws InvalidLogInException {
if(!isLoggedIn(session)) {
throw new InvalidLogInException("You are not logged!");
}
User user = (User)(session.getAttribute(LOGGED));
if(!user.isAdmin()) {
throw new InvalidLogInException("You are not admin!");
}
return true;
}
}
|
UTF-8
|
Java
| 1,145 |
java
|
SessionManager.java
|
Java
|
[] | null |
[] |
package dominos.demo.controller;
import dominos.demo.model.pojos.users.User;
import dominos.demo.util.exceptions.InvalidLogInException;
import javax.servlet.http.HttpSession;
public class SessionManager {
public static final String LOGGED = "logged";
public static final String SHOPPING_CART = "cart";
public static final String PIZZA = "pizza";
public static final String PIZZA_INGREDIENTS = "ingredients";
public static boolean isLoggedIn(HttpSession session) {
if(session.isNew() || session.getAttribute(LOGGED) == null) {
return false;
}
return true;
}
public static void logUser(HttpSession session, User user) {
session.setAttribute(LOGGED, user);
}
protected static boolean validateLoginAdmin(HttpSession session)throws InvalidLogInException {
if(!isLoggedIn(session)) {
throw new InvalidLogInException("You are not logged!");
}
User user = (User)(session.getAttribute(LOGGED));
if(!user.isAdmin()) {
throw new InvalidLogInException("You are not admin!");
}
return true;
}
}
| 1,145 | 0.673362 | 0.673362 | 36 | 30.805555 | 26.737219 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.527778 | false | false |
3
|
b8a763cd1ef6a8653e5914173dd3d8ac04ed09ce
| 17,016,660,426,944 |
30fb462a79e6b7e15402abce0e865d48a9ca4faa
|
/runescape-client/src/main/java/class20.java
|
5324ef4ddb9fa8682cbb823148407467d1bd6667
|
[
"BSD-2-Clause"
] |
permissive
|
open-osrs/runelite
|
https://github.com/open-osrs/runelite
|
c976bfae2af5144a65c6bddceab9b45cea4b5684
|
915fb55c0a2a1c000dc04a431e68f3bbb29a40cf
|
refs/heads/master
| 2023-03-18T18:51:39.918000 | 2022-06-28T22:54:31 | 2022-06-28T22:54:31 | 182,144,048 | 264 | 951 |
BSD-2-Clause
| false | 2022-07-15T00:36:20 | 2019-04-18T19:14:19 | 2022-07-14T21:58:43 | 2022-07-15T00:36:20 | 95,444 | 286 | 448 | 1 |
Java
| false | false |
import java.io.IOException;
import java.util.concurrent.Callable;
import net.runelite.mapping.Export;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
@ObfuscatedName("p")
public class class20 implements Callable {
@ObfuscatedName("j")
@ObfuscatedGetter(
intValue = -1119374455
)
@Export("clientType")
public static int clientType;
@ObfuscatedName("nb")
@ObfuscatedSignature(
descriptor = "Lbk;"
)
@Export("tempMenuAction")
static MenuAction tempMenuAction;
@ObfuscatedName("c")
@ObfuscatedSignature(
descriptor = "Ls;"
)
final class10 field109;
// $FF: synthetic field
@ObfuscatedSignature(
descriptor = "Lu;"
)
final class14 this$0;
@ObfuscatedSignature(
descriptor = "(Lu;Ls;)V"
)
class20(class14 var1, class10 var2) {
this.this$0 = var1; // L: 46
this.field109 = var2; // L: 47
} // L: 48
public Object call() throws Exception {
try {
while (this.field109.method78()) { // L: 53
DynamicObject.method1991(10L); // L: 54
}
} catch (IOException var2) { // L: 57
return new class21("Error servicing REST query: " + var2.getMessage()); // L: 58
}
return this.field109.method90(); // L: 60
}
@ObfuscatedName("ar")
@ObfuscatedSignature(
descriptor = "(II)I",
garbageValue = "-2092046767"
)
static int method255(int var0) {
return (int)Math.pow(2.0D, (double)(7.0F + (float)var0 / 256.0F)); // L: 3847
}
}
|
UTF-8
|
Java
| 1,467 |
java
|
class20.java
|
Java
|
[] | null |
[] |
import java.io.IOException;
import java.util.concurrent.Callable;
import net.runelite.mapping.Export;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
@ObfuscatedName("p")
public class class20 implements Callable {
@ObfuscatedName("j")
@ObfuscatedGetter(
intValue = -1119374455
)
@Export("clientType")
public static int clientType;
@ObfuscatedName("nb")
@ObfuscatedSignature(
descriptor = "Lbk;"
)
@Export("tempMenuAction")
static MenuAction tempMenuAction;
@ObfuscatedName("c")
@ObfuscatedSignature(
descriptor = "Ls;"
)
final class10 field109;
// $FF: synthetic field
@ObfuscatedSignature(
descriptor = "Lu;"
)
final class14 this$0;
@ObfuscatedSignature(
descriptor = "(Lu;Ls;)V"
)
class20(class14 var1, class10 var2) {
this.this$0 = var1; // L: 46
this.field109 = var2; // L: 47
} // L: 48
public Object call() throws Exception {
try {
while (this.field109.method78()) { // L: 53
DynamicObject.method1991(10L); // L: 54
}
} catch (IOException var2) { // L: 57
return new class21("Error servicing REST query: " + var2.getMessage()); // L: 58
}
return this.field109.method90(); // L: 60
}
@ObfuscatedName("ar")
@ObfuscatedSignature(
descriptor = "(II)I",
garbageValue = "-2092046767"
)
static int method255(int var0) {
return (int)Math.pow(2.0D, (double)(7.0F + (float)var0 / 256.0F)); // L: 3847
}
}
| 1,467 | 0.693252 | 0.62713 | 61 | 23.049181 | 17.83938 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.540984 | false | false |
3
|
c55f57cb2facad7cf347bad3481d58ae882ead33
| 10,333,691,341,620 |
bcc20b6e197d92a4b26e21575e2dbc9dfe8e5fbf
|
/src/main/java/com/jm/stacsearchjpa/model/Summaries.java
|
ed0d014b0bb2eeb910b2273e11bc82ff91f806d9
|
[] |
no_license
|
turingtestfail/stac-search-jpa
|
https://github.com/turingtestfail/stac-search-jpa
|
a71ef812f32afe13e5fd4f31c257301d0d897274
|
c42bb8b529d3c969a035f2760c992a62e4c42702
|
refs/heads/master
| 2023-01-07T20:22:22.591000 | 2020-11-17T19:25:39 | 2020-11-17T19:25:39 | 288,208,343 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jm.stacsearchjpa.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.jm.stacsearchjpa.util.BandsJsonSerializer;
import com.jm.stacsearchjpa.util.IntervalJsonSerializer;
import com.vladmihalcea.hibernate.type.array.ListArrayType;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import java.util.List;
import java.util.Set;
@Embeddable
@Data
@TypeDef(
name = "list-array",
typeClass = ListArrayType.class
)
public class Summaries {
@Embedded
DateTime datetime;
@JsonProperty("sci:citation")
@Type(type = "list-array")
@Column(
name = "citation",
columnDefinition = "text[]"
)
private List<String> citation;
@JsonProperty("eo:gsd")
@Type(type = "list-array")
@Column(
name = "gsd",
columnDefinition = "integer[]"
)
private List<Integer> gsd;
@Type(type = "list-array")
@Column(
name = "platform",
columnDefinition = "text[]"
)
private List<String> platform;
@Type(type = "list-array")
@Column(
name = "constellation",
columnDefinition = "text[]"
)
private List<String> constellation;
@Type(type = "list-array")
@Column(
name = "instruments",
columnDefinition = "text[]"
)
private List<String> instruments;
@Embedded
@JsonProperty("view:off_nadir")
private OffNadir offNadir;
@Embedded
@JsonProperty("view:sun_elevation")
private SunElevation sunElevation;
@JsonProperty("eo:bands")
@ManyToMany(fetch= FetchType.EAGER)
@JsonSerialize(using= BandsJsonSerializer.class)
private Set<Band> bands;
}
|
UTF-8
|
Java
| 2,003 |
java
|
Summaries.java
|
Java
|
[
{
"context": "archjpa.util.IntervalJsonSerializer;\nimport com.vladmihalcea.hibernate.type.array.ListArrayType;\nimport lom",
"end": 286,
"score": 0.6520859599113464,
"start": 279,
"tag": "USERNAME",
"value": "admihal"
}
] | null |
[] |
package com.jm.stacsearchjpa.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.jm.stacsearchjpa.util.BandsJsonSerializer;
import com.jm.stacsearchjpa.util.IntervalJsonSerializer;
import com.vladmihalcea.hibernate.type.array.ListArrayType;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import java.util.List;
import java.util.Set;
@Embeddable
@Data
@TypeDef(
name = "list-array",
typeClass = ListArrayType.class
)
public class Summaries {
@Embedded
DateTime datetime;
@JsonProperty("sci:citation")
@Type(type = "list-array")
@Column(
name = "citation",
columnDefinition = "text[]"
)
private List<String> citation;
@JsonProperty("eo:gsd")
@Type(type = "list-array")
@Column(
name = "gsd",
columnDefinition = "integer[]"
)
private List<Integer> gsd;
@Type(type = "list-array")
@Column(
name = "platform",
columnDefinition = "text[]"
)
private List<String> platform;
@Type(type = "list-array")
@Column(
name = "constellation",
columnDefinition = "text[]"
)
private List<String> constellation;
@Type(type = "list-array")
@Column(
name = "instruments",
columnDefinition = "text[]"
)
private List<String> instruments;
@Embedded
@JsonProperty("view:off_nadir")
private OffNadir offNadir;
@Embedded
@JsonProperty("view:sun_elevation")
private SunElevation sunElevation;
@JsonProperty("eo:bands")
@ManyToMany(fetch= FetchType.EAGER)
@JsonSerialize(using= BandsJsonSerializer.class)
private Set<Band> bands;
}
| 2,003 | 0.669496 | 0.669496 | 81 | 23.728395 | 16.896206 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382716 | false | false |
3
|
b546544798dd1114cc2ffc78d0c5ae5f19de6b15
| 10,333,691,341,330 |
707060e605d3d3467807878abba54b3f7e87f800
|
/Commons/src/main/java/org/hallock/tfe/msg/TestIt.java
|
7d43b9f128fcf186d3d43740848e49543a236d1a
|
[] |
no_license
|
tlhallock/Multiplayer2048
|
https://github.com/tlhallock/Multiplayer2048
|
4acdd38237778124b2dd30a0f26127b61576bd87
|
92a312454d1a11fa5f3588bdb456e718620d7609
|
refs/heads/master
| 2021-01-12T06:07:29.026000 | 2017-01-11T04:28:26 | 2017-01-11T04:28:26 | 77,305,644 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//package org.hallock.tfe.msg;
//
//import java.io.ByteArrayOutputStream;
//import java.io.IOException;
//import java.math.BigDecimal;
//
//import org.hallock.tfe.cmn.game.TileBoard;
//import org.hallock.tfe.cmn.util.Json;
//import org.hallock.tfe.msg.SimpleParser.KnownValueReader;
//import org.hallock.tfe.msg.SimpleParser.NullableActionHandler;
//import org.hallock.tfe.msg.SimpleParser.ObjectReader;
//import org.hallock.tfe.msg.SimpleParser.SimpleActionReader;
//import org.hallock.tfe.msg.SimpleParser.SimpleKnownValue;
//
//import com.fasterxml.jackson.core.JsonGenerator;
//import com.fasterxml.jackson.core.JsonParseException;
//import com.fasterxml.jackson.core.JsonParser;
//import com.fasterxml.jackson.core.JsonToken;
//
//public class TestIt
//{
// public static void testValueListener1() throws IOException
// {
// String json = " { \"id\": 25 }";
// JsonParser createParser = Json.createParser(json);
//
// KnownValueReader handler = new KnownValueReader(false);
// SimpleKnownValue<BigDecimal> value = new SimpleKnownValue<BigDecimal>();
// handler.addNumberListener("/id", value);
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// System.out.println(value.getValue());
//
// handler.assumeSet();
// }
//
// public static void testValueListener() throws IOException
// {
// String json = " { \"foobar\": {}, \"id\": 25, \"raboof\": {} }";
// JsonParser createParser = Json.createParser(json);
//
// KnownValueReader handler = new KnownValueReader(false);
// SimpleKnownValue<BigDecimal> value = new SimpleKnownValue<BigDecimal>();
// handler.addNumberListener("/id", value);
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// System.out.println(value.getValue());
//
// handler.assumeSet();
// }
//
// public static void testValueListener2() throws IOException
// {
// ByteArrayOutputStream output = new ByteArrayOutputStream();
// try (JsonGenerator gen = Json.createUnopenedGenerator(output);)
// {
// gen.writeStartObject();
// gen.writeFieldName("the thing");
// new TileBoard(4,5).write(gen);
// gen.writeEndObject();
// }
// String json = new String(output.toByteArray());
// JsonParser createParser = Json.createParser(json);
//
// System.out.println("Json: " + json);
//
// KnownValueReader handler = new KnownValueReader(false);
// SimpleKnownValue<TileBoard> value = new SimpleKnownValue<TileBoard>();
//
// handler.addObjectListener("/the thing", value, new ObjectReader<TileBoard>() {
// @Override
// public TileBoard parse(JsonParser parser) throws IOException
// {
// return new TileBoard(parser);
// }});
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// System.out.println(value.getValue());
//
// handler.assumeSet();
// }
//
//
//
//
//
//
// public static void testActionListener() throws IOException
// {
//
// String json = " { \"id\": 25 }";
// JsonParser createParser = Json.createParser(json);
//
// SimpleActionReader handler = new SimpleActionReader(false);
// handler.addNumberListener("/id", new NullableActionHandler<BigDecimal>()
// {
// @Override
// public void handle(BigDecimal t)
// {
// System.out.println("Found id: " + t);
// }
// });
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// handler.assumeSet();
// }
//
//
// public static void main(String[] args) throws JsonParseException, IOException
// {
// testValueListener2();
// }
//}
|
UTF-8
|
Java
| 4,015 |
java
|
TestIt.java
|
Java
|
[] | null |
[] |
//package org.hallock.tfe.msg;
//
//import java.io.ByteArrayOutputStream;
//import java.io.IOException;
//import java.math.BigDecimal;
//
//import org.hallock.tfe.cmn.game.TileBoard;
//import org.hallock.tfe.cmn.util.Json;
//import org.hallock.tfe.msg.SimpleParser.KnownValueReader;
//import org.hallock.tfe.msg.SimpleParser.NullableActionHandler;
//import org.hallock.tfe.msg.SimpleParser.ObjectReader;
//import org.hallock.tfe.msg.SimpleParser.SimpleActionReader;
//import org.hallock.tfe.msg.SimpleParser.SimpleKnownValue;
//
//import com.fasterxml.jackson.core.JsonGenerator;
//import com.fasterxml.jackson.core.JsonParseException;
//import com.fasterxml.jackson.core.JsonParser;
//import com.fasterxml.jackson.core.JsonToken;
//
//public class TestIt
//{
// public static void testValueListener1() throws IOException
// {
// String json = " { \"id\": 25 }";
// JsonParser createParser = Json.createParser(json);
//
// KnownValueReader handler = new KnownValueReader(false);
// SimpleKnownValue<BigDecimal> value = new SimpleKnownValue<BigDecimal>();
// handler.addNumberListener("/id", value);
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// System.out.println(value.getValue());
//
// handler.assumeSet();
// }
//
// public static void testValueListener() throws IOException
// {
// String json = " { \"foobar\": {}, \"id\": 25, \"raboof\": {} }";
// JsonParser createParser = Json.createParser(json);
//
// KnownValueReader handler = new KnownValueReader(false);
// SimpleKnownValue<BigDecimal> value = new SimpleKnownValue<BigDecimal>();
// handler.addNumberListener("/id", value);
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// System.out.println(value.getValue());
//
// handler.assumeSet();
// }
//
// public static void testValueListener2() throws IOException
// {
// ByteArrayOutputStream output = new ByteArrayOutputStream();
// try (JsonGenerator gen = Json.createUnopenedGenerator(output);)
// {
// gen.writeStartObject();
// gen.writeFieldName("the thing");
// new TileBoard(4,5).write(gen);
// gen.writeEndObject();
// }
// String json = new String(output.toByteArray());
// JsonParser createParser = Json.createParser(json);
//
// System.out.println("Json: " + json);
//
// KnownValueReader handler = new KnownValueReader(false);
// SimpleKnownValue<TileBoard> value = new SimpleKnownValue<TileBoard>();
//
// handler.addObjectListener("/the thing", value, new ObjectReader<TileBoard>() {
// @Override
// public TileBoard parse(JsonParser parser) throws IOException
// {
// return new TileBoard(parser);
// }});
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// System.out.println(value.getValue());
//
// handler.assumeSet();
// }
//
//
//
//
//
//
// public static void testActionListener() throws IOException
// {
//
// String json = " { \"id\": 25 }";
// JsonParser createParser = Json.createParser(json);
//
// SimpleActionReader handler = new SimpleActionReader(false);
// handler.addNumberListener("/id", new NullableActionHandler<BigDecimal>()
// {
// @Override
// public void handle(BigDecimal t)
// {
// System.out.println("Found id: " + t);
// }
// });
//
// if (!createParser.nextToken().equals(JsonToken.START_OBJECT))
// throw new RuntimeException();
//
// SimpleParser.parseCurrentObject(handler, createParser);
//
// handler.assumeSet();
// }
//
//
// public static void main(String[] args) throws JsonParseException, IOException
// {
// testValueListener2();
// }
//}
| 4,015 | 0.670984 | 0.668244 | 129 | 29.124031 | 25.569788 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.062016 | false | false |
3
|
6cd2e11c843aa902c9038c3023b7f96738a52602
| 13,657,996,055,077 |
d38900c06a75e6c71b51f4290809763218626411
|
/agp-core/src/main/java/com/lvsint/abp/common/api/rest/bean/rpm/export/RPMEventIndexedProgrammeEntryExportResponse.java
|
2f5ace597570e9587156346da6b956e65a919a22
|
[] |
no_license
|
XClouded/avp
|
https://github.com/XClouded/avp
|
ef5d0df5fd06d67793f93539e6421c5c8cef06c5
|
4a41681376cd3e1ec7f814dcd1f178d89e94f3d6
|
refs/heads/master
| 2017-02-26T23:03:31.245000 | 2014-07-22T19:03:40 | 2014-07-22T19:03:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lvsint.abp.common.api.rest.bean.rpm.export;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;
import com.lvsint.abp.common.api.rest.bean.rpm.RPMEventPathResponse;
public class RPMEventIndexedProgrammeEntryExportResponse extends RPMProgrammeEntryExportResponse {
private List<RPMMarketExportResponse> markets;
public RPMEventIndexedProgrammeEntryExportResponse() {
super();
}
public List<RPMMarketExportResponse> getMarkets() {
return markets;
}
public void setMarkets(List<RPMMarketExportResponse> markets) {
this.markets = markets;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((markets == null) ? 0 : markets.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
RPMEventIndexedProgrammeEntryExportResponse other = (RPMEventIndexedProgrammeEntryExportResponse) obj;
if (markets == null) {
if (other.markets != null)
return false;
} else if (!markets.equals(other.markets))
return false;
return true;
}
@Override
public String toString() {
return "RPMEventIndexedProgrammeEntryExportResponse [markets=" + markets + ", toString()=" + super.toString()
+ "]";
}
public static final RPMEventIndexedProgrammeEntryExportResponse SAMPLE_ESP_G1 =
new RPMEventIndexedProgrammeEntryExportResponse();
static {
try {
// SAMPLE_ESP_G1.setRowNumber(1);
SAMPLE_ESP_G1.setIndex(12);
SAMPLE_ESP_G1.setEventPaths(RPMEventPathResponse.SAMPLE_LIST_FOOT_ESP_LA_LIGA);
SAMPLE_ESP_G1.setEventId(2L);
SAMPLE_ESP_G1.setEventStartDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-30 20:00:00"));
SAMPLE_ESP_G1.setEventDescription("Valencia vs Zaragoza");
SAMPLE_ESP_G1.setEventComments("Important game");
SAMPLE_ESP_G1.setHomeOpponentId(1003L);
SAMPLE_ESP_G1.setHomeOpponentDescription("Valencia");
SAMPLE_ESP_G1.setAwayOpponentId(1004L);
SAMPLE_ESP_G1.setAwayOpponentDescription("Zaragoza");
SAMPLE_ESP_G1.setTvChannel("Sky Sports 1");
SAMPLE_ESP_G1.setProgrammedDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-29 20:00:00"));
SAMPLE_ESP_G1.setMarkets(Arrays.asList(RPMMarketExportResponse.SAMPLE_ESP_WDW_90MINS,
RPMMarketExportResponse.SAMPLE_ESP_WDW_1STH, RPMMarketExportResponse.SAMPLE_ESP_WDW_HC_90MINS));
} catch (ParseException e) {
}
}
public static final RPMEventIndexedProgrammeEntryExportResponse SAMPLE_ESP_G2 =
new RPMEventIndexedProgrammeEntryExportResponse();
static {
try {
// SAMPLE_ESP_G2.setRowNumber(1);
SAMPLE_ESP_G2.setIndex(1);
SAMPLE_ESP_G2.setEventPaths(RPMEventPathResponse.SAMPLE_LIST_FOOT_ESP_LA_LIGA);
SAMPLE_ESP_G2.setEventId(2L);
SAMPLE_ESP_G2.setEventStartDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-30 20:00:00"));
SAMPLE_ESP_G2.setEventDescription("Valencia vs Zaragoza");
SAMPLE_ESP_G2.setEventComments("Important game");
SAMPLE_ESP_G2.setHomeOpponentId(1003L);
SAMPLE_ESP_G2.setHomeOpponentDescription("Valencia");
SAMPLE_ESP_G2.setAwayOpponentId(1004L);
SAMPLE_ESP_G2.setAwayOpponentDescription("Zaragoza");
SAMPLE_ESP_G2.setTvChannel("Sky Sports 1");
SAMPLE_ESP_G2.setProgrammedDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-29 20:00:00"));
SAMPLE_ESP_G2.setMarkets(Arrays.asList(RPMMarketExportResponse.SAMPLE_ESP_WDW_90MINS,
RPMMarketExportResponse.SAMPLE_ESP_WDW_1STH, RPMMarketExportResponse.SAMPLE_ESP_WDW_HC_90MINS,
RPMMarketExportResponse.SAMPLE_ESP_HTFT_90MINS, RPMMarketExportResponse.SAMPLE_ESP_CS_90MINS));
} catch (ParseException e) {
}
}
}
|
UTF-8
|
Java
| 4,606 |
java
|
RPMEventIndexedProgrammeEntryExportResponse.java
|
Java
|
[] | null |
[] |
package com.lvsint.abp.common.api.rest.bean.rpm.export;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;
import com.lvsint.abp.common.api.rest.bean.rpm.RPMEventPathResponse;
public class RPMEventIndexedProgrammeEntryExportResponse extends RPMProgrammeEntryExportResponse {
private List<RPMMarketExportResponse> markets;
public RPMEventIndexedProgrammeEntryExportResponse() {
super();
}
public List<RPMMarketExportResponse> getMarkets() {
return markets;
}
public void setMarkets(List<RPMMarketExportResponse> markets) {
this.markets = markets;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((markets == null) ? 0 : markets.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
RPMEventIndexedProgrammeEntryExportResponse other = (RPMEventIndexedProgrammeEntryExportResponse) obj;
if (markets == null) {
if (other.markets != null)
return false;
} else if (!markets.equals(other.markets))
return false;
return true;
}
@Override
public String toString() {
return "RPMEventIndexedProgrammeEntryExportResponse [markets=" + markets + ", toString()=" + super.toString()
+ "]";
}
public static final RPMEventIndexedProgrammeEntryExportResponse SAMPLE_ESP_G1 =
new RPMEventIndexedProgrammeEntryExportResponse();
static {
try {
// SAMPLE_ESP_G1.setRowNumber(1);
SAMPLE_ESP_G1.setIndex(12);
SAMPLE_ESP_G1.setEventPaths(RPMEventPathResponse.SAMPLE_LIST_FOOT_ESP_LA_LIGA);
SAMPLE_ESP_G1.setEventId(2L);
SAMPLE_ESP_G1.setEventStartDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-30 20:00:00"));
SAMPLE_ESP_G1.setEventDescription("Valencia vs Zaragoza");
SAMPLE_ESP_G1.setEventComments("Important game");
SAMPLE_ESP_G1.setHomeOpponentId(1003L);
SAMPLE_ESP_G1.setHomeOpponentDescription("Valencia");
SAMPLE_ESP_G1.setAwayOpponentId(1004L);
SAMPLE_ESP_G1.setAwayOpponentDescription("Zaragoza");
SAMPLE_ESP_G1.setTvChannel("Sky Sports 1");
SAMPLE_ESP_G1.setProgrammedDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-29 20:00:00"));
SAMPLE_ESP_G1.setMarkets(Arrays.asList(RPMMarketExportResponse.SAMPLE_ESP_WDW_90MINS,
RPMMarketExportResponse.SAMPLE_ESP_WDW_1STH, RPMMarketExportResponse.SAMPLE_ESP_WDW_HC_90MINS));
} catch (ParseException e) {
}
}
public static final RPMEventIndexedProgrammeEntryExportResponse SAMPLE_ESP_G2 =
new RPMEventIndexedProgrammeEntryExportResponse();
static {
try {
// SAMPLE_ESP_G2.setRowNumber(1);
SAMPLE_ESP_G2.setIndex(1);
SAMPLE_ESP_G2.setEventPaths(RPMEventPathResponse.SAMPLE_LIST_FOOT_ESP_LA_LIGA);
SAMPLE_ESP_G2.setEventId(2L);
SAMPLE_ESP_G2.setEventStartDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-30 20:00:00"));
SAMPLE_ESP_G2.setEventDescription("Valencia vs Zaragoza");
SAMPLE_ESP_G2.setEventComments("Important game");
SAMPLE_ESP_G2.setHomeOpponentId(1003L);
SAMPLE_ESP_G2.setHomeOpponentDescription("Valencia");
SAMPLE_ESP_G2.setAwayOpponentId(1004L);
SAMPLE_ESP_G2.setAwayOpponentDescription("Zaragoza");
SAMPLE_ESP_G2.setTvChannel("Sky Sports 1");
SAMPLE_ESP_G2.setProgrammedDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.parse("2013-06-29 20:00:00"));
SAMPLE_ESP_G2.setMarkets(Arrays.asList(RPMMarketExportResponse.SAMPLE_ESP_WDW_90MINS,
RPMMarketExportResponse.SAMPLE_ESP_WDW_1STH, RPMMarketExportResponse.SAMPLE_ESP_WDW_HC_90MINS,
RPMMarketExportResponse.SAMPLE_ESP_HTFT_90MINS, RPMMarketExportResponse.SAMPLE_ESP_CS_90MINS));
} catch (ParseException e) {
}
}
}
| 4,606 | 0.62766 | 0.59987 | 107 | 41.04673 | 32.155983 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.551402 | false | false |
3
|
1f1f99acd4cd3684e58903eea316e3da73e90c8c
| 18,253,611,035,326 |
26d4d6bbb096c964c88a4b955614a13e12dfd1f8
|
/src/main/java/shadows/apotheosis/mixin/AnvilMenuMixin.java
|
967cb2ebf4c45457c672318ddef92efb00e1c9f9
|
[
"MIT"
] |
permissive
|
Aikini/Apotheosis
|
https://github.com/Aikini/Apotheosis
|
82c1a0bea597c870ae2106651996d262ecd3fa4c
|
ae6926747331ad2541dba73c82b84345e73ed78c
|
refs/heads/1.18
| 2022-01-28T20:00:16.367000 | 2022-01-18T09:47:32 | 2022-01-18T09:47:32 | 386,188,244 | 0 | 0 |
MIT
| true | 2021-07-15T06:27:23 | 2021-07-15T06:27:23 | 2021-06-25T04:56:35 | 2021-07-05T23:58:08 | 3,324 | 0 | 0 | 0 | null | false | false |
package shadows.apotheosis.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import net.minecraft.world.inventory.AnvilMenu;
@Mixin(AnvilMenu.class)
public class AnvilMenuMixin {
@ModifyConstant(method = "createResult()V")
public int apoth_removeLevelCap(int old) {
if (old == 40) return Integer.MAX_VALUE;
return old;
}
}
|
UTF-8
|
Java
| 396 |
java
|
AnvilMenuMixin.java
|
Java
|
[] | null |
[] |
package shadows.apotheosis.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import net.minecraft.world.inventory.AnvilMenu;
@Mixin(AnvilMenu.class)
public class AnvilMenuMixin {
@ModifyConstant(method = "createResult()V")
public int apoth_removeLevelCap(int old) {
if (old == 40) return Integer.MAX_VALUE;
return old;
}
}
| 396 | 0.772727 | 0.767677 | 17 | 22.294117 | 20.61343 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.823529 | false | false |
3
|
7a79ee132f0bc19861ec431abfbd3ee6ce1ed399
| 30,820,685,332,726 |
f6de660f81f552013742babb2fbb47a84809f16c
|
/src/test/java/org/hortonworks/qe/TestOnlyIfHbaseInstalled.java
|
777d5a0386515ebe5431a63cc3e23749ee58ba14
|
[] |
no_license
|
aloklal99/junit-examples
|
https://github.com/aloklal99/junit-examples
|
5da6c9e3b31a14622cebbf1324f4db7a4335fbb1
|
e047590d87a667a1d582e076e39574bfadcad2c8
|
refs/heads/master
| 2020-06-30T23:32:35.410000 | 2016-02-12T20:23:31 | 2016-02-12T20:23:31 | 37,562,172 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.hortonworks.qe;
import static org.junit.Assume.assumeTrue;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class TestOnlyIfHbaseInstalled {
// tests will run only if hbase is installed
@Before
public void skipTestIf() {
System.out.println("TestSkipOneTestIfNoHbaseInstalled.skipTestIf()");
assumeTrue("yes".equals(TestUtils.isHbaseInstalled()));
}
@Test
public void test1() {
System.out.println("TestSkipOneTestIfNoHbaseInstalled.test1");
fail("Should not have run!");
}
@Test
public void test2() {
System.out.println("TestSkipOneTestIfNoHbaseInstalled.test2");
fail("Should not have run!");
}
}
|
UTF-8
|
Java
| 679 |
java
|
TestOnlyIfHbaseInstalled.java
|
Java
|
[] | null |
[] |
package org.hortonworks.qe;
import static org.junit.Assume.assumeTrue;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class TestOnlyIfHbaseInstalled {
// tests will run only if hbase is installed
@Before
public void skipTestIf() {
System.out.println("TestSkipOneTestIfNoHbaseInstalled.skipTestIf()");
assumeTrue("yes".equals(TestUtils.isHbaseInstalled()));
}
@Test
public void test1() {
System.out.println("TestSkipOneTestIfNoHbaseInstalled.test1");
fail("Should not have run!");
}
@Test
public void test2() {
System.out.println("TestSkipOneTestIfNoHbaseInstalled.test2");
fail("Should not have run!");
}
}
| 679 | 0.746686 | 0.740795 | 30 | 21.633333 | 21.908115 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.133333 | false | false |
3
|
fc41d3b8a1f0582cd90166786be9e5073ad2377b
| 26,465,588,480,300 |
be2ba637a6135abf28e693650d5399fb3fdaf780
|
/app/src/main/java/com/example/c2n/retailerhome/presenter/RetailerHomeActivity.java
|
63b5fa437009b1de9fdbd95e1c2bb68575f10c1d
|
[] |
no_license
|
devrath123/C2NRetailer
|
https://github.com/devrath123/C2NRetailer
|
fcca842c9f97b32bbf42ea33aa0ce8f4260ee6fc
|
38fec2e3ede5bdb527c6b72bb5acc94a7a90e3c8
|
refs/heads/master
| 2022-02-26T02:16:06.675000 | 2019-10-06T10:16:08 | 2019-10-06T10:16:08 | 197,916,532 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.c2n.retailerhome.presenter;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.c2n.R;
import com.example.c2n.core.FCMHandler;
import com.example.c2n.core.SharedPrefManager;
import com.example.c2n.edit_profile.presenter.EditProfileFragment;
import com.example.c2n.initial_phase.MainActivity;
import com.example.c2n.offer_cards_list.presenter.OffersListActivity;
import com.example.c2n.retailer_deal.presenter.RetailerDealFragment;
import com.example.c2n.viewshops.presenter.ViewShopsFragment;
import com.squareup.picasso.Picasso;
import butterknife.ButterKnife;
public class RetailerHomeActivity extends AppCompatActivity {
private static final String TAG = RetailerHomeActivity.class.getSimpleName();
private NavigationView navigationView;
private DrawerLayout drawer;
private View navHeader;
private ImageView imgNavHeaderBg;
private ImageView imgProfile;
private TextView txtName, txtWebsite;
private Toolbar toolbar;
public static int navItemIndex = 0;
// tags used to attach the fragments
private static final String TAG_HOME = "home";
private static final String TAG_PROFILE = "profile";
private static final String TAG_SHOPS = "shops";
private static final String TAG_OFFERS = "offers";
private static final String TAG_DEALS = "deals";
private static final String TAG_LOGOUT = "logout";
public static String CURRENT_TAG = TAG_HOME;
// toolbar titles respected to selected nav menu item
private String[] activityTitles;
// flag to load home fragment when user presses back key
private boolean shouldLoadHomeFragOnBackPress = true;
private Handler mHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_retailer_home2);
ButterKnife.bind(this);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
SharedPrefManager.Init(this);
mHandler = new Handler();
Bundle intent = getIntent().getExtras();
boolean status = intent.getBoolean("status");
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationView = (NavigationView) findViewById(R.id.nav_view);
navHeader = navigationView.getHeaderView(0);
txtName = navHeader.findViewById(R.id.name);
imgProfile = navHeader.findViewById(R.id.imageView);
txtName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navItemIndex = 1;
CURRENT_TAG = TAG_PROFILE;
setToolbarTitle();
EditProfileFragment editProfileFragment = new EditProfileFragment();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
fragmentTransaction.replace(R.id.frame, editProfileFragment, CURRENT_TAG);
fragmentTransaction.commitAllowingStateLoss();
drawer.closeDrawers();
}
});
imgProfile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navItemIndex = 1;
CURRENT_TAG = TAG_PROFILE;
setToolbarTitle();
EditProfileFragment editProfileFragment = new EditProfileFragment();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
fragmentTransaction.replace(R.id.frame, editProfileFragment, CURRENT_TAG);
fragmentTransaction.commitAllowingStateLoss();
drawer.closeDrawers();
}
});
// load toolbar titles from string resources
activityTitles = getResources().getStringArray(R.array.nav_item_activity_titles);
loadNavHeader();
setUpNavigationView();
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
try {
navItemIndex = Integer.parseInt(bundle.getString("navigation"));
CURRENT_TAG = TAG_SHOPS;
if (status) {
navItemIndex = 4;
CURRENT_TAG = TAG_DEALS;
}
loadHomeFragment();
} catch (Exception e) {
if (status) {
navItemIndex = 4;
CURRENT_TAG = TAG_DEALS;
} else {
navItemIndex = 0;
CURRENT_TAG = TAG_HOME;
}
loadHomeFragment();
}
}
}
private void loadNavHeader() {
SharedPrefManager.LoadFromPref();
// name, website
txtName.setText("Hi, " + SharedPrefManager.get_userFullName());
if (!SharedPrefManager.get_userProfilePic().equals("")) {
Log.d("RetailerHomeActivity", SharedPrefManager.get_userProfilePic());
Picasso.get().load(SharedPrefManager.get_userProfilePic()).fit().into(imgProfile);
}
}
private void loadHomeFragment() {
selectNavMenu();
setToolbarTitle();
if (getSupportFragmentManager().findFragmentByTag(CURRENT_TAG) != null) {
drawer.closeDrawers();
return;
}
Runnable mPendingRunnable = new Runnable() {
@Override
public void run() {
// update the main content by replacing fragments
Fragment fragment = getHomeFragment();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);
fragmentTransaction.commitAllowingStateLoss();
}
};
// If mPendingRunnable is not null, then add to the message queue
if (mPendingRunnable != null) {
mHandler.post(mPendingRunnable);
}
drawer.closeDrawers();
invalidateOptionsMenu();
}
private Fragment getHomeFragment() {
switch (navItemIndex) {
case 0:
RetailerHomeFragment retailerHomeFragment = new RetailerHomeFragment();
return retailerHomeFragment;
case 1:
EditProfileFragment editProfileFragment = new EditProfileFragment();
return editProfileFragment;
case 2:
ViewShopsFragment viewShopsFragment = new ViewShopsFragment();
return viewShopsFragment;
case 3:
case 4:
RetailerDealFragment retailerDealFragment = new RetailerDealFragment();
return retailerDealFragment;
default:
return new RetailerHomeFragment();
}
}
private void setToolbarTitle() {
getSupportActionBar().setTitle(activityTitles[navItemIndex]);
}
public void setToolbatTitle(String title) {
getSupportActionBar().setTitle(title);
}
private void selectNavMenu() {
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
}
private void setUpNavigationView() {
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.nav_home:
navItemIndex = 0;
CURRENT_TAG = TAG_HOME;
break;
case R.id.nav_profile:
navItemIndex = 1;
CURRENT_TAG = TAG_PROFILE;
break;
case R.id.nav_shops:
navItemIndex = 2;
CURRENT_TAG = TAG_SHOPS;
break;
case R.id.nav_offers:
navItemIndex = 3;
CURRENT_TAG = TAG_OFFERS;
startActivity(new Intent(RetailerHomeActivity.this, OffersListActivity.class));
break;
case R.id.nav_deal:
navItemIndex = 4;
CURRENT_TAG = TAG_DEALS;
break;
case R.id.nav_logout:
AlertDialog.Builder alertDialog = new AlertDialog.Builder(RetailerHomeActivity.this);
alertDialog.setTitle("Confirm ");
alertDialog.setMessage("Are you sure you want to logout?");
alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
FCMHandler fcmHandler = new FCMHandler();
fcmHandler.disableFCM();
SharedPrefManager.DeleteAllEntriesFromPref();
startActivity(new Intent(RetailerHomeActivity.this, MainActivity.class));
finish();
}
});
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
break;
default:
navItemIndex = 0;
}
if (menuItem.isChecked()) {
menuItem.setChecked(false);
} else {
menuItem.setChecked(true);
}
menuItem.setChecked(true);
loadHomeFragment();
return true;
}
});
ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.openDrawer, R.string.closeDrawer) {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
}
};
drawer.setDrawerListener(actionBarDrawerToggle);
actionBarDrawerToggle.syncState();
}
@Override
public void onBackPressed() {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawers();
return;
}
if (shouldLoadHomeFragOnBackPress) {
if (navItemIndex != 0) {
navItemIndex = 0;
CURRENT_TAG = TAG_HOME;
loadHomeFragment();
return;
} else {
System.exit(0);
}
}
super.onBackPressed();
}
}
|
UTF-8
|
Java
| 12,244 |
java
|
RetailerHomeActivity.java
|
Java
|
[] | null |
[] |
package com.example.c2n.retailerhome.presenter;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.c2n.R;
import com.example.c2n.core.FCMHandler;
import com.example.c2n.core.SharedPrefManager;
import com.example.c2n.edit_profile.presenter.EditProfileFragment;
import com.example.c2n.initial_phase.MainActivity;
import com.example.c2n.offer_cards_list.presenter.OffersListActivity;
import com.example.c2n.retailer_deal.presenter.RetailerDealFragment;
import com.example.c2n.viewshops.presenter.ViewShopsFragment;
import com.squareup.picasso.Picasso;
import butterknife.ButterKnife;
public class RetailerHomeActivity extends AppCompatActivity {
private static final String TAG = RetailerHomeActivity.class.getSimpleName();
private NavigationView navigationView;
private DrawerLayout drawer;
private View navHeader;
private ImageView imgNavHeaderBg;
private ImageView imgProfile;
private TextView txtName, txtWebsite;
private Toolbar toolbar;
public static int navItemIndex = 0;
// tags used to attach the fragments
private static final String TAG_HOME = "home";
private static final String TAG_PROFILE = "profile";
private static final String TAG_SHOPS = "shops";
private static final String TAG_OFFERS = "offers";
private static final String TAG_DEALS = "deals";
private static final String TAG_LOGOUT = "logout";
public static String CURRENT_TAG = TAG_HOME;
// toolbar titles respected to selected nav menu item
private String[] activityTitles;
// flag to load home fragment when user presses back key
private boolean shouldLoadHomeFragOnBackPress = true;
private Handler mHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_retailer_home2);
ButterKnife.bind(this);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
SharedPrefManager.Init(this);
mHandler = new Handler();
Bundle intent = getIntent().getExtras();
boolean status = intent.getBoolean("status");
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationView = (NavigationView) findViewById(R.id.nav_view);
navHeader = navigationView.getHeaderView(0);
txtName = navHeader.findViewById(R.id.name);
imgProfile = navHeader.findViewById(R.id.imageView);
txtName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navItemIndex = 1;
CURRENT_TAG = TAG_PROFILE;
setToolbarTitle();
EditProfileFragment editProfileFragment = new EditProfileFragment();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
fragmentTransaction.replace(R.id.frame, editProfileFragment, CURRENT_TAG);
fragmentTransaction.commitAllowingStateLoss();
drawer.closeDrawers();
}
});
imgProfile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navItemIndex = 1;
CURRENT_TAG = TAG_PROFILE;
setToolbarTitle();
EditProfileFragment editProfileFragment = new EditProfileFragment();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
fragmentTransaction.replace(R.id.frame, editProfileFragment, CURRENT_TAG);
fragmentTransaction.commitAllowingStateLoss();
drawer.closeDrawers();
}
});
// load toolbar titles from string resources
activityTitles = getResources().getStringArray(R.array.nav_item_activity_titles);
loadNavHeader();
setUpNavigationView();
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
try {
navItemIndex = Integer.parseInt(bundle.getString("navigation"));
CURRENT_TAG = TAG_SHOPS;
if (status) {
navItemIndex = 4;
CURRENT_TAG = TAG_DEALS;
}
loadHomeFragment();
} catch (Exception e) {
if (status) {
navItemIndex = 4;
CURRENT_TAG = TAG_DEALS;
} else {
navItemIndex = 0;
CURRENT_TAG = TAG_HOME;
}
loadHomeFragment();
}
}
}
private void loadNavHeader() {
SharedPrefManager.LoadFromPref();
// name, website
txtName.setText("Hi, " + SharedPrefManager.get_userFullName());
if (!SharedPrefManager.get_userProfilePic().equals("")) {
Log.d("RetailerHomeActivity", SharedPrefManager.get_userProfilePic());
Picasso.get().load(SharedPrefManager.get_userProfilePic()).fit().into(imgProfile);
}
}
private void loadHomeFragment() {
selectNavMenu();
setToolbarTitle();
if (getSupportFragmentManager().findFragmentByTag(CURRENT_TAG) != null) {
drawer.closeDrawers();
return;
}
Runnable mPendingRunnable = new Runnable() {
@Override
public void run() {
// update the main content by replacing fragments
Fragment fragment = getHomeFragment();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);
fragmentTransaction.commitAllowingStateLoss();
}
};
// If mPendingRunnable is not null, then add to the message queue
if (mPendingRunnable != null) {
mHandler.post(mPendingRunnable);
}
drawer.closeDrawers();
invalidateOptionsMenu();
}
private Fragment getHomeFragment() {
switch (navItemIndex) {
case 0:
RetailerHomeFragment retailerHomeFragment = new RetailerHomeFragment();
return retailerHomeFragment;
case 1:
EditProfileFragment editProfileFragment = new EditProfileFragment();
return editProfileFragment;
case 2:
ViewShopsFragment viewShopsFragment = new ViewShopsFragment();
return viewShopsFragment;
case 3:
case 4:
RetailerDealFragment retailerDealFragment = new RetailerDealFragment();
return retailerDealFragment;
default:
return new RetailerHomeFragment();
}
}
private void setToolbarTitle() {
getSupportActionBar().setTitle(activityTitles[navItemIndex]);
}
public void setToolbatTitle(String title) {
getSupportActionBar().setTitle(title);
}
private void selectNavMenu() {
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
}
private void setUpNavigationView() {
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.nav_home:
navItemIndex = 0;
CURRENT_TAG = TAG_HOME;
break;
case R.id.nav_profile:
navItemIndex = 1;
CURRENT_TAG = TAG_PROFILE;
break;
case R.id.nav_shops:
navItemIndex = 2;
CURRENT_TAG = TAG_SHOPS;
break;
case R.id.nav_offers:
navItemIndex = 3;
CURRENT_TAG = TAG_OFFERS;
startActivity(new Intent(RetailerHomeActivity.this, OffersListActivity.class));
break;
case R.id.nav_deal:
navItemIndex = 4;
CURRENT_TAG = TAG_DEALS;
break;
case R.id.nav_logout:
AlertDialog.Builder alertDialog = new AlertDialog.Builder(RetailerHomeActivity.this);
alertDialog.setTitle("Confirm ");
alertDialog.setMessage("Are you sure you want to logout?");
alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
FCMHandler fcmHandler = new FCMHandler();
fcmHandler.disableFCM();
SharedPrefManager.DeleteAllEntriesFromPref();
startActivity(new Intent(RetailerHomeActivity.this, MainActivity.class));
finish();
}
});
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
break;
default:
navItemIndex = 0;
}
if (menuItem.isChecked()) {
menuItem.setChecked(false);
} else {
menuItem.setChecked(true);
}
menuItem.setChecked(true);
loadHomeFragment();
return true;
}
});
ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.openDrawer, R.string.closeDrawer) {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
}
};
drawer.setDrawerListener(actionBarDrawerToggle);
actionBarDrawerToggle.syncState();
}
@Override
public void onBackPressed() {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawers();
return;
}
if (shouldLoadHomeFragOnBackPress) {
if (navItemIndex != 0) {
navItemIndex = 0;
CURRENT_TAG = TAG_HOME;
loadHomeFragment();
return;
} else {
System.exit(0);
}
}
super.onBackPressed();
}
}
| 12,244 | 0.583469 | 0.580284 | 338 | 35.22781 | 27.133434 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585799 | false | false |
3
|
a860771af980b47a68f9ac78a36f879a7f77ddea
| 29,497,835,458,345 |
4315bd9d757ae80d166d620cb0653a9c27d3086c
|
/ADMNOVO(STRUTS)/admnovo/src/java/com/devflex/tebca/admtebca/ImpuestoEmpresaActionForm.java
|
ed1c5653c83524e5f26512468ec10a8c71516da6
|
[] |
no_license
|
elderius/Netbean-Novopayment-
|
https://github.com/elderius/Netbean-Novopayment-
|
848576dbe40a512458bb6f65ec7b8fc49fa06ec9
|
e398e0fb19b3e6372fddd5e350c5d7de798547d4
|
refs/heads/master
| 2016-09-12T21:12:01.456000 | 2016-05-10T15:52:27 | 2016-05-10T15:52:27 | 58,288,593 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.devflex.tebca.admtebca;
import com.devflex.tebca.rec.ImpuestoEmpresa;
import java.util.ArrayList;
/**
*
* @author DESARROLLO3
*/
public class ImpuestoEmpresaActionForm extends AdmtebcaActionForm {
private String password ="";
private String idEmpresa ="";
private String idEmpresaLabel ="";
private ImpuestoEmpresa empresa= new ImpuestoEmpresa();
private ArrayList listaEmpresas = new ArrayList();
private ArrayList listaImpuestos = new ArrayList();
private ArrayList listaImpuestosEmpresa = new ArrayList();
public String getIdEmpresaLabel() {
return idEmpresaLabel;
}
public void setIdEmpresaLabel(String idEmpresaLabel) {
this.idEmpresaLabel = idEmpresaLabel;
}
public ArrayList getListaImpuestos() {
return listaImpuestos;
}
public void setListaImpuestos(ArrayList listaImpuestos) {
this.listaImpuestos = listaImpuestos;
}
public String getIdEmpresa() {
return idEmpresa;
}
public void setIdEmpresa(String idEmpresa) {
this.idEmpresa = idEmpresa;
}
public ArrayList getListaEmpresas() {
return listaEmpresas;
}
public void setListaEmpresas(ArrayList listaEmpresas) {
this.listaEmpresas = listaEmpresas;
}
public ImpuestoEmpresa getEmpresa() {
return empresa;
}
public void setEmpresa(ImpuestoEmpresa empresa) {
this.empresa = empresa;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ArrayList getListaImpuestosEmpresa() {
return listaImpuestosEmpresa;
}
public void setListaImpuestosEmpresa(ArrayList listaImpuestosEmpresa) {
this.listaImpuestosEmpresa = listaImpuestosEmpresa;
}
}
|
UTF-8
|
Java
| 1,957 |
java
|
ImpuestoEmpresaActionForm.java
|
Java
|
[
{
"context": "sa;\nimport java.util.ArrayList;\n\n/**\n *\n * @author DESARROLLO3\n */\npublic class ImpuestoEmpresaActionForm extend",
"end": 242,
"score": 0.999609649181366,
"start": 231,
"tag": "USERNAME",
"value": "DESARROLLO3"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.devflex.tebca.admtebca;
import com.devflex.tebca.rec.ImpuestoEmpresa;
import java.util.ArrayList;
/**
*
* @author DESARROLLO3
*/
public class ImpuestoEmpresaActionForm extends AdmtebcaActionForm {
private String password ="";
private String idEmpresa ="";
private String idEmpresaLabel ="";
private ImpuestoEmpresa empresa= new ImpuestoEmpresa();
private ArrayList listaEmpresas = new ArrayList();
private ArrayList listaImpuestos = new ArrayList();
private ArrayList listaImpuestosEmpresa = new ArrayList();
public String getIdEmpresaLabel() {
return idEmpresaLabel;
}
public void setIdEmpresaLabel(String idEmpresaLabel) {
this.idEmpresaLabel = idEmpresaLabel;
}
public ArrayList getListaImpuestos() {
return listaImpuestos;
}
public void setListaImpuestos(ArrayList listaImpuestos) {
this.listaImpuestos = listaImpuestos;
}
public String getIdEmpresa() {
return idEmpresa;
}
public void setIdEmpresa(String idEmpresa) {
this.idEmpresa = idEmpresa;
}
public ArrayList getListaEmpresas() {
return listaEmpresas;
}
public void setListaEmpresas(ArrayList listaEmpresas) {
this.listaEmpresas = listaEmpresas;
}
public ImpuestoEmpresa getEmpresa() {
return empresa;
}
public void setEmpresa(ImpuestoEmpresa empresa) {
this.empresa = empresa;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ArrayList getListaImpuestosEmpresa() {
return listaImpuestosEmpresa;
}
public void setListaImpuestosEmpresa(ArrayList listaImpuestosEmpresa) {
this.listaImpuestosEmpresa = listaImpuestosEmpresa;
}
}
| 1,957 | 0.688809 | 0.688298 | 81 | 23.160494 | 22.292919 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.320988 | false | false |
3
|
b818ff26d9fa0455a326f76a2802b96f3360a419
| 11,647,951,376,295 |
202d571297aa25a17696e943de84cef18e727f61
|
/TC-W/src/main/java/com/tc/qa/util/ImageValidator.java
|
19195d4461f038f73a8c46d4475f2c8ad40dee65
|
[] |
no_license
|
melvinsolomon/TC
|
https://github.com/melvinsolomon/TC
|
6154b5315eb2a89efa38e451eefe9de0779165e9
|
60bba4bdad1703df9927f8cc26bbc90ffd070e8f
|
refs/heads/master
| 2021-05-08T21:28:37.618000 | 2018-01-31T06:45:32 | 2018-01-31T06:45:32 | 119,642,302 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tc.qa.util;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import com.tc.qa.base.TestBase;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class ImageValidator extends TestBase{
public Boolean isImageLoaded(WebElement image1)
{
Boolean imageLoaded1 = (Boolean) ((JavascriptExecutor)driver).executeScript("return arguments[0].complete && arguments[0].naturalWidth > 0", image1);
return imageLoaded1;
}
public void getBackgroundImage() {
String html = "<html><head></head><body><div class=\"post_video\" style=\"background-image:url(http://img.youtube.com/vi/JFf3uazyXco/2.jpg);\"></body></html>";
Document doc = Jsoup.parse( html );
Elements elements = doc.getElementsByClass("post_video");
for( Element e : elements ) {
String attr = e.attr("style");
System.out.println( attr.substring( attr.indexOf("http://"), attr.indexOf(")") ) );
}
}
}
|
UTF-8
|
Java
| 1,130 |
java
|
ImageValidator.java
|
Java
|
[] | null |
[] |
package com.tc.qa.util;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import com.tc.qa.base.TestBase;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class ImageValidator extends TestBase{
public Boolean isImageLoaded(WebElement image1)
{
Boolean imageLoaded1 = (Boolean) ((JavascriptExecutor)driver).executeScript("return arguments[0].complete && arguments[0].naturalWidth > 0", image1);
return imageLoaded1;
}
public void getBackgroundImage() {
String html = "<html><head></head><body><div class=\"post_video\" style=\"background-image:url(http://img.youtube.com/vi/JFf3uazyXco/2.jpg);\"></body></html>";
Document doc = Jsoup.parse( html );
Elements elements = doc.getElementsByClass("post_video");
for( Element e : elements ) {
String attr = e.attr("style");
System.out.println( attr.substring( attr.indexOf("http://"), attr.indexOf(")") ) );
}
}
}
| 1,130 | 0.649558 | 0.641593 | 33 | 32.303032 | 39.912392 | 167 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false |
3
|
1b08608ba3128f7b151beb46a4f9e77363dc9177
| 1,975,685,022,611 |
5417c04302c4fce4dabebd109098e242f1bb712f
|
/app/src/main/java/com/platform/utility/SmsReceiver.java
|
12599c929804cc6abf0fc69f8765a4677956c5e6
|
[] |
no_license
|
HarshadaDeo/TechPlatform-DevOrg-Android
|
https://github.com/HarshadaDeo/TechPlatform-DevOrg-Android
|
c4c3449a150e91f228fef3fbc2826ae9252c4787
|
320b0b2f5cf458f6551764bf507cf40347d68fdd
|
refs/heads/master
| 2020-04-15T04:24:41.410000 | 2019-01-04T14:53:12 | 2019-01-04T14:53:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.platform.utility;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
public class SmsReceiver extends BroadcastReceiver {
private OtpSmsReceiverListener listener;
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null && intent.getAction() != null && intent.getAction().contentEquals(
Constants.SMS_RECEIVE_IDENTIFIER)) {
Bundle data = intent.getExtras();
if (data != null) {
Object[] objects = (Object[]) data.get("get_msg");
if (objects != null) {
final String MESSAGE_TEMPLATE = "";
for (Object obj : objects) {
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) obj);
String message = smsMessage.getDisplayMessageBody();
if (message.contains(MESSAGE_TEMPLATE)) {
if (listener != null) {
listener.smsReceive(message);
return;
}
}
}
}
}
}
}
public void setListener(OtpSmsReceiverListener listener) {
this.listener = listener;
}
public void deRegisterListener() {
this.listener = null;
}
public interface OtpSmsReceiverListener {
void smsReceive(String otp);
}
}
|
UTF-8
|
Java
| 1,594 |
java
|
SmsReceiver.java
|
Java
|
[] | null |
[] |
package com.platform.utility;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
public class SmsReceiver extends BroadcastReceiver {
private OtpSmsReceiverListener listener;
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null && intent.getAction() != null && intent.getAction().contentEquals(
Constants.SMS_RECEIVE_IDENTIFIER)) {
Bundle data = intent.getExtras();
if (data != null) {
Object[] objects = (Object[]) data.get("get_msg");
if (objects != null) {
final String MESSAGE_TEMPLATE = "";
for (Object obj : objects) {
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) obj);
String message = smsMessage.getDisplayMessageBody();
if (message.contains(MESSAGE_TEMPLATE)) {
if (listener != null) {
listener.smsReceive(message);
return;
}
}
}
}
}
}
}
public void setListener(OtpSmsReceiverListener listener) {
this.listener = listener;
}
public void deRegisterListener() {
this.listener = null;
}
public interface OtpSmsReceiverListener {
void smsReceive(String otp);
}
}
| 1,594 | 0.541405 | 0.541405 | 49 | 31.530613 | 24.680077 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.367347 | false | false |
3
|
57f5feba2c511eaaee9e3d00b36f9ed5c27926c9
| 30,923,764,531,492 |
769df6cba2a3658ef53da0f8cc7147d43eb9112c
|
/src/main/java/com/example/bypassAlgorithm/entity/LoginUserReposne.java
|
d908647e54419260c8ec7a89482a47a716553061
|
[] |
no_license
|
gurpreet-qualhon/corrlink-bypassAlgorithm
|
https://github.com/gurpreet-qualhon/corrlink-bypassAlgorithm
|
c3155c59bfcc1c4cfd0f639187bbecf2f5cd889b
|
120af8a37ffadfa6121941039c0044a83cca17cc
|
refs/heads/main
| 2023-02-04T16:49:29.891000 | 2020-12-22T11:04:52 | 2020-12-22T11:04:52 | 321,937,018 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.bypassAlgorithm.entity;
public class LoginUserReposne {
private int userId;
public LoginUserReposne() {}
public LoginUserReposne(int userId, String authToken, int status, String responseBody, String customAuthToken) {
super();
this.userId = userId;
this.authToken = authToken;
this.status = status;
this.responseBody = responseBody;
this.customAuthToken = customAuthToken;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getAuthToken() {
return authToken;
}
public void setAuthToken(String authToken) {
this.authToken = authToken;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
private String authToken;
private int status;
private String responseBody;
private String customAuthToken;
public String getCustomAuthToken() {
return customAuthToken;
}
public void setCustomAuthToken(String customAuthToken) {
this.customAuthToken = customAuthToken;
}
public String getResponseBody() {
return responseBody;
}
public void setResponseBody(String responseBody) {
this.responseBody = responseBody;
}
}
|
UTF-8
|
Java
| 1,205 |
java
|
LoginUserReposne.java
|
Java
|
[] | null |
[] |
package com.example.bypassAlgorithm.entity;
public class LoginUserReposne {
private int userId;
public LoginUserReposne() {}
public LoginUserReposne(int userId, String authToken, int status, String responseBody, String customAuthToken) {
super();
this.userId = userId;
this.authToken = authToken;
this.status = status;
this.responseBody = responseBody;
this.customAuthToken = customAuthToken;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getAuthToken() {
return authToken;
}
public void setAuthToken(String authToken) {
this.authToken = authToken;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
private String authToken;
private int status;
private String responseBody;
private String customAuthToken;
public String getCustomAuthToken() {
return customAuthToken;
}
public void setCustomAuthToken(String customAuthToken) {
this.customAuthToken = customAuthToken;
}
public String getResponseBody() {
return responseBody;
}
public void setResponseBody(String responseBody) {
this.responseBody = responseBody;
}
}
| 1,205 | 0.751037 | 0.751037 | 50 | 23.1 | 20.011248 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.76 | false | false |
3
|
fb937efcf51c9d004f28ba3c01b1848c9a289cec
| 8,684,423,933,857 |
74275fadbc7dacbeb095e2a0537de3f9ee3e1b00
|
/hive-udfs-cassandra/src/main/java/com/kenshoo/hive/udfs/cassandra/DeserializeToString.java
|
ce6118adbf19e85a41623f2464a390f27d4b96f7
|
[] |
no_license
|
kenshoo/hive-udfs
|
https://github.com/kenshoo/hive-udfs
|
f91bc50422127837881e867bb71a51cd5e655468
|
451e53f323d22d5674c9a68f1389c67f3027cd72
|
refs/heads/master
| 2016-12-13T19:05:29.324000 | 2016-05-15T15:22:07 | 2016-05-15T15:22:07 | 38,808,274 | 1 | 0 | null | false | 2017-08-20T12:18:07 | 2015-07-09T08:33:01 | 2017-08-07T11:25:50 | 2017-08-20T11:38:47 | 153 | 1 | 0 | 0 |
Java
| null | null |
package com.kenshoo.hive.udfs.cassandra;
import org.apache.cassandra.db.marshal.*;
import org.apache.hadoop.hive.ql.exec.UDF;
import java.nio.ByteBuffer;
import java.util.HashMap;
/**
* Created by noamh on 09/07/15.
*/
public class DeserializeToString extends UDF {
//We use a map instead of reflection so we can support different naming for each type
public String evaluate(byte[] fieldValue,String serilizerName) throws Exception {
String result = "";
ByteBuffer byteBuffer = ByteBuffer.wrap(fieldValue);
result = Serializer.getSerilizer(serilizerName).getString(byteBuffer);
return result;
}
}
|
UTF-8
|
Java
| 651 |
java
|
DeserializeToString.java
|
Java
|
[
{
"context": "ffer;\nimport java.util.HashMap;\n\n/**\n * Created by noamh on 09/07/15.\n */\npublic class DeserializeToString",
"end": 206,
"score": 0.9996244311332703,
"start": 201,
"tag": "USERNAME",
"value": "noamh"
}
] | null |
[] |
package com.kenshoo.hive.udfs.cassandra;
import org.apache.cassandra.db.marshal.*;
import org.apache.hadoop.hive.ql.exec.UDF;
import java.nio.ByteBuffer;
import java.util.HashMap;
/**
* Created by noamh on 09/07/15.
*/
public class DeserializeToString extends UDF {
//We use a map instead of reflection so we can support different naming for each type
public String evaluate(byte[] fieldValue,String serilizerName) throws Exception {
String result = "";
ByteBuffer byteBuffer = ByteBuffer.wrap(fieldValue);
result = Serializer.getSerilizer(serilizerName).getString(byteBuffer);
return result;
}
}
| 651 | 0.723502 | 0.714286 | 25 | 25.040001 | 28.249573 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
3
|
36cbea88f134ac8096b3ebaf1239562ac97ea514
| 20,478,404,086,250 |
1caa3dd31a7c03ab7a30fd3e087d04341965ed80
|
/Online shopping/Main.java
|
208ee94de47fa81cd2c02de46fff68d5d7401f08
|
[] |
no_license
|
AdarshJha11/Playground
|
https://github.com/AdarshJha11/Playground
|
bdfedee41a47094aba7fc46ac14648cd16672f55
|
e1708075ec057b8e3d7a4f7444162c4c7ece1b8d
|
refs/heads/master
| 2022-09-27T16:17:35.400000 | 2020-05-30T16:12:17 | 2020-05-30T16:12:17 | 260,403,880 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
#include<iostream>
using namespace std;
int main()
{
int amountF,discountF,shippingF,amountS,discountS,shippingS,amountA,discountA,shippingA;
cin>>amountF>>discountF>>shippingF>>amountS>>discountS>>shippingS>>amountA>>discountA>>shippingA;
int priceF = amountF - (discountF*amountF)/100 + shippingF;
int priceS = amountS - (discountS*amountS)/100 + shippingS;
int priceA = amountA - (discountA*amountA)/100 + shippingA;
cout<<"In Flipkart Rs."<<priceF<<"\n";
cout<<"In Snapdeal Rs."<<priceS<<"\n";
cout<<"In Amazon Rs."<<priceA<<"\n";
if(priceS<priceF)
{
if(priceS<priceA)
{
cout<<"He will prefer Snapdeal"<<"\n";
}
else
{
cout<<"He will prefer Amazon"<<"\n";
}
}
else
{
if(priceF<priceA)
{
cout<<"He will prefer Flipkart"<<"\n";
}
else
{
cout<<"He will prefer Amazon"<<"\n";
}
}
return 0;
}
|
UTF-8
|
Java
| 911 |
java
|
Main.java
|
Java
|
[] | null |
[] |
#include<iostream>
using namespace std;
int main()
{
int amountF,discountF,shippingF,amountS,discountS,shippingS,amountA,discountA,shippingA;
cin>>amountF>>discountF>>shippingF>>amountS>>discountS>>shippingS>>amountA>>discountA>>shippingA;
int priceF = amountF - (discountF*amountF)/100 + shippingF;
int priceS = amountS - (discountS*amountS)/100 + shippingS;
int priceA = amountA - (discountA*amountA)/100 + shippingA;
cout<<"In Flipkart Rs."<<priceF<<"\n";
cout<<"In Snapdeal Rs."<<priceS<<"\n";
cout<<"In Amazon Rs."<<priceA<<"\n";
if(priceS<priceF)
{
if(priceS<priceA)
{
cout<<"He will prefer Snapdeal"<<"\n";
}
else
{
cout<<"He will prefer Amazon"<<"\n";
}
}
else
{
if(priceF<priceA)
{
cout<<"He will prefer Flipkart"<<"\n";
}
else
{
cout<<"He will prefer Amazon"<<"\n";
}
}
return 0;
}
| 911 | 0.60483 | 0.593853 | 42 | 20.714285 | 24.736984 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false |
3
|
b25526b35f0ef3eeffaef4d5a787007f824ac7bc
| 27,264,452,411,201 |
49fc183641cb13886a8f9606e24a5884561dec53
|
/src/main/java/jjc/springboot1/dao/ProductPropertyValueDAO.java
|
cda2a1ffddf1e4466144be334949899ebd251137
|
[] |
no_license
|
Atomcheng/tmall_springboot
|
https://github.com/Atomcheng/tmall_springboot
|
8fa563ac02658a005782ded2cf969351abfee3b2
|
1d55ec028fda8764a096ec52ab0c327f412e8ba6
|
refs/heads/master
| 2023-02-09T10:53:33.136000 | 2021-01-07T02:25:11 | 2021-01-07T02:25:11 | 327,480,765 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package jjc.springboot1.dao;
import jjc.springboot1.pojo.Product;
import jjc.springboot1.pojo.ProductPropertyValue;
import jjc.springboot1.pojo.Property;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProductPropertyValueDAO extends JpaRepository<ProductPropertyValue, Integer> {
List<ProductPropertyValue> findByProduct(Product product);
}
|
UTF-8
|
Java
| 404 |
java
|
ProductPropertyValueDAO.java
|
Java
|
[] | null |
[] |
package jjc.springboot1.dao;
import jjc.springboot1.pojo.Product;
import jjc.springboot1.pojo.ProductPropertyValue;
import jjc.springboot1.pojo.Property;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProductPropertyValueDAO extends JpaRepository<ProductPropertyValue, Integer> {
List<ProductPropertyValue> findByProduct(Product product);
}
| 404 | 0.839109 | 0.829208 | 13 | 30.076923 | 29.305977 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.615385 | false | false |
3
|
6106a0ba33f85ad032f7a730aba9d47eccb477f2
| 9,440,338,163,124 |
6afd37153bc3fd2c18434f8ec80fe187d6927367
|
/src/com/bookstore/dao/TradeDAO.java
|
e4fc3884016a5405f14c9c8320d1add9d93d6b3b
|
[] |
no_license
|
RanxinTao/Bookstore
|
https://github.com/RanxinTao/Bookstore
|
97d500f8ffbd975f0ccd27e1d1282a0f9439a270
|
2f1810ea1b7209ad642c59327455e226f4dc5473
|
refs/heads/master
| 2021-01-19T00:49:13.283000 | 2016-11-25T05:32:45 | 2016-11-25T05:32:45 | 73,248,726 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bookstore.dao;
import java.util.Set;
import com.bookstore.entity.Trade;
public interface TradeDAO {
public abstract void insert(Trade trade); //insert a trade into database
public abstract Set<Trade> getTradesByUserId(int userId); //return a set of trades associate with the userId
}
|
UTF-8
|
Java
| 307 |
java
|
TradeDAO.java
|
Java
|
[] | null |
[] |
package com.bookstore.dao;
import java.util.Set;
import com.bookstore.entity.Trade;
public interface TradeDAO {
public abstract void insert(Trade trade); //insert a trade into database
public abstract Set<Trade> getTradesByUserId(int userId); //return a set of trades associate with the userId
}
| 307 | 0.771987 | 0.771987 | 13 | 22.615385 | 32.30513 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769231 | false | false |
3
|
077029c928808b8c6b2f76406137dc6753576391
| 395,137,001,049 |
02844a1bc2446f0deb1bee7db0f94d24556062b6
|
/social-im-provider/social-im-user-center/src/main/java/com/enuos/live/service/VisitorService.java
|
31cb8d974a8f504c8d77f49614ed1853b128f93c
|
[] |
no_license
|
xubinxmcog/xbObj20201120
|
https://github.com/xubinxmcog/xbObj20201120
|
7b48f73f910fc79854b59edec38c67a17ea35168
|
f4e9dc95ba69395eefb50c3c6f7ef4ba1a99943e
|
refs/heads/master
| 2023-01-23T02:51:45.427000 | 2020-11-30T02:59:32 | 2020-11-30T02:59:32 | 314,460,677 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.enuos.live.service;
import com.enuos.live.result.Result;
import java.util.Map;
/**
* @Description 访客业务
* @Author wangyingjie
* @Date 2020/7/14
* @Modified
*/
public interface VisitorService {
/**
* @Description: 保存访客记录
* @Param: [params]
* @Return: com.enuos.live.result.Result
* @Author: wangyingjie
* @Date: 2020/7/15
*/
Result save(Map<String, Object> params);
/**
* @Description: vip专享访客记录
* @Param: [params]
* @Return: com.enuos.live.result.Result
* @Author: wangyingjie
* @Date: 2020/7/14
*/
Result list(Map<String, Object> params);
}
|
UTF-8
|
Java
| 682 |
java
|
VisitorService.java
|
Java
|
[
{
"context": "ava.util.Map;\n\n/**\n * @Description 访客业务\n * @Author wangyingjie\n * @Date 2020/7/14\n * @Modified\n */\npublic interf",
"end": 141,
"score": 0.9995697140693665,
"start": 130,
"tag": "USERNAME",
"value": "wangyingjie"
},
{
"context": "urn: com.enuos.live.result.Result \n * @Author: wangyingjie\n * @Date: 2020/7/15 \n */ \n Result save",
"end": 349,
"score": 0.9996188282966614,
"start": 338,
"tag": "USERNAME",
"value": "wangyingjie"
},
{
"context": "turn: com.enuos.live.result.Result\n * @Author: wangyingjie\n * @Date: 2020/7/14\n */\n Result list(M",
"end": 569,
"score": 0.9996141195297241,
"start": 558,
"tag": "USERNAME",
"value": "wangyingjie"
}
] | null |
[] |
package com.enuos.live.service;
import com.enuos.live.result.Result;
import java.util.Map;
/**
* @Description 访客业务
* @Author wangyingjie
* @Date 2020/7/14
* @Modified
*/
public interface VisitorService {
/**
* @Description: 保存访客记录
* @Param: [params]
* @Return: com.enuos.live.result.Result
* @Author: wangyingjie
* @Date: 2020/7/15
*/
Result save(Map<String, Object> params);
/**
* @Description: vip专享访客记录
* @Param: [params]
* @Return: com.enuos.live.result.Result
* @Author: wangyingjie
* @Date: 2020/7/14
*/
Result list(Map<String, Object> params);
}
| 682 | 0.6 | 0.567692 | 33 | 18.69697 | 14.615236 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.212121 | false | false |
3
|
359c9b132c52c17f4e0977449bd891fd99cef98f
| 14,302,241,125,151 |
15b260ccada93e20bb696ae19b14ec62e78ed023
|
/v2/src/main/java/com/alipay/api/domain/AlipayOpenMiniWidgetGoodsUploadModel.java
|
ab2cb3127c2003986db55b7f6141d88f0bb1d399
|
[
"Apache-2.0"
] |
permissive
|
alipay/alipay-sdk-java-all
|
https://github.com/alipay/alipay-sdk-java-all
|
df461d00ead2be06d834c37ab1befa110736b5ab
|
8cd1750da98ce62dbc931ed437f6101684fbb66a
|
refs/heads/master
| 2023-08-27T03:59:06.566000 | 2023-08-22T14:54:57 | 2023-08-22T14:54:57 | 132,569,986 | 470 | 207 |
Apache-2.0
| false | 2022-12-25T07:37:40 | 2018-05-08T07:19:22 | 2022-12-17T09:20:53 | 2022-12-25T07:37:39 | 344,790 | 385 | 180 | 46 |
Java
| false | false |
package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 小部件商品上传
*
* @author auto create
* @since 1.0, 2022-12-06 13:21:14
*/
public class AlipayOpenMiniWidgetGoodsUploadModel extends AlipayObject {
private static final long serialVersionUID = 5482885376591658933L;
/**
* 商品信息列表
*/
@ApiListField("goods_list")
@ApiField("widget_goods_info")
private List<WidgetGoodsInfo> goodsList;
/**
* 用于承接品的商家小程序ID
*/
@ApiField("mini_app_id")
private String miniAppId;
/**
* 品的售卖商家,即承接该品的小程序背后的商家。和mini_app_id要求对应
*/
@ApiField("pid")
private String pid;
public List<WidgetGoodsInfo> getGoodsList() {
return this.goodsList;
}
public void setGoodsList(List<WidgetGoodsInfo> goodsList) {
this.goodsList = goodsList;
}
public String getMiniAppId() {
return this.miniAppId;
}
public void setMiniAppId(String miniAppId) {
this.miniAppId = miniAppId;
}
public String getPid() {
return this.pid;
}
public void setPid(String pid) {
this.pid = pid;
}
}
|
UTF-8
|
Java
| 1,236 |
java
|
AlipayOpenMiniWidgetGoodsUploadModel.java
|
Java
|
[
{
"context": "apping.ApiListField;\n\n/**\n * 小部件商品上传\n *\n * @author auto create\n * @since 1.0, 2022-12-06 13:21:14\n */\npublic cla",
"end": 235,
"score": 0.9039766192436218,
"start": 224,
"tag": "USERNAME",
"value": "auto create"
}
] | null |
[] |
package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 小部件商品上传
*
* @author auto create
* @since 1.0, 2022-12-06 13:21:14
*/
public class AlipayOpenMiniWidgetGoodsUploadModel extends AlipayObject {
private static final long serialVersionUID = 5482885376591658933L;
/**
* 商品信息列表
*/
@ApiListField("goods_list")
@ApiField("widget_goods_info")
private List<WidgetGoodsInfo> goodsList;
/**
* 用于承接品的商家小程序ID
*/
@ApiField("mini_app_id")
private String miniAppId;
/**
* 品的售卖商家,即承接该品的小程序背后的商家。和mini_app_id要求对应
*/
@ApiField("pid")
private String pid;
public List<WidgetGoodsInfo> getGoodsList() {
return this.goodsList;
}
public void setGoodsList(List<WidgetGoodsInfo> goodsList) {
this.goodsList = goodsList;
}
public String getMiniAppId() {
return this.miniAppId;
}
public void setMiniAppId(String miniAppId) {
this.miniAppId = miniAppId;
}
public String getPid() {
return this.pid;
}
public void setPid(String pid) {
this.pid = pid;
}
}
| 1,236 | 0.723986 | 0.693122 | 59 | 18.220339 | 18.87431 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.966102 | false | false |
3
|
ed9e7aba0f5d154554e30418ffc8da238f20214d
| 14,302,241,128,508 |
35f6203f788b9147e8647e296f5cab1037ab6b1d
|
/app/src/main/java/spinno/com/munchoba/settergetter/Innerdata2.java
|
827d24b0cd93cb625006e52df2e604c0bdcac8bf
|
[] |
no_license
|
Diwakarsingh9/Munchoba2
|
https://github.com/Diwakarsingh9/Munchoba2
|
7fbd32c9f79a4b164490ef35af1a97cbd0652b7e
|
2d34f89661d9c291ca83a1ffaa6f71a0b135a80e
|
refs/heads/master
| 2021-01-10T18:03:45.792000 | 2015-12-23T11:44:42 | 2015-12-23T11:44:42 | 48,487,641 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package spinno.com.munchoba.settergetter;
import com.google.gson.annotations.SerializedName;
/**
* Created by saifi45 on 8/6/2015.
*/
public class Innerdata2 {
@SerializedName("date")
public String dates11;
@SerializedName("time")
public String time;
@SerializedName("meal_type")
public String meal_type;
@SerializedName("food")
public String food;
@SerializedName("count")
public String counts;
@SerializedName("measurement")
public String measurement;
@SerializedName("calories")
public String calories;
}
|
UTF-8
|
Java
| 575 |
java
|
Innerdata2.java
|
Java
|
[
{
"context": "son.annotations.SerializedName;\n\n/**\n * Created by saifi45 on 8/6/2015.\n */\npublic class Innerdata2 {\n @S",
"end": 120,
"score": 0.9996145963668823,
"start": 113,
"tag": "USERNAME",
"value": "saifi45"
}
] | null |
[] |
package spinno.com.munchoba.settergetter;
import com.google.gson.annotations.SerializedName;
/**
* Created by saifi45 on 8/6/2015.
*/
public class Innerdata2 {
@SerializedName("date")
public String dates11;
@SerializedName("time")
public String time;
@SerializedName("meal_type")
public String meal_type;
@SerializedName("food")
public String food;
@SerializedName("count")
public String counts;
@SerializedName("measurement")
public String measurement;
@SerializedName("calories")
public String calories;
}
| 575 | 0.693913 | 0.674783 | 30 | 18.166666 | 15.236105 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
3
|
a2240cbd01946ad43bdd8937d91ffc8853387755
| 6,622,839,589,665 |
2b56256e6c6ce279d32ee7f41ae06cd498286697
|
/src/Analyzer.java
|
edc6e22a1b5620f66d0a3bdc9d13d4d873dac172
|
[] |
no_license
|
FirstRound/AvatarProject
|
https://github.com/FirstRound/AvatarProject
|
5985bcb2e4fd70b03b3c7211afdd65b0e462e90c
|
b6dd72a501dd8f166ebca567deb13f93b556586c
|
refs/heads/master
| 2021-01-10T17:22:51.818000 | 2016-03-06T09:38:09 | 2016-03-06T09:38:09 | 53,193,608 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Created by pisatel on 05.03.16.
* For analysis all data from DeviceController
* Can make analysis by time and by current data.
*
* Get devices controller to analyse consumption
*/
public class Analyzer {
private final int LOW_BOUND = 100;
private final int HIGHT_BOUND = 200;
private int _current_consumption = 0;
private double _avg_consumption;
private DevicesController _devices_controller = new DevicesController();
public Analyzer(DevicesController dc) {
_devices_controller = dc;
}
public void setAvgConsumption(double avg) {
_avg_consumption = avg;
}
public ConsumptionState getAvgConsumptionState() {
return gradeState((int)_avg_consumption);
}
public ConsumptionState getCurrentState() {
_current_consumption = _devices_controller.getCurrentConsumption();
_avg_consumption = (_avg_consumption + _current_consumption) / 2.0;
return gradeState(_current_consumption);
}
//TODO: make grading
private ConsumptionState gradeState(int value) {
ConsumptionState state;
if (_current_consumption <= LOW_BOUND)
state = ConsumptionState.LOW;
else if (_current_consumption <= HIGHT_BOUND && _current_consumption > LOW_BOUND)
state = ConsumptionState.HIGHT;
else
state = ConsumptionState.HIGHT;
return state;
}
}
|
UTF-8
|
Java
| 1,415 |
java
|
Analyzer.java
|
Java
|
[
{
"context": "/**\n * Created by pisatel on 05.03.16.\n * For analysis all data from Device",
"end": 25,
"score": 0.9995809197425842,
"start": 18,
"tag": "USERNAME",
"value": "pisatel"
}
] | null |
[] |
/**
* Created by pisatel on 05.03.16.
* For analysis all data from DeviceController
* Can make analysis by time and by current data.
*
* Get devices controller to analyse consumption
*/
public class Analyzer {
private final int LOW_BOUND = 100;
private final int HIGHT_BOUND = 200;
private int _current_consumption = 0;
private double _avg_consumption;
private DevicesController _devices_controller = new DevicesController();
public Analyzer(DevicesController dc) {
_devices_controller = dc;
}
public void setAvgConsumption(double avg) {
_avg_consumption = avg;
}
public ConsumptionState getAvgConsumptionState() {
return gradeState((int)_avg_consumption);
}
public ConsumptionState getCurrentState() {
_current_consumption = _devices_controller.getCurrentConsumption();
_avg_consumption = (_avg_consumption + _current_consumption) / 2.0;
return gradeState(_current_consumption);
}
//TODO: make grading
private ConsumptionState gradeState(int value) {
ConsumptionState state;
if (_current_consumption <= LOW_BOUND)
state = ConsumptionState.LOW;
else if (_current_consumption <= HIGHT_BOUND && _current_consumption > LOW_BOUND)
state = ConsumptionState.HIGHT;
else
state = ConsumptionState.HIGHT;
return state;
}
}
| 1,415 | 0.665724 | 0.655124 | 46 | 29.76087 | 24.289186 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.347826 | false | false |
3
|
94c4acb231234d625dfa16099eb56602e3ac76f1
| 32,590,211,865,381 |
a1cdf267670d62760ead7edef181d8e4287d528d
|
/Backend/manport/src/main/java/com/manportq/manport/Model/types/FrontEndTypes.java
|
bdde8170b8a2ee237b49f90f420f438315b9a7fa
|
[] |
no_license
|
Omer-Demirtas/Manport
|
https://github.com/Omer-Demirtas/Manport
|
c65d251dabeb830d3fc049ef06425fd2c65777ec
|
ae32662d584847286afe84d6b29f8b2f46bb1dde
|
refs/heads/main
| 2023-05-02T19:05:39.588000 | 2021-05-29T18:28:35 | 2021-05-29T18:28:35 | 354,624,904 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.manportq.manport.Model.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum FrontEndTypes
{
No_UI,
Other,
Pure_HTML_CSS_JS,
JSP,
Apache_Wicket,
BackboneJs,
ReactJs;
@JsonValue
public int toValue() {
return ordinal();
}
}
|
UTF-8
|
Java
| 301 |
java
|
FrontEndTypes.java
|
Java
|
[] | null |
[] |
package com.manportq.manport.Model.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum FrontEndTypes
{
No_UI,
Other,
Pure_HTML_CSS_JS,
JSP,
Apache_Wicket,
BackboneJs,
ReactJs;
@JsonValue
public int toValue() {
return ordinal();
}
}
| 301 | 0.644518 | 0.644518 | 19 | 14.842105 | 13.654624 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false |
3
|
056a297cd2affbd7ca8a77f83b29307450d3587b
| 24,979,529,813,066 |
70fe4ce6e9f0412adba90ca150bb94e686db4e2b
|
/app/src/main/java/com/otapp/net/Bus/Core/SeatMap.java
|
345558546b21547d6dd6a11a1b21f00fa89db8f6
|
[] |
no_license
|
vasimkhanp/otapppublic18_05_2020
|
https://github.com/vasimkhanp/otapppublic18_05_2020
|
9df63ad888def2d7448fff50b86f04a8b129f855
|
e7067af113c1fc61fc2734b52ca0a8358531c538
|
refs/heads/master
| 2022-07-30T13:19:59.116000 | 2020-05-18T07:11:06 | 2020-05-18T07:11:06 | 264,853,665 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.otapp.net.Bus.Core;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
public class SeatMap implements Parcelable {
@SerializedName("Status")
int Status;
@SerializedName("message")
String sMessage;
@SerializedName("busid")
String sBusId;
@SerializedName("route_id")
String sRouteId;
@SerializedName("sub_route_id")
String sSubRouteId;
@SerializedName("bus_route_id")
String sBusRouteId;
@SerializedName("bus_route_schedule_id")
String sBusRouteScheduleId;
@SerializedName("fromID")
String sFromID;
@SerializedName("toID")
String sToId;
@SerializedName("journeyDate")
String sJourneyDate;
@SerializedName("bus_route_seat_id")
String sBusRouteSeatId;
@SerializedName("TotalSeats")
String sTotalSeats;
@SerializedName("boarding_time")
String sBoardingTime;
@SerializedName("Seat_Row_count")
String sRowCount;
@SerializedName("seatDetails")
private ArrayList<Object> seatArrayList;
private String sAvailableSeats;
private String sProcessingSeats;
public SeatMap(int status, String sMessage, String sBusId, String sRouteId, String sSubRouteId,
String sBusRouteId, String sBusRouteScheduleId, String sFromID, String sToId,
String sJourneyDate, String sBusRouteSeatId, String sTotalSeats, String sBoardingTime,
String sRowCount, ArrayList<Object> seatArrayList, String sAvailableSeats, String sProcessingSeats) {
Status = status;
this.sMessage = sMessage;
this.sBusId = sBusId;
this.sRouteId = sRouteId;
this.sSubRouteId = sSubRouteId;
this.sBusRouteId = sBusRouteId;
this.sBusRouteScheduleId = sBusRouteScheduleId;
this.sFromID = sFromID;
this.sToId = sToId;
this.sJourneyDate = sJourneyDate;
this.sBusRouteSeatId = sBusRouteSeatId;
this.sTotalSeats = sTotalSeats;
this.sBoardingTime = sBoardingTime;
this.sRowCount = sRowCount;
this.seatArrayList = seatArrayList;
this.sAvailableSeats = sAvailableSeats;
this.sProcessingSeats = sProcessingSeats;
}
public SeatMap() {
}
public int getStatus() {
return Status;
}
public void setStatus(int status) {
Status = status;
}
public String getsMessage() {
return sMessage;
}
public void setsMessage(String sMessage) {
this.sMessage = sMessage;
}
public String getsBusId() {
return sBusId;
}
public void setsBusId(String sBusId) {
this.sBusId = sBusId;
}
public String getsRouteId() {
return sRouteId;
}
public void setsRouteId(String sRouteId) {
this.sRouteId = sRouteId;
}
public String getsSubRouteId() {
return sSubRouteId;
}
public void setsSubRouteId(String sSubRouteId) {
this.sSubRouteId = sSubRouteId;
}
public String getsBusRouteId() {
return sBusRouteId;
}
public void setsBusRouteId(String sBusRouteId) {
this.sBusRouteId = sBusRouteId;
}
public String getsBusRouteScheduleId() {
return sBusRouteScheduleId;
}
public void setsBusRouteScheduleId(String sBusRouteScheduleId) {
this.sBusRouteScheduleId = sBusRouteScheduleId;
}
public String getsFromID() {
return sFromID;
}
public void setsFromID(String sFromID) {
this.sFromID = sFromID;
}
public String getsToId() {
return sToId;
}
public void setsToId(String sToId) {
this.sToId = sToId;
}
public String getsJourneyDate() {
return sJourneyDate;
}
public void setsJourneyDate(String sJourneyDate) {
this.sJourneyDate = sJourneyDate;
}
public String getsBusRouteSeatId() {
return sBusRouteSeatId;
}
public void setsBusRouteSeatId(String sBusRouteSeatId) {
this.sBusRouteSeatId = sBusRouteSeatId;
}
public String getsTotalSeats() {
return sTotalSeats;
}
public void setsTotalSeats(String sTotalSeats) {
this.sTotalSeats = sTotalSeats;
}
public String getsBoardingTime() {
return sBoardingTime;
}
public void setsBoardingTime(String sBoardingTime) {
this.sBoardingTime = sBoardingTime;
}
public String getsRowCount() {
return sRowCount;
}
public void setsRowCount(String sRowCount) {
this.sRowCount = sRowCount;
}
public ArrayList<Object> getSeatArrayList() {
return seatArrayList;
}
public void setSeatArrayList(ArrayList<Object> seatArrayList) {
this.seatArrayList = seatArrayList;
}
public String getsAvailableSeats() {
return sAvailableSeats;
}
public void setsAvailableSeats(String sAvailableSeats) {
this.sAvailableSeats = sAvailableSeats;
}
public String getsProcessingSeats() {
return sProcessingSeats;
}
public void setsProcessingSeats(String sProcessingSeats) {
this.sProcessingSeats = sProcessingSeats;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.Status);
dest.writeString(this.sMessage);
dest.writeString(this.sBusId);
dest.writeString(this.sRouteId);
dest.writeString(this.sSubRouteId);
dest.writeString(this.sBusRouteId);
dest.writeString(this.sBusRouteScheduleId);
dest.writeString(this.sFromID);
dest.writeString(this.sToId);
dest.writeString(this.sJourneyDate);
dest.writeString(this.sBusRouteSeatId);
dest.writeString(this.sTotalSeats);
dest.writeString(this.sBoardingTime);
dest.writeString(this.sRowCount);
dest.writeList(this.seatArrayList);
dest.writeString(this.sAvailableSeats);
dest.writeString(this.sProcessingSeats);
}
protected SeatMap(Parcel in) {
this.Status = in.readInt();
this.sMessage = in.readString();
this.sBusId = in.readString();
this.sRouteId = in.readString();
this.sSubRouteId = in.readString();
this.sBusRouteId = in.readString();
this.sBusRouteScheduleId = in.readString();
this.sFromID = in.readString();
this.sToId = in.readString();
this.sJourneyDate = in.readString();
this.sBusRouteSeatId = in.readString();
this.sTotalSeats = in.readString();
this.sBoardingTime = in.readString();
this.sRowCount = in.readString();
this.seatArrayList = new ArrayList<Object>();
in.readList(this.seatArrayList, Object.class.getClassLoader());
this.sAvailableSeats = in.readString();
this.sProcessingSeats = in.readString();
}
public static final Creator<SeatMap> CREATOR = new Creator<SeatMap>() {
@Override
public SeatMap createFromParcel(Parcel source) {
return new SeatMap(source);
}
@Override
public SeatMap[] newArray(int size) {
return new SeatMap[size];
}
};
}
|
UTF-8
|
Java
| 7,332 |
java
|
SeatMap.java
|
Java
|
[] | null |
[] |
package com.otapp.net.Bus.Core;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
public class SeatMap implements Parcelable {
@SerializedName("Status")
int Status;
@SerializedName("message")
String sMessage;
@SerializedName("busid")
String sBusId;
@SerializedName("route_id")
String sRouteId;
@SerializedName("sub_route_id")
String sSubRouteId;
@SerializedName("bus_route_id")
String sBusRouteId;
@SerializedName("bus_route_schedule_id")
String sBusRouteScheduleId;
@SerializedName("fromID")
String sFromID;
@SerializedName("toID")
String sToId;
@SerializedName("journeyDate")
String sJourneyDate;
@SerializedName("bus_route_seat_id")
String sBusRouteSeatId;
@SerializedName("TotalSeats")
String sTotalSeats;
@SerializedName("boarding_time")
String sBoardingTime;
@SerializedName("Seat_Row_count")
String sRowCount;
@SerializedName("seatDetails")
private ArrayList<Object> seatArrayList;
private String sAvailableSeats;
private String sProcessingSeats;
public SeatMap(int status, String sMessage, String sBusId, String sRouteId, String sSubRouteId,
String sBusRouteId, String sBusRouteScheduleId, String sFromID, String sToId,
String sJourneyDate, String sBusRouteSeatId, String sTotalSeats, String sBoardingTime,
String sRowCount, ArrayList<Object> seatArrayList, String sAvailableSeats, String sProcessingSeats) {
Status = status;
this.sMessage = sMessage;
this.sBusId = sBusId;
this.sRouteId = sRouteId;
this.sSubRouteId = sSubRouteId;
this.sBusRouteId = sBusRouteId;
this.sBusRouteScheduleId = sBusRouteScheduleId;
this.sFromID = sFromID;
this.sToId = sToId;
this.sJourneyDate = sJourneyDate;
this.sBusRouteSeatId = sBusRouteSeatId;
this.sTotalSeats = sTotalSeats;
this.sBoardingTime = sBoardingTime;
this.sRowCount = sRowCount;
this.seatArrayList = seatArrayList;
this.sAvailableSeats = sAvailableSeats;
this.sProcessingSeats = sProcessingSeats;
}
public SeatMap() {
}
public int getStatus() {
return Status;
}
public void setStatus(int status) {
Status = status;
}
public String getsMessage() {
return sMessage;
}
public void setsMessage(String sMessage) {
this.sMessage = sMessage;
}
public String getsBusId() {
return sBusId;
}
public void setsBusId(String sBusId) {
this.sBusId = sBusId;
}
public String getsRouteId() {
return sRouteId;
}
public void setsRouteId(String sRouteId) {
this.sRouteId = sRouteId;
}
public String getsSubRouteId() {
return sSubRouteId;
}
public void setsSubRouteId(String sSubRouteId) {
this.sSubRouteId = sSubRouteId;
}
public String getsBusRouteId() {
return sBusRouteId;
}
public void setsBusRouteId(String sBusRouteId) {
this.sBusRouteId = sBusRouteId;
}
public String getsBusRouteScheduleId() {
return sBusRouteScheduleId;
}
public void setsBusRouteScheduleId(String sBusRouteScheduleId) {
this.sBusRouteScheduleId = sBusRouteScheduleId;
}
public String getsFromID() {
return sFromID;
}
public void setsFromID(String sFromID) {
this.sFromID = sFromID;
}
public String getsToId() {
return sToId;
}
public void setsToId(String sToId) {
this.sToId = sToId;
}
public String getsJourneyDate() {
return sJourneyDate;
}
public void setsJourneyDate(String sJourneyDate) {
this.sJourneyDate = sJourneyDate;
}
public String getsBusRouteSeatId() {
return sBusRouteSeatId;
}
public void setsBusRouteSeatId(String sBusRouteSeatId) {
this.sBusRouteSeatId = sBusRouteSeatId;
}
public String getsTotalSeats() {
return sTotalSeats;
}
public void setsTotalSeats(String sTotalSeats) {
this.sTotalSeats = sTotalSeats;
}
public String getsBoardingTime() {
return sBoardingTime;
}
public void setsBoardingTime(String sBoardingTime) {
this.sBoardingTime = sBoardingTime;
}
public String getsRowCount() {
return sRowCount;
}
public void setsRowCount(String sRowCount) {
this.sRowCount = sRowCount;
}
public ArrayList<Object> getSeatArrayList() {
return seatArrayList;
}
public void setSeatArrayList(ArrayList<Object> seatArrayList) {
this.seatArrayList = seatArrayList;
}
public String getsAvailableSeats() {
return sAvailableSeats;
}
public void setsAvailableSeats(String sAvailableSeats) {
this.sAvailableSeats = sAvailableSeats;
}
public String getsProcessingSeats() {
return sProcessingSeats;
}
public void setsProcessingSeats(String sProcessingSeats) {
this.sProcessingSeats = sProcessingSeats;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.Status);
dest.writeString(this.sMessage);
dest.writeString(this.sBusId);
dest.writeString(this.sRouteId);
dest.writeString(this.sSubRouteId);
dest.writeString(this.sBusRouteId);
dest.writeString(this.sBusRouteScheduleId);
dest.writeString(this.sFromID);
dest.writeString(this.sToId);
dest.writeString(this.sJourneyDate);
dest.writeString(this.sBusRouteSeatId);
dest.writeString(this.sTotalSeats);
dest.writeString(this.sBoardingTime);
dest.writeString(this.sRowCount);
dest.writeList(this.seatArrayList);
dest.writeString(this.sAvailableSeats);
dest.writeString(this.sProcessingSeats);
}
protected SeatMap(Parcel in) {
this.Status = in.readInt();
this.sMessage = in.readString();
this.sBusId = in.readString();
this.sRouteId = in.readString();
this.sSubRouteId = in.readString();
this.sBusRouteId = in.readString();
this.sBusRouteScheduleId = in.readString();
this.sFromID = in.readString();
this.sToId = in.readString();
this.sJourneyDate = in.readString();
this.sBusRouteSeatId = in.readString();
this.sTotalSeats = in.readString();
this.sBoardingTime = in.readString();
this.sRowCount = in.readString();
this.seatArrayList = new ArrayList<Object>();
in.readList(this.seatArrayList, Object.class.getClassLoader());
this.sAvailableSeats = in.readString();
this.sProcessingSeats = in.readString();
}
public static final Creator<SeatMap> CREATOR = new Creator<SeatMap>() {
@Override
public SeatMap createFromParcel(Parcel source) {
return new SeatMap(source);
}
@Override
public SeatMap[] newArray(int size) {
return new SeatMap[size];
}
};
}
| 7,332 | 0.650846 | 0.650709 | 266 | 26.481203 | 21.230953 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.488722 | false | false |
3
|
bb0dd415824c1191854c7510dd69fa8cee72bd7a
| 11,089,605,619,741 |
116925455e3a13517a499a53fe610e990d7d6462
|
/TrucksFirst_Android/TrucksFirst/src/main/java/com/fissionlabs/trucksfirst/checklist/SixthScreenFragment.java
|
ba6b3665c9360ee468eb4710f83a15a462fb3592
|
[] |
no_license
|
shivalakshmi/My
|
https://github.com/shivalakshmi/My
|
fb332c68037a505b8c60113de8c7e470e6dc17fb
|
76e9f030b8f97ac27ce1a71d8c03322bc49915bb
|
refs/heads/master
| 2021-01-10T03:50:48.382000 | 2015-11-17T14:53:24 | 2015-11-17T14:53:24 | 46,353,714 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fissionlabs.trucksfirst.checklist;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.support.annotation.Nullable;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.fissionlabs.trucksfirst.R;
import com.fissionlabs.trucksfirst.common.TFConst;
import com.fissionlabs.trucksfirst.model.checklist.NewChecklist;
import com.fissionlabs.trucksfirst.model.checklist.TollAmount;
import com.fissionlabs.trucksfirst.util.TFUtils;
import com.fissionlabs.trucksfirst.webservices.WebServices;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
/**
* @author ashok on 9/23/15.
*/
public class SixthScreenFragment extends CheckListCommonFragment {
private TextView mTvTime;
private int count = 10;
private boolean timeOver;
private int timeTaken = 0;
private RadioGroup radio_group_tollcash, radio_group_tollReceipt, radio_group_tollcashtopup;
private CheckBox chkNoEntry,chkMechanical, chkRepairExp, chkUnapprovedRtoExp, chkChallan, chkUnapprovedExp;
private EditText edittext_tollcash;
private WebServices mWebServices;
private TollAmount mTollAmount;
private TextView mTVRemainingTollAmount,mTVtollReceipt;
private NewChecklist newChecklist = FirstScreenFragment.newChecklist;
private ArrayList<String> mTollCashShortageList = new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// CheckListBaseFragment.moveToNext();
View view = inflater.inflate(R.layout.fragment_sixth_screen_checklist, container, false);
Button next = (Button) view.findViewById(R.id.btnNext);
radio_group_tollcash = (RadioGroup) view.findViewById(R.id.radio_group_tollcash);
radio_group_tollReceipt = (RadioGroup) view.findViewById(R.id.radio_group_tollReceipt);
radio_group_tollcashtopup = (RadioGroup) view.findViewById(R.id.radio_group_tollcashtopup);
chkNoEntry = (CheckBox) view.findViewById(R.id.chkNoEntry);
chkMechanical = (CheckBox) view.findViewById(R.id.chkMechanical);
chkRepairExp = (CheckBox) view.findViewById(R.id.chkRepairExp);
chkUnapprovedRtoExp = (CheckBox) view.findViewById(R.id.chkUnapprovedRtoExp);
chkChallan = (CheckBox) view.findViewById(R.id.chkChallan);
chkUnapprovedExp = (CheckBox) view.findViewById(R.id.chkUnapprovedExp);
edittext_tollcash = (EditText) view.findViewById(R.id.edittext_tollcash);
mTvTime = (TextView) view.findViewById(R.id.tvTime);
TextView tvPageNumber = (TextView) view.findViewById(R.id.tvPageNumber);
mTVRemainingTollAmount = (TextView)view.findViewById(R.id.remaining_toll_amount);
mTVtollReceipt = (TextView)view.findViewById(R.id.toll_receipt);
tvPageNumber.setText(String.format(getResources().getString(R.string.page_number), 6, 11));
mTvTime.setText(String.format(getResources().getString(R.string.timer), count));
startTimer();
mWebServices = new WebServices();
mWebServices.getTollAmount(getActivity(), new ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == TFConst.SUCCESS) {
String responseStr = resultData.getString("response");
if (responseStr != null) {
mTollAmount = new Gson().fromJson(responseStr, TollAmount.class);
mTVRemainingTollAmount.setText(Html.fromHtml(getActivity().getString(R.string.isthe_tollcash,mTollAmount.remainingTollAmount)));
mTVtollReceipt.setText(Html.fromHtml(getActivity().getString(R.string.toll_receipt,mTollAmount.prevHubToCurrentHubTollAmount)));
}
} else {
Toast.makeText(getActivity(), "" + getResources().getString(R.string.issue_parsing_data), Toast.LENGTH_SHORT).show();
}
TFUtils.hideProgressBar();
}
});
radio_group_tollReceipt.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton rb = (RadioButton) group.findViewById(checkedId);
if (null != rb && checkedId > -1) {
if (rb.getText().toString().equalsIgnoreCase("OK")) {
newChecklist.data.screen6.tollReceipts = true;
} else {
newChecklist.data.screen6.tollReceipts = false;
}
}
}
});
radio_group_tollcashtopup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton rb = (RadioButton) group.findViewById(checkedId);
if (null != rb && checkedId > -1) {
if (rb.getText().toString().equalsIgnoreCase("OK")) {
newChecklist.data.screen6.isTopUpDone = true;
} else {
newChecklist.data.screen6.isTopUpDone = false;
}
}
}
});
radio_group_tollcash.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton rb = (RadioButton) group.findViewById(checkedId);
if (null != rb && checkedId > -1) {
if (rb.getText().toString().equalsIgnoreCase("OK")) {
newChecklist.data.screen6.isCashWithDriverOk = true;
} else {
newChecklist.data.screen6.isCashWithDriverOk = false;
}
}
}
});
chkNoEntry.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkNoEntry.getText().toString());
} else {
mTollCashShortageList.remove(chkNoEntry.getText().toString());
}
}
});
chkMechanical.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkMechanical.getText().toString());
} else {
mTollCashShortageList.remove(chkMechanical.getText().toString());
}
}
});
chkRepairExp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkRepairExp.getText().toString());
} else {
mTollCashShortageList.remove(chkRepairExp.getText().toString());
}
}
});
chkUnapprovedRtoExp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkUnapprovedRtoExp.getText().toString());
} else {
mTollCashShortageList.remove(chkUnapprovedRtoExp.getText().toString());
}
}
});
chkChallan.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkChallan.getText().toString());
} else {
mTollCashShortageList.remove(chkChallan.getText().toString());
}
}
});
chkUnapprovedExp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkUnapprovedExp.getText().toString());
} else {
mTollCashShortageList.remove(chkUnapprovedExp.getText().toString());
}
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
newChecklist.data.screen6.tollCashWithDriver = mTollAmount.remainingTollAmount;
if(edittext_tollcash.getText().toString().length()>0)
newChecklist.data.screen6.inputAmount = Integer.parseInt(edittext_tollcash.getText().toString());
else
newChecklist.data.screen6.inputAmount = 0;
newChecklist.data.screen6.timeTaken = timeTaken;
if(mTollCashShortageList!=null) {
newChecklist.data.screen6.cashShortageReason = mTollCashShortageList.toString().replace("[", "").replace("]", "")
.replace(", ", ",");
}
else{
newChecklist.data.screen6.cashShortageReason = "";
}
CheckListBaseFragment.moveToNext();
}
});
return view;
}
private void startTimer() {
Timer T = new Timer();
T.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if (mHomeActivity == null) {
return;
}
mHomeActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (count == 0) {
timeOver = true;
}
if (timeOver) {
mTvTime.setTextColor(mHomeActivity.getResources().getColor(R.color.red));
mTvTime.setText(String.format(mHomeActivity.getResources().getString(R.string.timer), count));
count++;
} else {
mTvTime.setTextColor(mHomeActivity.getResources().getColor(R.color.black));
mTvTime.setText(String.format(mHomeActivity.getResources().getString(R.string.timer), count));
count--;
}
timeTaken++;
}
});
}
}, 20, 1000);
}
}
|
UTF-8
|
Java
| 11,466 |
java
|
SixthScreenFragment.java
|
Java
|
[
{
"context": "Timer;\nimport java.util.TimerTask;\n\n/**\n * @author ashok on 9/23/15.\n */\npublic class SixthScreenFragment ",
"end": 991,
"score": 0.9989766478538513,
"start": 986,
"tag": "USERNAME",
"value": "ashok"
}
] | null |
[] |
package com.fissionlabs.trucksfirst.checklist;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.support.annotation.Nullable;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.fissionlabs.trucksfirst.R;
import com.fissionlabs.trucksfirst.common.TFConst;
import com.fissionlabs.trucksfirst.model.checklist.NewChecklist;
import com.fissionlabs.trucksfirst.model.checklist.TollAmount;
import com.fissionlabs.trucksfirst.util.TFUtils;
import com.fissionlabs.trucksfirst.webservices.WebServices;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
/**
* @author ashok on 9/23/15.
*/
public class SixthScreenFragment extends CheckListCommonFragment {
private TextView mTvTime;
private int count = 10;
private boolean timeOver;
private int timeTaken = 0;
private RadioGroup radio_group_tollcash, radio_group_tollReceipt, radio_group_tollcashtopup;
private CheckBox chkNoEntry,chkMechanical, chkRepairExp, chkUnapprovedRtoExp, chkChallan, chkUnapprovedExp;
private EditText edittext_tollcash;
private WebServices mWebServices;
private TollAmount mTollAmount;
private TextView mTVRemainingTollAmount,mTVtollReceipt;
private NewChecklist newChecklist = FirstScreenFragment.newChecklist;
private ArrayList<String> mTollCashShortageList = new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// CheckListBaseFragment.moveToNext();
View view = inflater.inflate(R.layout.fragment_sixth_screen_checklist, container, false);
Button next = (Button) view.findViewById(R.id.btnNext);
radio_group_tollcash = (RadioGroup) view.findViewById(R.id.radio_group_tollcash);
radio_group_tollReceipt = (RadioGroup) view.findViewById(R.id.radio_group_tollReceipt);
radio_group_tollcashtopup = (RadioGroup) view.findViewById(R.id.radio_group_tollcashtopup);
chkNoEntry = (CheckBox) view.findViewById(R.id.chkNoEntry);
chkMechanical = (CheckBox) view.findViewById(R.id.chkMechanical);
chkRepairExp = (CheckBox) view.findViewById(R.id.chkRepairExp);
chkUnapprovedRtoExp = (CheckBox) view.findViewById(R.id.chkUnapprovedRtoExp);
chkChallan = (CheckBox) view.findViewById(R.id.chkChallan);
chkUnapprovedExp = (CheckBox) view.findViewById(R.id.chkUnapprovedExp);
edittext_tollcash = (EditText) view.findViewById(R.id.edittext_tollcash);
mTvTime = (TextView) view.findViewById(R.id.tvTime);
TextView tvPageNumber = (TextView) view.findViewById(R.id.tvPageNumber);
mTVRemainingTollAmount = (TextView)view.findViewById(R.id.remaining_toll_amount);
mTVtollReceipt = (TextView)view.findViewById(R.id.toll_receipt);
tvPageNumber.setText(String.format(getResources().getString(R.string.page_number), 6, 11));
mTvTime.setText(String.format(getResources().getString(R.string.timer), count));
startTimer();
mWebServices = new WebServices();
mWebServices.getTollAmount(getActivity(), new ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == TFConst.SUCCESS) {
String responseStr = resultData.getString("response");
if (responseStr != null) {
mTollAmount = new Gson().fromJson(responseStr, TollAmount.class);
mTVRemainingTollAmount.setText(Html.fromHtml(getActivity().getString(R.string.isthe_tollcash,mTollAmount.remainingTollAmount)));
mTVtollReceipt.setText(Html.fromHtml(getActivity().getString(R.string.toll_receipt,mTollAmount.prevHubToCurrentHubTollAmount)));
}
} else {
Toast.makeText(getActivity(), "" + getResources().getString(R.string.issue_parsing_data), Toast.LENGTH_SHORT).show();
}
TFUtils.hideProgressBar();
}
});
radio_group_tollReceipt.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton rb = (RadioButton) group.findViewById(checkedId);
if (null != rb && checkedId > -1) {
if (rb.getText().toString().equalsIgnoreCase("OK")) {
newChecklist.data.screen6.tollReceipts = true;
} else {
newChecklist.data.screen6.tollReceipts = false;
}
}
}
});
radio_group_tollcashtopup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton rb = (RadioButton) group.findViewById(checkedId);
if (null != rb && checkedId > -1) {
if (rb.getText().toString().equalsIgnoreCase("OK")) {
newChecklist.data.screen6.isTopUpDone = true;
} else {
newChecklist.data.screen6.isTopUpDone = false;
}
}
}
});
radio_group_tollcash.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton rb = (RadioButton) group.findViewById(checkedId);
if (null != rb && checkedId > -1) {
if (rb.getText().toString().equalsIgnoreCase("OK")) {
newChecklist.data.screen6.isCashWithDriverOk = true;
} else {
newChecklist.data.screen6.isCashWithDriverOk = false;
}
}
}
});
chkNoEntry.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkNoEntry.getText().toString());
} else {
mTollCashShortageList.remove(chkNoEntry.getText().toString());
}
}
});
chkMechanical.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkMechanical.getText().toString());
} else {
mTollCashShortageList.remove(chkMechanical.getText().toString());
}
}
});
chkRepairExp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkRepairExp.getText().toString());
} else {
mTollCashShortageList.remove(chkRepairExp.getText().toString());
}
}
});
chkUnapprovedRtoExp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkUnapprovedRtoExp.getText().toString());
} else {
mTollCashShortageList.remove(chkUnapprovedRtoExp.getText().toString());
}
}
});
chkChallan.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkChallan.getText().toString());
} else {
mTollCashShortageList.remove(chkChallan.getText().toString());
}
}
});
chkUnapprovedExp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mTollCashShortageList.add(chkUnapprovedExp.getText().toString());
} else {
mTollCashShortageList.remove(chkUnapprovedExp.getText().toString());
}
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
newChecklist.data.screen6.tollCashWithDriver = mTollAmount.remainingTollAmount;
if(edittext_tollcash.getText().toString().length()>0)
newChecklist.data.screen6.inputAmount = Integer.parseInt(edittext_tollcash.getText().toString());
else
newChecklist.data.screen6.inputAmount = 0;
newChecklist.data.screen6.timeTaken = timeTaken;
if(mTollCashShortageList!=null) {
newChecklist.data.screen6.cashShortageReason = mTollCashShortageList.toString().replace("[", "").replace("]", "")
.replace(", ", ",");
}
else{
newChecklist.data.screen6.cashShortageReason = "";
}
CheckListBaseFragment.moveToNext();
}
});
return view;
}
private void startTimer() {
Timer T = new Timer();
T.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if (mHomeActivity == null) {
return;
}
mHomeActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (count == 0) {
timeOver = true;
}
if (timeOver) {
mTvTime.setTextColor(mHomeActivity.getResources().getColor(R.color.red));
mTvTime.setText(String.format(mHomeActivity.getResources().getString(R.string.timer), count));
count++;
} else {
mTvTime.setTextColor(mHomeActivity.getResources().getColor(R.color.black));
mTvTime.setText(String.format(mHomeActivity.getResources().getString(R.string.timer), count));
count--;
}
timeTaken++;
}
});
}
}, 20, 1000);
}
}
| 11,466 | 0.602739 | 0.599686 | 282 | 39.659573 | 35.385681 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.556738 | false | false |
9
|
6b24571a52dd8125771d850e237ededa0284f7f7
| 26,697,516,771,277 |
724eff140a7a5bf42c4fb8c1d76adbd668d0d12c
|
/src/number/index_141_160/BinaryTreePostorderTraversal.java
|
960900099525c84d54da6b5f1255c842a3c94881
|
[] |
no_license
|
codemayq/leetcode
|
https://github.com/codemayq/leetcode
|
5cd2a1edee6dadd27562ccd3ddb19b6523df44e2
|
c3664e96fb069973f71393281abb24357939f22f
|
refs/heads/master
| 2019-01-01T15:29:16.077000 | 2018-03-10T15:43:46 | 2018-03-10T15:43:46 | 64,000,842 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package number.index_141_160;
import structure.TreeNode;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
/**
* NO.145
* Given a binary tree, return the postorder traversal of its nodes' values.
* For example:
* Given binary tree {1,#,2,3},
* 1
* \
* 2
* /
* 3
* <p>
* return [3,2,1].
* Note: Recursive solution is trivial, could you do it iteratively?
*/
public class BinaryTreePostorderTraversal {
public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> results = new ArrayList<>();
postorderTraversal(root, results);
return results;
}
public void postorderTraversal(TreeNode root, List<Integer> results) {
if (root == null)
return;
postorderTraversal(root.left, results);
postorderTraversal(root.right, results);
results.add(root.val);
}
public List<Integer> postorderTraversal2(TreeNode root) {
LinkedList<Integer> results = new LinkedList<>();
Stack<TreeNode> stack = new Stack<>();
TreeNode p = root;
while (!stack.isEmpty() || p != null) {
if (p != null) {
stack.push(p);
results.addFirst(p.val);
p = p.right;
} else {
TreeNode node = stack.pop();
p = node.left;
}
}
return results;
}
}
|
UTF-8
|
Java
| 1,438 |
java
|
BinaryTreePostorderTraversal.java
|
Java
|
[] | null |
[] |
package number.index_141_160;
import structure.TreeNode;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
/**
* NO.145
* Given a binary tree, return the postorder traversal of its nodes' values.
* For example:
* Given binary tree {1,#,2,3},
* 1
* \
* 2
* /
* 3
* <p>
* return [3,2,1].
* Note: Recursive solution is trivial, could you do it iteratively?
*/
public class BinaryTreePostorderTraversal {
public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> results = new ArrayList<>();
postorderTraversal(root, results);
return results;
}
public void postorderTraversal(TreeNode root, List<Integer> results) {
if (root == null)
return;
postorderTraversal(root.left, results);
postorderTraversal(root.right, results);
results.add(root.val);
}
public List<Integer> postorderTraversal2(TreeNode root) {
LinkedList<Integer> results = new LinkedList<>();
Stack<TreeNode> stack = new Stack<>();
TreeNode p = root;
while (!stack.isEmpty() || p != null) {
if (p != null) {
stack.push(p);
results.addFirst(p.val);
p = p.right;
} else {
TreeNode node = stack.pop();
p = node.left;
}
}
return results;
}
}
| 1,438 | 0.584145 | 0.570932 | 55 | 25.145454 | 20.731546 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.654545 | false | false |
9
|
11dffe427f057344161609bcb02bfbbaf7dfe3eb
| 12,652,973,667,591 |
a1962f005ca6a7b07daa42d33de5faafa28a4ff0
|
/com.finn/src/main/java/designpatterns/composite/transparent/Leaf.java
|
69eb8ff38eb98d6a8db39450da2a176e869141d2
|
[] |
no_license
|
MAXJOKER/keep-learning
|
https://github.com/MAXJOKER/keep-learning
|
8cf58e5d88528debbdbf045b312729cb4d184f81
|
be270d70ae4c0d17571bd94ecf1f75a5668c7aa0
|
refs/heads/master
| 2022-09-19T05:06:04.005000 | 2022-08-31T17:07:25 | 2022-08-31T17:07:25 | 173,444,314 | 6 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package designpatterns.composite.transparent;
/**
* @author maxjoker
* @date 2022-01-28 12:32
*/
public class Leaf extends Component {
/**
* 叶子对象名字
*/
private String name;
/**
* @param name
*/
public Leaf(String name) {
this.name = name;
}
/**
* 输出叶子对象结构,叶子对象没有子对象,直接输出名字
* @param preStr
*/
@Override
public void printStruct(String preStr) {
System.out.println(preStr + " - " + name);
}
}
|
UTF-8
|
Java
| 545 |
java
|
Leaf.java
|
Java
|
[
{
"context": "ignpatterns.composite.transparent;\n\n/**\n * @author maxjoker\n * @date 2022-01-28 12:32\n */\npublic class Leaf e",
"end": 70,
"score": 0.9995017051696777,
"start": 62,
"tag": "USERNAME",
"value": "maxjoker"
}
] | null |
[] |
package designpatterns.composite.transparent;
/**
* @author maxjoker
* @date 2022-01-28 12:32
*/
public class Leaf extends Component {
/**
* 叶子对象名字
*/
private String name;
/**
* @param name
*/
public Leaf(String name) {
this.name = name;
}
/**
* 输出叶子对象结构,叶子对象没有子对象,直接输出名字
* @param preStr
*/
@Override
public void printStruct(String preStr) {
System.out.println(preStr + " - " + name);
}
}
| 545 | 0.552795 | 0.52795 | 29 | 15.655172 | 14.690545 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | false | false |
9
|
8bbf9482d880463a821a9cf133c7aba4ac7bdded
| 12,652,973,669,866 |
67d18f5cb8235ca2bce3e69723a0c6458b34ceb1
|
/src/main/java/diplom/response/CommentResponse.java
|
55284eaffaaf93c21c75423fe19a1d1ab26db87d
|
[] |
no_license
|
altsora/BlogEngineDiplom
|
https://github.com/altsora/BlogEngineDiplom
|
6dd05873de1cf10018cc327b1f36314fa1e43e37
|
5ed69a29b9cbcacf616b77b7bfa3b0058c923e97
|
refs/heads/master
| 2023-03-12T08:57:59.305000 | 2021-02-25T20:48:12 | 2021-02-25T20:48:12 | 317,306,205 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package diplom.response;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@Builder
@RequiredArgsConstructor
public class CommentResponse {
private final long id;
private final long timestamp;
private final String text;
private final UserWithPhotoResponse user;
}
|
UTF-8
|
Java
| 324 |
java
|
CommentResponse.java
|
Java
|
[] | null |
[] |
package diplom.response;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@Builder
@RequiredArgsConstructor
public class CommentResponse {
private final long id;
private final long timestamp;
private final String text;
private final UserWithPhotoResponse user;
}
| 324 | 0.79321 | 0.79321 | 15 | 20.6 | 13.807244 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false |
9
|
07d837842196ad0373ff7583107060bc5d105018
| 1,735,166,839,970 |
0fc3be908c2fce963fef475e2f21b9a8e62f374a
|
/src/main/java/fr/ebiz/computerdatabase/ui/web/converter/LocalDatePropertyEditorSupport.java
|
0adaae5f722767ed49bffd0593406203a612ce0d
|
[] |
no_license
|
omegas27/training-java
|
https://github.com/omegas27/training-java
|
84e6a841822ba00b36f70e93d0a73d9fffc54275
|
3136fe0dc49887e204d61631fd212aba34399451
|
refs/heads/master
| 2020-12-10T03:13:20.981000 | 2017-08-04T13:15:41 | 2017-08-04T13:15:41 | 95,428,292 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package fr.ebiz.computerdatabase.ui.web.converter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import java.beans.PropertyEditorSupport;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
@Component
public final class LocalDatePropertyEditorSupport extends PropertyEditorSupport {
private final MessageSource messageSource;
/**
* Constructor.
*
* @param messageSource The messageSource source
*/
@Autowired
public LocalDatePropertyEditorSupport(@Qualifier("messageSource") MessageSource messageSource) {
this.messageSource = messageSource;
}
@Override
public String getAsText() {
LocalDate value = (LocalDate) getValue();
if (value != null) {
return getDateTimeFormatter().format(value);
}
return "";
}
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (text == null || text.isEmpty()) {
this.setValue(null);
} else {
this.setValue(LocalDate.parse(text, getDateTimeFormatter()));
}
}
/**
* Get the date fime formatter for the current locale.
*
* @return The date time formatter
*/
private DateTimeFormatter getDateTimeFormatter() {
Locale locale = LocaleContextHolder.getLocale();
return DateTimeFormatter.ofPattern(messageSource.getMessage("date.format", null, locale));
}
}
|
UTF-8
|
Java
| 1,713 |
java
|
LocalDatePropertyEditorSupport.java
|
Java
|
[] | null |
[] |
package fr.ebiz.computerdatabase.ui.web.converter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import java.beans.PropertyEditorSupport;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
@Component
public final class LocalDatePropertyEditorSupport extends PropertyEditorSupport {
private final MessageSource messageSource;
/**
* Constructor.
*
* @param messageSource The messageSource source
*/
@Autowired
public LocalDatePropertyEditorSupport(@Qualifier("messageSource") MessageSource messageSource) {
this.messageSource = messageSource;
}
@Override
public String getAsText() {
LocalDate value = (LocalDate) getValue();
if (value != null) {
return getDateTimeFormatter().format(value);
}
return "";
}
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (text == null || text.isEmpty()) {
this.setValue(null);
} else {
this.setValue(LocalDate.parse(text, getDateTimeFormatter()));
}
}
/**
* Get the date fime formatter for the current locale.
*
* @return The date time formatter
*/
private DateTimeFormatter getDateTimeFormatter() {
Locale locale = LocaleContextHolder.getLocale();
return DateTimeFormatter.ofPattern(messageSource.getMessage("date.format", null, locale));
}
}
| 1,713 | 0.70286 | 0.701693 | 56 | 29.607143 | 26.964712 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
9
|
05acdf595f51dea818e1d2fe2916bc3418709c79
| 29,824,252,952,771 |
9021fed361d399fb15535c6775fb275358940784
|
/src/main/java/com/mikey/shopx/repository/CartItemRepo.java
|
4fd13caf98223bdfba5bfcc1619794866438b82b
|
[] |
no_license
|
hellozexi/shopx
|
https://github.com/hellozexi/shopx
|
943e4fd40697cc0b1cc026fe20ce62b3ec8f363e
|
1fec11e37bb2311f213b6bdd6bfd57f974ef5831
|
refs/heads/master
| 2022-11-15T10:23:14.321000 | 2020-07-07T00:34:23 | 2020-07-07T00:34:23 | 261,910,819 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mikey.shopx.repository;
import com.mikey.shopx.model.CartItem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CartItemRepo extends JpaRepository<CartItem, Long> {
CartItem getCartItemById(Long id);
}
|
UTF-8
|
Java
| 312 |
java
|
CartItemRepo.java
|
Java
|
[] | null |
[] |
package com.mikey.shopx.repository;
import com.mikey.shopx.model.CartItem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CartItemRepo extends JpaRepository<CartItem, Long> {
CartItem getCartItemById(Long id);
}
| 312 | 0.826923 | 0.826923 | 10 | 30.200001 | 24.489998 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
9
|
2b5e1e01274a450e898011a8085c783aa4605002
| 8,589,985,913 |
282cc343302b3cb113bdbb00bc6afe2eac5f8c34
|
/src/assg1p1/RailNetworkTest.java
|
7424f8fa13b9404a401bf96cb4bc36715c67e116
|
[
"MIT"
] |
permissive
|
JoelMorrisey/comp-333-assingments
|
https://github.com/JoelMorrisey/comp-333-assingments
|
38b4a47740f11c44256eda2cf43eeec57f23def9
|
a09a749f8d6c8350ac95f761718cfad4c5f5f045
|
refs/heads/main
| 2023-06-21T09:07:10.410000 | 2021-07-23T06:29:56 | 2021-07-23T06:29:56 | 388,700,266 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package assg1p1;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.TreeSet;
import org.junit.Before;
import org.junit.Test;
public class RailNetworkTest {
RailNetwork r;
@Before public void initialize() {
String stationData = "src/data/station_data.csv";
String connectionData = "src/data/adjacent_stations.csv";
r = new RailNetwork(stationData,connectionData);
}
/** Tests for routeMinDistance with no failures **/
@Test
public void routeMinDistanceTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceTest2() {
String origin = "Hornsby";
String destination = "Chatswood";
String[] expected = {"Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara",
"Lindfield","Roseville","Chatswood"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
String[] expected = {"Wolli Creek","Tempe","Sydenham","St Peters",
"Erskineville","Redfern","Central","Town Hall"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
String[] expected = {"East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Flemington","Homebush",
"Strathfield","Burwood","Croydon","Ashfield","Summer Hill",
"Lewisham","Petersham","Stanmore","Newtown","Macdonaldtown",
"Redfern","Erskineville","St Peters","Sydenham","Tempe",
"Wolli Creek","Arncliffe","Banksia","Rockdale","Kogarah",
"Carlton","Allawah","Hurstville"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
/** Test for routeMinStop with no failures **/
@Test
public void routeMinStopTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopTest2() {
String origin = "Hornsby";
String destination = "Epping";
String[] expected = {"Hornsby","Normanhurst","Thornleigh","Pennant Hills",
"Beecroft","Cheltenham","Epping"};
ArrayList<String> actual = r.routeMinStop(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
String[] expected = {"Wolli Creek","International Airport",
"Domestic Airport","Mascot","Green Square",
"Central","Town Hall"};
ArrayList<String> actual = r.routeMinStop(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopTest4() {
String origin = "Richmond";
String destination = "Hurstville";
String[] expected = {"Richmond","East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Berala","Regents Park",
"Birrong","Yagoona","Bankstown","Punchbowl","Wiley Park",
"Lakemba","Belmore","Campsie","Canterbury","Hurlstone Park",
"Dulwich Hill","Marrickville","Sydenham","Tempe","Wolli Creek",
"Arncliffe","Banksia","Rockdale","Kogarah","Carlton","Allawah",
"Hurstville"};
ArrayList<String> actual = r.routeMinStop(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
/** Tests for routeMinDistance with failures **/
@Test
public void routeMinDistanceWithFailuresTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest2() {
String origin = "Hornsby";
String destination = "Epping";
TreeSet<String> failures = new TreeSet<>();
failures.add("Beecroft");
String[] expected = {"Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara","Lindfield",
"Roseville","Chatswood","North Ryde","Macquarie Park",
"Macquarie University","Epping"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
String[] expected = {"Wolli Creek","Tempe","Sydenham","St Peters",
"Erskineville","Redfern","Macdonaldtown","Newtown","Stanmore",
"Petersham","Lewisham","Summer Hill","Ashfield","Croydon",
"Burwood","Strathfield","North Strathfield","Concord West",
"Rhodes","Meadowbank","West Ryde","Denistone","Eastwood",
"Epping","Macquarie University","Macquarie Park","North Ryde",
"Chatswood","Artarmon","St Leonards","Wollstonecraft","Waverton",
"North Sydney","Milsons Point","Wynyard","Town Hall"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
String[] expected = {"East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Flemington","Homebush",
"Strathfield","North Strathfield","Concord West","Rhodes",
"Meadowbank","West Ryde","Denistone","Eastwood","Epping",
"Cheltenham","Beecroft","Pennant Hills","Thornleigh","Normanhurst",
"Hornsby","Waitara","Wahroonga","Warrawee","Turramurra","Pymble",
"Gordon","Killara","Lindfield","Roseville","Chatswood","Artarmon",
"St Leonards","Wollstonecraft","Waverton","North Sydney",
"Milsons Point","Wynyard","Town Hall","Central","Redfern",
"Erskineville","St Peters","Sydenham","Tempe","Wolli Creek",
"Arncliffe","Banksia","Rockdale","Kogarah","Carlton","Allawah",
"Hurstville"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest5() {
String origin = "Richmond";
String destination = "Blacktown";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("North Ryde");
String[] expected = {"Richmond","East Richmond","Clarendon","Windsor",
"Mulgrave","Vineyard","Riverstone","Schofields","Quakers Hill",
"Marayong","Blacktown"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest6() {
String origin = "Waterfall";
String destination = "Cronulla";
TreeSet<String> failures = new TreeSet<>();
failures.add("Sutherland");
String[] expected = {};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest7() {
String origin = "Leppington";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("Strathfield");
String[] expected = {};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
/** Tests for routeMinStop with failures **/
@Test
public void routeMinStopWithFailuresTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest2() {
String origin = "Hornsby";
String destination = "Epping";
TreeSet<String> failures = new TreeSet<>();
failures.add("Beecroft");
String[] expected = {"Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara","Lindfield",
"Roseville","Chatswood","North Ryde","Macquarie Park",
"Macquarie University","Epping"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
String[] expected = {"Wolli Creek","Tempe","Sydenham","St Peters",
"Erskineville","Redfern","Macdonaldtown","Newtown","Stanmore",
"Petersham","Lewisham","Summer Hill","Ashfield","Croydon",
"Burwood","Strathfield","North Strathfield","Concord West",
"Rhodes","Meadowbank","West Ryde","Denistone","Eastwood",
"Epping","Macquarie University","Macquarie Park","North Ryde",
"Chatswood","Artarmon","St Leonards","Wollstonecraft","Waverton",
"North Sydney","Milsons Point","Wynyard","Town Hall"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
String[] expected = {"East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Flemington","Homebush",
"Strathfield","North Strathfield","Concord West","Rhodes",
"Meadowbank","West Ryde","Denistone","Eastwood","Epping",
"Cheltenham","Beecroft","Pennant Hills","Thornleigh",
"Normanhurst","Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara","Lindfield","Roseville",
"Chatswood","Artarmon","St Leonards","Wollstonecraft","Waverton",
"North Sydney","Milsons Point","Wynyard","Town Hall","Central",
"Green Square","Mascot","Domestic Airport","International Airport",
"Wolli Creek","Arncliffe","Banksia","Rockdale","Kogarah","Carlton",
"Allawah","Hurstville"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest5() {
String origin = "Richmond";
String destination = "Blacktown";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("North Ryde");
String[] expected = {"Richmond","East Richmond","Clarendon","Windsor",
"Mulgrave","Vineyard","Riverstone","Schofields","Quakers Hill",
"Marayong","Blacktown"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest6() {
String origin = "Waterfall";
String destination = "Cronulla";
TreeSet<String> failures = new TreeSet<>();
failures.add("Sutherland");
String[] expected = {};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest7() {
String origin = "Leppington";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("Strathfield");
String[] expected = {};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
/** Tests for findTotalDistance **/
@Test
public void findTotalDistanceTest1() {
String origin = "Hornsby";
String destination = "Epping";
TreeSet<String> failures = new TreeSet<>();
int expected = 9703;
int actual = r.findTotalDistance(r.routeMinDistance(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest2() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
int expected = 70768;
int actual = r.findTotalDistance(r.routeMinDistance(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest3() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
int expected = 106712;
int actual = r.findTotalDistance(r.routeMinDistance(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
int expected = 108550;
int actual = r.findTotalDistance(r.routeMinStop(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest5() {
String origin = "Waterfall";
String destination = "Cronulla";
TreeSet<String> failures = new TreeSet<>();
failures.add("Sutherland");
int expected = 0;
int actual = r.findTotalDistance(r.routeMinStop(origin, destination, failures));
assertEquals(expected,actual);
}
/** Tests for optimalScanCost **/
@Test
public void optimalScanCostTest1() {
String origin = "Blacktown";
String destination = "Pendle Hill";
int expected = 9996;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest2() {
String origin = "Parramatta";
String destination = "Blacktown";
int expected = 29313;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest3() {
String origin = "Hornsby";
String destination = "Central";
int expected = 102062;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest4() {
String origin = "Central";
String destination = "Richmond";
int expected = 298418;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest5() {
String origin = "Richmond";
String destination = "Waterfall";
int expected = 533404;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
/** Tests for optimalScanSolution **/
@Test
public void optimalScanSolutionTest1() {
String origin = "Blacktown";
String destination = "Pendle Hill";
String[] expected = {"Seven Hills"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest2() {
String origin = "Parramatta";
String destination = "Blacktown";
String[] expected = {"Toongabbie", "Wentworthville"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest3() {
String origin = "Central";
String destination = "Hornsby";
String[] expected = {"Artarmon","Killara","Milsons Point","Pymble",
"Roseville","St Leonards","Turramurra","Wahroonga",
"Waverton","Wynyard"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest4() {
String origin = "Richmond";
String destination = "Central";
String[] expected = {"Ashfield","Blacktown","Burwood","Clarendon","Clyde",
"Harris Park","Homebush","Lewisham","Lidcombe",
"Macdonaldtown","Mulgrave","Parramatta","Pendle Hill",
"Quakers Hill","Riverstone","Seven Hills","Stanmore",
"Westmead"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest5() {
String origin = "Richmond";
String destination = "Waterfall";
String[] expected = {"Allawah","Arncliffe","Ashfield","Auburn","Burwood",
"Clarendon","Clyde","Como","Erskineville",
"Flemington","Harris Park","Heathcote","Homebush",
"Hurstville","Kogarah","Loftus","Marayong","Newtown",
"Oatley","Pendle Hill","Penshurst","Petersham",
"Redfern","Rockdale","Schofields","Seven Hills",
"Summer Hill","Sutherland","Sydenham","Tempe",
"Vineyard","Westmead","Windsor"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
}
|
UTF-8
|
Java
| 18,913 |
java
|
RailNetworkTest.java
|
Java
|
[
{
"context": "void routeMinDistanceTest1() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tString[] ex",
"end": 589,
"score": 0.7867212295532227,
"start": 582,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "tring origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tString[] expected = {\"Hornsby\"};\n\t\t\n\t\tArr",
"end": 619,
"score": 0.5294829607009888,
"start": 616,
"tag": "NAME",
"value": "Hor"
},
{
"context": "void routeMinDistanceTest2() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Chatswood\";\n\t\tString[] ",
"end": 861,
"score": 0.7842469215393066,
"start": 854,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "estination = \"Chatswood\";\n\t\tString[] expected = {\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\t\t\t \"Tur",
"end": 929,
"score": 0.6451675891876221,
"start": 924,
"tag": "NAME",
"value": "Horns"
},
{
"context": "mington\",\"Homebush\",\n\t\t\t\t\"Strathfield\",\"Burwood\",\"Croydon\",\"Ashfield\",\"Summer Hill\",\n\t\t\t\t\"Lewisham\",\"Peters",
"end": 2043,
"score": 0.7319386601448059,
"start": 2036,
"tag": "NAME",
"value": "Croydon"
},
{
"context": "don\",\"Ashfield\",\"Summer Hill\",\n\t\t\t\t\"Lewisham\",\"Petersham\",\"Stanmore\",\"Newtown\",\"Macdonaldtown\",\n\t\t\t\t\"Re",
"end": 2093,
"score": 0.5689669251441956,
"start": 2090,
"tag": "NAME",
"value": "ers"
},
{
"context": "n\",\"Macdonaldtown\",\n\t\t\t\t\"Redfern\",\"Erskineville\",\"St Peters\",\"Sydenham\",\"Tempe\",\n\t\t\t\t\"Wolli Creek\",\"Arncli",
"end": 2172,
"score": 0.6280697584152222,
"start": 2166,
"tag": "NAME",
"value": "St Pet"
},
{
"context": ",\"Arncliffe\",\"Banksia\",\"Rockdale\",\"Kogarah\",\n\t\t\t\t\"Carlton\",\"Allawah\",\"Hurstville\"};\n\n\t\t\n\t\tArrayList<String>",
"end": 2271,
"score": 0.8312900066375732,
"start": 2264,
"tag": "NAME",
"value": "Carlton"
},
{
"context": "lic void routeMinStopTest1() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tString[] ex",
"end": 2543,
"score": 0.8235254883766174,
"start": 2536,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "tring origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tString[] expected = {\"Hornsby\"};\n\t\t\n\t\tArr",
"end": 2573,
"score": 0.6134339570999146,
"start": 2570,
"tag": "NAME",
"value": "Hor"
},
{
"context": "lic void routeMinStopTest2() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Epping\";\n\t\tString[] exp",
"end": 2810,
"score": 0.8480911254882812,
"start": 2803,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "g destination = \"Epping\";\n\t\tString[] expected = {\"Hornsby\",\"Normanhurst\",\"Thornleigh\",\"Pennant Hills\",\n\t\t",
"end": 2875,
"score": 0.5758486986160278,
"start": 2870,
"tag": "NAME",
"value": "Horns"
},
{
"context": "lic void routeMinStopTest4() {\n\t\tString origin = \"Richmond\";\n\t\tString destination = \"Hurstville\";\n\t\tString[]",
"end": 3540,
"score": 0.9347764253616333,
"start": 3532,
"tag": "NAME",
"value": "Richmond"
},
{
"context": "nDistanceWithFailuresTest1() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tTreeSet<Str",
"end": 4455,
"score": 0.8535173535346985,
"start": 4448,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "tring origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tTreeSet<String> failures = new TreeSet<>(",
"end": 4485,
"score": 0.5455856919288635,
"start": 4482,
"tag": "NAME",
"value": "Hor"
},
{
"context": "nDistanceWithFailuresTest2() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Epping\";\n\t\tTreeSet<St",
"end": 4793,
"score": 0.5678596496582031,
"start": 4788,
"tag": "NAME",
"value": "Horns"
},
{
"context": "ailures.add(\"Beecroft\");\n\n\t\tString[] expected = {\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurr",
"end": 4937,
"score": 0.9643256068229675,
"start": 4930,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "d(\"Beecroft\");\n\n\t\tString[] expected = {\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble",
"end": 4947,
"score": 0.9724718928337097,
"start": 4940,
"tag": "NAME",
"value": "Waitara"
},
{
"context": "t\");\n\n\t\tString[] expected = {\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"G",
"end": 4951,
"score": 0.6177849769592285,
"start": 4950,
"tag": "NAME",
"value": "W"
},
{
"context": "ng[] expected = {\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Kill",
"end": 4963,
"score": 0.5118981599807739,
"start": 4962,
"tag": "NAME",
"value": "W"
},
{
"context": "{\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\n\t\t\t\t\"Ro",
"end": 4988,
"score": 0.9324491620063782,
"start": 4978,
"tag": "NAME",
"value": "Turramurra"
},
{
"context": "aitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\n\t\t\t\t\"Roseville\",",
"end": 4997,
"score": 0.9545990824699402,
"start": 4991,
"tag": "NAME",
"value": "Pymble"
},
{
"context": "Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\n\t\t\t\t\"Roseville\",\"Chatswoo",
"end": 5006,
"score": 0.9884824752807617,
"start": 5000,
"tag": "NAME",
"value": "Gordon"
},
{
"context": "\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\n\t\t\t\t\"Roseville\",\"Chatswood\",\"North ",
"end": 5016,
"score": 0.9912261962890625,
"start": 5009,
"tag": "NAME",
"value": "Killara"
},
{
"context": "Hills\",\"Thornleigh\",\"Normanhurst\",\n\t\t\t\t\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\"Turramurra\",\"Pymble\",",
"end": 6960,
"score": 0.6044435501098633,
"start": 6956,
"tag": "NAME",
"value": "Wait"
},
{
"context": "Wahroonga\",\"Warrawee\",\"Turramurra\",\"Pymble\",\n\t\t\t\t\"Gordon\",\"Killara\",\"Lindfield\",\"Roseville\",\"Chatswood\",\"A",
"end": 7022,
"score": 0.9721412658691406,
"start": 7016,
"tag": "NAME",
"value": "Gordon"
},
{
"context": "\",\"Warrawee\",\"Turramurra\",\"Pymble\",\n\t\t\t\t\"Gordon\",\"Killara\",\"Lindfield\",\"Roseville\",\"Chatswood\",\"Artarmon\",\n",
"end": 7032,
"score": 0.9861288070678711,
"start": 7025,
"tag": "NAME",
"value": "Killara"
},
{
"context": "n\",\"Killara\",\"Lindfield\",\"Roseville\",\"Chatswood\",\"Artarmon\",\n\t\t\t\t\"St Leonards\",\"Wollstonecraft\",\"Wavert",
"end": 7074,
"score": 0.6763408780097961,
"start": 7071,
"tag": "NAME",
"value": "Art"
},
{
"context": "St Peters\",\"Sydenham\",\"Tempe\",\"Wolli Creek\",\n\t\t\t\t\"Arncliffe\",\"Banksia\",\"Rockdale\",\"Kogarah\",\"Carlton\",\"",
"end": 7280,
"score": 0.5064290165901184,
"start": 7277,
"tag": "NAME",
"value": "Arn"
},
{
"context": ",\n\t\t\t\t\"Arncliffe\",\"Banksia\",\"Rockdale\",\"Kogarah\",\"Carlton\",\"Allawah\",\n\t\t\t\t\"Hurstville\"};\n\t\t \n\t\t\n\t\tArrayList",
"end": 7327,
"score": 0.6641309857368469,
"start": 7320,
"tag": "NAME",
"value": "Carlton"
},
{
"context": "nDistanceWithFailuresTest5() {\n\t\tString origin = \"Richmond\";\n\t\tString destination = \"Blacktown\";\n\t\tTreeSet<S",
"end": 7584,
"score": 0.9887974858283997,
"start": 7576,
"tag": "NAME",
"value": "Richmond"
},
{
"context": "ilures.add(\"North Ryde\");\n\t\tString[] expected = {\"Richmond\",\"East Richmond\",\"Clarendon\",\"Windsor\",\n\t\t\t\t\"",
"end": 7754,
"score": 0.8581875562667847,
"start": 7750,
"tag": "NAME",
"value": "Rich"
},
{
"context": "teMinStopWithFailuresTest1() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tTreeSet<Str",
"end": 8927,
"score": 0.7012419700622559,
"start": 8920,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "tring origin = \"Hornsby\";\n\t\tString destination = \"Hornsby\";\n\t\tTreeSet<String> failures = new TreeSet<>(",
"end": 8957,
"score": 0.5374632477760315,
"start": 8954,
"tag": "NAME",
"value": "Hor"
},
{
"context": "teMinStopWithFailuresTest2() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Epping\";\n\t\tTreeSet<Stri",
"end": 9259,
"score": 0.8517209887504578,
"start": 9252,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "\"West Ryde\",\"Denistone\",\"Eastwood\",\"Epping\",\n\t\t\t\t\"Cheltenham\",\"Beecroft\",\"Pennant Hills\",\"Thornleigh\",\n\t\t\t\t\"No",
"end": 11332,
"score": 0.8557477593421936,
"start": 11322,
"tag": "NAME",
"value": "Cheltenham"
},
{
"context": "Denistone\",\"Eastwood\",\"Epping\",\n\t\t\t\t\"Cheltenham\",\"Beecroft\",\"Pennant Hills\",\"Thornleigh\",\n\t\t\t\t\"Normanhurst\",",
"end": 11343,
"score": 0.7386091947555542,
"start": 11335,
"tag": "NAME",
"value": "Beecroft"
},
{
"context": "\"Eastwood\",\"Epping\",\n\t\t\t\t\"Cheltenham\",\"Beecroft\",\"Pennant Hills\",\"Thornleigh\",\n\t\t\t\t\"Normanhurst\",\"Hornsby\",\"Waita",
"end": 11359,
"score": 0.7573072910308838,
"start": 11346,
"tag": "NAME",
"value": "Pennant Hills"
},
{
"context": "am\",\"Beecroft\",\"Pennant Hills\",\"Thornleigh\",\n\t\t\t\t\"Normanhurst\",\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee",
"end": 11384,
"score": 0.6405015587806702,
"start": 11380,
"tag": "NAME",
"value": "Norm"
},
{
"context": "roft\",\"Pennant Hills\",\"Thornleigh\",\n\t\t\t\t\"Normanhurst\",\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t",
"end": 11391,
"score": 0.514829695224762,
"start": 11389,
"tag": "NAME",
"value": "st"
},
{
"context": ",\"Pennant Hills\",\"Thornleigh\",\n\t\t\t\t\"Normanhurst\",\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurr",
"end": 11401,
"score": 0.8778457641601562,
"start": 11394,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "Hills\",\"Thornleigh\",\n\t\t\t\t\"Normanhurst\",\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble",
"end": 11411,
"score": 0.9180343151092529,
"start": 11404,
"tag": "NAME",
"value": "Waitara"
},
{
"context": ",\"Hornsby\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\"Ros",
"end": 11448,
"score": 0.6780996322631836,
"start": 11442,
"tag": "NAME",
"value": "Turram"
},
{
"context": "y\",\"Waitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\"Rosevil",
"end": 11452,
"score": 0.5838712453842163,
"start": 11450,
"tag": "NAME",
"value": "ra"
},
{
"context": "aitara\",\"Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\"Roseville\",\n\t\t\t\t",
"end": 11461,
"score": 0.8260303139686584,
"start": 11455,
"tag": "NAME",
"value": "Pymble"
},
{
"context": "Wahroonga\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\"Roseville\",\n\t\t\t\t\"Chatswoo",
"end": 11470,
"score": 0.9761611819267273,
"start": 11464,
"tag": "NAME",
"value": "Gordon"
},
{
"context": "\",\"Warrawee\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\"Roseville\",\n\t\t\t\t\"Chatswood\",\"Artarm",
"end": 11480,
"score": 0.9745059013366699,
"start": 11473,
"tag": "NAME",
"value": "Killara"
},
{
"context": "e\",\n\t\t\t\t\"Turramurra\",\"Pymble\",\"Gordon\",\"Killara\",\"Lindfield\",\"Roseville\",\n\t\t\t\t\"Chatswood\",\"Artarmon\",\"St Leon",
"end": 11492,
"score": 0.6390107870101929,
"start": 11483,
"tag": "NAME",
"value": "Lindfield"
},
{
"context": "illara\",\"Lindfield\",\"Roseville\",\n\t\t\t\t\"Chatswood\",\"Artarmon\",\"St Leonards\",\"Wollstonecraft\",\"Waverton\",\n\t\t\t\t\"",
"end": 11532,
"score": 0.9526582360267639,
"start": 11524,
"tag": "NAME",
"value": "Artarmon"
},
{
"context": "reek\",\"Arncliffe\",\"Banksia\",\"Rockdale\",\"Kogarah\",\"Carlton\",\n\t\t\t\t\"Allawah\",\"Hurstville\"};\n\t\t \n\t\t \n\t\tArrayLis",
"end": 11786,
"score": 0.8587786555290222,
"start": 11779,
"tag": "NAME",
"value": "Carlton"
},
{
"context": "ng origin = \"Leppington\";\n\t\tString destination = \"Hornsby\";\n\t\tTreeSet<String> failures = new TreeSet<>();\n\t",
"end": 12963,
"score": 0.9993813633918762,
"start": 12956,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "oid findTotalDistanceTest1() {\n\t\tString origin = \"Hornsby\";\n\t\tString destination = \"Epping\";\n\t\tTreeSet<Stri",
"end": 13344,
"score": 0.9995570182800293,
"start": 13337,
"tag": "NAME",
"value": "Hornsby"
},
{
"context": "tring origin = \"Hornsby\";\n\t\tString destination = \"Epping\";\n\t\tTreeSet<String> failures = new TreeSet<>();\n\t",
"end": 13377,
"score": 0.6746958494186401,
"start": 13371,
"tag": "NAME",
"value": "Epping"
},
{
"context": "ring> failures = new TreeSet<>();\n\t\tfailures.add(\"Burwood\");\n\t\tfailures.add(\"Bankstown\");\n\t\tfailures.add(\"L",
"end": 14083,
"score": 0.9392951726913452,
"start": 14076,
"tag": "NAME",
"value": "Burwood"
},
{
"context": "ring> failures = new TreeSet<>();\n\t\tfailures.add(\"Burwood\");\n\t\tfailures.add(\"Bankstown\");\n\t\tfailures.add(\"L",
"end": 14517,
"score": 0.8968846797943115,
"start": 14510,
"tag": "NAME",
"value": "Burwood"
},
{
"context": "stination = \"Hornsby\";\n\t\t\n\t\tString[] expected = {\"Artarmon\",\"Killara\",\"Milsons Point\",\"Pymble\",\n\t\t\t\t\t\t\t \"Ros",
"end": 17277,
"score": 0.9985415935516357,
"start": 17269,
"tag": "NAME",
"value": "Artarmon"
},
{
"context": " \"Hornsby\";\n\t\t\n\t\tString[] expected = {\"Artarmon\",\"Killara\",\"Milsons Point\",\"Pymble\",\n\t\t\t\t\t\t\t \"Roseville\",\"S",
"end": 17287,
"score": 0.9884204864501953,
"start": 17280,
"tag": "NAME",
"value": "Killara"
},
{
"context": "d optimalScanSolutionTest4() {\n\t\tString origin = \"Richmond\";\n\t\tString destination = \"Central\";\n\t\t\n\t\tString[]",
"end": 17662,
"score": 0.9787235260009766,
"start": 17654,
"tag": "NAME",
"value": "Richmond"
},
{
"context": "d optimalScanSolutionTest5() {\n\t\tString origin = \"Richmond\";\n\t\tString destination = \"Waterfall\";\n\t\t\n\t\tString",
"end": 18235,
"score": 0.9333834648132324,
"start": 18227,
"tag": "NAME",
"value": "Richmond"
},
{
"context": "ination = \"Waterfall\";\n\t\t\n\t\tString[] expected = {\"Allawah\",\"Arncliffe\",\"Ashfield\",\"Auburn\",\"Burwood\",\n\t\t\t\t\t",
"end": 18308,
"score": 0.9962562918663025,
"start": 18301,
"tag": "NAME",
"value": "Allawah"
},
{
"context": "\"Waterfall\";\n\t\t\n\t\tString[] expected = {\"Allawah\",\"Arncliffe\",\"Ashfield\",\"Auburn\",\"Burwood\",\n\t\t\t\t\t\t\t \"Clarendo",
"end": 18320,
"score": 0.9993505477905273,
"start": 18311,
"tag": "NAME",
"value": "Arncliffe"
},
{
"context": "\n\t\t\n\t\tString[] expected = {\"Allawah\",\"Arncliffe\",\"Ashfield\",\"Auburn\",\"Burwood\",\n\t\t\t\t\t\t\t \"Clarendon\",\"Clyde\",",
"end": 18331,
"score": 0.9038845896720886,
"start": 18323,
"tag": "NAME",
"value": "Ashfield"
},
{
"context": "g[] expected = {\"Allawah\",\"Arncliffe\",\"Ashfield\",\"Auburn\",\"Burwood\",\n\t\t\t\t\t\t\t \"Clarendon\",\"Clyde\",\"Como\"",
"end": 18337,
"score": 0.6344012022018433,
"start": 18334,
"tag": "NAME",
"value": "Aub"
},
{
"context": "rncliffe\",\"Ashfield\",\"Auburn\",\"Burwood\",\n\t\t\t\t\t\t\t \"Clarendon\",\"Clyde\",\"Como\",\"Erskineville\",\n\t\t\t\t\t\t\t \"Flemingt",
"end": 18371,
"score": 0.9910424947738647,
"start": 18362,
"tag": "NAME",
"value": "Clarendon"
},
{
"context": "shfield\",\"Auburn\",\"Burwood\",\n\t\t\t\t\t\t\t \"Clarendon\",\"Clyde\",\"Como\",\"Erskineville\",\n\t\t\t\t\t\t\t \"Flemington\",\"Har",
"end": 18379,
"score": 0.9837072491645813,
"start": 18374,
"tag": "NAME",
"value": "Clyde"
},
{
"context": ",\"Auburn\",\"Burwood\",\n\t\t\t\t\t\t\t \"Clarendon\",\"Clyde\",\"Como\",\"Erskineville\",\n\t\t\t\t\t\t\t \"Flemington\",\"Harris Par",
"end": 18386,
"score": 0.9163492918014526,
"start": 18382,
"tag": "NAME",
"value": "Como"
},
{
"context": "larendon\",\"Clyde\",\"Como\",\"Erskineville\",\n\t\t\t\t\t\t\t \"Flemington\",\"Harris Park\",\"Heathcote\",\"Homebush\",\n\t\t\t\t\t\t\t \"H",
"end": 18423,
"score": 0.810245156288147,
"start": 18413,
"tag": "NAME",
"value": "Flemington"
},
{
"context": "own\",\n\t\t\t\t\t\t\t \"Oatley\",\"Pendle Hill\",\"Penshurst\",\"Petersham\",\n\t\t\t\t\t\t\t \"Redfern\",\"Rockdale\",\"Schofields\",\"Seve",
"end": 18578,
"score": 0.6967533230781555,
"start": 18569,
"tag": "NAME",
"value": "Petersham"
},
{
"context": "\",\"Pendle Hill\",\"Penshurst\",\"Petersham\",\n\t\t\t\t\t\t\t \"Redfern\",\"Rockdale\",\"Schofields\",\"Seven Hills\",\n\t\t\t\t\t\t\t \"",
"end": 18597,
"score": 0.7183700203895569,
"start": 18590,
"tag": "NAME",
"value": "Redfern"
}
] | null |
[] |
package assg1p1;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.TreeSet;
import org.junit.Before;
import org.junit.Test;
public class RailNetworkTest {
RailNetwork r;
@Before public void initialize() {
String stationData = "src/data/station_data.csv";
String connectionData = "src/data/adjacent_stations.csv";
r = new RailNetwork(stationData,connectionData);
}
/** Tests for routeMinDistance with no failures **/
@Test
public void routeMinDistanceTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceTest2() {
String origin = "Hornsby";
String destination = "Chatswood";
String[] expected = {"Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara",
"Lindfield","Roseville","Chatswood"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
String[] expected = {"Wolli Creek","Tempe","Sydenham","St Peters",
"Erskineville","Redfern","Central","Town Hall"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
String[] expected = {"East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Flemington","Homebush",
"Strathfield","Burwood","Croydon","Ashfield","Summer Hill",
"Lewisham","Petersham","Stanmore","Newtown","Macdonaldtown",
"Redfern","Erskineville","<NAME>ers","Sydenham","Tempe",
"Wolli Creek","Arncliffe","Banksia","Rockdale","Kogarah",
"Carlton","Allawah","Hurstville"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
/** Test for routeMinStop with no failures **/
@Test
public void routeMinStopTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinDistance(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopTest2() {
String origin = "Hornsby";
String destination = "Epping";
String[] expected = {"Hornsby","Normanhurst","Thornleigh","Pennant Hills",
"Beecroft","Cheltenham","Epping"};
ArrayList<String> actual = r.routeMinStop(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
String[] expected = {"Wolli Creek","International Airport",
"Domestic Airport","Mascot","Green Square",
"Central","Town Hall"};
ArrayList<String> actual = r.routeMinStop(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopTest4() {
String origin = "Richmond";
String destination = "Hurstville";
String[] expected = {"Richmond","East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Berala","Regents Park",
"Birrong","Yagoona","Bankstown","Punchbowl","Wiley Park",
"Lakemba","Belmore","Campsie","Canterbury","Hurlstone Park",
"Dulwich Hill","Marrickville","Sydenham","Tempe","Wolli Creek",
"Arncliffe","Banksia","Rockdale","Kogarah","Carlton","Allawah",
"Hurstville"};
ArrayList<String> actual = r.routeMinStop(origin, destination);
assertArrayEquals(expected, actual.toArray());
}
/** Tests for routeMinDistance with failures **/
@Test
public void routeMinDistanceWithFailuresTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest2() {
String origin = "Hornsby";
String destination = "Epping";
TreeSet<String> failures = new TreeSet<>();
failures.add("Beecroft");
String[] expected = {"Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara","Lindfield",
"Roseville","Chatswood","North Ryde","Macquarie Park",
"Macquarie University","Epping"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
String[] expected = {"Wolli Creek","Tempe","Sydenham","St Peters",
"Erskineville","Redfern","Macdonaldtown","Newtown","Stanmore",
"Petersham","Lewisham","Summer Hill","Ashfield","Croydon",
"Burwood","Strathfield","North Strathfield","Concord West",
"Rhodes","Meadowbank","West Ryde","Denistone","Eastwood",
"Epping","Macquarie University","Macquarie Park","North Ryde",
"Chatswood","Artarmon","St Leonards","Wollstonecraft","Waverton",
"North Sydney","Milsons Point","Wynyard","Town Hall"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
String[] expected = {"East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Flemington","Homebush",
"Strathfield","North Strathfield","Concord West","Rhodes",
"Meadowbank","West Ryde","Denistone","Eastwood","Epping",
"Cheltenham","Beecroft","Pennant Hills","Thornleigh","Normanhurst",
"Hornsby","Waitara","Wahroonga","Warrawee","Turramurra","Pymble",
"Gordon","Killara","Lindfield","Roseville","Chatswood","Artarmon",
"St Leonards","Wollstonecraft","Waverton","North Sydney",
"Milsons Point","Wynyard","Town Hall","Central","Redfern",
"Erskineville","St Peters","Sydenham","Tempe","Wolli Creek",
"Arncliffe","Banksia","Rockdale","Kogarah","Carlton","Allawah",
"Hurstville"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest5() {
String origin = "Richmond";
String destination = "Blacktown";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("North Ryde");
String[] expected = {"Richmond","East Richmond","Clarendon","Windsor",
"Mulgrave","Vineyard","Riverstone","Schofields","Quakers Hill",
"Marayong","Blacktown"};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest6() {
String origin = "Waterfall";
String destination = "Cronulla";
TreeSet<String> failures = new TreeSet<>();
failures.add("Sutherland");
String[] expected = {};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinDistanceWithFailuresTest7() {
String origin = "Leppington";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("Strathfield");
String[] expected = {};
ArrayList<String> actual = r.routeMinDistance(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
/** Tests for routeMinStop with failures **/
@Test
public void routeMinStopWithFailuresTest1() {
String origin = "Hornsby";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
String[] expected = {"Hornsby"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest2() {
String origin = "Hornsby";
String destination = "Epping";
TreeSet<String> failures = new TreeSet<>();
failures.add("Beecroft");
String[] expected = {"Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara","Lindfield",
"Roseville","Chatswood","North Ryde","Macquarie Park",
"Macquarie University","Epping"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest3() {
String origin = "Wolli Creek";
String destination = "Town Hall";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
String[] expected = {"Wolli Creek","Tempe","Sydenham","St Peters",
"Erskineville","Redfern","Macdonaldtown","Newtown","Stanmore",
"Petersham","Lewisham","Summer Hill","Ashfield","Croydon",
"Burwood","Strathfield","North Strathfield","Concord West",
"Rhodes","Meadowbank","West Ryde","Denistone","Eastwood",
"Epping","Macquarie University","Macquarie Park","North Ryde",
"Chatswood","Artarmon","St Leonards","Wollstonecraft","Waverton",
"North Sydney","Milsons Point","Wynyard","Town Hall"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
String[] expected = {"East Richmond","Clarendon","Windsor","Mulgrave",
"Vineyard","Riverstone","Schofields","Quakers Hill","Marayong",
"Blacktown","Seven Hills","Toongabbie","Pendle Hill",
"Wentworthville","Westmead","Parramatta","Harris Park",
"Granville","Clyde","Auburn","Lidcombe","Flemington","Homebush",
"Strathfield","North Strathfield","Concord West","Rhodes",
"Meadowbank","West Ryde","Denistone","Eastwood","Epping",
"Cheltenham","Beecroft","<NAME>","Thornleigh",
"Normanhurst","Hornsby","Waitara","Wahroonga","Warrawee",
"Turramurra","Pymble","Gordon","Killara","Lindfield","Roseville",
"Chatswood","Artarmon","St Leonards","Wollstonecraft","Waverton",
"North Sydney","Milsons Point","Wynyard","Town Hall","Central",
"Green Square","Mascot","Domestic Airport","International Airport",
"Wolli Creek","Arncliffe","Banksia","Rockdale","Kogarah","Carlton",
"Allawah","Hurstville"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest5() {
String origin = "Richmond";
String destination = "Blacktown";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("North Ryde");
String[] expected = {"Richmond","East Richmond","Clarendon","Windsor",
"Mulgrave","Vineyard","Riverstone","Schofields","Quakers Hill",
"Marayong","Blacktown"};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest6() {
String origin = "Waterfall";
String destination = "Cronulla";
TreeSet<String> failures = new TreeSet<>();
failures.add("Sutherland");
String[] expected = {};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
@Test
public void routeMinStopWithFailuresTest7() {
String origin = "Leppington";
String destination = "Hornsby";
TreeSet<String> failures = new TreeSet<>();
failures.add("Central");
failures.add("Strathfield");
String[] expected = {};
ArrayList<String> actual = r.routeMinStop(origin, destination, failures);
assertArrayEquals(expected, actual.toArray());
}
/** Tests for findTotalDistance **/
@Test
public void findTotalDistanceTest1() {
String origin = "Hornsby";
String destination = "Epping";
TreeSet<String> failures = new TreeSet<>();
int expected = 9703;
int actual = r.findTotalDistance(r.routeMinDistance(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest2() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
int expected = 70768;
int actual = r.findTotalDistance(r.routeMinDistance(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest3() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
int expected = 106712;
int actual = r.findTotalDistance(r.routeMinDistance(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest4() {
String origin = "East Richmond";
String destination = "Hurstville";
TreeSet<String> failures = new TreeSet<>();
failures.add("Burwood");
failures.add("Bankstown");
failures.add("Liverpool");
failures.add("North Ryde");
int expected = 108550;
int actual = r.findTotalDistance(r.routeMinStop(origin, destination, failures));
assertEquals(expected,actual);
}
@Test
public void findTotalDistanceTest5() {
String origin = "Waterfall";
String destination = "Cronulla";
TreeSet<String> failures = new TreeSet<>();
failures.add("Sutherland");
int expected = 0;
int actual = r.findTotalDistance(r.routeMinStop(origin, destination, failures));
assertEquals(expected,actual);
}
/** Tests for optimalScanCost **/
@Test
public void optimalScanCostTest1() {
String origin = "Blacktown";
String destination = "Pendle Hill";
int expected = 9996;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest2() {
String origin = "Parramatta";
String destination = "Blacktown";
int expected = 29313;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest3() {
String origin = "Hornsby";
String destination = "Central";
int expected = 102062;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest4() {
String origin = "Central";
String destination = "Richmond";
int expected = 298418;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
@Test
public void optimalScanCostTest5() {
String origin = "Richmond";
String destination = "Waterfall";
int expected = 533404;
int actual = r.optimalScanCost((r.routeMinDistance(origin, destination)));
assertEquals(expected,actual);
}
/** Tests for optimalScanSolution **/
@Test
public void optimalScanSolutionTest1() {
String origin = "Blacktown";
String destination = "Pendle Hill";
String[] expected = {"Seven Hills"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest2() {
String origin = "Parramatta";
String destination = "Blacktown";
String[] expected = {"Toongabbie", "Wentworthville"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest3() {
String origin = "Central";
String destination = "Hornsby";
String[] expected = {"Artarmon","Killara","Milsons Point","Pymble",
"Roseville","St Leonards","Turramurra","Wahroonga",
"Waverton","Wynyard"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest4() {
String origin = "Richmond";
String destination = "Central";
String[] expected = {"Ashfield","Blacktown","Burwood","Clarendon","Clyde",
"Harris Park","Homebush","Lewisham","Lidcombe",
"Macdonaldtown","Mulgrave","Parramatta","Pendle Hill",
"Quakers Hill","Riverstone","Seven Hills","Stanmore",
"Westmead"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
@Test
public void optimalScanSolutionTest5() {
String origin = "Richmond";
String destination = "Waterfall";
String[] expected = {"Allawah","Arncliffe","Ashfield","Auburn","Burwood",
"Clarendon","Clyde","Como","Erskineville",
"Flemington","Harris Park","Heathcote","Homebush",
"Hurstville","Kogarah","Loftus","Marayong","Newtown",
"Oatley","Pendle Hill","Penshurst","Petersham",
"Redfern","Rockdale","Schofields","Seven Hills",
"Summer Hill","Sutherland","Sydenham","Tempe",
"Vineyard","Westmead","Windsor"};
ArrayList<String> actual = r.optimalScanSolution(r.routeMinDistance(origin, destination));
Collections.sort(actual);
assertArrayEquals(expected,actual.toArray());
}
}
| 18,906 | 0.697933 | 0.69328 | 569 | 32.239017 | 25.050371 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.420035 | false | false |
9
|
e4a8fb958f89efa257817a3218a204992ba82981
| 14,963,666,111,364 |
c8683965581d24c801b87b248ec0b13b19c720f1
|
/Module_4/06_Spring_Data_Repository/Bai_tap/mo_dung_ung_dung_Blog/blog/src/main/java/vn/codegym/blog/controller/BlogController.java
|
4371ee55b97f4bd900553c3430c7c1aa4bf419f8
|
[] |
no_license
|
Anhdungg/A1020I1-Le_Van_Anh_Dung
|
https://github.com/Anhdungg/A1020I1-Le_Van_Anh_Dung
|
e9882f2be144caea060f3da97c0a61f35c2fe9fe
|
a13302ff7fa3ff627f21b13145f042ea38c3a109
|
refs/heads/main
| 2023-07-14T04:48:41.365000 | 2021-08-03T05:19:13 | 2021-08-03T05:19:13 | 309,366,729 | 0 | 1 | null | false | 2020-11-09T07:39:56 | 2020-11-02T12:43:39 | 2020-11-09T07:13:48 | 2020-11-09T07:13:45 | 4,099 | 0 | 0 | 0 |
HTML
| false | false |
package vn.codegym.blog.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import vn.codegym.blog.model.Blog;
import vn.codegym.blog.model.Category;
import vn.codegym.blog.service.BlogService;
import vn.codegym.blog.service.CategoryService;
import javax.validation.Valid;
import java.util.List;
@Controller
public class BlogController {
@Autowired
private BlogService service;
@Autowired
private CategoryService categoryService;
@ModelAttribute("listCategory")
public List<Category> listCategory(){
return categoryService.findAll();
}
@GetMapping(value = "/")
public String home(@PageableDefault(3) Pageable pageable, Model model){
Page<Blog> page = service.findAll(pageable);
model.addAttribute("listPost", page);
model.addAttribute("pages", new int[page.getTotalPages()]);
model.addAttribute("home", true);
return "blog/index";
}
@GetMapping(value = "/create-blog")
public String viewCreate(Model model){
model.addAttribute("blog", new Blog());
return "blog/create";
}
@PostMapping(value = "/create-blog")
public String saveCreate(@Valid @ModelAttribute Blog blog, BindingResult bindingResult, RedirectAttributes redirectAttributes, Model model){
if (bindingResult.hasErrors()){
return "blog/create";
}else {
if (service.existsByURLTitle(blog.getURLTitle())){
model.addAttribute("statusURLTitle", "URL tiêu đề đã tồn tại");
return "blog/create";
}else {
redirectAttributes.addFlashAttribute("status", "Bài viết đã được lưu");
service.save(blog);
return "redirect:/";
}
}
}
@GetMapping(value = "/edit-blog/{id}")
public ModelAndView viewEdit(@PathVariable Integer id){
return new ModelAndView("blog/edit", "blog", service.findById(id));
}
@PostMapping(value = "/edit-blog")
public String saveEdit(@Valid @ModelAttribute Blog blog, BindingResult bindingResult, RedirectAttributes redirectAttributes, Model model){
if (bindingResult.hasErrors()){
return "blog/edit";
}else {
if (service.findById(blog.getId()).getURLTitle().equals(blog.getURLTitle())){
redirectAttributes.addFlashAttribute("status", "Bài viết đã được cập nhập");
service.save(blog);
return "redirect:/";
}else {
if (service.existsByURLTitle(blog.getURLTitle())){
model.addAttribute("statusURLTitle", "URL tiêu đề đã tồn tại");
model.addAttribute("blog", blog);
return "blog/edit";
}else {
redirectAttributes.addFlashAttribute("status", "Bài viết đã được cập nhập");
service.save(blog);
return "redirect:/";
}
}
}
}
@GetMapping(value = "/delete-blog")
public String delete(@RequestParam("id") Integer id, RedirectAttributes redirectAttributes){
redirectAttributes.addFlashAttribute("status", "Bài viết đã được xoá");
service.delete(id);
return "redirect:/";
}
@GetMapping(value = "/search")
public ModelAndView viewSearch(@RequestParam("value") String value, @PageableDefault(3) Pageable pageable){
Page<Blog> page = service.findAllByTitleContaining(value, pageable);
ModelAndView modelAndView = new ModelAndView("blog/index");
modelAndView.addObject("listPost", page);
modelAndView.addObject("pages", new int[page.getTotalPages()]);
return modelAndView;
}
@GetMapping(value = "/about")
public ModelAndView viewAbout(){
return new ModelAndView("blog/about", "about", true);
}
}
|
UTF-8
|
Java
| 4,416 |
java
|
BlogController.java
|
Java
|
[] | null |
[] |
package vn.codegym.blog.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import vn.codegym.blog.model.Blog;
import vn.codegym.blog.model.Category;
import vn.codegym.blog.service.BlogService;
import vn.codegym.blog.service.CategoryService;
import javax.validation.Valid;
import java.util.List;
@Controller
public class BlogController {
@Autowired
private BlogService service;
@Autowired
private CategoryService categoryService;
@ModelAttribute("listCategory")
public List<Category> listCategory(){
return categoryService.findAll();
}
@GetMapping(value = "/")
public String home(@PageableDefault(3) Pageable pageable, Model model){
Page<Blog> page = service.findAll(pageable);
model.addAttribute("listPost", page);
model.addAttribute("pages", new int[page.getTotalPages()]);
model.addAttribute("home", true);
return "blog/index";
}
@GetMapping(value = "/create-blog")
public String viewCreate(Model model){
model.addAttribute("blog", new Blog());
return "blog/create";
}
@PostMapping(value = "/create-blog")
public String saveCreate(@Valid @ModelAttribute Blog blog, BindingResult bindingResult, RedirectAttributes redirectAttributes, Model model){
if (bindingResult.hasErrors()){
return "blog/create";
}else {
if (service.existsByURLTitle(blog.getURLTitle())){
model.addAttribute("statusURLTitle", "URL tiêu đề đã tồn tại");
return "blog/create";
}else {
redirectAttributes.addFlashAttribute("status", "Bài viết đã được lưu");
service.save(blog);
return "redirect:/";
}
}
}
@GetMapping(value = "/edit-blog/{id}")
public ModelAndView viewEdit(@PathVariable Integer id){
return new ModelAndView("blog/edit", "blog", service.findById(id));
}
@PostMapping(value = "/edit-blog")
public String saveEdit(@Valid @ModelAttribute Blog blog, BindingResult bindingResult, RedirectAttributes redirectAttributes, Model model){
if (bindingResult.hasErrors()){
return "blog/edit";
}else {
if (service.findById(blog.getId()).getURLTitle().equals(blog.getURLTitle())){
redirectAttributes.addFlashAttribute("status", "Bài viết đã được cập nhập");
service.save(blog);
return "redirect:/";
}else {
if (service.existsByURLTitle(blog.getURLTitle())){
model.addAttribute("statusURLTitle", "URL tiêu đề đã tồn tại");
model.addAttribute("blog", blog);
return "blog/edit";
}else {
redirectAttributes.addFlashAttribute("status", "Bài viết đã được cập nhập");
service.save(blog);
return "redirect:/";
}
}
}
}
@GetMapping(value = "/delete-blog")
public String delete(@RequestParam("id") Integer id, RedirectAttributes redirectAttributes){
redirectAttributes.addFlashAttribute("status", "Bài viết đã được xoá");
service.delete(id);
return "redirect:/";
}
@GetMapping(value = "/search")
public ModelAndView viewSearch(@RequestParam("value") String value, @PageableDefault(3) Pageable pageable){
Page<Blog> page = service.findAllByTitleContaining(value, pageable);
ModelAndView modelAndView = new ModelAndView("blog/index");
modelAndView.addObject("listPost", page);
modelAndView.addObject("pages", new int[page.getTotalPages()]);
return modelAndView;
}
@GetMapping(value = "/about")
public ModelAndView viewAbout(){
return new ModelAndView("blog/about", "about", true);
}
}
| 4,416 | 0.652184 | 0.651724 | 114 | 37.157894 | 29.608137 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.701754 | false | false |
9
|
5f9eaf69e2bfbb0ba3350d5d3b80a612514f024e
| 14,963,666,108,915 |
21486bab1b439648bf072d64f7d1d641144e5949
|
/src/main/java/org/contacts/Card.java
|
01bffbba73719ec3eeb21c103430a59452b5afdc
|
[] |
no_license
|
rossh/contacts
|
https://github.com/rossh/contacts
|
afa4a39222defb51bcc55a67b9dfefbef231ec8e
|
ba25ceb52cc2ffc01b0bd5146db3377b95ebe787
|
refs/heads/master
| 2016-09-06T07:07:42.481000 | 2013-12-13T20:35:22 | 2013-12-13T20:35:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.contacts;
import java.util.Date;
/**
* This interface represents a card.
*
* @author ross
*
*/
public interface Card extends Comparable<Card>{
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the sex
*/
public Sex getSex();
/**
* @param sex the sex to set
*/
public void setSex(Sex sex);
/**
* @return the birthday
*/
public Date getBirthday();
/**
* @param birthday the birthday to set
*/
public void setBirthday(Date birthday);
}
|
UTF-8
|
Java
| 581 |
java
|
Card.java
|
Java
|
[
{
"context": "* This interface represents a card.\n * \n * @author ross\n *\n */\npublic interface Card extends Comparable<C",
"end": 107,
"score": 0.9889047145843506,
"start": 103,
"tag": "USERNAME",
"value": "ross"
}
] | null |
[] |
package org.contacts;
import java.util.Date;
/**
* This interface represents a card.
*
* @author ross
*
*/
public interface Card extends Comparable<Card>{
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the sex
*/
public Sex getSex();
/**
* @param sex the sex to set
*/
public void setSex(Sex sex);
/**
* @return the birthday
*/
public Date getBirthday();
/**
* @param birthday the birthday to set
*/
public void setBirthday(Date birthday);
}
| 581 | 0.623064 | 0.623064 | 43 | 12.534883 | 13.788011 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.744186 | false | false |
9
|
92259b8050c97f881259160fa1218b7f54fb2d22
| 11,871,289,652,045 |
f80e402e592ce0fe9abac06cc109ba07adbdedd1
|
/org.rodinp.core/src/org/rodinp/internal/core/DeltaProcessor.java
|
eda65ea9378191739aed76dd97be437afafba4a6
|
[] |
no_license
|
systerel/RodinCore
|
https://github.com/systerel/RodinCore
|
f82be2bbfe2f63a91b4fc43cae6aa481a18d601f
|
cbba1f1cfe439952b78123067915845f2f6cc2ec
|
refs/heads/master
| 2023-04-27T07:11:32.841000 | 2023-04-13T14:27:43 | 2023-04-13T14:27:43 | 150,590,697 | 4 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*******************************************************************************
* Copyright (c) 2005, 2012 ETH Zurich and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* ETH Zurich - initial API and implementation
* Systerel - separation of file and root element
*******************************************************************************/
package org.rodinp.internal.core;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
import org.rodinp.core.ElementChangedEvent;
import org.rodinp.core.IElementChangedListener;
import org.rodinp.core.IElementType;
import org.rodinp.core.IRodinDB;
import org.rodinp.core.IRodinElement;
import org.rodinp.core.IRodinElementDelta;
import org.rodinp.core.IRodinFile;
import org.rodinp.core.IRodinProject;
import org.rodinp.core.RodinCore;
import org.rodinp.core.RodinDBException;
import org.rodinp.internal.core.builder.RodinBuilder;
import org.rodinp.internal.core.util.DebugUtil;
import org.rodinp.internal.core.util.Util;
/**
* This class is used by <code>RodinDBManager</code> to convert
* <code>IResourceDelta</code>s into <code>IRodinElementDelta</code>s.
* It also does some processing on the <code>RodinElement</code>s involved
* (e.g. closing them).
*/
public class DeltaProcessor {
/*package*/ static boolean DEBUG = false;
/*package*/ static boolean VERBOSE = false;
// must not collide with ElementChangedEvent event masks
public static final int DEFAULT_CHANGE_EVENT = 0;
/*
* The global state of delta processing.
*/
private final DeltaProcessingState state;
/*
* The Rodin database
*/
RodinDBManager manager;
/*
* The <code>RodinElementDelta</code> corresponding to the <code>IResourceDelta</code> being translated.
*/
private RodinElementDelta currentDelta;
/* The Rodin element that was last created (see createElement(IResource)).
* This is used as a stack of Rodin elements (using getParent() to pop it, and
* using the various get*(...) to push it. */
private Openable currentElement;
/*
* Queue of deltas created explicily by the Rodin database that
* have yet to be fired.
*/
public ArrayList<IRodinElementDelta> rodinDBDeltas= new ArrayList<IRodinElementDelta>();
/*
* Turns delta firing on/off. By default it is on.
*/
private boolean isFiring= true;
/*
* Used to update the RodinDB for <code>IRodinElementDelta</code>s.
*/
private final DBUpdater dbUpdater = new DBUpdater();
/* A set of RodinProject whose caches need to be reset */
private HashSet<RodinProject> projectCachesToReset = new HashSet<RodinProject>();
/*
* Type of event that should be processed no matter what the real event type is.
*/
public int overridenEventType = -1;
public DeltaProcessor(DeltaProcessingState state, RodinDBManager manager) {
this.state = state;
this.manager = manager;
}
/*
* Adds the given child handle to its parent's cache of children.
*/
private void addToParentInfo(Openable child) {
Openable parent = child.getParent();
if (parent != null && parent.isOpen()) {
try {
RodinElementInfo info = parent.getElementInfo();
info.addChild(child);
} catch (RodinDBException e) {
// do nothing - we already checked if open
}
}
}
/*
* Process the given delta and look for projects being added, opened, closed or
* with a Rodin nature being added or removed.
* Note that projects being deleted are checked in deleting(IProject).
* In all cases, add the project's dependents to the list of projects to update
* so that the build related markers can be updated.
*/
private void checkProjectsBeingAddedOrRemoved(IResourceDelta delta) {
IResource resource = delta.getResource();
boolean processChildren = false;
switch (resource.getType()) {
case IResource.ROOT :
// Update cache of old projects
if (this.state.dbProjectsCache == null) {
try {
this.state.dbProjectsCache = this.manager.getRodinDB().getRodinProjects();
} catch (RodinDBException e) {
// Rodin database doesn't exist: never happens
}
}
processChildren = true;
break;
case IResource.PROJECT :
// NB: No need to check project's nature as if the project is not a Rodin project:
// - if the project is added or changed this is a noop for projectsBeingDeleted
// - if the project is closed, it has already lost its Rodin nature
IProject project = (IProject)resource;
RodinProject rodinProject = (RodinProject)RodinCore.valueOf(project);
switch (delta.getKind()) {
case IResourceDelta.ADDED :
if (RodinProject.hasRodinNature(project)) {
this.addToParentInfo(rodinProject);
}
break;
case IResourceDelta.CHANGED :
if ((delta.getFlags() & IResourceDelta.OPEN) != 0) {
if (project.isOpen()) {
if (RodinProject.hasRodinNature(project)) {
this.addToParentInfo(rodinProject);
}
} else {
try {
rodinProject.close();
} catch (RodinDBException e) {
// Rodin project doesn't exist: ignore
}
this.removeFromParentInfo(rodinProject);
this.manager.removePerProjectInfo(rodinProject);
}
} else if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
boolean wasRodinProject = this.manager.getRodinDB().findOldRodinProject(project) != null;
boolean isRodinProject = RodinProject.hasRodinNature(project);
if (wasRodinProject != isRodinProject) {
// workaround for bug 15168 circular errors not reported
if (isRodinProject) {
this.addToParentInfo(rodinProject);
} else {
// remove classpath cache so that initializeRoots() will not consider the project has a classpath
this.manager.removePerProjectInfo((RodinProject)RodinCore.valueOf(project));
// close project
try {
rodinProject.close();
} catch (RodinDBException e) {
// java project doesn't exist: ignore
}
this.removeFromParentInfo(rodinProject);
}
} else {
// in case the project was removed then added then changed (see bug 19799)
if (isRodinProject) { // need nature check - 18698
this.addToParentInfo(rodinProject);
}
}
} else {
// workaround for bug 15168 circular errors not reported
// in case the project was removed then added then changed
if (RodinProject.hasRodinNature(project)) { // need nature check - 18698
this.addToParentInfo(rodinProject);
}
}
break;
case IResourceDelta.REMOVED :
// remove classpath cache so that initializeRoots() will not consider the project has a classpath
this.manager.removePerProjectInfo((RodinProject)RodinCore.valueOf(resource));
break;
}
break;
case IResource.FILE :
// Nothing to do.
break;
}
if (processChildren) {
for (IResourceDelta child: delta.getAffectedChildren()) {
checkProjectsBeingAddedOrRemoved(child);
}
}
}
/*
* Closes the given element, which removes it from the cache of open elements.
*/
private void close(Openable element) {
try {
element.close();
} catch (RodinDBException e) {
// do nothing
}
}
/*
* Generic processing for elements with changed contents:<ul>
* <li>The element is closed such that any subsequent accesses will re-open
* the element reflecting its new structure.
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
* </ul>
* Delta argument could be null if processing an external JAR change
*/
private void contentChanged(Openable element) {
close(element);
removeFromBufferCache(element, false);
int flags = IRodinElementDelta.F_CONTENT;
currentDelta().changed(element, flags);
}
/*
* Creates the openables corresponding to this resource.
* Returns null if none was found.
*/
private Openable createElement(IResource resource, IElementType<?> elementType) {
if (resource == null) return null;
IRodinElement element = null;
if (elementType == IRodinProject.ELEMENT_TYPE) {
// note that non-java resources rooted at the project level will also enter this code with
// an elementType JAVA_PROJECT (see #elementType(...)).
if (resource instanceof IProject){
if (this.currentElement != null
&& this.currentElement.getElementType() == IRodinProject.ELEMENT_TYPE
&& ((IRodinProject)this.currentElement).getProject().equals(resource)) {
return this.currentElement;
}
IProject proj = (IProject)resource;
if (RodinProject.hasRodinNature(proj)) {
element = RodinCore.valueOf(proj);
} else {
// Rodin project may have been been closed or removed (look for
// element amongst old Rodin project s list).
element = this.manager.getRodinDB().findOldRodinProject(proj);
}
}
} else {
element = RodinCore.valueOf(resource);
}
if (element == null) return null;
this.currentElement = (Openable) element;
return this.currentElement;
}
/*
* Check if external archives have changed and create the corresponding deltas.
* Returns whether at least on delta was created.
*/
private RodinElementDelta currentDelta() {
if (this.currentDelta == null) {
this.currentDelta = new RodinElementDelta(this.manager.getRodinDB());
}
return this.currentDelta;
}
/*
* Note that the project is about to be deleted.
*/
private void deleting(IProject project) {
try {
// discard indexing jobs that belong to this project so that the project can be
// deleted without interferences from the index manager
// this.manager.indexManager.discardJobs(project.getName());
RodinProject rodinProject = (RodinProject)RodinCore.valueOf(project);
rodinProject.close();
// Also update cache of old projects
if (this.state.dbProjectsCache == null) {
this.state.dbProjectsCache = this.manager.getRodinDB().getRodinProjects();
}
this.removeFromParentInfo(rodinProject);
} catch (RodinDBException e) {
// Rodin project doesn't exist: ignore
}
}
/*
* Processing for an element that has been added:<ul>
* <li>If the element is a project, do nothing, and do not process
* children, as when a project is created it does not yet have any
* natures - specifically a java nature.
* <li>If the element is not a project, process it as added (see
* <code>basicElementAdded</code>.
* </ul>
*/
private void elementAdded(Openable element, IResourceDelta delta) {
IElementType<?> elementType = element.getElementType();
if (elementType == IRodinProject.ELEMENT_TYPE) {
// project add is handled by RodinProject.configure() because
// when a project is created, it does not yet have a java nature
if (delta != null && RodinProject.hasRodinNature((IProject)delta.getResource())) {
addToParentInfo(element);
if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) {
Openable movedFromElement = (Openable)element.getRodinDB().getRodinProject(delta.getMovedFromPath().lastSegment());
currentDelta().movedTo(element, movedFromElement);
} else {
currentDelta().added(element);
}
// refresh pkg fragment roots and caches of the project (and its dependents)
this.projectCachesToReset.add((RodinProject) element);
}
} else {
if (delta == null || (delta.getFlags() & IResourceDelta.MOVED_FROM) == 0) {
// regular element addition
addToParentInfo(element);
// Force the element to be closed as it might have been opened
// before the resource modification came in and it might have a new child
// For example, in an IWorkspaceRunnable:
// 1. create a package fragment p using a java model operation
// 2. open package p
// 3. add file X.java in folder p
// When the resource delta comes in, only the addition of p is notified,
// but the package p is already opened, thus its children are not recomputed
// and it appears empty.
close(element);
currentDelta().added(element);
} else {
// element is moved
addToParentInfo(element);
close(element);
IPath movedFromPath = delta.getMovedFromPath();
IResource res = delta.getResource();
IFile movedFromFile = res.getWorkspace().getRoot().getFile(movedFromPath);
IElementType<?> movedFromType = this.elementType(movedFromFile);
Openable movedFromElement = this.createElement(movedFromFile, movedFromType);
if (movedFromElement == null) {
// moved from a non-Rodin file
currentDelta().added(element);
} else {
currentDelta().movedTo(element, movedFromElement);
}
}
// reset project's caches
// TODO make that finer grained when project caches are implemented.
final RodinProject project = (RodinProject) element.getRodinProject();
this.projectCachesToReset.add(project);
}
}
/*
* Generic processing for a removed element:<ul>
* <li>Close the element, removing its structure from the cache
* <li>Remove the element from its parent's cache of children
* <li>Add a REMOVED entry in the delta
* </ul>
* Delta argument could be null if processing an external JAR change
*/
private void elementRemoved(Openable element, IResourceDelta delta) {
IElementType<?> elementType = element.getElementType();
if (delta == null || (delta.getFlags() & IResourceDelta.MOVED_TO) == 0) {
// regular element removal
close(element);
removeFromParentInfo(element);
removeFromBufferCache(element, true);
currentDelta().removed(element);
} else {
// element is moved
close(element);
removeFromParentInfo(element);
removeFromBufferCache(element, true);
IPath movedToPath = delta.getMovedToPath();
IResource res = delta.getResource();
IResource movedToRes;
switch (res.getType()) {
case IResource.PROJECT:
movedToRes = res.getWorkspace().getRoot().getProject(movedToPath.lastSegment());
break;
case IResource.FOLDER:
movedToRes = res.getWorkspace().getRoot().getFolder(movedToPath);
break;
case IResource.FILE:
movedToRes = res.getWorkspace().getRoot().getFile(movedToPath);
break;
default:
return;
}
// find the element type of the moved from element
IElementType<?> movedToType = this.elementType(movedToRes);
// reset current element as it might be inside a nested root (popUntilPrefixOf() may use the outer root)
this.currentElement = null;
// create the moved To element
Openable movedToElement =
elementType != IRodinProject.ELEMENT_TYPE
&& movedToType == IRodinProject.ELEMENT_TYPE ?
null : // outside classpath
this.createElement(movedToRes, movedToType);
if (movedToElement == null) {
// moved outside classpath
currentDelta().removed(element);
} else {
currentDelta().movedFrom(element, movedToElement);
}
}
if (elementType == IRodinDB.ELEMENT_TYPE) {
// this.manager.indexManager.reset();
} else if (elementType == IRodinProject.ELEMENT_TYPE) {
this.projectCachesToReset.add((RodinProject) element);
} else {
final RodinProject project = (RodinProject) element.getRodinProject();
this.projectCachesToReset.add(project);
}
}
/*
* Returns the type of the Rodin element the given delta matches to.
* Returns <code>null</code> if unknown (e.g. a non-Rodin resource)
*/
private IElementType<?> elementType(IResource res) {
if (res instanceof IProject) {
return IRodinProject.ELEMENT_TYPE;
} else if (res.getType() == IResource.FILE) {
final ElementTypeManager etManager = ElementTypeManager
.getInstance();
if (etManager.getFileAssociation((IFile) res) == null)
return null;
return IRodinFile.ELEMENT_TYPE;
} else {
return null;
}
}
/*
* Flushes all deltas without firing them.
*/
public void flush() {
this.rodinDBDeltas = new ArrayList<IRodinElementDelta>();
}
/* Returns the list of Rodin projects in the workspace.
*
*/
IRodinProject[] getRodinProjects() {
try {
return this.manager.getRodinDB().getRodinProjects();
} catch (RodinDBException e) {
// java model doesn't exist
return new IRodinProject[0];
}
}
/*
* Fire Rodin database delta, flushing them after the fact after post_change notification.
* If the firing mode has been turned off, this has no effect.
*/
public void fire(IRodinElementDelta customDelta, int eventType) {
if (!this.isFiring) return;
if (DEBUG) {
System.out.println("-----------------------------------------------------------------------------------------------------------------------");//$NON-NLS-1$
}
IRodinElementDelta deltaToNotify;
if (customDelta == null){
deltaToNotify = this.mergeDeltas(this.rodinDBDeltas);
} else {
deltaToNotify = customDelta;
}
// Notification
// Important: if any listener reacts to notification by updating the listeners list or mask, these lists will
// be duplicated, so it is necessary to remember original lists in a variable (since field values may change under us)
IElementChangedListener[] listeners = this.state.elementChangedListeners;
int[] listenerMask = this.state.elementChangedListenerMasks;
int listenerCount = this.state.elementChangedListenerCount;
switch (eventType) {
case DEFAULT_CHANGE_EVENT:
firePostChangeDelta(deltaToNotify, listeners, listenerMask, listenerCount);
break;
case ElementChangedEvent.POST_CHANGE:
firePostChangeDelta(deltaToNotify, listeners, listenerMask, listenerCount);
break;
}
}
private void firePostChangeDelta(
IRodinElementDelta deltaToNotify,
IElementChangedListener[] listeners,
int[] listenerMask,
int listenerCount) {
// post change deltas
if (DEBUG){
System.out.println("FIRING POST_CHANGE Delta ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
}
if (deltaToNotify != null) {
// flush now so as to keep listener reactions to post their own deltas for subsequent iteration
this.flush();
notifyListeners(deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
}
}
/*
* Returns whether a given delta contains some information relevant to the RodinDB,
* in particular it will not consider SYNC or MARKER only deltas.
*/
private boolean isAffectedBy(IResourceDelta rootDelta){
//if (rootDelta == null) System.out.println("NULL DELTA");
//long start = System.currentTimeMillis();
if (rootDelta != null) {
// use local exception to quickly escape from delta traversal
class FoundRelevantDeltaException extends RuntimeException {
private static final long serialVersionUID = 7137113252936111022L; // backward compatible
// only the class name is used (to differenciate from other RuntimeExceptions)
}
try {
rootDelta.accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) /* throws CoreException */ {
switch (delta.getKind()){
case IResourceDelta.ADDED :
case IResourceDelta.REMOVED :
throw new FoundRelevantDeltaException();
case IResourceDelta.CHANGED :
// if any flag is set but SYNC or MARKER, this delta should be considered
if (delta.getAffectedChildren().length == 0 // only check leaf delta nodes
&& (delta.getFlags() & ~(IResourceDelta.SYNC | IResourceDelta.MARKERS)) != 0) {
throw new FoundRelevantDeltaException();
}
}
return true;
}
});
} catch(FoundRelevantDeltaException e) {
//System.out.println("RELEVANT DELTA detected in: "+ (System.currentTimeMillis() - start));
return true;
} catch(CoreException e) { // ignore delta if not able to traverse
}
}
//System.out.println("IGNORE SYNC DELTA took: "+ (System.currentTimeMillis() - start));
return false;
}
/*
* Merges all awaiting deltas.
*/
private IRodinElementDelta mergeDeltas(Collection<IRodinElementDelta> deltas) {
if (deltas.size() == 0) return null;
if (deltas.size() == 1) return deltas.iterator().next();
if (VERBOSE) {
System.out.println("MERGING " + deltas.size() + " DELTAS ["+Thread.currentThread()+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
Iterator<IRodinElementDelta> iterator = deltas.iterator();
RodinElementDelta rootDelta = new RodinElementDelta(this.manager.rodinDB);
boolean insertedTree = false;
while (iterator.hasNext()) {
RodinElementDelta delta = (RodinElementDelta)iterator.next();
if (VERBOSE) {
System.out.println(delta.toString());
}
IRodinElement element = delta.getElement();
if (this.manager.rodinDB.equals(element)) {
IRodinElementDelta[] children = delta.getAffectedChildren();
for (int j = 0; j < children.length; j++) {
RodinElementDelta projectDelta = (RodinElementDelta) children[j];
rootDelta.insertDeltaTree(projectDelta.getElement(), projectDelta);
insertedTree = true;
}
IResourceDelta[] resourceDeltas = delta.getResourceDeltas();
if (resourceDeltas != null) {
for (int i = 0, length = resourceDeltas.length; i < length; i++) {
rootDelta.addResourceDelta(resourceDeltas[i]);
insertedTree = true;
}
}
} else {
rootDelta.insertDeltaTree(element, delta);
insertedTree = true;
}
}
if (insertedTree) return rootDelta;
return null;
}
private void notifyListeners(IRodinElementDelta deltaToNotify, int eventType, IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) {
final ElementChangedEvent extraEvent = new ElementChangedEvent(deltaToNotify, eventType);
for (int i= 0; i < listenerCount; i++) {
if ((listenerMask[i] & eventType) != 0){
final IElementChangedListener listener = listeners[i];
long start = -1;
if (VERBOSE) {
System.out.print("Listener #" + (i+1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$
start = System.currentTimeMillis();
}
// wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
Util.log(exception, "Exception occurred in listener of Rodin element change notification"); //$NON-NLS-1$
}
@Override
public void run() throws Exception {
listener.elementChanged(extraEvent);
}
});
if (VERBOSE) {
System.out.println(" -> " + (System.currentTimeMillis()-start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
}
/*
* Generic processing for elements with changed contents:<ul>
* <li>The element is closed such that any subsequent accesses will re-open
* the element reflecting its new structure.
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
* </ul>
*/
private void nonRodinResourcesChanged(Openable element, IResourceDelta delta)
throws RodinDBException {
// reset non-Rodin resources if element was open
if (element.isOpen()) {
RodinElementInfo info = element.getElementInfo();
if (element.getElementType() == IRodinDB.ELEMENT_TYPE) {
((RodinDBInfo) info).nonRodinResources = null;
currentDelta().addResourceDelta(delta);
return;
} else if (element.getElementType() == IRodinProject.ELEMENT_TYPE) {
((RodinProjectElementInfo) info).setNonRodinResources(null);
}
}
RodinElementDelta current = currentDelta();
RodinElementDelta elementDelta = current.find(element);
if (elementDelta == null) {
// don't use find after creating the delta as it can be null (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63434)
elementDelta = current.changed(element, IRodinElementDelta.F_CONTENT);
}
elementDelta.addResourceDelta(delta);
}
/*
* Converts a <code>IResourceDelta</code> rooted in a <code>Workspace</code> into
* the corresponding set of <code>IRodinElementDelta</code>, rooted in the
* relevant <code>RodinDB</code>s.
*/
private IRodinElementDelta processResourceDelta(IResourceDelta changes) {
try {
IRodinDB database = this.manager.getRodinDB();
if (!database.isOpen()) {
// force opening of the Rodin database so that Rodin element deltas are reported
try {
database.open(null);
} catch (RodinDBException e) {
Util.log(e, "Couldn't open the Rodin database");
return null;
}
}
this.currentElement = null;
// get the workspace delta, and start processing there.
for (IResourceDelta delta: changes.getAffectedChildren()) {
IResource res = delta.getResource();
// find out the element type
IElementType<?> elementType;
IProject proj = (IProject) res;
boolean wasRodinProject = this.manager.getRodinDB().findOldRodinProject(proj) != null;
boolean isRodinProject = RodinProject.hasRodinNature(proj);
if (!wasRodinProject && !isRodinProject) {
elementType = null;
} else {
elementType = IRodinProject.ELEMENT_TYPE;
// traverse delta
this.traverseProjectDelta(delta, elementType);
}
if (elementType == null
|| (wasRodinProject != isRodinProject && (delta.getKind()) == IResourceDelta.CHANGED)) {
// project has changed nature (description or open/closed)
try {
// add child as non Rodin resource
nonRodinResourcesChanged((RodinDB)database, delta);
} catch (RodinDBException e) {
// Rodin database could not be opened
}
}
}
resetProjectCaches();
return this.currentDelta;
} finally {
this.currentDelta = null;
this.projectCachesToReset.clear();
}
}
/*
* Traverse the set of projects which have changed namespace, and reset their
* caches and their dependents.
*/
private void resetProjectCaches() {
// TODO implement when project caches are there
}
/*
* Registers the given delta with this delta processor.
*/
public void registerRodinDBDelta(IRodinElementDelta delta) {
this.rodinDBDeltas.add(delta);
}
/*
* Removes any buffer associated to the given element.
*/
private void removeFromBufferCache(Openable child, boolean force) {
if (child instanceof RodinFile) {
final RodinFile rodinFile = (RodinFile) child;
final RodinDBManager rodinDBManager = RodinDBManager.getRodinDBManager();
rodinDBManager.removeBuffer(rodinFile.getMutableCopy(), force);
}
}
/*
* Removes the given element from its parents cache of children. If the
* element does not have a parent, or the parent is not currently open,
* this has no effect.
*/
private void removeFromParentInfo(Openable child) {
Openable parent = child.getParent();
if (parent != null && parent.isOpen()) {
try {
RodinElementInfo info = parent.getElementInfo();
info.removeChild(child);
} catch (RodinDBException e) {
// do nothing - we already checked if open
}
}
}
/*
* Notification that some resource changes have happened
* on the platform, and that the Rodin Model should update any required
* internal structures such that its elements remain consistent.
* Translates <code>IResourceDeltas</code> into <code>IRodinElementDeltas</code>.
*
* @see IResourceDelta
* @see IResource
*/
public void resourceChanged(IResourceChangeEvent event) {
if (event.getSource() instanceof IWorkspace) {
int eventType = this.overridenEventType == -1 ? event.getType() : this.overridenEventType;
IResource resource = event.getResource();
IResourceDelta delta = event.getDelta();
if (VERBOSE) {
System.out.println("-----------------------------------------------------------------------------------------------------------------------");//$NON-NLS-1$
System.out.println("PROCESSING Resource Changed Event ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$
DebugUtil.printEvent(event);
if (this.overridenEventType != -1) {
System.out.println(" Event type is overriden to:" + //$NON-NLS-1$
DebugUtil.eventTypeAsString(eventType));
}
}
switch(eventType){
case IResourceChangeEvent.PRE_DELETE :
try {
if(resource.getType() == IResource.PROJECT
&& ((IProject) resource).hasNature(RodinCore.NATURE_ID)) {
deleting((IProject)resource);
}
} catch(CoreException e){
// project doesn't exist or is not open: ignore
}
return;
case IResourceChangeEvent.POST_CHANGE :
if (isAffectedBy(delta)) { // avoid populating for SYNC or MARKER deltas
try {
try {
stopDeltas();
checkProjectsBeingAddedOrRemoved(delta);
IRodinElementDelta translatedDelta = processResourceDelta(delta);
if (translatedDelta != null) {
registerRodinDBDelta(translatedDelta);
}
} finally {
startDeltas();
}
fire(null, ElementChangedEvent.POST_CHANGE);
} finally {
// Cleanup cache of old projects
this.state.dbProjectsCache = null;
}
}
return;
case IResourceChangeEvent.PRE_BUILD :
// this.processPostChange = false;
if(isAffectedBy(delta)) { // avoid populating for SYNC or MARKER deltas
RodinBuilder.buildStarting();
}
// does not fire any deltas
return;
case IResourceChangeEvent.POST_BUILD :
RodinBuilder.buildFinished();
return;
}
}
}
/*
* Turns the firing mode to on. That is, deltas that are/have been
* registered will be fired.
*/
private void startDeltas() {
this.isFiring = true;
}
/*
* Turns the firing mode to off. That is, deltas that are/have been
* registered will not be fired until deltas are started again.
*/
private void stopDeltas() {
this.isFiring = false;
}
/*
* Converts an <code>IResourceDelta</code> rooted at a Rodin project and
* its children into the corresponding <code>IRodinElementDelta</code>s.
*/
private void traverseProjectDelta(IResourceDelta delta,
IElementType<?> elementType) {
IProject project = (IProject) delta.getResource();
RodinProject rodinProject = (RodinProject) RodinCore.valueOf(project);
// process current delta
boolean processChildren = this.updateCurrentDeltaAndIndex(delta, elementType);
// process children if needed
if (processChildren) {
for (IResourceDelta child: delta.getAffectedChildren()) {
traverseDelta(child, rodinProject);
}
}
}
/*
* Converts an <code>IResourceDelta</code> and its children into
* the corresponding <code>IRodinElementDelta</code>s.
*/
private void traverseDelta(IResourceDelta delta, RodinProject rodinProject) {
IResource res = delta.getResource();
switch (res.getType()) {
case IResource.FILE:
IElementType<?> elementType = elementType(res);
if (elementType != null) {
this.updateCurrentDeltaAndIndex(delta, elementType);
} else {
try {
// add child as non Rodin resource
nonRodinResourcesChanged(rodinProject, delta);
} catch (RodinDBException e) {
// Rodin database could not be opened
}
}
break;
case IResource.FOLDER:
try {
// add child as non Rodin resource
nonRodinResourcesChanged(rodinProject, delta);
} catch (RodinDBException e) {
// Rodin database could not be opened
}
break;
default:
assert false;
}
}
/*
* Update the current delta (ie. add/remove/change the given element) and update the correponding index.
* Returns whether the children of the given delta must be processed.
* @throws a RodinDBException if the delta doesn't correspond to a java element of the given type.
*/
public boolean updateCurrentDeltaAndIndex(IResourceDelta delta,
IElementType<?> elementType) {
Openable element;
switch (delta.getKind()) {
case IResourceDelta.ADDED :
IResource deltaRes = delta.getResource();
element = createElement(deltaRes, elementType);
if (element == null) {
return false;
}
// updateIndex(element, delta);
elementAdded(element, delta);
return elementType == IRodinProject.ELEMENT_TYPE;
case IResourceDelta.REMOVED :
deltaRes = delta.getResource();
element = createElement(deltaRes, elementType);
if (element == null) {
return false;
}
// updateIndex(element, delta);
elementRemoved(element, delta);
if (deltaRes.getType() == IResource.PROJECT){
// reset the corresponding project built state, since cannot reuse if added back
if (RodinBuilder.DEBUG)
System.out.println("Clearing last state for removed project : " + deltaRes); //$NON-NLS-1$
this.manager.setLastBuiltState((IProject)deltaRes, null /*no state*/);
// clean up previous session containers (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=89850)
// this.manager.previousSessionContainers.remove(element);
}
return elementType == IRodinProject.ELEMENT_TYPE;
case IResourceDelta.CHANGED :
int flags = delta.getFlags();
if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.ENCODING) != 0) {
// content or encoding has changed
element = createElement(delta.getResource(), elementType);
if (element == null) return false;
// updateIndex(element, delta);
contentChanged(element);
} else if (elementType == IRodinProject.ELEMENT_TYPE) {
if ((flags & IResourceDelta.OPEN) != 0) {
// project has been opened or closed
IProject res = (IProject)delta.getResource();
element = createElement(res, elementType);
if (element == null) {
return false;
}
if (res.isOpen()) {
if (RodinProject.hasRodinNature(res)) {
addToParentInfo(element);
currentDelta().opened(element);
// refresh pkg fragment roots and caches of the project (and its dependents)
this.projectCachesToReset.add((RodinProject) element);
// this.manager.indexManager.indexAll(res);
}
} else {
RodinDB javaModel = this.manager.getRodinDB();
boolean wasRodinProject = javaModel.findOldRodinProject(res) != null;
if (wasRodinProject) {
close(element);
removeFromParentInfo(element);
currentDelta().closed(element);
// this.manager.indexManager.discardJobs(element.getElementName());
// this.manager.indexManager.removeIndexFamily(res.getFullPath());
}
}
return false; // when a project is open/closed don't process children
}
if ((flags & IResourceDelta.DESCRIPTION) != 0) {
IProject res = (IProject)delta.getResource();
RodinDB javaModel = this.manager.getRodinDB();
boolean wasRodinProject = javaModel.findOldRodinProject(res) != null;
boolean isRodinProject = RodinProject.hasRodinNature(res);
if (wasRodinProject != isRodinProject) {
// project's nature has been added or removed
element = this.createElement(res, elementType);
if (element == null) return false; // note its resources are still visible as roots to other projects
if (isRodinProject) {
elementAdded(element, delta);
// this.manager.indexManager.indexAll(res);
} else {
elementRemoved(element, delta);
// this.manager.indexManager.discardJobs(element.getElementName());
// this.manager.indexManager.removeIndexFamily(res.getFullPath());
// reset the corresponding project built state, since cannot reuse if added back
if (RodinBuilder.DEBUG)
System.out.println("Clearing last state for project loosing Rodin nature: " + res); //$NON-NLS-1$
this.manager.setLastBuiltState(res, null /*no state*/);
}
return false; // when a project's nature is added/removed don't process children
}
}
return true; // something changed within the project and we don't know what.
}
return true;
}
return true;
}
/*
* Update the Rodin database given some delta
*/
public void updateRodinDB(IRodinElementDelta customDelta) {
if (customDelta == null) {
for (IRodinElementDelta delta: this.rodinDBDeltas) {
this.dbUpdater.processRodinDelta(delta);
}
} else {
this.dbUpdater.processRodinDelta(customDelta);
}
}
}
|
UTF-8
|
Java
| 37,131 |
java
|
DeltaProcessor.java
|
Java
|
[
{
"context": "ETH Zurich - initial API and implementation\n * Systerel - separation of file and root element\n **********",
"end": 464,
"score": 0.9941659569740295,
"start": 456,
"tag": "USERNAME",
"value": "Systerel"
}
] | null |
[] |
/*******************************************************************************
* Copyright (c) 2005, 2012 ETH Zurich and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* ETH Zurich - initial API and implementation
* Systerel - separation of file and root element
*******************************************************************************/
package org.rodinp.internal.core;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
import org.rodinp.core.ElementChangedEvent;
import org.rodinp.core.IElementChangedListener;
import org.rodinp.core.IElementType;
import org.rodinp.core.IRodinDB;
import org.rodinp.core.IRodinElement;
import org.rodinp.core.IRodinElementDelta;
import org.rodinp.core.IRodinFile;
import org.rodinp.core.IRodinProject;
import org.rodinp.core.RodinCore;
import org.rodinp.core.RodinDBException;
import org.rodinp.internal.core.builder.RodinBuilder;
import org.rodinp.internal.core.util.DebugUtil;
import org.rodinp.internal.core.util.Util;
/**
* This class is used by <code>RodinDBManager</code> to convert
* <code>IResourceDelta</code>s into <code>IRodinElementDelta</code>s.
* It also does some processing on the <code>RodinElement</code>s involved
* (e.g. closing them).
*/
public class DeltaProcessor {
/*package*/ static boolean DEBUG = false;
/*package*/ static boolean VERBOSE = false;
// must not collide with ElementChangedEvent event masks
public static final int DEFAULT_CHANGE_EVENT = 0;
/*
* The global state of delta processing.
*/
private final DeltaProcessingState state;
/*
* The Rodin database
*/
RodinDBManager manager;
/*
* The <code>RodinElementDelta</code> corresponding to the <code>IResourceDelta</code> being translated.
*/
private RodinElementDelta currentDelta;
/* The Rodin element that was last created (see createElement(IResource)).
* This is used as a stack of Rodin elements (using getParent() to pop it, and
* using the various get*(...) to push it. */
private Openable currentElement;
/*
* Queue of deltas created explicily by the Rodin database that
* have yet to be fired.
*/
public ArrayList<IRodinElementDelta> rodinDBDeltas= new ArrayList<IRodinElementDelta>();
/*
* Turns delta firing on/off. By default it is on.
*/
private boolean isFiring= true;
/*
* Used to update the RodinDB for <code>IRodinElementDelta</code>s.
*/
private final DBUpdater dbUpdater = new DBUpdater();
/* A set of RodinProject whose caches need to be reset */
private HashSet<RodinProject> projectCachesToReset = new HashSet<RodinProject>();
/*
* Type of event that should be processed no matter what the real event type is.
*/
public int overridenEventType = -1;
public DeltaProcessor(DeltaProcessingState state, RodinDBManager manager) {
this.state = state;
this.manager = manager;
}
/*
* Adds the given child handle to its parent's cache of children.
*/
private void addToParentInfo(Openable child) {
Openable parent = child.getParent();
if (parent != null && parent.isOpen()) {
try {
RodinElementInfo info = parent.getElementInfo();
info.addChild(child);
} catch (RodinDBException e) {
// do nothing - we already checked if open
}
}
}
/*
* Process the given delta and look for projects being added, opened, closed or
* with a Rodin nature being added or removed.
* Note that projects being deleted are checked in deleting(IProject).
* In all cases, add the project's dependents to the list of projects to update
* so that the build related markers can be updated.
*/
private void checkProjectsBeingAddedOrRemoved(IResourceDelta delta) {
IResource resource = delta.getResource();
boolean processChildren = false;
switch (resource.getType()) {
case IResource.ROOT :
// Update cache of old projects
if (this.state.dbProjectsCache == null) {
try {
this.state.dbProjectsCache = this.manager.getRodinDB().getRodinProjects();
} catch (RodinDBException e) {
// Rodin database doesn't exist: never happens
}
}
processChildren = true;
break;
case IResource.PROJECT :
// NB: No need to check project's nature as if the project is not a Rodin project:
// - if the project is added or changed this is a noop for projectsBeingDeleted
// - if the project is closed, it has already lost its Rodin nature
IProject project = (IProject)resource;
RodinProject rodinProject = (RodinProject)RodinCore.valueOf(project);
switch (delta.getKind()) {
case IResourceDelta.ADDED :
if (RodinProject.hasRodinNature(project)) {
this.addToParentInfo(rodinProject);
}
break;
case IResourceDelta.CHANGED :
if ((delta.getFlags() & IResourceDelta.OPEN) != 0) {
if (project.isOpen()) {
if (RodinProject.hasRodinNature(project)) {
this.addToParentInfo(rodinProject);
}
} else {
try {
rodinProject.close();
} catch (RodinDBException e) {
// Rodin project doesn't exist: ignore
}
this.removeFromParentInfo(rodinProject);
this.manager.removePerProjectInfo(rodinProject);
}
} else if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
boolean wasRodinProject = this.manager.getRodinDB().findOldRodinProject(project) != null;
boolean isRodinProject = RodinProject.hasRodinNature(project);
if (wasRodinProject != isRodinProject) {
// workaround for bug 15168 circular errors not reported
if (isRodinProject) {
this.addToParentInfo(rodinProject);
} else {
// remove classpath cache so that initializeRoots() will not consider the project has a classpath
this.manager.removePerProjectInfo((RodinProject)RodinCore.valueOf(project));
// close project
try {
rodinProject.close();
} catch (RodinDBException e) {
// java project doesn't exist: ignore
}
this.removeFromParentInfo(rodinProject);
}
} else {
// in case the project was removed then added then changed (see bug 19799)
if (isRodinProject) { // need nature check - 18698
this.addToParentInfo(rodinProject);
}
}
} else {
// workaround for bug 15168 circular errors not reported
// in case the project was removed then added then changed
if (RodinProject.hasRodinNature(project)) { // need nature check - 18698
this.addToParentInfo(rodinProject);
}
}
break;
case IResourceDelta.REMOVED :
// remove classpath cache so that initializeRoots() will not consider the project has a classpath
this.manager.removePerProjectInfo((RodinProject)RodinCore.valueOf(resource));
break;
}
break;
case IResource.FILE :
// Nothing to do.
break;
}
if (processChildren) {
for (IResourceDelta child: delta.getAffectedChildren()) {
checkProjectsBeingAddedOrRemoved(child);
}
}
}
/*
* Closes the given element, which removes it from the cache of open elements.
*/
private void close(Openable element) {
try {
element.close();
} catch (RodinDBException e) {
// do nothing
}
}
/*
* Generic processing for elements with changed contents:<ul>
* <li>The element is closed such that any subsequent accesses will re-open
* the element reflecting its new structure.
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
* </ul>
* Delta argument could be null if processing an external JAR change
*/
private void contentChanged(Openable element) {
close(element);
removeFromBufferCache(element, false);
int flags = IRodinElementDelta.F_CONTENT;
currentDelta().changed(element, flags);
}
/*
* Creates the openables corresponding to this resource.
* Returns null if none was found.
*/
private Openable createElement(IResource resource, IElementType<?> elementType) {
if (resource == null) return null;
IRodinElement element = null;
if (elementType == IRodinProject.ELEMENT_TYPE) {
// note that non-java resources rooted at the project level will also enter this code with
// an elementType JAVA_PROJECT (see #elementType(...)).
if (resource instanceof IProject){
if (this.currentElement != null
&& this.currentElement.getElementType() == IRodinProject.ELEMENT_TYPE
&& ((IRodinProject)this.currentElement).getProject().equals(resource)) {
return this.currentElement;
}
IProject proj = (IProject)resource;
if (RodinProject.hasRodinNature(proj)) {
element = RodinCore.valueOf(proj);
} else {
// Rodin project may have been been closed or removed (look for
// element amongst old Rodin project s list).
element = this.manager.getRodinDB().findOldRodinProject(proj);
}
}
} else {
element = RodinCore.valueOf(resource);
}
if (element == null) return null;
this.currentElement = (Openable) element;
return this.currentElement;
}
/*
* Check if external archives have changed and create the corresponding deltas.
* Returns whether at least on delta was created.
*/
private RodinElementDelta currentDelta() {
if (this.currentDelta == null) {
this.currentDelta = new RodinElementDelta(this.manager.getRodinDB());
}
return this.currentDelta;
}
/*
* Note that the project is about to be deleted.
*/
private void deleting(IProject project) {
try {
// discard indexing jobs that belong to this project so that the project can be
// deleted without interferences from the index manager
// this.manager.indexManager.discardJobs(project.getName());
RodinProject rodinProject = (RodinProject)RodinCore.valueOf(project);
rodinProject.close();
// Also update cache of old projects
if (this.state.dbProjectsCache == null) {
this.state.dbProjectsCache = this.manager.getRodinDB().getRodinProjects();
}
this.removeFromParentInfo(rodinProject);
} catch (RodinDBException e) {
// Rodin project doesn't exist: ignore
}
}
/*
* Processing for an element that has been added:<ul>
* <li>If the element is a project, do nothing, and do not process
* children, as when a project is created it does not yet have any
* natures - specifically a java nature.
* <li>If the element is not a project, process it as added (see
* <code>basicElementAdded</code>.
* </ul>
*/
private void elementAdded(Openable element, IResourceDelta delta) {
IElementType<?> elementType = element.getElementType();
if (elementType == IRodinProject.ELEMENT_TYPE) {
// project add is handled by RodinProject.configure() because
// when a project is created, it does not yet have a java nature
if (delta != null && RodinProject.hasRodinNature((IProject)delta.getResource())) {
addToParentInfo(element);
if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) {
Openable movedFromElement = (Openable)element.getRodinDB().getRodinProject(delta.getMovedFromPath().lastSegment());
currentDelta().movedTo(element, movedFromElement);
} else {
currentDelta().added(element);
}
// refresh pkg fragment roots and caches of the project (and its dependents)
this.projectCachesToReset.add((RodinProject) element);
}
} else {
if (delta == null || (delta.getFlags() & IResourceDelta.MOVED_FROM) == 0) {
// regular element addition
addToParentInfo(element);
// Force the element to be closed as it might have been opened
// before the resource modification came in and it might have a new child
// For example, in an IWorkspaceRunnable:
// 1. create a package fragment p using a java model operation
// 2. open package p
// 3. add file X.java in folder p
// When the resource delta comes in, only the addition of p is notified,
// but the package p is already opened, thus its children are not recomputed
// and it appears empty.
close(element);
currentDelta().added(element);
} else {
// element is moved
addToParentInfo(element);
close(element);
IPath movedFromPath = delta.getMovedFromPath();
IResource res = delta.getResource();
IFile movedFromFile = res.getWorkspace().getRoot().getFile(movedFromPath);
IElementType<?> movedFromType = this.elementType(movedFromFile);
Openable movedFromElement = this.createElement(movedFromFile, movedFromType);
if (movedFromElement == null) {
// moved from a non-Rodin file
currentDelta().added(element);
} else {
currentDelta().movedTo(element, movedFromElement);
}
}
// reset project's caches
// TODO make that finer grained when project caches are implemented.
final RodinProject project = (RodinProject) element.getRodinProject();
this.projectCachesToReset.add(project);
}
}
/*
* Generic processing for a removed element:<ul>
* <li>Close the element, removing its structure from the cache
* <li>Remove the element from its parent's cache of children
* <li>Add a REMOVED entry in the delta
* </ul>
* Delta argument could be null if processing an external JAR change
*/
private void elementRemoved(Openable element, IResourceDelta delta) {
IElementType<?> elementType = element.getElementType();
if (delta == null || (delta.getFlags() & IResourceDelta.MOVED_TO) == 0) {
// regular element removal
close(element);
removeFromParentInfo(element);
removeFromBufferCache(element, true);
currentDelta().removed(element);
} else {
// element is moved
close(element);
removeFromParentInfo(element);
removeFromBufferCache(element, true);
IPath movedToPath = delta.getMovedToPath();
IResource res = delta.getResource();
IResource movedToRes;
switch (res.getType()) {
case IResource.PROJECT:
movedToRes = res.getWorkspace().getRoot().getProject(movedToPath.lastSegment());
break;
case IResource.FOLDER:
movedToRes = res.getWorkspace().getRoot().getFolder(movedToPath);
break;
case IResource.FILE:
movedToRes = res.getWorkspace().getRoot().getFile(movedToPath);
break;
default:
return;
}
// find the element type of the moved from element
IElementType<?> movedToType = this.elementType(movedToRes);
// reset current element as it might be inside a nested root (popUntilPrefixOf() may use the outer root)
this.currentElement = null;
// create the moved To element
Openable movedToElement =
elementType != IRodinProject.ELEMENT_TYPE
&& movedToType == IRodinProject.ELEMENT_TYPE ?
null : // outside classpath
this.createElement(movedToRes, movedToType);
if (movedToElement == null) {
// moved outside classpath
currentDelta().removed(element);
} else {
currentDelta().movedFrom(element, movedToElement);
}
}
if (elementType == IRodinDB.ELEMENT_TYPE) {
// this.manager.indexManager.reset();
} else if (elementType == IRodinProject.ELEMENT_TYPE) {
this.projectCachesToReset.add((RodinProject) element);
} else {
final RodinProject project = (RodinProject) element.getRodinProject();
this.projectCachesToReset.add(project);
}
}
/*
* Returns the type of the Rodin element the given delta matches to.
* Returns <code>null</code> if unknown (e.g. a non-Rodin resource)
*/
private IElementType<?> elementType(IResource res) {
if (res instanceof IProject) {
return IRodinProject.ELEMENT_TYPE;
} else if (res.getType() == IResource.FILE) {
final ElementTypeManager etManager = ElementTypeManager
.getInstance();
if (etManager.getFileAssociation((IFile) res) == null)
return null;
return IRodinFile.ELEMENT_TYPE;
} else {
return null;
}
}
/*
* Flushes all deltas without firing them.
*/
public void flush() {
this.rodinDBDeltas = new ArrayList<IRodinElementDelta>();
}
/* Returns the list of Rodin projects in the workspace.
*
*/
IRodinProject[] getRodinProjects() {
try {
return this.manager.getRodinDB().getRodinProjects();
} catch (RodinDBException e) {
// java model doesn't exist
return new IRodinProject[0];
}
}
/*
* Fire Rodin database delta, flushing them after the fact after post_change notification.
* If the firing mode has been turned off, this has no effect.
*/
public void fire(IRodinElementDelta customDelta, int eventType) {
if (!this.isFiring) return;
if (DEBUG) {
System.out.println("-----------------------------------------------------------------------------------------------------------------------");//$NON-NLS-1$
}
IRodinElementDelta deltaToNotify;
if (customDelta == null){
deltaToNotify = this.mergeDeltas(this.rodinDBDeltas);
} else {
deltaToNotify = customDelta;
}
// Notification
// Important: if any listener reacts to notification by updating the listeners list or mask, these lists will
// be duplicated, so it is necessary to remember original lists in a variable (since field values may change under us)
IElementChangedListener[] listeners = this.state.elementChangedListeners;
int[] listenerMask = this.state.elementChangedListenerMasks;
int listenerCount = this.state.elementChangedListenerCount;
switch (eventType) {
case DEFAULT_CHANGE_EVENT:
firePostChangeDelta(deltaToNotify, listeners, listenerMask, listenerCount);
break;
case ElementChangedEvent.POST_CHANGE:
firePostChangeDelta(deltaToNotify, listeners, listenerMask, listenerCount);
break;
}
}
private void firePostChangeDelta(
IRodinElementDelta deltaToNotify,
IElementChangedListener[] listeners,
int[] listenerMask,
int listenerCount) {
// post change deltas
if (DEBUG){
System.out.println("FIRING POST_CHANGE Delta ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
}
if (deltaToNotify != null) {
// flush now so as to keep listener reactions to post their own deltas for subsequent iteration
this.flush();
notifyListeners(deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
}
}
/*
* Returns whether a given delta contains some information relevant to the RodinDB,
* in particular it will not consider SYNC or MARKER only deltas.
*/
private boolean isAffectedBy(IResourceDelta rootDelta){
//if (rootDelta == null) System.out.println("NULL DELTA");
//long start = System.currentTimeMillis();
if (rootDelta != null) {
// use local exception to quickly escape from delta traversal
class FoundRelevantDeltaException extends RuntimeException {
private static final long serialVersionUID = 7137113252936111022L; // backward compatible
// only the class name is used (to differenciate from other RuntimeExceptions)
}
try {
rootDelta.accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) /* throws CoreException */ {
switch (delta.getKind()){
case IResourceDelta.ADDED :
case IResourceDelta.REMOVED :
throw new FoundRelevantDeltaException();
case IResourceDelta.CHANGED :
// if any flag is set but SYNC or MARKER, this delta should be considered
if (delta.getAffectedChildren().length == 0 // only check leaf delta nodes
&& (delta.getFlags() & ~(IResourceDelta.SYNC | IResourceDelta.MARKERS)) != 0) {
throw new FoundRelevantDeltaException();
}
}
return true;
}
});
} catch(FoundRelevantDeltaException e) {
//System.out.println("RELEVANT DELTA detected in: "+ (System.currentTimeMillis() - start));
return true;
} catch(CoreException e) { // ignore delta if not able to traverse
}
}
//System.out.println("IGNORE SYNC DELTA took: "+ (System.currentTimeMillis() - start));
return false;
}
/*
* Merges all awaiting deltas.
*/
private IRodinElementDelta mergeDeltas(Collection<IRodinElementDelta> deltas) {
if (deltas.size() == 0) return null;
if (deltas.size() == 1) return deltas.iterator().next();
if (VERBOSE) {
System.out.println("MERGING " + deltas.size() + " DELTAS ["+Thread.currentThread()+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
Iterator<IRodinElementDelta> iterator = deltas.iterator();
RodinElementDelta rootDelta = new RodinElementDelta(this.manager.rodinDB);
boolean insertedTree = false;
while (iterator.hasNext()) {
RodinElementDelta delta = (RodinElementDelta)iterator.next();
if (VERBOSE) {
System.out.println(delta.toString());
}
IRodinElement element = delta.getElement();
if (this.manager.rodinDB.equals(element)) {
IRodinElementDelta[] children = delta.getAffectedChildren();
for (int j = 0; j < children.length; j++) {
RodinElementDelta projectDelta = (RodinElementDelta) children[j];
rootDelta.insertDeltaTree(projectDelta.getElement(), projectDelta);
insertedTree = true;
}
IResourceDelta[] resourceDeltas = delta.getResourceDeltas();
if (resourceDeltas != null) {
for (int i = 0, length = resourceDeltas.length; i < length; i++) {
rootDelta.addResourceDelta(resourceDeltas[i]);
insertedTree = true;
}
}
} else {
rootDelta.insertDeltaTree(element, delta);
insertedTree = true;
}
}
if (insertedTree) return rootDelta;
return null;
}
private void notifyListeners(IRodinElementDelta deltaToNotify, int eventType, IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) {
final ElementChangedEvent extraEvent = new ElementChangedEvent(deltaToNotify, eventType);
for (int i= 0; i < listenerCount; i++) {
if ((listenerMask[i] & eventType) != 0){
final IElementChangedListener listener = listeners[i];
long start = -1;
if (VERBOSE) {
System.out.print("Listener #" + (i+1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$
start = System.currentTimeMillis();
}
// wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
Util.log(exception, "Exception occurred in listener of Rodin element change notification"); //$NON-NLS-1$
}
@Override
public void run() throws Exception {
listener.elementChanged(extraEvent);
}
});
if (VERBOSE) {
System.out.println(" -> " + (System.currentTimeMillis()-start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
}
/*
* Generic processing for elements with changed contents:<ul>
* <li>The element is closed such that any subsequent accesses will re-open
* the element reflecting its new structure.
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
* </ul>
*/
private void nonRodinResourcesChanged(Openable element, IResourceDelta delta)
throws RodinDBException {
// reset non-Rodin resources if element was open
if (element.isOpen()) {
RodinElementInfo info = element.getElementInfo();
if (element.getElementType() == IRodinDB.ELEMENT_TYPE) {
((RodinDBInfo) info).nonRodinResources = null;
currentDelta().addResourceDelta(delta);
return;
} else if (element.getElementType() == IRodinProject.ELEMENT_TYPE) {
((RodinProjectElementInfo) info).setNonRodinResources(null);
}
}
RodinElementDelta current = currentDelta();
RodinElementDelta elementDelta = current.find(element);
if (elementDelta == null) {
// don't use find after creating the delta as it can be null (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63434)
elementDelta = current.changed(element, IRodinElementDelta.F_CONTENT);
}
elementDelta.addResourceDelta(delta);
}
/*
* Converts a <code>IResourceDelta</code> rooted in a <code>Workspace</code> into
* the corresponding set of <code>IRodinElementDelta</code>, rooted in the
* relevant <code>RodinDB</code>s.
*/
private IRodinElementDelta processResourceDelta(IResourceDelta changes) {
try {
IRodinDB database = this.manager.getRodinDB();
if (!database.isOpen()) {
// force opening of the Rodin database so that Rodin element deltas are reported
try {
database.open(null);
} catch (RodinDBException e) {
Util.log(e, "Couldn't open the Rodin database");
return null;
}
}
this.currentElement = null;
// get the workspace delta, and start processing there.
for (IResourceDelta delta: changes.getAffectedChildren()) {
IResource res = delta.getResource();
// find out the element type
IElementType<?> elementType;
IProject proj = (IProject) res;
boolean wasRodinProject = this.manager.getRodinDB().findOldRodinProject(proj) != null;
boolean isRodinProject = RodinProject.hasRodinNature(proj);
if (!wasRodinProject && !isRodinProject) {
elementType = null;
} else {
elementType = IRodinProject.ELEMENT_TYPE;
// traverse delta
this.traverseProjectDelta(delta, elementType);
}
if (elementType == null
|| (wasRodinProject != isRodinProject && (delta.getKind()) == IResourceDelta.CHANGED)) {
// project has changed nature (description or open/closed)
try {
// add child as non Rodin resource
nonRodinResourcesChanged((RodinDB)database, delta);
} catch (RodinDBException e) {
// Rodin database could not be opened
}
}
}
resetProjectCaches();
return this.currentDelta;
} finally {
this.currentDelta = null;
this.projectCachesToReset.clear();
}
}
/*
* Traverse the set of projects which have changed namespace, and reset their
* caches and their dependents.
*/
private void resetProjectCaches() {
// TODO implement when project caches are there
}
/*
* Registers the given delta with this delta processor.
*/
public void registerRodinDBDelta(IRodinElementDelta delta) {
this.rodinDBDeltas.add(delta);
}
/*
* Removes any buffer associated to the given element.
*/
private void removeFromBufferCache(Openable child, boolean force) {
if (child instanceof RodinFile) {
final RodinFile rodinFile = (RodinFile) child;
final RodinDBManager rodinDBManager = RodinDBManager.getRodinDBManager();
rodinDBManager.removeBuffer(rodinFile.getMutableCopy(), force);
}
}
/*
* Removes the given element from its parents cache of children. If the
* element does not have a parent, or the parent is not currently open,
* this has no effect.
*/
private void removeFromParentInfo(Openable child) {
Openable parent = child.getParent();
if (parent != null && parent.isOpen()) {
try {
RodinElementInfo info = parent.getElementInfo();
info.removeChild(child);
} catch (RodinDBException e) {
// do nothing - we already checked if open
}
}
}
/*
* Notification that some resource changes have happened
* on the platform, and that the Rodin Model should update any required
* internal structures such that its elements remain consistent.
* Translates <code>IResourceDeltas</code> into <code>IRodinElementDeltas</code>.
*
* @see IResourceDelta
* @see IResource
*/
public void resourceChanged(IResourceChangeEvent event) {
if (event.getSource() instanceof IWorkspace) {
int eventType = this.overridenEventType == -1 ? event.getType() : this.overridenEventType;
IResource resource = event.getResource();
IResourceDelta delta = event.getDelta();
if (VERBOSE) {
System.out.println("-----------------------------------------------------------------------------------------------------------------------");//$NON-NLS-1$
System.out.println("PROCESSING Resource Changed Event ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$
DebugUtil.printEvent(event);
if (this.overridenEventType != -1) {
System.out.println(" Event type is overriden to:" + //$NON-NLS-1$
DebugUtil.eventTypeAsString(eventType));
}
}
switch(eventType){
case IResourceChangeEvent.PRE_DELETE :
try {
if(resource.getType() == IResource.PROJECT
&& ((IProject) resource).hasNature(RodinCore.NATURE_ID)) {
deleting((IProject)resource);
}
} catch(CoreException e){
// project doesn't exist or is not open: ignore
}
return;
case IResourceChangeEvent.POST_CHANGE :
if (isAffectedBy(delta)) { // avoid populating for SYNC or MARKER deltas
try {
try {
stopDeltas();
checkProjectsBeingAddedOrRemoved(delta);
IRodinElementDelta translatedDelta = processResourceDelta(delta);
if (translatedDelta != null) {
registerRodinDBDelta(translatedDelta);
}
} finally {
startDeltas();
}
fire(null, ElementChangedEvent.POST_CHANGE);
} finally {
// Cleanup cache of old projects
this.state.dbProjectsCache = null;
}
}
return;
case IResourceChangeEvent.PRE_BUILD :
// this.processPostChange = false;
if(isAffectedBy(delta)) { // avoid populating for SYNC or MARKER deltas
RodinBuilder.buildStarting();
}
// does not fire any deltas
return;
case IResourceChangeEvent.POST_BUILD :
RodinBuilder.buildFinished();
return;
}
}
}
/*
* Turns the firing mode to on. That is, deltas that are/have been
* registered will be fired.
*/
private void startDeltas() {
this.isFiring = true;
}
/*
* Turns the firing mode to off. That is, deltas that are/have been
* registered will not be fired until deltas are started again.
*/
private void stopDeltas() {
this.isFiring = false;
}
/*
* Converts an <code>IResourceDelta</code> rooted at a Rodin project and
* its children into the corresponding <code>IRodinElementDelta</code>s.
*/
private void traverseProjectDelta(IResourceDelta delta,
IElementType<?> elementType) {
IProject project = (IProject) delta.getResource();
RodinProject rodinProject = (RodinProject) RodinCore.valueOf(project);
// process current delta
boolean processChildren = this.updateCurrentDeltaAndIndex(delta, elementType);
// process children if needed
if (processChildren) {
for (IResourceDelta child: delta.getAffectedChildren()) {
traverseDelta(child, rodinProject);
}
}
}
/*
* Converts an <code>IResourceDelta</code> and its children into
* the corresponding <code>IRodinElementDelta</code>s.
*/
private void traverseDelta(IResourceDelta delta, RodinProject rodinProject) {
IResource res = delta.getResource();
switch (res.getType()) {
case IResource.FILE:
IElementType<?> elementType = elementType(res);
if (elementType != null) {
this.updateCurrentDeltaAndIndex(delta, elementType);
} else {
try {
// add child as non Rodin resource
nonRodinResourcesChanged(rodinProject, delta);
} catch (RodinDBException e) {
// Rodin database could not be opened
}
}
break;
case IResource.FOLDER:
try {
// add child as non Rodin resource
nonRodinResourcesChanged(rodinProject, delta);
} catch (RodinDBException e) {
// Rodin database could not be opened
}
break;
default:
assert false;
}
}
/*
* Update the current delta (ie. add/remove/change the given element) and update the correponding index.
* Returns whether the children of the given delta must be processed.
* @throws a RodinDBException if the delta doesn't correspond to a java element of the given type.
*/
public boolean updateCurrentDeltaAndIndex(IResourceDelta delta,
IElementType<?> elementType) {
Openable element;
switch (delta.getKind()) {
case IResourceDelta.ADDED :
IResource deltaRes = delta.getResource();
element = createElement(deltaRes, elementType);
if (element == null) {
return false;
}
// updateIndex(element, delta);
elementAdded(element, delta);
return elementType == IRodinProject.ELEMENT_TYPE;
case IResourceDelta.REMOVED :
deltaRes = delta.getResource();
element = createElement(deltaRes, elementType);
if (element == null) {
return false;
}
// updateIndex(element, delta);
elementRemoved(element, delta);
if (deltaRes.getType() == IResource.PROJECT){
// reset the corresponding project built state, since cannot reuse if added back
if (RodinBuilder.DEBUG)
System.out.println("Clearing last state for removed project : " + deltaRes); //$NON-NLS-1$
this.manager.setLastBuiltState((IProject)deltaRes, null /*no state*/);
// clean up previous session containers (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=89850)
// this.manager.previousSessionContainers.remove(element);
}
return elementType == IRodinProject.ELEMENT_TYPE;
case IResourceDelta.CHANGED :
int flags = delta.getFlags();
if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.ENCODING) != 0) {
// content or encoding has changed
element = createElement(delta.getResource(), elementType);
if (element == null) return false;
// updateIndex(element, delta);
contentChanged(element);
} else if (elementType == IRodinProject.ELEMENT_TYPE) {
if ((flags & IResourceDelta.OPEN) != 0) {
// project has been opened or closed
IProject res = (IProject)delta.getResource();
element = createElement(res, elementType);
if (element == null) {
return false;
}
if (res.isOpen()) {
if (RodinProject.hasRodinNature(res)) {
addToParentInfo(element);
currentDelta().opened(element);
// refresh pkg fragment roots and caches of the project (and its dependents)
this.projectCachesToReset.add((RodinProject) element);
// this.manager.indexManager.indexAll(res);
}
} else {
RodinDB javaModel = this.manager.getRodinDB();
boolean wasRodinProject = javaModel.findOldRodinProject(res) != null;
if (wasRodinProject) {
close(element);
removeFromParentInfo(element);
currentDelta().closed(element);
// this.manager.indexManager.discardJobs(element.getElementName());
// this.manager.indexManager.removeIndexFamily(res.getFullPath());
}
}
return false; // when a project is open/closed don't process children
}
if ((flags & IResourceDelta.DESCRIPTION) != 0) {
IProject res = (IProject)delta.getResource();
RodinDB javaModel = this.manager.getRodinDB();
boolean wasRodinProject = javaModel.findOldRodinProject(res) != null;
boolean isRodinProject = RodinProject.hasRodinNature(res);
if (wasRodinProject != isRodinProject) {
// project's nature has been added or removed
element = this.createElement(res, elementType);
if (element == null) return false; // note its resources are still visible as roots to other projects
if (isRodinProject) {
elementAdded(element, delta);
// this.manager.indexManager.indexAll(res);
} else {
elementRemoved(element, delta);
// this.manager.indexManager.discardJobs(element.getElementName());
// this.manager.indexManager.removeIndexFamily(res.getFullPath());
// reset the corresponding project built state, since cannot reuse if added back
if (RodinBuilder.DEBUG)
System.out.println("Clearing last state for project loosing Rodin nature: " + res); //$NON-NLS-1$
this.manager.setLastBuiltState(res, null /*no state*/);
}
return false; // when a project's nature is added/removed don't process children
}
}
return true; // something changed within the project and we don't know what.
}
return true;
}
return true;
}
/*
* Update the Rodin database given some delta
*/
public void updateRodinDB(IRodinElementDelta customDelta) {
if (customDelta == null) {
for (IRodinElementDelta delta: this.rodinDBDeltas) {
this.dbUpdater.processRodinDelta(delta);
}
} else {
this.dbUpdater.processRodinDelta(customDelta);
}
}
}
| 37,131 | 0.683068 | 0.680079 | 1,052 | 34.295628 | 28.856026 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.596008 | false | false |
9
|
33b4c225a653695c9065fa99d57c5f61853ef270
| 11,871,289,650,281 |
51f4197d28166b581b99cadd547969516fd3bbfd
|
/app/src/main/java/ru/firsto/yac16artists/api/net/BODY_DELETE.java
|
2bcc75d28a025110e3d714bb8f652da456085cf1
|
[] |
no_license
|
Firsto/YAC16Artists
|
https://github.com/Firsto/YAC16Artists
|
18e952e6c6d29dcc04c07d102d1187463bfbb393
|
1c8509481f101eb5f2dee682fa1c338018a0c3b8
|
refs/heads/master
| 2020-12-24T19:03:54.908000 | 2016-04-19T10:39:41 | 2016-04-19T10:39:41 | 56,586,614 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.firsto.yac16artists.api.net;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import retrofit.http.RestMethod;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target(METHOD)
@Retention(RUNTIME)
@RestMethod(value = "DELETE", hasBody = true)
public @interface BODY_DELETE {
String value();
}
|
UTF-8
|
Java
| 402 |
java
|
BODY_DELETE.java
|
Java
|
[] | null |
[] |
package ru.firsto.yac16artists.api.net;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import retrofit.http.RestMethod;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target(METHOD)
@Retention(RUNTIME)
@RestMethod(value = "DELETE", hasBody = true)
public @interface BODY_DELETE {
String value();
}
| 402 | 0.793532 | 0.788557 | 16 | 24.1875 | 19.660299 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
9
|
5a091254ca5ea68e3cb1f1d47442db528b22530d
| 15,212,774,206,823 |
0cfcdcb266aed21d735ae7b0e3a52bfc03d93cda
|
/goldray/src/main/java/com/goldray/backend/model/po/RichTextPo.java
|
51bf4c8edb4a5d44f2ffb17f7b37a78c55ca14eb
|
[] |
no_license
|
zowbman/jessedong
|
https://github.com/zowbman/jessedong
|
a03e5ff22eb281c63eff5a85897192698d755019
|
4b024d164ee7091d41d05e5c48d36cd6aeed7285
|
refs/heads/master
| 2021-01-20T11:46:54.417000 | 2017-04-21T12:41:34 | 2017-04-21T12:41:34 | 82,633,097 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.goldray.backend.model.po;
/**
* Created by zwb on 2017/4/18.
*/
public class RichTextPo {
private int id;
private int type;
private String text;
private int addTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getAddTime() {
return addTime;
}
public void setAddTime(int addTime) {
this.addTime = addTime;
}
}
|
UTF-8
|
Java
| 707 |
java
|
RichTextPo.java
|
Java
|
[
{
"context": "e com.goldray.backend.model.po;\n\n/**\n * Created by zwb on 2017/4/18.\n */\npublic class RichTextPo {\n p",
"end": 60,
"score": 0.9995615482330322,
"start": 57,
"tag": "USERNAME",
"value": "zwb"
}
] | null |
[] |
package com.goldray.backend.model.po;
/**
* Created by zwb on 2017/4/18.
*/
public class RichTextPo {
private int id;
private int type;
private String text;
private int addTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getAddTime() {
return addTime;
}
public void setAddTime(int addTime) {
this.addTime = addTime;
}
}
| 707 | 0.55587 | 0.545969 | 43 | 15.44186 | 13.140214 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.302326 | false | false |
9
|
f87afa07612a7e276fcde40d9ba4375684ee7aaf
| 9,466,107,954,789 |
e709946d936b09f9614a7a4bc617687d84638ea1
|
/src/main/java/br/com/gft/wa/opening/domain/opening/OpeningRepository.java
|
e7f7f3379e08515fbeaf4d29fde359e2f1c66cb5
|
[] |
no_license
|
mkacunha/ms-opening
|
https://github.com/mkacunha/ms-opening
|
f9c780365291e09625d9d50b52f0d8d1831a7b04
|
1708d1e439dcdc76c3441d582c162dd9f1d0721f
|
refs/heads/master
| 2023-01-20T20:41:30.979000 | 2020-11-29T02:24:43 | 2020-11-29T02:24:43 | 316,860,274 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.gft.wa.opening.domain.opening;
import br.com.gft.wa.opening.domain.BusinessException;
import org.springframework.data.jpa.repository.JpaRepository;
public interface OpeningRepository extends JpaRepository<Opening, Long> {
default Opening getOne(Long id) {
return findById(id).orElseThrow(() -> new BusinessException("Vaga de id " + id + " não encontrada"));
}
}
|
UTF-8
|
Java
| 398 |
java
|
OpeningRepository.java
|
Java
|
[] | null |
[] |
package br.com.gft.wa.opening.domain.opening;
import br.com.gft.wa.opening.domain.BusinessException;
import org.springframework.data.jpa.repository.JpaRepository;
public interface OpeningRepository extends JpaRepository<Opening, Long> {
default Opening getOne(Long id) {
return findById(id).orElseThrow(() -> new BusinessException("Vaga de id " + id + " não encontrada"));
}
}
| 398 | 0.745592 | 0.745592 | 12 | 32.083332 | 35.254925 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
9
|
768e42e91cd8b80c5222c97dda7dcc1014fed25d
| 14,353,780,770,338 |
9803ac28242274e26793328616f1d229b7adef3b
|
/Test/app/src/main/java/com/uvarov/test/widgets/SwipeLayout.java
|
a970ac96c17d480edfa65872d59d560de2031c9e
|
[] |
no_license
|
UvarovBoris/androidTest
|
https://github.com/UvarovBoris/androidTest
|
eb2170a5a45b49b66b3b8a2cb843e13cc4bda2c1
|
f1ce9ed12ad8707707989dc5a21dd9f27a5d1120
|
refs/heads/master
| 2021-01-20T17:33:59.123000 | 2017-09-25T14:52:31 | 2017-09-25T14:52:31 | 61,446,321 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.uvarov.test.widgets;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.view.NestedScrollingParent;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ViewDragHelper;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.AccelerateInterpolator;
import com.uvarov.test.R;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.WeakHashMap;
public class SwipeLayout extends ViewGroup {
private static final String TAG = SwipeLayout.class.getSimpleName();
private static final float VELOCITY_THRESHOLD = 1500f;
private ViewDragHelper dragHelper;
private View centerView;
private float velocityThreshold;
private float touchSlop;
private OnSwipeListener swipeListener;
private WeakReference<ObjectAnimator> resetAnimator;
private final Map<View, Boolean> hackedParents = new WeakHashMap<>();
private static final int TOUCH_STATE_WAIT = 0;
private static final int TOUCH_STATE_SWIPE = 1;
private static final int TOUCH_STATE_SKIP = 2;
private int touchState = TOUCH_STATE_WAIT;
private float touchX;
private float touchY;
private float maxOffset;
public SwipeLayout(Context context) {
super(context);
init(context, null);
}
public SwipeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public SwipeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
dragHelper = ViewDragHelper.create(this, 1f, dragCallback);
velocityThreshold = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, VELOCITY_THRESHOLD, getResources().getDisplayMetrics());
touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeLayout);
if (a.hasValue(R.styleable.SwipeLayout_swipe_enabled)) {
maxOffset = a.getDimension(R.styleable.SwipeLayout_max_offset, 0);
}
a.recycle();
}
}
public void setOnSwipeListener(OnSwipeListener swipeListener) {
this.swipeListener = swipeListener;
}
/**
* reset swipe-layout state to initial position
*/
public void reset() {
if (centerView == null) return;
finishResetAnimator();
dragHelper.abort();
offsetChildren(null, -centerView.getLeft());
}
/**
* reset swipe-layout state to initial position with animation (200ms)
*/
public void animateReset() {
if (centerView == null) return;
finishResetAnimator();
dragHelper.abort();
ObjectAnimator animator = new ObjectAnimator();
animator.setTarget(this);
animator.setPropertyName("offset");
animator.setInterpolator(new AccelerateInterpolator());
animator.setIntValues(centerView.getLeft(), 0);
animator.setDuration(200);
animator.start();
resetAnimator = new WeakReference<>(animator);
}
private void finishResetAnimator() {
if (resetAnimator == null) return;
ObjectAnimator animator = resetAnimator.get();
if (animator != null) {
resetAnimator.clear();
if (animator.isRunning()) {
animator.end();
}
}
}
/**
* get horizontal offset from initial position
*/
public int getOffset() {
return centerView == null ? 0 : centerView.getLeft();
}
/**
* set horizontal offset from initial position
*/
public void setOffset(int offset) {
if (centerView != null) {
offsetChildren(null, offset - centerView.getLeft());
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int count = getChildCount();
int maxHeight = 0;
// Find out how big everyone wants to be
if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) {
measureChildren(widthMeasureSpec, heightMeasureSpec);
} else {
//find a child with biggest height
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
measureChild(child, widthMeasureSpec, heightMeasureSpec);
maxHeight = Math.max(maxHeight, child.getMeasuredHeight());
}
if (maxHeight > 0) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY);
measureChildren(widthMeasureSpec, heightMeasureSpec);
}
}
// Find rightmost and bottom-most child
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() != GONE) {
int childBottom;
childBottom = child.getMeasuredHeight();
maxHeight = Math.max(maxHeight, childBottom);
}
}
maxHeight += getPaddingTop() + getPaddingBottom();
maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight());
setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec),
resolveSize(maxHeight, heightMeasureSpec));
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
final int count = getChildCount();
final int parentTop = getPaddingTop();
centerView = getChildAt(0);
if (centerView == null) throw new RuntimeException("Center view must be added");
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE) {
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int width = child.getMeasuredWidth();
final int height = child.getMeasuredHeight();
int childLeft;
int childTop;
childLeft = child.getLeft();
childTop = parentTop;
child.layout(childLeft, childTop, childLeft + width, childTop + height);
}
}
}
private final ViewDragHelper.Callback dragCallback = new ViewDragHelper.Callback() {
private int initLeft;
@Override
public boolean tryCaptureView(View child, int pointerId) {
initLeft = child.getLeft();
return true;
}
@Override
public int clampViewPositionHorizontal(View child, int left, int dx) {
if (dx > 0) {
return left > maxOffset ? (int) maxOffset : left;
} else {
return left < -maxOffset ? (int) -maxOffset : left;
}
}
@Override
public int getViewHorizontalDragRange(View child) {
return getWidth();
}
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
int dx = releasedChild.getLeft() - initLeft;
if (dx == 0) return;
boolean handled = false;
if (dx > 0) {
handled = xvel >= 0 ? onMoveRightReleased(releasedChild, dx, xvel) : onMoveLeftReleased(releasedChild, dx, xvel);
} else if (dx < 0) {
handled = xvel <= 0 ? onMoveLeftReleased(releasedChild, dx, xvel) : onMoveRightReleased(releasedChild, dx, xvel);
}
if (!handled) {
startScrollAnimation(releasedChild, releasedChild.getLeft() - centerView.getLeft(), false, dx > 0);
}
}
@Override
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
offsetChildren(changedView, dx);
if (swipeListener == null) return;
if (dx > 0) {
if (centerView.getLeft() >= maxOffset)
swipeListener.onSwiped(SwipeLayout.this, true);
} else if (dx < 0) {
if (centerView.getLeft() <= -maxOffset)
swipeListener.onSwiped(SwipeLayout.this, false);
}
/*
int stickyBound;
if (dx > 0) {
//move to right
if (leftView != null) {
stickyBound = getStickyBound(leftView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (leftView.getRight() - stickyBound > 0 && leftView.getRight() - stickyBound - dx <= 0)
swipeListener.onLeftStickyEdge(SwipeLayout.this, true);
}
}
if (rightView != null) {
stickyBound = getStickyBound(rightView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (rightView.getLeft() + stickyBound > getWidth() && rightView.getLeft() + stickyBound - dx <= getWidth())
swipeListener.onRightStickyEdge(SwipeLayout.this, true);
}
}
} else if (dx < 0) {
//move to left
if (leftView != null) {
stickyBound = getStickyBound(leftView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (leftView.getRight() - stickyBound <= 0 && leftView.getRight() - stickyBound - dx > 0)
swipeListener.onLeftStickyEdge(SwipeLayout.this, false);
}
}
if (rightView != null) {
stickyBound = getStickyBound(rightView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (rightView.getLeft() + stickyBound <= getWidth() && rightView.getLeft() + stickyBound - dx > getWidth())
swipeListener.onRightStickyEdge(SwipeLayout.this, false);
}
}
}
*/
}
private boolean onMoveRightReleased(View child, int dx, float xvel) {
if (xvel > velocityThreshold) {
boolean moveToOriginal = centerView.getLeft() < 0;
startScrollAnimation(child, 0, !moveToOriginal, true);
return true;
}
return false;
}
private boolean onMoveLeftReleased(View child, int dx, float xvel) {
if (-xvel > velocityThreshold) {
boolean moveToOriginal = centerView.getLeft() > 0;
startScrollAnimation(child, 0, !moveToOriginal, false);
return true;
}
return false;
}
};
private void startScrollAnimation(View view, int targetX, boolean moveToClamp, boolean toRight) {
if (dragHelper.settleCapturedViewAt(targetX, view.getTop())) {
ViewCompat.postOnAnimation(view, new SettleRunnable(view, moveToClamp, toRight));
} else {
if (moveToClamp && swipeListener != null) {
swipeListener.onSwipeClampReached(SwipeLayout.this, toRight);
}
}
}
private void offsetChildren(View skip, int dx) {
if (dx == 0) return;
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child == skip) continue;
child.offsetLeftAndRight(dx);
invalidate(child.getLeft(), child.getTop(), child.getRight(), child.getBottom());
}
}
private void hackParents() {
ViewParent parent = getParent();
while (parent != null) {
if (parent instanceof NestedScrollingParent) {
View view = (View) parent;
hackedParents.put(view, view.isEnabled());
}
parent = parent.getParent();
}
}
private void unHackParents() {
for (Map.Entry<View, Boolean> entry : hackedParents.entrySet()) {
View view = entry.getKey();
if (view != null) {
view.setEnabled(entry.getValue());
}
}
hackedParents.clear();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return dragHelper.shouldInterceptTouchEvent(event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean defaultResult = super.onTouchEvent(event);
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
touchState = TOUCH_STATE_WAIT;
touchX = event.getX();
touchY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
if (touchState == TOUCH_STATE_WAIT) {
float dx = Math.abs(event.getX() - touchX);
float dy = Math.abs(event.getY() - touchY);
if (dx >= touchSlop || dy >= touchSlop) {
touchState = dy == 0 || dx / dy > 1f ? TOUCH_STATE_SWIPE : TOUCH_STATE_SKIP;
if (touchState == TOUCH_STATE_SWIPE) {
requestDisallowInterceptTouchEvent(true);
hackParents();
if (swipeListener != null)
swipeListener.onBeginSwipe(this, event.getX() > touchX);
}
}
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (touchState == TOUCH_STATE_SWIPE) {
unHackParents();
requestDisallowInterceptTouchEvent(false);
}
touchState = TOUCH_STATE_WAIT;
break;
}
if (event.getActionMasked() != MotionEvent.ACTION_MOVE || touchState == TOUCH_STATE_SWIPE) {
dragHelper.processTouchEvent(event);
}
return true;
}
@Override
protected LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
private class SettleRunnable implements Runnable {
private final View mView;
private final boolean moveToClamp;
private final boolean moveToRight;
SettleRunnable(View view, boolean moveToClamp, boolean moveToRight) {
this.mView = view;
this.moveToClamp = moveToClamp;
this.moveToRight = moveToRight;
}
public void run() {
if (dragHelper != null && dragHelper.continueSettling(true)) {
ViewCompat.postOnAnimation(this.mView, this);
} else {
Log.d(TAG, "ONSWIPE clamp: " + moveToClamp + " ; moveToRight: " + moveToRight);
if (moveToClamp && swipeListener != null) {
swipeListener.onSwipeClampReached(SwipeLayout.this, moveToRight);
}
}
}
}
public interface OnSwipeListener {
void onBeginSwipe(SwipeLayout swipeLayout, boolean moveToRight);
void onSwipeClampReached(SwipeLayout swipeLayout, boolean moveToRight);
void onLeftStickyEdge(SwipeLayout swipeLayout, boolean moveToRight);
void onRightStickyEdge(SwipeLayout swipeLayout, boolean moveToRight);
void onSwiped(SwipeLayout swipeLayout, boolean moveToRight);
}
}
|
UTF-8
|
Java
| 15,985 |
java
|
SwipeLayout.java
|
Java
|
[] | null |
[] |
package com.uvarov.test.widgets;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.view.NestedScrollingParent;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ViewDragHelper;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.AccelerateInterpolator;
import com.uvarov.test.R;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.WeakHashMap;
public class SwipeLayout extends ViewGroup {
private static final String TAG = SwipeLayout.class.getSimpleName();
private static final float VELOCITY_THRESHOLD = 1500f;
private ViewDragHelper dragHelper;
private View centerView;
private float velocityThreshold;
private float touchSlop;
private OnSwipeListener swipeListener;
private WeakReference<ObjectAnimator> resetAnimator;
private final Map<View, Boolean> hackedParents = new WeakHashMap<>();
private static final int TOUCH_STATE_WAIT = 0;
private static final int TOUCH_STATE_SWIPE = 1;
private static final int TOUCH_STATE_SKIP = 2;
private int touchState = TOUCH_STATE_WAIT;
private float touchX;
private float touchY;
private float maxOffset;
public SwipeLayout(Context context) {
super(context);
init(context, null);
}
public SwipeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public SwipeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
dragHelper = ViewDragHelper.create(this, 1f, dragCallback);
velocityThreshold = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, VELOCITY_THRESHOLD, getResources().getDisplayMetrics());
touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeLayout);
if (a.hasValue(R.styleable.SwipeLayout_swipe_enabled)) {
maxOffset = a.getDimension(R.styleable.SwipeLayout_max_offset, 0);
}
a.recycle();
}
}
public void setOnSwipeListener(OnSwipeListener swipeListener) {
this.swipeListener = swipeListener;
}
/**
* reset swipe-layout state to initial position
*/
public void reset() {
if (centerView == null) return;
finishResetAnimator();
dragHelper.abort();
offsetChildren(null, -centerView.getLeft());
}
/**
* reset swipe-layout state to initial position with animation (200ms)
*/
public void animateReset() {
if (centerView == null) return;
finishResetAnimator();
dragHelper.abort();
ObjectAnimator animator = new ObjectAnimator();
animator.setTarget(this);
animator.setPropertyName("offset");
animator.setInterpolator(new AccelerateInterpolator());
animator.setIntValues(centerView.getLeft(), 0);
animator.setDuration(200);
animator.start();
resetAnimator = new WeakReference<>(animator);
}
private void finishResetAnimator() {
if (resetAnimator == null) return;
ObjectAnimator animator = resetAnimator.get();
if (animator != null) {
resetAnimator.clear();
if (animator.isRunning()) {
animator.end();
}
}
}
/**
* get horizontal offset from initial position
*/
public int getOffset() {
return centerView == null ? 0 : centerView.getLeft();
}
/**
* set horizontal offset from initial position
*/
public void setOffset(int offset) {
if (centerView != null) {
offsetChildren(null, offset - centerView.getLeft());
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int count = getChildCount();
int maxHeight = 0;
// Find out how big everyone wants to be
if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) {
measureChildren(widthMeasureSpec, heightMeasureSpec);
} else {
//find a child with biggest height
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
measureChild(child, widthMeasureSpec, heightMeasureSpec);
maxHeight = Math.max(maxHeight, child.getMeasuredHeight());
}
if (maxHeight > 0) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY);
measureChildren(widthMeasureSpec, heightMeasureSpec);
}
}
// Find rightmost and bottom-most child
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() != GONE) {
int childBottom;
childBottom = child.getMeasuredHeight();
maxHeight = Math.max(maxHeight, childBottom);
}
}
maxHeight += getPaddingTop() + getPaddingBottom();
maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight());
setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec),
resolveSize(maxHeight, heightMeasureSpec));
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
final int count = getChildCount();
final int parentTop = getPaddingTop();
centerView = getChildAt(0);
if (centerView == null) throw new RuntimeException("Center view must be added");
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE) {
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int width = child.getMeasuredWidth();
final int height = child.getMeasuredHeight();
int childLeft;
int childTop;
childLeft = child.getLeft();
childTop = parentTop;
child.layout(childLeft, childTop, childLeft + width, childTop + height);
}
}
}
private final ViewDragHelper.Callback dragCallback = new ViewDragHelper.Callback() {
private int initLeft;
@Override
public boolean tryCaptureView(View child, int pointerId) {
initLeft = child.getLeft();
return true;
}
@Override
public int clampViewPositionHorizontal(View child, int left, int dx) {
if (dx > 0) {
return left > maxOffset ? (int) maxOffset : left;
} else {
return left < -maxOffset ? (int) -maxOffset : left;
}
}
@Override
public int getViewHorizontalDragRange(View child) {
return getWidth();
}
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
int dx = releasedChild.getLeft() - initLeft;
if (dx == 0) return;
boolean handled = false;
if (dx > 0) {
handled = xvel >= 0 ? onMoveRightReleased(releasedChild, dx, xvel) : onMoveLeftReleased(releasedChild, dx, xvel);
} else if (dx < 0) {
handled = xvel <= 0 ? onMoveLeftReleased(releasedChild, dx, xvel) : onMoveRightReleased(releasedChild, dx, xvel);
}
if (!handled) {
startScrollAnimation(releasedChild, releasedChild.getLeft() - centerView.getLeft(), false, dx > 0);
}
}
@Override
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
offsetChildren(changedView, dx);
if (swipeListener == null) return;
if (dx > 0) {
if (centerView.getLeft() >= maxOffset)
swipeListener.onSwiped(SwipeLayout.this, true);
} else if (dx < 0) {
if (centerView.getLeft() <= -maxOffset)
swipeListener.onSwiped(SwipeLayout.this, false);
}
/*
int stickyBound;
if (dx > 0) {
//move to right
if (leftView != null) {
stickyBound = getStickyBound(leftView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (leftView.getRight() - stickyBound > 0 && leftView.getRight() - stickyBound - dx <= 0)
swipeListener.onLeftStickyEdge(SwipeLayout.this, true);
}
}
if (rightView != null) {
stickyBound = getStickyBound(rightView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (rightView.getLeft() + stickyBound > getWidth() && rightView.getLeft() + stickyBound - dx <= getWidth())
swipeListener.onRightStickyEdge(SwipeLayout.this, true);
}
}
} else if (dx < 0) {
//move to left
if (leftView != null) {
stickyBound = getStickyBound(leftView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (leftView.getRight() - stickyBound <= 0 && leftView.getRight() - stickyBound - dx > 0)
swipeListener.onLeftStickyEdge(SwipeLayout.this, false);
}
}
if (rightView != null) {
stickyBound = getStickyBound(rightView);
if (stickyBound != LayoutParams.STICKY_NONE) {
if (rightView.getLeft() + stickyBound <= getWidth() && rightView.getLeft() + stickyBound - dx > getWidth())
swipeListener.onRightStickyEdge(SwipeLayout.this, false);
}
}
}
*/
}
private boolean onMoveRightReleased(View child, int dx, float xvel) {
if (xvel > velocityThreshold) {
boolean moveToOriginal = centerView.getLeft() < 0;
startScrollAnimation(child, 0, !moveToOriginal, true);
return true;
}
return false;
}
private boolean onMoveLeftReleased(View child, int dx, float xvel) {
if (-xvel > velocityThreshold) {
boolean moveToOriginal = centerView.getLeft() > 0;
startScrollAnimation(child, 0, !moveToOriginal, false);
return true;
}
return false;
}
};
private void startScrollAnimation(View view, int targetX, boolean moveToClamp, boolean toRight) {
if (dragHelper.settleCapturedViewAt(targetX, view.getTop())) {
ViewCompat.postOnAnimation(view, new SettleRunnable(view, moveToClamp, toRight));
} else {
if (moveToClamp && swipeListener != null) {
swipeListener.onSwipeClampReached(SwipeLayout.this, toRight);
}
}
}
private void offsetChildren(View skip, int dx) {
if (dx == 0) return;
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child == skip) continue;
child.offsetLeftAndRight(dx);
invalidate(child.getLeft(), child.getTop(), child.getRight(), child.getBottom());
}
}
private void hackParents() {
ViewParent parent = getParent();
while (parent != null) {
if (parent instanceof NestedScrollingParent) {
View view = (View) parent;
hackedParents.put(view, view.isEnabled());
}
parent = parent.getParent();
}
}
private void unHackParents() {
for (Map.Entry<View, Boolean> entry : hackedParents.entrySet()) {
View view = entry.getKey();
if (view != null) {
view.setEnabled(entry.getValue());
}
}
hackedParents.clear();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return dragHelper.shouldInterceptTouchEvent(event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean defaultResult = super.onTouchEvent(event);
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
touchState = TOUCH_STATE_WAIT;
touchX = event.getX();
touchY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
if (touchState == TOUCH_STATE_WAIT) {
float dx = Math.abs(event.getX() - touchX);
float dy = Math.abs(event.getY() - touchY);
if (dx >= touchSlop || dy >= touchSlop) {
touchState = dy == 0 || dx / dy > 1f ? TOUCH_STATE_SWIPE : TOUCH_STATE_SKIP;
if (touchState == TOUCH_STATE_SWIPE) {
requestDisallowInterceptTouchEvent(true);
hackParents();
if (swipeListener != null)
swipeListener.onBeginSwipe(this, event.getX() > touchX);
}
}
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (touchState == TOUCH_STATE_SWIPE) {
unHackParents();
requestDisallowInterceptTouchEvent(false);
}
touchState = TOUCH_STATE_WAIT;
break;
}
if (event.getActionMasked() != MotionEvent.ACTION_MOVE || touchState == TOUCH_STATE_SWIPE) {
dragHelper.processTouchEvent(event);
}
return true;
}
@Override
protected LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
private class SettleRunnable implements Runnable {
private final View mView;
private final boolean moveToClamp;
private final boolean moveToRight;
SettleRunnable(View view, boolean moveToClamp, boolean moveToRight) {
this.mView = view;
this.moveToClamp = moveToClamp;
this.moveToRight = moveToRight;
}
public void run() {
if (dragHelper != null && dragHelper.continueSettling(true)) {
ViewCompat.postOnAnimation(this.mView, this);
} else {
Log.d(TAG, "ONSWIPE clamp: " + moveToClamp + " ; moveToRight: " + moveToRight);
if (moveToClamp && swipeListener != null) {
swipeListener.onSwipeClampReached(SwipeLayout.this, moveToRight);
}
}
}
}
public interface OnSwipeListener {
void onBeginSwipe(SwipeLayout swipeLayout, boolean moveToRight);
void onSwipeClampReached(SwipeLayout swipeLayout, boolean moveToRight);
void onLeftStickyEdge(SwipeLayout swipeLayout, boolean moveToRight);
void onRightStickyEdge(SwipeLayout swipeLayout, boolean moveToRight);
void onSwiped(SwipeLayout swipeLayout, boolean moveToRight);
}
}
| 15,985 | 0.574789 | 0.571723 | 457 | 33.980305 | 29.043875 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.652079 | false | false |
9
|
c9df6b805d59bdc4d686cd7163c15cb5c478e680
| 14,353,780,771,837 |
bbd941acf115476ebdc7655cc8845c51d7143c03
|
/Java/Position.java
|
d55ad1486c164a568fb76814cff0d8f30b179a87
|
[] |
no_license
|
SukyoungCho/Programming
|
https://github.com/SukyoungCho/Programming
|
989090660fba4f302aaade2b13f3e770aae4c079
|
2569c202964eb6405897952c68080c345cd8024b
|
refs/heads/master
| 2020-04-07T10:16:04.761000 | 2018-11-19T20:36:15 | 2018-11-19T20:36:15 | 158,279,578 | 0 | 0 | null | false | 2018-11-19T19:41:37 | 2018-11-19T19:35:44 | 2018-11-19T19:39:08 | 2018-11-19T19:41:37 | 0 | 0 | 0 | 0 |
R
| false | null |
//////////////////// ALL ASSIGNMENTS INCLUDE THIS SECTION /////////////////////
//
// Title: Maze Explorer
// Files:
// Course: CS300, Summer, 2018
//
// Author: Sukyoung Cho
// Email: scho83@wisc.edu
// Lecturer's Name: Mouna Kacem
//
//////////////////// /////////////////// /////////////////// ///////////////////
/**
* Position neither private nor public.
* @author sycho
*
*/
class Position {
int col; // column of the position, 0 indexed
int row; // column of the position, 0 indexed
/**
* Constructs a position object with given row and column
*
* @param row Row for the position
* @param col Column for the position
*/
Position(int row, int col) {
this.row = row;
this.col = col;
}
/**
* Copies a position object
* @override
* @param original
*/
Position(Position original) {
this.row = original.row;
this.col = original.col;
}
/**
* Checks if the two objects have same row and column values This method overrides the equals
* method declared in the java.lang.Object class
*
* @param other The other position object to be compared with
*/
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof Position)) {
// if the given is not a Position class object
return false;
}
Position pOther = (Position) other;
return this.col == pOther.col && this.row == pOther.row;
}
/**
* Checks if the two objects have same row and column values This is an example of overloading
* methods This method does not override the java.lang.Object's equals method. It has the same
* name, but different input argument parameters.
*
* @param row Row for comparison
* @param col Column for comparison
*/
public boolean equals(int row, int col) {
return this.col == col && this.row == row;
}
}
|
UTF-8
|
Java
| 1,897 |
java
|
Position.java
|
Java
|
[
{
"context": "iles:\n// Course: CS300, Summer, 2018\n//\n// Author: Sukyoung Cho\n// Email: scho83@wisc.edu\n// Lecturer's Name: Mou",
"end": 174,
"score": 0.9998553991317749,
"start": 162,
"tag": "NAME",
"value": "Sukyoung Cho"
},
{
"context": " Summer, 2018\n//\n// Author: Sukyoung Cho\n// Email: scho83@wisc.edu\n// Lecturer's Name: Mouna Kacem\n//\n//////////////",
"end": 200,
"score": 0.9999310374259949,
"start": 185,
"tag": "EMAIL",
"value": "scho83@wisc.edu"
},
{
"context": " Cho\n// Email: scho83@wisc.edu\n// Lecturer's Name: Mouna Kacem\n//\n//////////////////// /////////////////// /////",
"end": 232,
"score": 0.9997696876525879,
"start": 221,
"tag": "NAME",
"value": "Mouna Kacem"
},
{
"context": " * Position neither private nor public.\n * @author sycho\n *\n */\nclass Position {\n int col; // column of t",
"end": 377,
"score": 0.9986993074417114,
"start": 372,
"tag": "USERNAME",
"value": "sycho"
}
] | null |
[] |
//////////////////// ALL ASSIGNMENTS INCLUDE THIS SECTION /////////////////////
//
// Title: Maze Explorer
// Files:
// Course: CS300, Summer, 2018
//
// Author: <NAME>
// Email: <EMAIL>
// Lecturer's Name: <NAME>
//
//////////////////// /////////////////// /////////////////// ///////////////////
/**
* Position neither private nor public.
* @author sycho
*
*/
class Position {
int col; // column of the position, 0 indexed
int row; // column of the position, 0 indexed
/**
* Constructs a position object with given row and column
*
* @param row Row for the position
* @param col Column for the position
*/
Position(int row, int col) {
this.row = row;
this.col = col;
}
/**
* Copies a position object
* @override
* @param original
*/
Position(Position original) {
this.row = original.row;
this.col = original.col;
}
/**
* Checks if the two objects have same row and column values This method overrides the equals
* method declared in the java.lang.Object class
*
* @param other The other position object to be compared with
*/
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof Position)) {
// if the given is not a Position class object
return false;
}
Position pOther = (Position) other;
return this.col == pOther.col && this.row == pOther.row;
}
/**
* Checks if the two objects have same row and column values This is an example of overloading
* methods This method does not override the java.lang.Object's equals method. It has the same
* name, but different input argument parameters.
*
* @param row Row for comparison
* @param col Column for comparison
*/
public boolean equals(int row, int col) {
return this.col == col && this.row == row;
}
}
| 1,878 | 0.604639 | 0.59884 | 76 | 23.960526 | 24.77076 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.236842 | false | false |
9
|
dbf7fe347385f76d96835876a06a2c7ab7378a2b
| 27,436,251,120,839 |
fbadc441a83bdfab5331f99f9b1b1c06a504c00f
|
/spring-boot-demo/web-flux/src/main/java/com/atdyl/webflux/pojo/SexEnum.java
|
5fbc1d2e92aa5bdd61b85114bfcbd18cd722d324
|
[] |
no_license
|
silentself/silentself-demo
|
https://github.com/silentself/silentself-demo
|
57805abd4ac059401e65c4be8f4689923bbf1661
|
7d0d894ea38620195fad7755d5e374b6d8a01735
|
refs/heads/master
| 2022-06-29T06:28:24.152000 | 2020-01-20T09:18:54 | 2020-01-20T09:18:54 | 227,262,108 | 0 | 0 | null | false | 2022-06-17T02:49:40 | 2019-12-11T02:48:23 | 2020-01-20T09:19:26 | 2022-06-17T02:49:39 | 64 | 0 | 0 | 2 |
Java
| false | false |
package com.atdyl.webflux.pojo;
public enum SexEnum {
MALE(1, "男"),
FEMALE(2, "女");
SexEnum(int code, String sex) {
this.code = code;
this.sex = sex;
}
public static SexEnum getSexEnum(int code) {
SexEnum[] values = SexEnum.values();
for (SexEnum value : values) {
if (value.code == code) {
return value;
}
}
return null;
}
private int code;
private String sex;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
}
|
UTF-8
|
Java
| 743 |
java
|
SexEnum.java
|
Java
|
[] | null |
[] |
package com.atdyl.webflux.pojo;
public enum SexEnum {
MALE(1, "男"),
FEMALE(2, "女");
SexEnum(int code, String sex) {
this.code = code;
this.sex = sex;
}
public static SexEnum getSexEnum(int code) {
SexEnum[] values = SexEnum.values();
for (SexEnum value : values) {
if (value.code == code) {
return value;
}
}
return null;
}
private int code;
private String sex;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
}
| 743 | 0.507442 | 0.504736 | 43 | 16.186047 | 14.245776 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.395349 | false | false |
9
|
ce96a9330c51e06058dd2c042a146d54fd8118db
| 21,895,743,303,579 |
a74a1a43743845c3b36bc5973284674a964a1973
|
/src/java8/exception/HelloWorld.java
|
e9d94f2e6828a18c6a2d8bc7fe5a091981e3e96a
|
[] |
no_license
|
chakriboos/java8-preparation
|
https://github.com/chakriboos/java8-preparation
|
694ff13b289203807eb4bc70da549176a8af6403
|
f650445434ffbb643f8737aa73eed8ffca6ca7e7
|
refs/heads/master
| 2023-08-30T14:53:59.486000 | 2016-08-12T06:45:45 | 2016-08-12T06:45:45 | 62,698,837 | 0 | 0 | null | false | 2016-08-12T06:45:46 | 2016-07-06T07:02:31 | 2016-07-20T11:18:22 | 2016-08-12T06:45:45 | 13 | 0 | 0 | 0 |
Java
| null | null |
package java8.exception;
public class HelloWorld<T extends Object> {
public static void main(String[] args) {
// TODO Auto-generated method stub
float d = 9.888f;
Object _ = new Object();
System.out.println("xxx" + _.getClass());
Integer a[] = {0,1};
System.out.println(a.toString());
}
}
|
UTF-8
|
Java
| 311 |
java
|
HelloWorld.java
|
Java
|
[] | null |
[] |
package java8.exception;
public class HelloWorld<T extends Object> {
public static void main(String[] args) {
// TODO Auto-generated method stub
float d = 9.888f;
Object _ = new Object();
System.out.println("xxx" + _.getClass());
Integer a[] = {0,1};
System.out.println(a.toString());
}
}
| 311 | 0.646302 | 0.623794 | 16 | 18.4375 | 16.966764 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4375 | false | false |
9
|
018b1a37112567c71d1f5925b701e3362bf6bc71
| 32,942,399,194,616 |
e3da27b37f45de06c8689e59f98c09f068c4a1a3
|
/src/main/java/com/mo9/mapper/mappers/combine/AggregateMapper.java
|
d2675bbf0fcdf0608014025e3375421ab4bdf371
|
[] |
no_license
|
cmnetmerge/easyMapper
|
https://github.com/cmnetmerge/easyMapper
|
73909755f91cfc4b071c1cdf612f47e4ced8dc64
|
fcd622f957f94f855a4103fcb8ac663909b09297
|
refs/heads/master
| 2017-11-26T18:43:08.349000 | 2017-06-23T10:39:35 | 2017-06-23T10:39:35 | 95,210,949 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mo9.mapper.mappers.combine;
import com.mo9.mapper.providers.combine.AggregateProvider;
import com.mo9.mapper.sql.criteria.Criteria;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
import java.util.Map;
/**
* Created by gavin on 2017/1/4.
*/
public interface AggregateMapper<T> {
@ResultType(java.util.Map.class)
@SelectProvider(type = AggregateProvider.class, method = "dynamicSQL")
Map<String, Object> aggregateOne(Criteria criteria);
@ResultType(java.util.List.class)
@SelectProvider(type = AggregateProvider.class, method = "dynamicSQL")
List<Map<String, Object>> aggregate(Criteria criteria);
}
|
UTF-8
|
Java
| 718 |
java
|
AggregateMapper.java
|
Java
|
[
{
"context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by gavin on 2017/1/4.\n */\npublic interface AggregateMapper",
"end": 317,
"score": 0.999519407749176,
"start": 312,
"tag": "USERNAME",
"value": "gavin"
}
] | null |
[] |
package com.mo9.mapper.mappers.combine;
import com.mo9.mapper.providers.combine.AggregateProvider;
import com.mo9.mapper.sql.criteria.Criteria;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
import java.util.Map;
/**
* Created by gavin on 2017/1/4.
*/
public interface AggregateMapper<T> {
@ResultType(java.util.Map.class)
@SelectProvider(type = AggregateProvider.class, method = "dynamicSQL")
Map<String, Object> aggregateOne(Criteria criteria);
@ResultType(java.util.List.class)
@SelectProvider(type = AggregateProvider.class, method = "dynamicSQL")
List<Map<String, Object>> aggregate(Criteria criteria);
}
| 718 | 0.764624 | 0.752089 | 22 | 31.636364 | 24.662348 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false |
9
|
faa9785b0ca43bb9e956fdf98acdb47310e5e274
| 32,942,399,199,266 |
c8688fa979a3bd8151662cd755ff05d091d308b2
|
/ssz-service-api/ssz-crowd-api/src/main/java/com/jusfoun/ssz/crowd/api/dao/ZbAnnexMapper.java
|
829f9a3eacf7ebcad06227b51681a968bc3899bc
|
[] |
no_license
|
StartHub/ssz
|
https://github.com/StartHub/ssz
|
b8765e19b725797e6bb0f2774d4e0b3d04222c3b
|
194f2cfce6a9c1b906f6c66419774843ffad5b4b
|
refs/heads/master
| 2020-03-27T03:01:09.827000 | 2018-08-23T09:48:40 | 2018-08-23T09:48:40 | 145,833,862 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jusfoun.ssz.crowd.api.dao;
import com.jusfoun.ssz.core.api.dao.GenericDao;
import com.jusfoun.ssz.crowd.api.entity.ZbAnnex;
public interface ZbAnnexMapper extends GenericDao<ZbAnnex> {
int deleteByPrimaryKey(Long id);
int insert(ZbAnnex record);
int insertSelective(ZbAnnex record);
ZbAnnex selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(ZbAnnex record);
int updateByPrimaryKey(ZbAnnex record);
}
|
UTF-8
|
Java
| 453 |
java
|
ZbAnnexMapper.java
|
Java
|
[] | null |
[] |
package com.jusfoun.ssz.crowd.api.dao;
import com.jusfoun.ssz.core.api.dao.GenericDao;
import com.jusfoun.ssz.crowd.api.entity.ZbAnnex;
public interface ZbAnnexMapper extends GenericDao<ZbAnnex> {
int deleteByPrimaryKey(Long id);
int insert(ZbAnnex record);
int insertSelective(ZbAnnex record);
ZbAnnex selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(ZbAnnex record);
int updateByPrimaryKey(ZbAnnex record);
}
| 453 | 0.772627 | 0.772627 | 18 | 24.222221 | 22.369513 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
9
|
30eb01b8b0d7a3dae8a29767c3cf82e8cfbd9277
| 6,038,724,067,819 |
bc566919bd413f8664f8c9173b58c66e42b177b8
|
/src/main/java/com/hongao/ext/consts/SmsTemplateCodes.java
|
ff4777af0c1abefa652173e91503d29ebe1396b0
|
[] |
no_license
|
moutainhigh/ext
|
https://github.com/moutainhigh/ext
|
d434f446cb9e5ebddc376f63e72cb9a506e574f7
|
67fff5e7104ea68d005ffd2e6fb89567d994851a
|
refs/heads/master
| 2020-09-10T02:12:07.659000 | 2018-02-08T01:44:08 | 2018-02-08T01:44:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hongao.ext.consts;
/**
* 短信发送模板(请勿修改)
*
* @author iTeller_zc
*
* @date 2017年12月5日 下午7:15:16
*/
public class SmsTemplateCodes {
/**
* 棋牌验证码发送模板
*/
public static final String GAME_DYNAMIC_CODE_TEMPLATE = "SMS_116563122";
/**
* 娃娃验证码发送模板
*/
public static final String DOLL_DYNAMIC_CODE_TEMPLATE = "SMS_109345028";
private SmsTemplateCodes(){
}
}
|
UTF-8
|
Java
| 452 |
java
|
SmsTemplateCodes.java
|
Java
|
[
{
"context": "ao.ext.consts;\n\n/**\n * 短信发送模板(请勿修改)\n * \n * @author iTeller_zc\n *\n * @date 2017年12月5日 下午7:15:16\n */\npublic class",
"end": 77,
"score": 0.9996808767318726,
"start": 67,
"tag": "USERNAME",
"value": "iTeller_zc"
}
] | null |
[] |
package com.hongao.ext.consts;
/**
* 短信发送模板(请勿修改)
*
* @author iTeller_zc
*
* @date 2017年12月5日 下午7:15:16
*/
public class SmsTemplateCodes {
/**
* 棋牌验证码发送模板
*/
public static final String GAME_DYNAMIC_CODE_TEMPLATE = "SMS_116563122";
/**
* 娃娃验证码发送模板
*/
public static final String DOLL_DYNAMIC_CODE_TEMPLATE = "SMS_109345028";
private SmsTemplateCodes(){
}
}
| 452 | 0.660622 | 0.582902 | 25 | 14.44 | 20.042116 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.72 | false | false |
9
|
51116de5f85149ff43795a07abe676949afd8b36
| 29,652,454,214,384 |
38ea37f6d5d1fe9cf19ce2d383624f947931bf24
|
/src/main/java/com/youi/finder/alexa/HandlerSpeechlet.java
|
020bd3a04b67f35e5555f2ea422505571c13b529
|
[] |
no_license
|
beaton/finder
|
https://github.com/beaton/finder
|
59c2c07bc43b0edfa691dd2ee89bcd3550d99f24
|
b2b3c84e2d1372c79996abb02eb19f6dcbce6cfc
|
refs/heads/master
| 2021-06-24T09:11:33.030000 | 2021-01-11T12:59:26 | 2021-01-11T12:59:26 | 188,268,591 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.youi.finder.alexa;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import com.amazon.speech.speechlet.SessionStartedRequest;
import com.amazon.speech.speechlet.SpeechletResponse;
import com.amazon.speech.speechlet.SpeechletV2;
import com.amazon.speech.json.SpeechletRequestEnvelope;
import com.amazon.speech.slu.Intent;
import com.amazon.speech.speechlet.IntentRequest;
import com.amazon.speech.speechlet.LaunchRequest;
import com.amazon.speech.speechlet.Session;
import com.amazon.speech.speechlet.SessionEndedRequest;
import com.amazon.speech.ui.Card;
import com.amazon.speech.ui.PlainTextOutputSpeech;
import com.amazon.speech.ui.StandardCard;
import com.amazon.speech.ui.Reprompt;
@Service
public class HandlerSpeechlet implements SpeechletV2 {
private Logger logger = Logger.getLogger(HandlerSpeechlet.class);
protected static final String SESSION_CONVERSATION_FLAG = "conversation";
public static final String SamplesHelpText = "Maybe try saying: Where is Ken";
public static final String RepromptText = "What else can I tell you? Say \"Help\" for some suggestions.";
@Autowired
private BeanFactory beanFactory;
public HandlerSpeechlet() {}
/**
* This is invoked when a new Alexa session is started. Any initialization logic
* would go here. You can store stuff in the Alexa session, for example, by
* calling: Session session = requestEnvelope.getSession();
*/
@Override
public void onSessionStarted(SpeechletRequestEnvelope<SessionStartedRequest> requestEnvelope) {
logger.info("New Alexa session initiated");
}
/**
* This method is invoked when the user first launches the skill, for example if
* they say "Alexa, open you I calendar."
*/
@Override
public SpeechletResponse onLaunch(SpeechletRequestEnvelope<LaunchRequest> requestEnvelope) {
logger.info("New Alexa onLaunch conversation initiated");
String requestId = requestEnvelope.getRequest().getRequestId();
String sessionId = requestEnvelope.getRequest().getRequestId();
logger.info("onLaunch requestId=" + requestId + " sessionId=" + sessionId);
// Set a session variable so that we know we're in conversation mode.
Session session = requestEnvelope.getSession();
session.setAttribute(SESSION_CONVERSATION_FLAG, "true");
// Create the initial greeting speech.
String speechText = "Hello from Google Calendar. " + SamplesHelpText;
Card card = this.newCard("Welcome!", speechText);
PlainTextOutputSpeech speech = this.newSpeech(speechText, false);
return this.newSpeechletResponse(card, speech, session, false);
}
/**
* This method is invoked whenever an intent is invoked by the user.
*
* We need to figure out what the intent is, and then delegate to a handler for
* that specific intent.
*/
@Override
public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) {
logger.info("New Alexa onIntent conversation initiated");
IntentRequest request = requestEnvelope.getRequest();
Session session = requestEnvelope.getSession();
Intent intent = request.getIntent();
if (intent != null) {
String intentName = intent.getName();
String handlerBeanName = intentName + "Handler";
logger.debug("Received intent: " + intentName);
handlerBeanName = StringUtils.replace(handlerBeanName, "AMAZON.", "Amazon");
handlerBeanName = handlerBeanName.substring(0, 1).toLowerCase() + handlerBeanName.substring(1);
logger.info("About to invoke Alexa handler '" + handlerBeanName + "' for intent '" + intentName + "'.");
try {
Object handlerBean = beanFactory.getBean(handlerBeanName);
if (handlerBean != null) {
if (handlerBean instanceof IntentHandler) {
IntentHandler intentHandler = (IntentHandler) handlerBean;
return intentHandler.handleIntent(intent, request, session);
}
}
} catch (Exception e) {
logger.error("Error handling Alexa intent " + intentName, e);
}
}
// Handle unknown intents. Ask the user for more info.
session.setAttribute(SESSION_CONVERSATION_FLAG, "true");
String errorText = "I'm afraid I do not understand. " + HandlerSpeechlet.SamplesHelpText;
Card card = this.newCard("Dazed and Confused", errorText);
PlainTextOutputSpeech speech = this.newSpeech(errorText, false);
return this.newSpeechletResponse(card, speech, session, false);
}
@Override
public void onSessionEnded(SpeechletRequestEnvelope<SessionEndedRequest> requestEnvelope) {
logger.info("Alexa session ended.");
}
public Card newCard(String cardTitle, String cardText) {
StandardCard card = new StandardCard();
card.setTitle((cardTitle == null) ? "You i Finder" : cardTitle);
card.setText(cardText);
return card;
}
public PlainTextOutputSpeech newSpeech(String speechText, boolean appendRepromptText) {
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(appendRepromptText ? speechText + "\n\n" + HandlerSpeechlet.RepromptText : speechText);
return speech;
}
public SpeechletResponse newSpeechletResponse(Card card, PlainTextOutputSpeech speech, Session session,
boolean shouldEndSession) {
if (inConversationMode(session) && !shouldEndSession) {
PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech();
repromptSpeech.setText(HandlerSpeechlet.RepromptText);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(repromptSpeech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
} else {
return SpeechletResponse.newTellResponse(speech, card);
}
}
public boolean inConversationMode(Session session) {
return session.getAttribute(SESSION_CONVERSATION_FLAG) != null;
}
}
|
UTF-8
|
Java
| 5,855 |
java
|
HandlerSpeechlet.java
|
Java
|
[] | null |
[] |
package com.youi.finder.alexa;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import com.amazon.speech.speechlet.SessionStartedRequest;
import com.amazon.speech.speechlet.SpeechletResponse;
import com.amazon.speech.speechlet.SpeechletV2;
import com.amazon.speech.json.SpeechletRequestEnvelope;
import com.amazon.speech.slu.Intent;
import com.amazon.speech.speechlet.IntentRequest;
import com.amazon.speech.speechlet.LaunchRequest;
import com.amazon.speech.speechlet.Session;
import com.amazon.speech.speechlet.SessionEndedRequest;
import com.amazon.speech.ui.Card;
import com.amazon.speech.ui.PlainTextOutputSpeech;
import com.amazon.speech.ui.StandardCard;
import com.amazon.speech.ui.Reprompt;
@Service
public class HandlerSpeechlet implements SpeechletV2 {
private Logger logger = Logger.getLogger(HandlerSpeechlet.class);
protected static final String SESSION_CONVERSATION_FLAG = "conversation";
public static final String SamplesHelpText = "Maybe try saying: Where is Ken";
public static final String RepromptText = "What else can I tell you? Say \"Help\" for some suggestions.";
@Autowired
private BeanFactory beanFactory;
public HandlerSpeechlet() {}
/**
* This is invoked when a new Alexa session is started. Any initialization logic
* would go here. You can store stuff in the Alexa session, for example, by
* calling: Session session = requestEnvelope.getSession();
*/
@Override
public void onSessionStarted(SpeechletRequestEnvelope<SessionStartedRequest> requestEnvelope) {
logger.info("New Alexa session initiated");
}
/**
* This method is invoked when the user first launches the skill, for example if
* they say "Alexa, open you I calendar."
*/
@Override
public SpeechletResponse onLaunch(SpeechletRequestEnvelope<LaunchRequest> requestEnvelope) {
logger.info("New Alexa onLaunch conversation initiated");
String requestId = requestEnvelope.getRequest().getRequestId();
String sessionId = requestEnvelope.getRequest().getRequestId();
logger.info("onLaunch requestId=" + requestId + " sessionId=" + sessionId);
// Set a session variable so that we know we're in conversation mode.
Session session = requestEnvelope.getSession();
session.setAttribute(SESSION_CONVERSATION_FLAG, "true");
// Create the initial greeting speech.
String speechText = "Hello from Google Calendar. " + SamplesHelpText;
Card card = this.newCard("Welcome!", speechText);
PlainTextOutputSpeech speech = this.newSpeech(speechText, false);
return this.newSpeechletResponse(card, speech, session, false);
}
/**
* This method is invoked whenever an intent is invoked by the user.
*
* We need to figure out what the intent is, and then delegate to a handler for
* that specific intent.
*/
@Override
public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) {
logger.info("New Alexa onIntent conversation initiated");
IntentRequest request = requestEnvelope.getRequest();
Session session = requestEnvelope.getSession();
Intent intent = request.getIntent();
if (intent != null) {
String intentName = intent.getName();
String handlerBeanName = intentName + "Handler";
logger.debug("Received intent: " + intentName);
handlerBeanName = StringUtils.replace(handlerBeanName, "AMAZON.", "Amazon");
handlerBeanName = handlerBeanName.substring(0, 1).toLowerCase() + handlerBeanName.substring(1);
logger.info("About to invoke Alexa handler '" + handlerBeanName + "' for intent '" + intentName + "'.");
try {
Object handlerBean = beanFactory.getBean(handlerBeanName);
if (handlerBean != null) {
if (handlerBean instanceof IntentHandler) {
IntentHandler intentHandler = (IntentHandler) handlerBean;
return intentHandler.handleIntent(intent, request, session);
}
}
} catch (Exception e) {
logger.error("Error handling Alexa intent " + intentName, e);
}
}
// Handle unknown intents. Ask the user for more info.
session.setAttribute(SESSION_CONVERSATION_FLAG, "true");
String errorText = "I'm afraid I do not understand. " + HandlerSpeechlet.SamplesHelpText;
Card card = this.newCard("Dazed and Confused", errorText);
PlainTextOutputSpeech speech = this.newSpeech(errorText, false);
return this.newSpeechletResponse(card, speech, session, false);
}
@Override
public void onSessionEnded(SpeechletRequestEnvelope<SessionEndedRequest> requestEnvelope) {
logger.info("Alexa session ended.");
}
public Card newCard(String cardTitle, String cardText) {
StandardCard card = new StandardCard();
card.setTitle((cardTitle == null) ? "You i Finder" : cardTitle);
card.setText(cardText);
return card;
}
public PlainTextOutputSpeech newSpeech(String speechText, boolean appendRepromptText) {
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(appendRepromptText ? speechText + "\n\n" + HandlerSpeechlet.RepromptText : speechText);
return speech;
}
public SpeechletResponse newSpeechletResponse(Card card, PlainTextOutputSpeech speech, Session session,
boolean shouldEndSession) {
if (inConversationMode(session) && !shouldEndSession) {
PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech();
repromptSpeech.setText(HandlerSpeechlet.RepromptText);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(repromptSpeech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
} else {
return SpeechletResponse.newTellResponse(speech, card);
}
}
public boolean inConversationMode(Session session) {
return session.getAttribute(SESSION_CONVERSATION_FLAG) != null;
}
}
| 5,855 | 0.764304 | 0.763108 | 166 | 34.271084 | 31.740932 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.843374 | false | false |
9
|
60f47321c7fa19e5b5bb7ad203bac65af5ab75d4
| 18,751,827,250,524 |
ddfcdc09950ebc681dea1a6507c18bcd1002cf7b
|
/src/test/java/eShop/OrderTest.java
|
75f616032e03d20f7f6aa1e77712f9ba104f3e69
|
[] |
no_license
|
GabinS/Tp-eShop
|
https://github.com/GabinS/Tp-eShop
|
807ec13242dcf402fa89a7dbfc5aa939d6c66afe
|
21b3be51bdab564bce179aa4a75370c7e54b21a9
|
refs/heads/master
| 2021-05-14T17:06:15.854000 | 2018-01-02T17:52:16 | 2018-01-02T17:52:16 | 116,038,770 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package eShop;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.tact.eshop.entity.Customer;
import com.tact.eshop.entity.Order;
public class OrderTest {
protected Order od;
protected Customer ct;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
this.od = new Order();
this.ct = new Customer("testFName","testLName");
}
@After
public void tearDown() throws Exception {
}
@Test
public void testgetFirstNameCustomer() {
this.od.setCustomer(this.ct);
assertEquals("testFName", this.od.getCustomer().getFirstName());
}
@Test
public void testgetLastNameCustomer() {
this.od.setCustomer(this.ct);
assertEquals("testLName", this.od.getCustomer().getLastName());
}
}
|
UTF-8
|
Java
| 1,023 |
java
|
OrderTest.java
|
Java
|
[] | null |
[] |
package eShop;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.tact.eshop.entity.Customer;
import com.tact.eshop.entity.Order;
public class OrderTest {
protected Order od;
protected Customer ct;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
this.od = new Order();
this.ct = new Customer("testFName","testLName");
}
@After
public void tearDown() throws Exception {
}
@Test
public void testgetFirstNameCustomer() {
this.od.setCustomer(this.ct);
assertEquals("testFName", this.od.getCustomer().getFirstName());
}
@Test
public void testgetLastNameCustomer() {
this.od.setCustomer(this.ct);
assertEquals("testLName", this.od.getCustomer().getLastName());
}
}
| 1,023 | 0.703812 | 0.703812 | 49 | 18.87755 | 19.489016 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.102041 | false | false |
9
|
0407a1daecac0202242ed815d18bf4c34b6873ca
| 18,399,639,902,255 |
301318e03449192bdd80a9d092caf5cb9f9ad57b
|
/app/src/main/java/com/example/leo/superdupermart/CarrinhoDAO.java
|
13b5af0f2d245bd610bd3ef9bf0ddd6391042728
|
[
"Apache-2.0"
] |
permissive
|
leonardofariasbarros/teste
|
https://github.com/leonardofariasbarros/teste
|
9ae3d447e323e2a4f13ccdfca5876c95e6cad80d
|
a8547d532cad03228a0ba5c667e0bc004557ec80
|
refs/heads/master
| 2020-05-21T10:10:04.133000 | 2016-10-05T02:36:13 | 2016-10-05T02:36:13 | 70,024,191 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.leo.superdupermart;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Leo on 14/09/2016.
*/
public class CarrinhoDAO {
private SQLiteDatabase bancoDeDados;
public CarrinhoDAO (Context context){
this.bancoDeDados =(new BancoDeDados2(context)).getWritableDatabase();
}
public boolean addProduto(Carrinho carrinho){
try {
String sqlCmd = "INSERT INTO MeuCarrinho VALUES ('" + carrinho.getLogin() +"', '" + carrinho.getNome() +
"', '" + carrinho.getDescricao() + "', '" + carrinho.getPreco() + "', '" + carrinho.getQuantidade() + "', '"
+ carrinho.getData() + "', '" + carrinho.getEstado() + "')";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
catch (SQLException e) {
Log.e("SuperDuperMartBD", e.getMessage());
return false;
}
}
public List<Carrinho> listaCarrinho(String login){
Carrinho carrinho = null;
ArrayList<Carrinho> list = new ArrayList();
String sqlQuery = "SELECT * FROM MeuCarrinho WHERE login='"+login+"' AND estado=0";
Cursor cursor = this.bancoDeDados.rawQuery(sqlQuery,null);
cursor.moveToFirst();
while(cursor.isAfterLast()!=true)
{
carrinho = new Carrinho(cursor.getString(0), cursor.getString(1), cursor.getString(2),cursor.getString(3),cursor.getString(4),
cursor.getString(5),cursor.getString(6));
list.add(carrinho);
cursor.moveToNext();
}
cursor.close();
return list;
}
public List<Carrinho> listaHistorico(String login){
Carrinho carrinho = null;
ArrayList<Carrinho> list = new ArrayList();
String sqlQuery = "SELECT * FROM MeuCarrinho WHERE login='"+login+"' AND estado=1";
Cursor cursor = this.bancoDeDados.rawQuery(sqlQuery,null);
cursor.moveToFirst();
while(cursor.isAfterLast()!=true)
{
carrinho = new Carrinho(cursor.getString(0), cursor.getString(1), cursor.getString(2),cursor.getString(3),cursor.getString(4),
cursor.getString(5),cursor.getString(6));
list.add(carrinho);
cursor.moveToNext();
}
cursor.close();
return list;
}
public boolean removerCarrinho(String login,String nome){
String sqlCmd = "DELETE FROM MeuCarrinho WHERE login='"+login+"' AND nome='"+nome+"'";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
public boolean limparHistorico(String login){
String sqlCmd = "DELETE FROM MeuCarrinho WHERE login='"+login+"' AND estado=1";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
public boolean alteraEstadoComprado(Carrinho carrinho){
String sqlCmd = "UPDATE MeuCarrinho SET estado=1 WHERE nome='"+carrinho.getNome()+"'";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
}
|
UTF-8
|
Java
| 3,209 |
java
|
CarrinhoDAO.java
|
Java
|
[
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Leo on 14/09/2016.\n */\npublic class CarrinhoDAO {\n ",
"end": 288,
"score": 0.6578928232192993,
"start": 286,
"tag": "USERNAME",
"value": "Le"
},
{
"context": "List;\nimport java.util.List;\n\n/**\n * Created by Leo on 14/09/2016.\n */\npublic class CarrinhoDAO {\n ",
"end": 289,
"score": 0.5846615433692932,
"start": 288,
"tag": "NAME",
"value": "o"
}
] | null |
[] |
package com.example.leo.superdupermart;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Leo on 14/09/2016.
*/
public class CarrinhoDAO {
private SQLiteDatabase bancoDeDados;
public CarrinhoDAO (Context context){
this.bancoDeDados =(new BancoDeDados2(context)).getWritableDatabase();
}
public boolean addProduto(Carrinho carrinho){
try {
String sqlCmd = "INSERT INTO MeuCarrinho VALUES ('" + carrinho.getLogin() +"', '" + carrinho.getNome() +
"', '" + carrinho.getDescricao() + "', '" + carrinho.getPreco() + "', '" + carrinho.getQuantidade() + "', '"
+ carrinho.getData() + "', '" + carrinho.getEstado() + "')";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
catch (SQLException e) {
Log.e("SuperDuperMartBD", e.getMessage());
return false;
}
}
public List<Carrinho> listaCarrinho(String login){
Carrinho carrinho = null;
ArrayList<Carrinho> list = new ArrayList();
String sqlQuery = "SELECT * FROM MeuCarrinho WHERE login='"+login+"' AND estado=0";
Cursor cursor = this.bancoDeDados.rawQuery(sqlQuery,null);
cursor.moveToFirst();
while(cursor.isAfterLast()!=true)
{
carrinho = new Carrinho(cursor.getString(0), cursor.getString(1), cursor.getString(2),cursor.getString(3),cursor.getString(4),
cursor.getString(5),cursor.getString(6));
list.add(carrinho);
cursor.moveToNext();
}
cursor.close();
return list;
}
public List<Carrinho> listaHistorico(String login){
Carrinho carrinho = null;
ArrayList<Carrinho> list = new ArrayList();
String sqlQuery = "SELECT * FROM MeuCarrinho WHERE login='"+login+"' AND estado=1";
Cursor cursor = this.bancoDeDados.rawQuery(sqlQuery,null);
cursor.moveToFirst();
while(cursor.isAfterLast()!=true)
{
carrinho = new Carrinho(cursor.getString(0), cursor.getString(1), cursor.getString(2),cursor.getString(3),cursor.getString(4),
cursor.getString(5),cursor.getString(6));
list.add(carrinho);
cursor.moveToNext();
}
cursor.close();
return list;
}
public boolean removerCarrinho(String login,String nome){
String sqlCmd = "DELETE FROM MeuCarrinho WHERE login='"+login+"' AND nome='"+nome+"'";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
public boolean limparHistorico(String login){
String sqlCmd = "DELETE FROM MeuCarrinho WHERE login='"+login+"' AND estado=1";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
public boolean alteraEstadoComprado(Carrinho carrinho){
String sqlCmd = "UPDATE MeuCarrinho SET estado=1 WHERE nome='"+carrinho.getNome()+"'";
this.bancoDeDados.execSQL(sqlCmd);
return true;
}
}
| 3,209 | 0.617638 | 0.609224 | 99 | 31.414141 | 32.672234 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
9
|
12470e17cda78e6217bba82792621e61408a4528
| 22,754,736,762,456 |
64bd18c1f5ba319d642b859fe8f93909a770b7a5
|
/test/moer/moerog/module/user/UserRepositoryTest.java
|
fae7bf83cdf7f1ea10c6434450fe0cfbcb8e153d
|
[] |
no_license
|
m0er/mOerog
|
https://github.com/m0er/mOerog
|
68c121ade5e2c227dcff42f795f1ebc0a37178ea
|
792db0e3268db0851d1905d13dc3059bd2736451
|
refs/heads/master
| 2020-04-09T19:49:12.146000 | 2014-05-19T07:35:03 | 2014-05-19T07:35:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package moer.moerog.module.user;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import moer.moerog.config.AppConfig;
import org.bson.types.ObjectId;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes=AppConfig.class, loader=AnnotationConfigContextLoader.class)
public class UserRepositoryTest {
@Autowired UserRepository userRepository;
@Before
public void setUp() {
userRepository.deleteAll();
User admin = new User();
admin.setAdmin(true);
admin.setUserId("admin");
admin.setNickname("mOer");
admin.setPassword("test");
userRepository.save(admin);
}
@Test
public void create() throws Exception {
assertThat(userRepository, is(notNullValue()));
}
@Test
public void findAdminById_어드민_찾기() {
User user = userRepository.findByUserId("admin");
assertThat(user.getId(), is(notNullValue(ObjectId.class)));
assertThat(user.getNickname(), is("mOer"));
assertThat(user.getPassword(), is("test"));
}
@Test
public void registerUserAndGet() throws Exception {
userRepository.deleteAll();
User user1 = new User();
user1.setUserId("testUser");
user1.setPassword("testUser");
user1.setEmail("testUser@testUser.com");
user1.setNickname("testUser");
userRepository.save(user1);
User user2 = userRepository.findOne(user1.getId());
assertThat(user1.getId(), is(user2.getId()));
assertThat(user1.getEmail(), is(user2.getEmail()));
}
}
|
UTF-8
|
Java
| 1,878 |
java
|
UserRepositoryTest.java
|
Java
|
[
{
"context": "\tadmin.setNickname(\"mOer\");\r\n\t\tadmin.setPassword(\"test\");\r\n\t\t\r\n\t\tuserRepository.save(admin);\r\n\t}\r\n\t\r\n\t@T",
"end": 971,
"score": 0.9993624687194824,
"start": 967,
"tag": "PASSWORD",
"value": "test"
},
{
"context": "\t\r\n\t\tUser user1 = new User();\r\n\t\tuser1.setUserId(\"testUser\");\r\n\t\tuser1.setPassword(\"testUser\");\r\n\t\tuser1.set",
"end": 1546,
"score": 0.9012690186500549,
"start": 1538,
"tag": "USERNAME",
"value": "testUser"
},
{
"context": "ser1.setUserId(\"testUser\");\r\n\t\tuser1.setPassword(\"testUser\");\r\n\t\tuser1.setEmail(\"testUser@testUser.com\");\r\n\t",
"end": 1580,
"score": 0.9993173480033875,
"start": 1572,
"tag": "PASSWORD",
"value": "testUser"
},
{
"context": "user1.setPassword(\"testUser\");\r\n\t\tuser1.setEmail(\"testUser@testUser.com\");\r\n\t\tuser1.setNickname(\"testUser\");\r\n\t\t\r\n\t\tuserR",
"end": 1624,
"score": 0.9999219179153442,
"start": 1603,
"tag": "EMAIL",
"value": "testUser@testUser.com"
}
] | null |
[] |
package moer.moerog.module.user;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import moer.moerog.config.AppConfig;
import org.bson.types.ObjectId;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes=AppConfig.class, loader=AnnotationConfigContextLoader.class)
public class UserRepositoryTest {
@Autowired UserRepository userRepository;
@Before
public void setUp() {
userRepository.deleteAll();
User admin = new User();
admin.setAdmin(true);
admin.setUserId("admin");
admin.setNickname("mOer");
admin.setPassword("<PASSWORD>");
userRepository.save(admin);
}
@Test
public void create() throws Exception {
assertThat(userRepository, is(notNullValue()));
}
@Test
public void findAdminById_어드민_찾기() {
User user = userRepository.findByUserId("admin");
assertThat(user.getId(), is(notNullValue(ObjectId.class)));
assertThat(user.getNickname(), is("mOer"));
assertThat(user.getPassword(), is("test"));
}
@Test
public void registerUserAndGet() throws Exception {
userRepository.deleteAll();
User user1 = new User();
user1.setUserId("testUser");
user1.setPassword("<PASSWORD>");
user1.setEmail("<EMAIL>");
user1.setNickname("testUser");
userRepository.save(user1);
User user2 = userRepository.findOne(user1.getId());
assertThat(user1.getId(), is(user2.getId()));
assertThat(user1.getEmail(), is(user2.getEmail()));
}
}
| 1,872 | 0.730728 | 0.722698 | 65 | 26.738462 | 22.123623 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.738461 | false | false |
9
|
4ff9c72e9e44d776b04d4d879eb3ea293603c2e7
| 24,601,572,719,260 |
86a994b62612e001fbaa85d9c1ef361a12e933a6
|
/University_Model/src/main/java/model/person/FacultyDirectory.java
|
5402f01351d2fe157896ce604427856b43b82e72
|
[] |
no_license
|
survea/CSYE6200-Educational-Institution-s-Ranking-System
|
https://github.com/survea/CSYE6200-Educational-Institution-s-Ranking-System
|
543764756773d84f90caebf2ea025b463b636499
|
6874b82a4fba01b3904cef9bebf44abf70f752c3
|
refs/heads/main
| 2023-08-14T22:17:32.519000 | 2021-10-04T15:38:44 | 2021-10-04T15:38:44 | 413,483,536 | 0 | 0 | null | false | 2021-10-04T15:38:45 | 2021-10-04T15:37:29 | 2021-10-04T15:38:05 | 2021-10-04T15:38:44 | 0 | 0 | 0 | 0 | null | false | false |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package model.person;
import java.util.ArrayList;
import java.util.List;
import model.department.Department;
/**
*
* @author DikshaGodse
*/
public class FacultyDirectory {
private Department department;
private List<Faculty> facultyList;
public FacultyDirectory(Department department) {
this.department = department;
this.facultyList = new ArrayList();
}
public List<Faculty> getFacultyList() {
return facultyList;
}
public void setFacultyList(List<Faculty> facultyList) {
this.facultyList = facultyList;
}
public void newFacultyProfile(Faculty newFaculty) {
facultyList.add(newFaculty);
}
}
|
UTF-8
|
Java
| 864 |
java
|
FacultyDirectory.java
|
Java
|
[
{
"context": "rt model.department.Department;\n\n/**\n *\n * @author DikshaGodse\n */\npublic class FacultyDirectory {\n private D",
"end": 324,
"score": 0.980345606803894,
"start": 313,
"tag": "NAME",
"value": "DikshaGodse"
}
] | 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.person;
import java.util.ArrayList;
import java.util.List;
import model.department.Department;
/**
*
* @author DikshaGodse
*/
public class FacultyDirectory {
private Department department;
private List<Faculty> facultyList;
public FacultyDirectory(Department department) {
this.department = department;
this.facultyList = new ArrayList();
}
public List<Faculty> getFacultyList() {
return facultyList;
}
public void setFacultyList(List<Faculty> facultyList) {
this.facultyList = facultyList;
}
public void newFacultyProfile(Faculty newFaculty) {
facultyList.add(newFaculty);
}
}
| 864 | 0.703704 | 0.703704 | 34 | 24.411764 | 21.442286 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false |
9
|
a3862e13e79a26580a7dab3abcb405f538e7ae16
| 2,370,821,955,174 |
731ebe2aa20b65d10d5f56c11f707848714bf1e8
|
/src/client/TimeClientWSDL.java
|
1157263a3d2bf7c58be191ec548eeccfd3e73b32
|
[] |
no_license
|
weixianqing/WSE
|
https://github.com/weixianqing/WSE
|
c41f55b40a0d51048746761c717da6969c48e4c3
|
bdd364a138d031e25e39c051a5666b557d330733
|
refs/heads/master
| 2017-12-01T17:05:23.530000 | 2016-07-28T17:34:41 | 2016-07-28T17:34:41 | 64,022,057 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package client;
/**
* Created by shelvin on 28/7/16 at 22:58.
*/
public class TimeClientWSDL
{
public static void main(String[] args)
{
TimeServerImplService tsis = new TimeServerImplService();
TimeServer timeServer = tsis.getTimeServerImplPort();
System.out.println(timeServer.getTimeAsString());
System.out.println(timeServer.getTimeAsElapsed());
}
}
|
UTF-8
|
Java
| 402 |
java
|
TimeClientWSDL.java
|
Java
|
[
{
"context": "package client;\n\n/**\n * Created by shelvin on 28/7/16 at 22:58.\n */\n\npublic class TimeClient",
"end": 42,
"score": 0.9982209801673889,
"start": 35,
"tag": "USERNAME",
"value": "shelvin"
}
] | null |
[] |
package client;
/**
* Created by shelvin on 28/7/16 at 22:58.
*/
public class TimeClientWSDL
{
public static void main(String[] args)
{
TimeServerImplService tsis = new TimeServerImplService();
TimeServer timeServer = tsis.getTimeServerImplPort();
System.out.println(timeServer.getTimeAsString());
System.out.println(timeServer.getTimeAsElapsed());
}
}
| 402 | 0.681592 | 0.659204 | 17 | 22.647058 | 24.724222 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false |
9
|
fc592427cd038e105a8253818b80a54afdbffd21
| 5,995,774,354,581 |
9ed574e12d95f865a2f65e88b916a37de3e18bf7
|
/app/src/main/java/com/example/nba/Page.java
|
a7d6502be4d0ad63c1ab33249fb81702a3950ea1
|
[] |
no_license
|
shihmingyuan/NBA_project
|
https://github.com/shihmingyuan/NBA_project
|
d4225dd8903ed6031e0989d0708c95f9ba377dc7
|
d4b4e10f16c3e1c3f61075338384f934236fac2f
|
refs/heads/master
| 2023-02-06T04:21:49.564000 | 2021-01-01T07:45:39 | 2021-01-01T07:45:39 | 325,936,189 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.nba;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import android.content.ClipData;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.navigation.NavigationView;
import java.util.NavigableSet;
public class Page extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
static String serverAddress = "192.168.10.88:580";
static String id = "";
static String password = "";
static String response = "";
static int win = 0;
static int lose = 0;
DrawerLayout drawerLayout;
NavigationView navigationView;
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page);
/*----------------------------------------*/
drawerLayout = findViewById(R.id.drawer_layout);
navigationView = findViewById(R.id.nav_view);
toolbar = findViewById(R.id.toolbar);
/*----------------------------------------*/
setSupportActionBar(toolbar);
/*----------------------------------------*/
navigationView.bringToFront();
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,drawerLayout,toolbar,R.string.navigation_drawer_open,R.string.navigation_drawer_close);
drawerLayout.addDrawerListener(toggle);
toggle.syncState();
navigationView.setNavigationItemSelectedListener(this);
/* got intent */
Intent myIntent = getIntent(); // gets the previously created intent
Page.id = myIntent.getStringExtra("id");
Page.password = myIntent.getStringExtra("password");
Page.win = myIntent.getIntExtra("win", -1);
Page.lose = myIntent.getIntExtra("lose", -1);
Log.d("KK", Page.id);
Log.d("KK", Page.password);
Log.d("KK", String.valueOf(Page.win));
Log.d("KK", String.valueOf(Page.lose));
/*Game*/
ImageButton btnA = findViewById(R.id.btnA);
btnA.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Calendar.class);
startActivity(intent);
}
});
/*Player*/
ImageButton btnB = findViewById(R.id.btnB);
btnB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Depot.class);
intent.putExtra("id", Page.id);
intent.putExtra("password", Page.password);
intent.putExtra("win", Page.win);
intent.putExtra("lose", Page.lose);
startActivity(intent);
}
});
/*Draw*/
ImageButton btnC = findViewById(R.id.btnC);
btnC.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Drawcard.class);
intent.putExtra("id", Page.id);
intent.putExtra("password", Page.password);
intent.putExtra("win", Page.win);
intent.putExtra("lose", Page.lose);
startActivity(intent);
}
});
/*Developer*/
ImageButton btnD = findViewById(R.id.btnD);
btnD.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Developer.class);
startActivity(intent);
}
});
}
@Override
public void onBackPressed() {
if(drawerLayout.isDrawerOpen(GravityCompat.START)){
drawerLayout.closeDrawer((GravityCompat.START));
}
else{
super.onBackPressed();
}
super.onBackPressed();
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if(id==R.id.nav_home){
Intent intent = new Intent(Page.this,Page.class);
startActivity(intent);
return true;
}else if(id==R.id.nav_profile){
Intent intent = new Intent(Page.this,Profile.class);
intent.putExtra("id", Page.id);
intent.putExtra("password", Page.password);
intent.putExtra("win", Page.win);
intent.putExtra("lose", Page.lose);
startActivity(intent);
return true;
}else if(id==R.id.nav_save){
Intent intent = new Intent(Page.this,Save.class);
startActivity(intent);
return true;
}
return true;
}
}
|
UTF-8
|
Java
| 5,222 |
java
|
Page.java
|
Java
|
[
{
"context": "tedListener {\n\n static String serverAddress = \"192.168.10.88:580\";\n static String id = \"\";\n static Strin",
"end": 783,
"score": 0.9997130632400513,
"start": 770,
"tag": "IP_ADDRESS",
"value": "192.168.10.88"
},
{
"context": "\n Page.password = myIntent.getStringExtra(\"password\");\n Page.win = myIntent.getIntExtra(\"win\",",
"end": 2084,
"score": 0.6521470546722412,
"start": 2076,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "e.id);\n intent.putExtra(\"password\", Page.password);\n intent.putExtra(\"win\", Page.win",
"end": 3057,
"score": 0.9982158541679382,
"start": 3044,
"tag": "PASSWORD",
"value": "Page.password"
},
{
"context": "e.id);\n intent.putExtra(\"password\", Page.password);\n intent.putExtra(\"win\", Page.win",
"end": 3598,
"score": 0.9982922673225403,
"start": 3585,
"tag": "PASSWORD",
"value": "Page.password"
},
{
"context": " Page.id);\n intent.putExtra(\"password\", Page.password);\n intent.putExtra(\"win\", Page.win);\n ",
"end": 4862,
"score": 0.892203152179718,
"start": 4849,
"tag": "PASSWORD",
"value": "Page.password"
}
] | null |
[] |
package com.example.nba;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import android.content.ClipData;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.navigation.NavigationView;
import java.util.NavigableSet;
public class Page extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
static String serverAddress = "192.168.10.88:580";
static String id = "";
static String password = "";
static String response = "";
static int win = 0;
static int lose = 0;
DrawerLayout drawerLayout;
NavigationView navigationView;
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page);
/*----------------------------------------*/
drawerLayout = findViewById(R.id.drawer_layout);
navigationView = findViewById(R.id.nav_view);
toolbar = findViewById(R.id.toolbar);
/*----------------------------------------*/
setSupportActionBar(toolbar);
/*----------------------------------------*/
navigationView.bringToFront();
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,drawerLayout,toolbar,R.string.navigation_drawer_open,R.string.navigation_drawer_close);
drawerLayout.addDrawerListener(toggle);
toggle.syncState();
navigationView.setNavigationItemSelectedListener(this);
/* got intent */
Intent myIntent = getIntent(); // gets the previously created intent
Page.id = myIntent.getStringExtra("id");
Page.password = myIntent.getStringExtra("<PASSWORD>");
Page.win = myIntent.getIntExtra("win", -1);
Page.lose = myIntent.getIntExtra("lose", -1);
Log.d("KK", Page.id);
Log.d("KK", Page.password);
Log.d("KK", String.valueOf(Page.win));
Log.d("KK", String.valueOf(Page.lose));
/*Game*/
ImageButton btnA = findViewById(R.id.btnA);
btnA.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Calendar.class);
startActivity(intent);
}
});
/*Player*/
ImageButton btnB = findViewById(R.id.btnB);
btnB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Depot.class);
intent.putExtra("id", Page.id);
intent.putExtra("password", <PASSWORD>);
intent.putExtra("win", Page.win);
intent.putExtra("lose", Page.lose);
startActivity(intent);
}
});
/*Draw*/
ImageButton btnC = findViewById(R.id.btnC);
btnC.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Drawcard.class);
intent.putExtra("id", Page.id);
intent.putExtra("password", <PASSWORD>);
intent.putExtra("win", Page.win);
intent.putExtra("lose", Page.lose);
startActivity(intent);
}
});
/*Developer*/
ImageButton btnD = findViewById(R.id.btnD);
btnD.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Page.this,Developer.class);
startActivity(intent);
}
});
}
@Override
public void onBackPressed() {
if(drawerLayout.isDrawerOpen(GravityCompat.START)){
drawerLayout.closeDrawer((GravityCompat.START));
}
else{
super.onBackPressed();
}
super.onBackPressed();
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if(id==R.id.nav_home){
Intent intent = new Intent(Page.this,Page.class);
startActivity(intent);
return true;
}else if(id==R.id.nav_profile){
Intent intent = new Intent(Page.this,Profile.class);
intent.putExtra("id", Page.id);
intent.putExtra("password", <PASSWORD>);
intent.putExtra("win", Page.win);
intent.putExtra("lose", Page.lose);
startActivity(intent);
return true;
}else if(id==R.id.nav_save){
Intent intent = new Intent(Page.this,Save.class);
startActivity(intent);
return true;
}
return true;
}
}
| 5,215 | 0.596132 | 0.592876 | 152 | 33.328949 | 23.686766 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769737 | false | false |
9
|
160173854668b725a0b9edcb90c5d60311bee11b
| 16,389,595,206,830 |
0cfcb3531cebce1cf4ffea6543d40b5a8d5fa51b
|
/HiWeb/src/java/com/hivacation/webapp/webchat/msg/MessageUtils.java
|
5185886fd61b5d30ee86bef9e6c4d14662714024
|
[] |
no_license
|
jasion-git/qvshu
|
https://github.com/jasion-git/qvshu
|
cd93f239843e559b6539a222b7c5d4bc260d3efd
|
951abfcc3ddb583c65cc3fd7c8a7fd34749a3cd1
|
refs/heads/master
| 2021-01-24T01:35:22.105000 | 2018-03-31T12:24:52 | 2018-03-31T12:24:52 | 122,815,585 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hivacation.webapp.webchat.msg;
import java.util.Date;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import com.hivacation.webapp.common.TimeUtils;
public class MessageUtils {
public static String genTextMsg(String from,String to,String content){
Document doc=DocumentHelper.createDocument();
Element xml=doc.addElement( "xml" );
xml.addElement("ToUserName").addText(to);
xml.addElement("FromUserName").addText(from);
xml.addElement("CreateTime").addText(TimeUtils.date2String(
new Date(), TimeUtils.FORMAT_YYYYMMDDHHMMSS));
xml.addElement("MsgType").addText("text");
xml.addElement("Content").addText(content);
return doc.getRootElement().asXML();
}
}
|
UTF-8
|
Java
| 755 |
java
|
MessageUtils.java
|
Java
|
[] | null |
[] |
package com.hivacation.webapp.webchat.msg;
import java.util.Date;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import com.hivacation.webapp.common.TimeUtils;
public class MessageUtils {
public static String genTextMsg(String from,String to,String content){
Document doc=DocumentHelper.createDocument();
Element xml=doc.addElement( "xml" );
xml.addElement("ToUserName").addText(to);
xml.addElement("FromUserName").addText(from);
xml.addElement("CreateTime").addText(TimeUtils.date2String(
new Date(), TimeUtils.FORMAT_YYYYMMDDHHMMSS));
xml.addElement("MsgType").addText("text");
xml.addElement("Content").addText(content);
return doc.getRootElement().asXML();
}
}
| 755 | 0.740397 | 0.735099 | 24 | 29.458334 | 21.383364 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.625 | false | false |
9
|
37f98672d6753a4663ffb8f9fbc240bde475a988
| 18,081,812,321,891 |
d892f48ac4c8a2e210e9115ffb60525406fba7dd
|
/src/main/java/com/swed/puzzle/writer/OutputWriter.java
|
54a72677c125a394755885db09214ef6a2776829
|
[] |
no_license
|
mackevicius1988/zebraPuzzle
|
https://github.com/mackevicius1988/zebraPuzzle
|
82e1066051ff4ade98c3460d8d8de220b4728598
|
15d8267328e142cfdbed0051d4cb91b064f5438f
|
refs/heads/master
| 2021-01-10T07:42:27.647000 | 2015-10-26T12:28:23 | 2015-10-26T12:28:23 | 44,965,747 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.swed.puzzle.writer;
import java.util.List;
import com.swed.puzzle.domain.Solution;
/**
*
* @author mmackevicius
*
*/
public interface OutputWriter {
void write(List<Solution> solutions);
}
|
UTF-8
|
Java
| 210 |
java
|
OutputWriter.java
|
Java
|
[
{
"context": "m.swed.puzzle.domain.Solution;\n\n/**\n * \n * @author mmackevicius\n *\n */\npublic interface OutputWriter {\n\tvoid writ",
"end": 129,
"score": 0.9982956647872925,
"start": 117,
"tag": "USERNAME",
"value": "mmackevicius"
}
] | null |
[] |
package com.swed.puzzle.writer;
import java.util.List;
import com.swed.puzzle.domain.Solution;
/**
*
* @author mmackevicius
*
*/
public interface OutputWriter {
void write(List<Solution> solutions);
}
| 210 | 0.72381 | 0.72381 | 14 | 14 | 15.090205 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false |
9
|
0d00c3f3bf92b29a7568ce853228527bc499f9b8
| 33,260,226,745,278 |
f7c686548775b9e577e1239d6ba2616e31908f47
|
/app/src/main/java/com/devabit/takestock/data/model/PaginatedList.java
|
f198172afccef542b77552d01110088bd368ab8f
|
[] |
no_license
|
4ndrik/takestock_android
|
https://github.com/4ndrik/takestock_android
|
ff80c589cb2a31d757fc47439172f407bad1548e
|
17bb85a4233c6a773d4c18261713197f2781be3c
|
refs/heads/master
| 2020-04-15T15:50:01.232000 | 2017-02-09T09:27:05 | 2017-02-09T09:27:05 | 55,589,460 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.devabit.takestock.data.model;
import android.text.TextUtils;
import java.util.List;
/**
* Created by Victor Artemyev on 13/05/2016.
*/
public class PaginatedList<T> {
private int mCount;
private String mNext;
private String mPrevious;
private List<T> mResults;
public int getCount() {
return mCount;
}
public void setCount(int count) {
mCount = count;
}
public String getNext() {
return mNext;
}
public void setNext(String next) {
mNext = next;
}
public boolean hasNext() {
return !TextUtils.isEmpty(mNext);
}
public String getPrevious() {
return mPrevious;
}
public void setPrevious(String previous) {
mPrevious = previous;
}
public boolean hasPrevious() {
return !TextUtils.isEmpty(mPrevious);
}
public List<T> getResults() {
return mResults;
}
public void setResults(List<T> results) {
mResults = results;
}
@Override public String toString() {
return "ResultList{" +
"mCount=" + mCount +
", mNext='" + mNext + '\'' +
", mPrevious='" + mPrevious + '\'' +
", mResults=" + mResults +
'}';
}
}
|
UTF-8
|
Java
| 1,295 |
java
|
PaginatedList.java
|
Java
|
[
{
"context": "tUtils;\n\nimport java.util.List;\n\n/**\n * Created by Victor Artemyev on 13/05/2016.\n */\npublic class PaginatedList<T> ",
"end": 132,
"score": 0.9998822212219238,
"start": 117,
"tag": "NAME",
"value": "Victor Artemyev"
}
] | null |
[] |
package com.devabit.takestock.data.model;
import android.text.TextUtils;
import java.util.List;
/**
* Created by <NAME> on 13/05/2016.
*/
public class PaginatedList<T> {
private int mCount;
private String mNext;
private String mPrevious;
private List<T> mResults;
public int getCount() {
return mCount;
}
public void setCount(int count) {
mCount = count;
}
public String getNext() {
return mNext;
}
public void setNext(String next) {
mNext = next;
}
public boolean hasNext() {
return !TextUtils.isEmpty(mNext);
}
public String getPrevious() {
return mPrevious;
}
public void setPrevious(String previous) {
mPrevious = previous;
}
public boolean hasPrevious() {
return !TextUtils.isEmpty(mPrevious);
}
public List<T> getResults() {
return mResults;
}
public void setResults(List<T> results) {
mResults = results;
}
@Override public String toString() {
return "ResultList{" +
"mCount=" + mCount +
", mNext='" + mNext + '\'' +
", mPrevious='" + mPrevious + '\'' +
", mResults=" + mResults +
'}';
}
}
| 1,286 | 0.555212 | 0.549035 | 65 | 18.923077 | 16.430092 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.323077 | false | false |
9
|
8e1f38059cd2e3d31622827d687a1dd5034d283f
| 31,310,311,595,197 |
cfd2262023cdcf82439dd3918f200aaa63616135
|
/src/main/java/com/greeting/util/GreetingConstants.java
|
40b8b5e46b613041ee0fe8f4e1f4bb7a0a029fe3
|
[] |
no_license
|
rbhattac2602/github-upload
|
https://github.com/rbhattac2602/github-upload
|
a1c06126358f8d3cb651df0f02d458a398655133
|
5212ffce2ea79e47ba5aad0424badfd4a2cd63a0
|
refs/heads/master
| 2022-08-25T19:35:53.959000 | 2020-05-17T18:28:11 | 2020-05-17T18:28:11 | 264,710,614 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.greeting.util;
public class GreetingConstants {
public static final String GREETING_USER_ID_MESSAGE = "Hi, userId ";
public static final String WELCOME_BUSINESS_USER_MESSAGE = "Welcome, business user!";
}
|
UTF-8
|
Java
| 226 |
java
|
GreetingConstants.java
|
Java
|
[] | null |
[] |
package com.greeting.util;
public class GreetingConstants {
public static final String GREETING_USER_ID_MESSAGE = "Hi, userId ";
public static final String WELCOME_BUSINESS_USER_MESSAGE = "Welcome, business user!";
}
| 226 | 0.752212 | 0.752212 | 6 | 36.666668 | 33.514507 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
9
|
56b8312eb8ffef530ad60aca3e5688efccff1d72
| 7,782,480,751,347 |
d76909f6bbad53c6d804ec348e4c22e57cffbe63
|
/src/dynamic/UniqueBinarySearchTrees_96/SolutionTest.java
|
8eb6c3fc0389a38000ab3e9596e3acfcba5aac96
|
[] |
no_license
|
k1ema/LeetCodeProblems
|
https://github.com/k1ema/LeetCodeProblems
|
60b6e5c4f107c5d68286f42e4ade3629d8919c50
|
cc077faad3ce3e1f8b7a57bb6df52f0d44ba8eb9
|
refs/heads/master
| 2022-11-09T01:50:35.269000 | 2022-10-22T10:58:04 | 2022-10-22T10:58:04 | 186,883,840 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dynamic.UniqueBinarySearchTrees_96;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class SolutionTest {
@Test
public void test() {
Solution s = new Solution();
assertEquals(1, s.numTrees(0));
assertEquals(1, s.numTrees(1));
assertEquals(5, s.numTrees(3));
assertEquals(14, s.numTrees(4));
assertEquals(42, s.numTrees(5));
assertEquals(4862, s.numTrees(9));
assertEquals(16796, s.numTrees(10));
assertEquals(16796, s.numTrees(10));
assertEquals(1767263190, s.numTrees(19));
}
}
|
UTF-8
|
Java
| 636 |
java
|
SolutionTest.java
|
Java
|
[] | null |
[] |
package dynamic.UniqueBinarySearchTrees_96;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class SolutionTest {
@Test
public void test() {
Solution s = new Solution();
assertEquals(1, s.numTrees(0));
assertEquals(1, s.numTrees(1));
assertEquals(5, s.numTrees(3));
assertEquals(14, s.numTrees(4));
assertEquals(42, s.numTrees(5));
assertEquals(4862, s.numTrees(9));
assertEquals(16796, s.numTrees(10));
assertEquals(16796, s.numTrees(10));
assertEquals(1767263190, s.numTrees(19));
}
}
| 636 | 0.647799 | 0.577044 | 21 | 29.285715 | 18.390326 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.047619 | false | false |
9
|
17b52a38fc00543b16030c89a0786ad09a82e9e2
| 8,091,718,400,318 |
8d563936c229ff6c8235eb79c86cdbd467a34819
|
/src/main/java/generic_pages/CommonEmailPage.java
|
61e1eaf152c48ab21e09954042d629b3fd18f0f8
|
[] |
no_license
|
vibhor954/carepro
|
https://github.com/vibhor954/carepro
|
2a1c2d82fe5bd6f506277139327f300044ab2b3d
|
a72e14403ef0b6b93a14c458101a8a4438e24ff3
|
refs/heads/master
| 2022-04-20T18:29:23.230000 | 2020-03-22T07:21:14 | 2020-03-22T07:21:14 | 241,033,737 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package generic_pages;
import logger.Log;
import org.apache.log4j.Logger;
import utils.Constants;
import utils.GlobalVars;
// Compare this to a default method in an interface Java 8
public abstract class CommonEmailPage {
private static CommonEmailPage commonEmailPage;
public static GlobalVars globalVars;
public static Logger logger;
public static CommonEmailPage getInstance() {
globalVars = GlobalVars.getInstance();
logger = Log.getInstance();
if (commonEmailPage == null) {
switch (globalVars.getPlatform()) {
case Constants.ANDROID:
commonEmailPage = pages.EmailPage.getEmailPageInstance();
break;
}
}
return commonEmailPage;
}
public abstract void composeemail(String to, String subject,String description);
public abstract boolean verifymailsent(String text);
public abstract boolean verifymailreceived(String text) throws InterruptedException;
public abstract boolean performsearch() throws InterruptedException;
public abstract boolean deletetrashemails();
public abstract boolean deleteinboxemails();
public abstract boolean deletesentemails();
public abstract boolean verifyemailfunctionality();
public abstract boolean emailnegativecases(String to,String subject,String description) throws InterruptedException;
}
|
UTF-8
|
Java
| 1,412 |
java
|
CommonEmailPage.java
|
Java
|
[] | null |
[] |
package generic_pages;
import logger.Log;
import org.apache.log4j.Logger;
import utils.Constants;
import utils.GlobalVars;
// Compare this to a default method in an interface Java 8
public abstract class CommonEmailPage {
private static CommonEmailPage commonEmailPage;
public static GlobalVars globalVars;
public static Logger logger;
public static CommonEmailPage getInstance() {
globalVars = GlobalVars.getInstance();
logger = Log.getInstance();
if (commonEmailPage == null) {
switch (globalVars.getPlatform()) {
case Constants.ANDROID:
commonEmailPage = pages.EmailPage.getEmailPageInstance();
break;
}
}
return commonEmailPage;
}
public abstract void composeemail(String to, String subject,String description);
public abstract boolean verifymailsent(String text);
public abstract boolean verifymailreceived(String text) throws InterruptedException;
public abstract boolean performsearch() throws InterruptedException;
public abstract boolean deletetrashemails();
public abstract boolean deleteinboxemails();
public abstract boolean deletesentemails();
public abstract boolean verifyemailfunctionality();
public abstract boolean emailnegativecases(String to,String subject,String description) throws InterruptedException;
}
| 1,412 | 0.72238 | 0.720963 | 39 | 35.179485 | 28.119591 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
9
|
6c9a5a40207f78419511488d66c618c74baa47aa
| 21,371,757,276,376 |
3cd3aa0a5a33302854189a65f8e9b2a2f3a607e4
|
/src/main/java/com/ws/worldskills/controller/MainController.java
|
e6bd1723181d7738a4ec887dc961fb932999a7d0
|
[] |
no_license
|
nikdok/ws
|
https://github.com/nikdok/ws
|
8113d383265d5c868a944431b2b69b339349f4cc
|
28fc1eeb72d5bb16379e2717836c23dce7a4c6a0
|
refs/heads/master
| 2023-08-12T20:33:14.650000 | 2021-10-16T09:01:23 | 2021-10-16T09:01:23 | 415,258,608 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ws.worldskills.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class MainController {
@GetMapping("/")
public String signInPage(Model model) {
return "login";
}
@GetMapping("/registration")
public String signUpPage(Model model) {
return "registration";
}
}
|
UTF-8
|
Java
| 445 |
java
|
MainController.java
|
Java
|
[] | null |
[] |
package com.ws.worldskills.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class MainController {
@GetMapping("/")
public String signInPage(Model model) {
return "login";
}
@GetMapping("/registration")
public String signUpPage(Model model) {
return "registration";
}
}
| 445 | 0.716854 | 0.716854 | 22 | 19.227272 | 18.992659 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false |
9
|
30f03adb4fd002a2b32aca3ff8caed35d538dce4
| 17,489,106,886,548 |
9b8c54d9cc6675620f725a85505e23e73b773a00
|
/src/org/benf/cfr/reader/util/functors/UnaryProcedure.java
|
0c2751dd5a3170f35a51f4343d2e77ef0bea1d20
|
[
"MIT"
] |
permissive
|
leibnitz27/cfr
|
https://github.com/leibnitz27/cfr
|
d54db8d56a1e7cffe720f2144f9b7bba347afd90
|
d6f6758ee900ae1a1fffebe2d75c69ce21237b2a
|
refs/heads/master
| 2023-08-24T14:56:50.161000 | 2022-08-12T07:17:41 | 2022-08-12T07:20:06 | 19,706,727 | 1,758 | 252 |
MIT
| false | 2022-08-12T07:19:26 | 2014-05-12T16:39:42 | 2022-08-09T09:25:43 | 2022-08-12T07:19:26 | 5,274 | 1,321 | 194 | 124 |
Java
| false | false |
package org.benf.cfr.reader.util.functors;
public interface UnaryProcedure<T> {
void call(T arg);
}
|
UTF-8
|
Java
| 105 |
java
|
UnaryProcedure.java
|
Java
|
[] | null |
[] |
package org.benf.cfr.reader.util.functors;
public interface UnaryProcedure<T> {
void call(T arg);
}
| 105 | 0.733333 | 0.733333 | 5 | 20 | 17.33205 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
9
|
886ca172a66614882504342ed7504ff5d1b82716
| 33,071,248,223,923 |
4eb5174a5ad8a44b622e3d3ed2549bed035c9f56
|
/PyC - TP2/src/Main.java
|
feea700ead15dcbcfd28a263aea9ea0ab41516aa
|
[] |
no_license
|
aleferrero98/PyC---TP2
|
https://github.com/aleferrero98/PyC---TP2
|
23ebef9d239cf58c8d020457b54ed1081c0d3e98
|
727d176f7d301c005d0091ee14c529429f11ef63
|
refs/heads/master
| 2020-05-27T05:04:09.311000 | 2019-05-25T00:58:48 | 2019-05-25T00:58:48 | 188,494,396 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Main {
private static final int CANT_PRODUCTORES = 5;
private static final int CANT_A_PRODUCIR = 10000; //10000
private static final int CANT_CONSUMIDORES = 8;
private static final int CANT_A_CONSUMIR = 6250; //NO ESPECIFICA, usamos 6250 para que se consuman todos los productos producidos
public static void main(String[] args) throws InterruptedException {
Productor productores[]=new Productor[CANT_PRODUCTORES];
Consumidor consumidores[]=new Consumidor[CANT_CONSUMIDORES];
Monitor monitor = new Monitor();
for (int i = 0; i < CANT_PRODUCTORES; i++) {
productores[i] = new Productor(monitor,CANT_A_PRODUCIR); // productores
productores[i].start();
}
for (int i = 0; i < CANT_CONSUMIDORES; i++) {
consumidores[i] = new Consumidor(monitor,CANT_A_CONSUMIR); //2 consumidores
consumidores[i].start();
}
for (int i = 0; i < CANT_PRODUCTORES; i++) {
productores[i].join();
}
for (int i = 0; i < 2; i++) {
consumidores[i].join();
}
// buffer.imprimir();
//System.out.println("Fin del hilo Main");
}
}
|
UTF-8
|
Java
| 1,291 |
java
|
Main.java
|
Java
|
[] | null |
[] |
public class Main {
private static final int CANT_PRODUCTORES = 5;
private static final int CANT_A_PRODUCIR = 10000; //10000
private static final int CANT_CONSUMIDORES = 8;
private static final int CANT_A_CONSUMIR = 6250; //NO ESPECIFICA, usamos 6250 para que se consuman todos los productos producidos
public static void main(String[] args) throws InterruptedException {
Productor productores[]=new Productor[CANT_PRODUCTORES];
Consumidor consumidores[]=new Consumidor[CANT_CONSUMIDORES];
Monitor monitor = new Monitor();
for (int i = 0; i < CANT_PRODUCTORES; i++) {
productores[i] = new Productor(monitor,CANT_A_PRODUCIR); // productores
productores[i].start();
}
for (int i = 0; i < CANT_CONSUMIDORES; i++) {
consumidores[i] = new Consumidor(monitor,CANT_A_CONSUMIR); //2 consumidores
consumidores[i].start();
}
for (int i = 0; i < CANT_PRODUCTORES; i++) {
productores[i].join();
}
for (int i = 0; i < 2; i++) {
consumidores[i].join();
}
// buffer.imprimir();
//System.out.println("Fin del hilo Main");
}
}
| 1,291 | 0.564679 | 0.544539 | 42 | 28.690475 | 32.386421 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.619048 | false | false |
9
|
1043a28b36f3b10b28ce7854e6b031a31c26a261
| 850,403,580,824 |
d84a9d9b4624ac4c86b5fe518289df1ca75fadaf
|
/back_boot/src/main/java/com/cai/service/impl/ChunkServiceImpl.java
|
db9c73aac06d4021e1d40a9e1b83bf5811bedfda
|
[] |
no_license
|
Dawei-Fang/Springboot-vue-UpDownloadFile
|
https://github.com/Dawei-Fang/Springboot-vue-UpDownloadFile
|
be27d657e3ce02b188149c8f14bd26b74b54de6a
|
e56616f38c40066c01cc24fed193ee1fa87533fc
|
refs/heads/master
| 2023-01-24T21:53:01.109000 | 2020-11-25T09:41:21 | 2020-11-25T09:41:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cai.service.impl;
import com.cai.util.SnowflakeIdWorker;
import com.cai.dao.TChunkInfoMapper;
import com.cai.model.TChunkInfo;
import com.cai.service.ChunkService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
@Service
public class ChunkServiceImpl implements ChunkService {
@Resource
TChunkInfoMapper tChunkInfoMapper;
@Override
public int saveChunk(TChunkInfo chunk) {
chunk.setId(SnowflakeIdWorker.getUUID()+SnowflakeIdWorker.getUUID());
return tChunkInfoMapper.insertSelective(chunk);
}
@Override
public ArrayList<Integer> checkChunk(TChunkInfo chunk) {
return tChunkInfoMapper.selectChunkNumbers(chunk);
}
@Override
public boolean checkChunk(String identifier, Integer chunkNumber) {
return false;
}
}
|
UTF-8
|
Java
| 837 |
java
|
ChunkServiceImpl.java
|
Java
|
[] | null |
[] |
package com.cai.service.impl;
import com.cai.util.SnowflakeIdWorker;
import com.cai.dao.TChunkInfoMapper;
import com.cai.model.TChunkInfo;
import com.cai.service.ChunkService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
@Service
public class ChunkServiceImpl implements ChunkService {
@Resource
TChunkInfoMapper tChunkInfoMapper;
@Override
public int saveChunk(TChunkInfo chunk) {
chunk.setId(SnowflakeIdWorker.getUUID()+SnowflakeIdWorker.getUUID());
return tChunkInfoMapper.insertSelective(chunk);
}
@Override
public ArrayList<Integer> checkChunk(TChunkInfo chunk) {
return tChunkInfoMapper.selectChunkNumbers(chunk);
}
@Override
public boolean checkChunk(String identifier, Integer chunkNumber) {
return false;
}
}
| 837 | 0.778973 | 0.778973 | 34 | 23.617647 | 22.601425 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.735294 | false | false |
9
|
06642ffb84e636cf8bb17514e5cc1dc28fe1b81f
| 24,507,083,396,131 |
695f1b98c8af04dc84e18c9d619f0289119129e1
|
/src/main/java/com/jiubo/erp/common/Result.java
|
107edb0633e3cddaf8facb3ebfb727b21f9cc866
|
[] |
no_license
|
wnsj/ERPSP
|
https://github.com/wnsj/ERPSP
|
95e3c833ebdf73f1ffbd070d1de7d577d0d819f1
|
6997f9f7eb1729e5230920a9f9d6597dce56344d
|
refs/heads/master
| 2022-07-13T13:13:47.115000 | 2019-11-25T10:39:26 | 2019-11-25T10:39:26 | 200,197,804 | 1 | 0 | null | false | 2021-04-26T19:23:07 | 2019-08-02T08:33:47 | 2021-02-01T10:38:24 | 2021-04-26T19:23:06 | 522 | 1 | 0 | 4 |
Java
| false | false |
package com.jiubo.erp.common;
import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Result<T> {
private String status;
private List<T> Listdata;
private Map<String, Object> mapdata = new HashMap<String, Object>();
private String Message;
private PageParam page;
private long totalnfo; //总记录数
private long totalPages; //总页数
private JSONObject data;
public JSONObject getData() {
return data;
}
public void setData(JSONObject data) {
this.data = data;
}
public long getTotalnfo() {
return totalnfo;
}
public void setTotalnfo(long totalnfo) {
this.totalnfo = totalnfo;
}
public long getTotalPages() {
return totalPages;
}
public void setTotalPages(long totalPages) {
this.totalPages = totalPages;
}
public void setTotalnfo(int totalnfo) {
this.totalnfo = totalnfo;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public PageParam getPage() {
return page;
}
public void setPage(PageParam page) {
this.page = page;
}
public Map<String, Object> getMapdata() {
return mapdata;
}
public void setMapdata(Map<String, Object> mapdata) {
this.mapdata = mapdata;
}
public List<T> getListdata() {
return Listdata;
}
public void setListdata(List<T> listdata) {
Listdata = listdata;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return Message;
}
public void setMessage(String message) {
Message = message;
}
}
|
UTF-8
|
Java
| 1,861 |
java
|
Result.java
|
Java
|
[] | null |
[] |
package com.jiubo.erp.common;
import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Result<T> {
private String status;
private List<T> Listdata;
private Map<String, Object> mapdata = new HashMap<String, Object>();
private String Message;
private PageParam page;
private long totalnfo; //总记录数
private long totalPages; //总页数
private JSONObject data;
public JSONObject getData() {
return data;
}
public void setData(JSONObject data) {
this.data = data;
}
public long getTotalnfo() {
return totalnfo;
}
public void setTotalnfo(long totalnfo) {
this.totalnfo = totalnfo;
}
public long getTotalPages() {
return totalPages;
}
public void setTotalPages(long totalPages) {
this.totalPages = totalPages;
}
public void setTotalnfo(int totalnfo) {
this.totalnfo = totalnfo;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public PageParam getPage() {
return page;
}
public void setPage(PageParam page) {
this.page = page;
}
public Map<String, Object> getMapdata() {
return mapdata;
}
public void setMapdata(Map<String, Object> mapdata) {
this.mapdata = mapdata;
}
public List<T> getListdata() {
return Listdata;
}
public void setListdata(List<T> listdata) {
Listdata = listdata;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return Message;
}
public void setMessage(String message) {
Message = message;
}
}
| 1,861 | 0.612886 | 0.612886 | 108 | 16.101852 | 17.20085 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.324074 | false | false |
9
|
7d361b7af1dd85b20af59df8147baa52b3f74d98
| 11,931,419,207,099 |
69c5d4f239072fe273ca5bdd396daeef2ac3c51f
|
/src/test/java/nicferrier/AppTest.java
|
316cf0ac9e74630f27b50ac46b11be8af4ff4bdd
|
[] |
no_license
|
nicferrier/maybe-a-language
|
https://github.com/nicferrier/maybe-a-language
|
a976a43ae904894a16c974f9888931e06ee3f053
|
598ae8efcc5a16d34bcaf106a2371f5fdcd94837
|
refs/heads/master
| 2021-04-27T10:51:58.862000 | 2018-02-24T15:42:16 | 2018-02-24T15:42:16 | 122,549,266 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package nicferrier;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import java.io.StringReader;
import java.io.IOException;
/**
* Unit test for simple App.
*/
public class AppTest extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
public void testApp() throws IOException
{
App a = new App();
String form1 = "(let ((a 10)) a)";
App.Cons lisp1 = a.read(new StringReader(form1));
assertTrue("(let ((a 10.0)) a)".equals(lisp1.toString()));
String form2 = "(let ((a \"hello\")) a)";
App.Cons lisp2 = a.read(new StringReader(form2));
assertTrue(form2.equals(lisp2.toString()));
String form3 = "(let ((a true)) a)";
App.Cons lisp3 = a.read(new StringReader(form3));
assertTrue(form3.equals(lisp3.toString()));
}
}
|
UTF-8
|
Java
| 1,152 |
java
|
AppTest.java
|
Java
|
[] | null |
[] |
package nicferrier;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import java.io.StringReader;
import java.io.IOException;
/**
* Unit test for simple App.
*/
public class AppTest extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
public void testApp() throws IOException
{
App a = new App();
String form1 = "(let ((a 10)) a)";
App.Cons lisp1 = a.read(new StringReader(form1));
assertTrue("(let ((a 10.0)) a)".equals(lisp1.toString()));
String form2 = "(let ((a \"hello\")) a)";
App.Cons lisp2 = a.read(new StringReader(form2));
assertTrue(form2.equals(lisp2.toString()));
String form3 = "(let ((a true)) a)";
App.Cons lisp3 = a.read(new StringReader(form3));
assertTrue(form3.equals(lisp3.toString()));
}
}
| 1,152 | 0.596354 | 0.579861 | 48 | 23 | 20.307018 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
9
|
c3ad733183f03193d8cb370c023bc29017c5ff24
| 16,432,544,934,169 |
c072af315fc1dd8983b2219df150d9994b9894d3
|
/factory/src/main/java/com/example/iwen/factory/data/database/userDataBase/UserDao.java
|
43499ccf13a2bf3ab6587402ddd9fab87494a742
|
[] |
no_license
|
ljr7822/Android_SignUp
|
https://github.com/ljr7822/Android_SignUp
|
4dafec44bb02d5e1c367876e2f118ff65aa5f337
|
610424f3715cebd33883503e547eac30177b63e7
|
refs/heads/master
| 2023-03-21T17:35:14.237000 | 2021-03-18T17:46:11 | 2021-03-18T17:46:11 | 312,443,557 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.iwen.factory.data.database.userDataBase;
import android.service.autofill.UserData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
/**
* 访问数据库操作的接口
*
* @author iwen大大怪
* Create to 2021/03/18 20:21
*/
@Dao
public interface UserDao {
@Insert
void insertUser(UserDataModel userDataModel);
@Update
void updateUser(UserDataModel userDataModel);
@Delete
void deleteUser(UserDataModel userDataModel);
@Query("DELETE FROM UserDataModel")
void deleteAllUser();
// @Query("SELECT * FROM userDataModel ORDER BY workId DESC")
// void getAllUser();
}
|
UTF-8
|
Java
| 727 |
java
|
UserDao.java
|
Java
|
[
{
"context": "oidx.room.Update;\n\n/**\n * 访问数据库操作的接口\n *\n * @author iwen大大怪\n * Create to 2021/03/18 20:21\n */\n@Dao\npublic int",
"end": 286,
"score": 0.9963447451591492,
"start": 279,
"tag": "NAME",
"value": "iwen大大怪"
}
] | null |
[] |
package com.example.iwen.factory.data.database.userDataBase;
import android.service.autofill.UserData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
/**
* 访问数据库操作的接口
*
* @author iwen大大怪
* Create to 2021/03/18 20:21
*/
@Dao
public interface UserDao {
@Insert
void insertUser(UserDataModel userDataModel);
@Update
void updateUser(UserDataModel userDataModel);
@Delete
void deleteUser(UserDataModel userDataModel);
@Query("DELETE FROM UserDataModel")
void deleteAllUser();
// @Query("SELECT * FROM userDataModel ORDER BY workId DESC")
// void getAllUser();
}
| 727 | 0.733238 | 0.71612 | 33 | 20.242424 | 18.988083 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
9
|
4f49790241aaa4faf69090645b82c94e0eb1aa7b
| 18,957,985,664,329 |
17a3b9ee74231d7758bddbca33520fbdab993a00
|
/OpenScienceJournal/whistlepunk_library/src/main/java/com/google/android/apps/forscience/whistlepunk/accounts/SignInActivity.java
|
755e1278f01f1b1e7654091fc2d57b1a197a364f
|
[
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
lizlooney/science-journal
|
https://github.com/lizlooney/science-journal
|
17d4bbd2cdce5a519041f90406663be845339d6e
|
73222ba6f538f3c2fa7ce3821f5004ff362b4752
|
refs/heads/master
| 2020-05-02T16:02:22.565000 | 2019-11-22T14:46:44 | 2019-11-25T18:42:04 | 178,058,353 | 1 | 0 |
Apache-2.0
| true | 2019-03-27T19:08:03 | 2019-03-27T19:08:03 | 2019-03-27T05:11:26 | 2019-03-26T19:59:52 | 23,651 | 0 | 0 | 0 | null | false | null |
/*
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.apps.forscience.whistlepunk.accounts;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.apps.forscience.whistlepunk.R;
import com.google.android.apps.forscience.whistlepunk.WhistlePunkApplication;
/** Activity that tells the user to explore their world. */
public class SignInActivity extends AppCompatActivity {
private static final String TAG = "SignInActivity";
private static final String FRAGMENT_TAG = "SignIn";
public static boolean shouldLaunch(Context context) {
AccountsProvider accountsProvider =
WhistlePunkApplication.getAppServices(context).getAccountsProvider();
return accountsProvider.getShowSignInActivityIfNotSignedIn() && !accountsProvider.isSignedIn();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
boolean isTablet = getResources().getBoolean(R.bool.is_tablet);
if (!isTablet) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
if (getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG) == null) {
Fragment fragment = new SignInFragment();
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, fragment, FRAGMENT_TAG)
.commit();
}
}
}
|
UTF-8
|
Java
| 2,123 |
java
|
SignInActivity.java
|
Java
|
[] | null |
[] |
/*
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.apps.forscience.whistlepunk.accounts;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.apps.forscience.whistlepunk.R;
import com.google.android.apps.forscience.whistlepunk.WhistlePunkApplication;
/** Activity that tells the user to explore their world. */
public class SignInActivity extends AppCompatActivity {
private static final String TAG = "SignInActivity";
private static final String FRAGMENT_TAG = "SignIn";
public static boolean shouldLaunch(Context context) {
AccountsProvider accountsProvider =
WhistlePunkApplication.getAppServices(context).getAccountsProvider();
return accountsProvider.getShowSignInActivityIfNotSignedIn() && !accountsProvider.isSignedIn();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
boolean isTablet = getResources().getBoolean(R.bool.is_tablet);
if (!isTablet) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
if (getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG) == null) {
Fragment fragment = new SignInFragment();
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, fragment, FRAGMENT_TAG)
.commit();
}
}
}
| 2,123 | 0.750353 | 0.746585 | 56 | 36.910713 | 28.172478 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446429 | false | false |
9
|
e2dfa4916f39c2bf9e455e66174a32247f9334f1
| 32,925,219,320,694 |
d4820e5701544e74c9e70c1c7a376eefca36c308
|
/ses/src/main/java/mm/com/dat/ses/evaluation/scoreDetail/entity/EvalScoreDetailEntity.java
|
6bb9ed7886cdf1d881369562df42a75ed631b5b6
|
[] |
no_license
|
Hsunandarhtet/StaffEvaluation
|
https://github.com/Hsunandarhtet/StaffEvaluation
|
3575268871c27a97036997de8b023e17b7d4665a
|
2e44acaa3e0012a83f06ab2804a62e724414b5a4
|
refs/heads/master
| 2022-12-31T10:21:39.161000 | 2020-10-26T05:59:12 | 2020-10-26T05:59:12 | 292,827,265 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/***************************************************************
* Author : Hsu Nandar Htet
* Created Date : 18/9/2020
* Updated Date : -
* Version : 1.0
* Dev History : -
***************************************************************/
package mm.com.dat.ses.evaluation.scoreDetail.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import lombok.Data;
import mm.com.dat.ses.evaluation.category.entity.EvalCategoryEntity;
import mm.com.dat.ses.evaluation.item.entity.EvalItemEntity;
import mm.com.dat.ses.evaluation.scoreHead.entity.EvalScoreHeadEntity;
@Data
@Entity
@Table(name = "eval_score_detail")
public class EvalScoreDetailEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@OrderBy
private Long eval_detail_id;
@ManyToOne
@JoinColumn(name="eval_score_head_id",nullable=false)
private EvalScoreHeadEntity evalScoreHeadId;
@ManyToOne
@JoinColumn(name="eval_item_id")
private EvalItemEntity evalItemId;
@ManyToOne
@JoinColumn(name="eval_category_id")
private EvalCategoryEntity evalCategoryId;
@Column(name="score_record_type",nullable=false,length=3)
private String scoreRecordType;
@Column(name="first_month_score")
private int firstMonthScore;
@Column(name="second_month_score")
private int secondMonthScore;
@Column(name="third_month_score")
private int thirdMonthScore;
@Column(name="fourth_month_score")
private int fourthMonthScore;
@Column(name="fifth_month_score")
private int fifthMonthScore;
@Column(name="sixth_month_score")
private int sixthMonthScore;
@Column(name="seventh_month_score")
private int seventhMonthScore;
@Column(name="eighth_month_score")
private int eighthMonthScore;
@Column(name="ninth_month_score")
private int ninthMonthScore;
@Column(name="tenth_month_score")
private int tenthMonthScore;
@Column(name="eleventh_month_score")
private int eleventhMonthScore;
@Column(name="twelfth_month_score")
private int twelfthMonthScore;
}
|
UTF-8
|
Java
| 2,345 |
java
|
EvalScoreDetailEntity.java
|
Java
|
[
{
"context": "******************************\r\n * Author :\tHsu Nandar Htet\t\t\t\t\t\t\r\n * Created Date :\t18/9/2020\r\n * Updated Da",
"end": 99,
"score": 0.999753475189209,
"start": 84,
"tag": "NAME",
"value": "Hsu Nandar Htet"
}
] | null |
[] |
/***************************************************************
* Author : <NAME>
* Created Date : 18/9/2020
* Updated Date : -
* Version : 1.0
* Dev History : -
***************************************************************/
package mm.com.dat.ses.evaluation.scoreDetail.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import lombok.Data;
import mm.com.dat.ses.evaluation.category.entity.EvalCategoryEntity;
import mm.com.dat.ses.evaluation.item.entity.EvalItemEntity;
import mm.com.dat.ses.evaluation.scoreHead.entity.EvalScoreHeadEntity;
@Data
@Entity
@Table(name = "eval_score_detail")
public class EvalScoreDetailEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@OrderBy
private Long eval_detail_id;
@ManyToOne
@JoinColumn(name="eval_score_head_id",nullable=false)
private EvalScoreHeadEntity evalScoreHeadId;
@ManyToOne
@JoinColumn(name="eval_item_id")
private EvalItemEntity evalItemId;
@ManyToOne
@JoinColumn(name="eval_category_id")
private EvalCategoryEntity evalCategoryId;
@Column(name="score_record_type",nullable=false,length=3)
private String scoreRecordType;
@Column(name="first_month_score")
private int firstMonthScore;
@Column(name="second_month_score")
private int secondMonthScore;
@Column(name="third_month_score")
private int thirdMonthScore;
@Column(name="fourth_month_score")
private int fourthMonthScore;
@Column(name="fifth_month_score")
private int fifthMonthScore;
@Column(name="sixth_month_score")
private int sixthMonthScore;
@Column(name="seventh_month_score")
private int seventhMonthScore;
@Column(name="eighth_month_score")
private int eighthMonthScore;
@Column(name="ninth_month_score")
private int ninthMonthScore;
@Column(name="tenth_month_score")
private int tenthMonthScore;
@Column(name="eleventh_month_score")
private int eleventhMonthScore;
@Column(name="twelfth_month_score")
private int twelfthMonthScore;
}
| 2,336 | 0.698081 | 0.693817 | 87 | 24.954023 | 18.889824 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.16092 | false | false |
9
|
5ccde5cb0829be999694d8e557602956706864c3
| 13,958,643,719,583 |
84285f6f44ac23fcac02463bb0ab2782c72e1026
|
/yifubao/core-service-admin/src/main/java/com/efubao/core/admin/domain/Goods.java
|
03a51cdc46f218a93edc6ca9283f6c6164829be6
|
[] |
no_license
|
lichao20000/projects-web
|
https://github.com/lichao20000/projects-web
|
f68122493861dd2a9f141c941534e55faacbd535
|
da34ce2468731eeff5ba0ae3948e4814e2413ac5
|
refs/heads/master
| 2021-12-10T09:41:30.578000 | 2016-08-05T04:13:41 | 2016-08-05T04:13:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.efubao.core.admin.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
*
*
* @author zzy
* @date 2016-03-09
*
*/
public class Goods implements Serializable {
/** */
private Long id;
/** 商品名称 */
private String name;
/** 商品编号 */
private String num;
/** 商品简述 */
private String summary;
/** 类目ID */
private Long categoryId;
/** 首图图片路径 */
private String firstImagePath;
/** 排序 */
private Integer sort;
/** 状态:1-正常;2-停用 */
private Integer status;
/** 最小价格 */
private BigDecimal minPrice;
/** 最大价格 */
private BigDecimal maxPrice;
/** 上线时间 */
private Timestamp onlineTime;
/** 下线时间 */
private Timestamp offlineTime;
/** 创建时间 */
private Timestamp createTime;
/** 更新时间 */
private Timestamp updateTime;
/** 是否删除 */
private Boolean isDel;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getFirstImagePath() {
return firstImagePath;
}
public void setFirstImagePath(String firstImagePath) {
this.firstImagePath = firstImagePath;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public BigDecimal getMinPrice() {
return minPrice;
}
public void setMinPrice(BigDecimal minPrice) {
this.minPrice = minPrice;
}
public BigDecimal getMaxPrice() {
return maxPrice;
}
public void setMaxPrice(BigDecimal maxPrice) {
this.maxPrice = maxPrice;
}
public Timestamp getOnlineTime() {
return onlineTime;
}
public void setOnlineTime(Timestamp onlineTime) {
this.onlineTime = onlineTime;
}
public Timestamp getOfflineTime() {
return offlineTime;
}
public void setOfflineTime(Timestamp offlineTime) {
this.offlineTime = offlineTime;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
public Timestamp getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Timestamp updateTime) {
this.updateTime = updateTime;
}
public Boolean getIsDel() {
return isDel;
}
public void setIsDel(Boolean isDel) {
this.isDel = isDel;
}
}
|
UTF-8
|
Java
| 3,394 |
java
|
Goods.java
|
Java
|
[
{
"context": "\nimport java.sql.Timestamp;\n\n/**\n * \n *\n * @author zzy\n * @date 2016-03-09\n *\n */\npublic class Goods imp",
"end": 150,
"score": 0.9996826648712158,
"start": 147,
"tag": "USERNAME",
"value": "zzy"
}
] | null |
[] |
package com.efubao.core.admin.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
*
*
* @author zzy
* @date 2016-03-09
*
*/
public class Goods implements Serializable {
/** */
private Long id;
/** 商品名称 */
private String name;
/** 商品编号 */
private String num;
/** 商品简述 */
private String summary;
/** 类目ID */
private Long categoryId;
/** 首图图片路径 */
private String firstImagePath;
/** 排序 */
private Integer sort;
/** 状态:1-正常;2-停用 */
private Integer status;
/** 最小价格 */
private BigDecimal minPrice;
/** 最大价格 */
private BigDecimal maxPrice;
/** 上线时间 */
private Timestamp onlineTime;
/** 下线时间 */
private Timestamp offlineTime;
/** 创建时间 */
private Timestamp createTime;
/** 更新时间 */
private Timestamp updateTime;
/** 是否删除 */
private Boolean isDel;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getFirstImagePath() {
return firstImagePath;
}
public void setFirstImagePath(String firstImagePath) {
this.firstImagePath = firstImagePath;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public BigDecimal getMinPrice() {
return minPrice;
}
public void setMinPrice(BigDecimal minPrice) {
this.minPrice = minPrice;
}
public BigDecimal getMaxPrice() {
return maxPrice;
}
public void setMaxPrice(BigDecimal maxPrice) {
this.maxPrice = maxPrice;
}
public Timestamp getOnlineTime() {
return onlineTime;
}
public void setOnlineTime(Timestamp onlineTime) {
this.onlineTime = onlineTime;
}
public Timestamp getOfflineTime() {
return offlineTime;
}
public void setOfflineTime(Timestamp offlineTime) {
this.offlineTime = offlineTime;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
public Timestamp getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Timestamp updateTime) {
this.updateTime = updateTime;
}
public Boolean getIsDel() {
return isDel;
}
public void setIsDel(Boolean isDel) {
this.isDel = isDel;
}
}
| 3,394 | 0.595978 | 0.592626 | 181 | 17.138121 | 16.165161 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.281768 | false | false |
9
|
5d1c8661a316e42cc3aa59f1131c968a3fe7c73e
| 13,958,643,719,589 |
6d1526544f51f132ff802ac4f033b4bfea184c42
|
/src/problem/ProducerII.java
|
cdb08d6bbf29e9d52f69fa54f45d95f5999e442a
|
[] |
no_license
|
hpclabdecom/producer_consumer
|
https://github.com/hpclabdecom/producer_consumer
|
a62f17d241d33416e080f0fe6c32618c6316c5a4
|
6e455c6ddd294fee26554fc5702eae63cbc80275
|
refs/heads/master
| 2023-05-06T18:34:34.798000 | 2021-05-27T10:55:17 | 2021-05-27T10:55:17 | 371,338,560 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package problem;
import java.util.Random;
public class ProducerII<S> extends Thread{
private Resource<S> re;
public ProducerII(Resource<S> re){
this.re = re;
}
public void run(){
int numeroProducoes = 1000;
//criando blocos
int[][] bloco = new int[100][100];
Random r = new Random();
int k=0;
while( k<numeroProducoes){
for( int x = 0; x<bloco.length;x++){
for(int y =0; y<bloco[0].length; y++){
bloco[x][y] = r.nextInt(1000);
}
}
re.putRegister((S)bloco);
k++;
}
}
}
|
UTF-8
|
Java
| 530 |
java
|
ProducerII.java
|
Java
|
[] | null |
[] |
package problem;
import java.util.Random;
public class ProducerII<S> extends Thread{
private Resource<S> re;
public ProducerII(Resource<S> re){
this.re = re;
}
public void run(){
int numeroProducoes = 1000;
//criando blocos
int[][] bloco = new int[100][100];
Random r = new Random();
int k=0;
while( k<numeroProducoes){
for( int x = 0; x<bloco.length;x++){
for(int y =0; y<bloco[0].length; y++){
bloco[x][y] = r.nextInt(1000);
}
}
re.putRegister((S)bloco);
k++;
}
}
}
| 530 | 0.592453 | 0.558491 | 31 | 16.096775 | 14.37371 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.258065 | false | false |
9
|
04cb7f6847065d3006a69998af96b4b9d7ca92f6
| 6,244,882,499,882 |
679a611a546148f8835f697c8052c178eb055160
|
/src/main/java/de/tuhh/sts/team11/protocol/AuctionWinnerEvent.java
|
e9343251e2f07e86af26a331d26d6dfb6de5fc07
|
[] |
no_license
|
mkaay/EnergyAuction
|
https://github.com/mkaay/EnergyAuction
|
9313e72da8641712ed6837841dce43202934593e
|
a8baa2de3790323362424679f7e4d1b654609341
|
refs/heads/master
| 2021-01-19T11:21:51.838000 | 2014-01-24T10:46:50 | 2014-01-24T10:46:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.tuhh.sts.team11.protocol;
import java.io.Serializable;
/**
* Created with IntelliJ IDEA.
*
* @author mkaay
* @since 1/23/14
*/
public class AuctionWinnerEvent implements Serializable {
public AuctionWinnerEvent() {
}
}
|
UTF-8
|
Java
| 247 |
java
|
AuctionWinnerEvent.java
|
Java
|
[
{
"context": "\n\n/**\n * Created with IntelliJ IDEA.\n *\n * @author mkaay\n * @since 1/23/14\n */\npublic class AuctionWinnerE",
"end": 123,
"score": 0.9996323585510254,
"start": 118,
"tag": "USERNAME",
"value": "mkaay"
}
] | null |
[] |
package de.tuhh.sts.team11.protocol;
import java.io.Serializable;
/**
* Created with IntelliJ IDEA.
*
* @author mkaay
* @since 1/23/14
*/
public class AuctionWinnerEvent implements Serializable {
public AuctionWinnerEvent() {
}
}
| 247 | 0.700405 | 0.672065 | 16 | 14.4375 | 16.911419 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | false | false |
9
|
6913d8a22736a8c42349edd849a9c7e6fc2140e6
| 20,212,116,125,989 |
0572c810830ccced34f6f22860d0fc08f8277e59
|
/Java-Herdt8/src/com/herdt/java8/kap12/SortArray.java
|
7b4906c0834dc41f71d3e4883cd71dff7f82aff4
|
[] |
no_license
|
frithjofhoppe/Java-Intro
|
https://github.com/frithjofhoppe/Java-Intro
|
f343a4974441a393abc0822d95083cf9a37f7ed3
|
d8eedc45f526d6abf0459ad292431661bd474e41
|
refs/heads/master
| 2021-01-15T13:25:08.980000 | 2017-08-11T12:01:39 | 2017-08-11T12:01:39 | 99,672,641 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.herdt.java8.kap12;
class SortArray
{
public static void main(String[] args)
{
int[] someNumbers = {11, 23, 4, 17, 6};
java.util.Arrays.sort(someNumbers);
for(int value: someNumbers)
System.out.println(value);
String s = java.util.Arrays.toString(someNumbers);
System.out.println(s);
}
}
|
UTF-8
|
Java
| 334 |
java
|
SortArray.java
|
Java
|
[] | null |
[] |
package com.herdt.java8.kap12;
class SortArray
{
public static void main(String[] args)
{
int[] someNumbers = {11, 23, 4, 17, 6};
java.util.Arrays.sort(someNumbers);
for(int value: someNumbers)
System.out.println(value);
String s = java.util.Arrays.toString(someNumbers);
System.out.println(s);
}
}
| 334 | 0.658683 | 0.625749 | 16 | 19.875 | 18.323055 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false |
9
|
bb752ec973e31c4e1506e1cc459352eb825b8e22
| 26,036,091,751,754 |
2cc8c75844db69dfbebbbca35da072df751c6e30
|
/src/main/java/com/Still/service/impl/LoginServiceImpl.java
|
f635d48d4c9a32a3ea53bc5b75a2798ba31ba220
|
[] |
no_license
|
ifyouSugar/shiro_springboot
|
https://github.com/ifyouSugar/shiro_springboot
|
669e37d0df9d558e77d6fd295bec088fe999959d
|
7c7cbb177758f7e7b76fa0ebcb2caa9a120b4e4d
|
refs/heads/master
| 2023-08-08T10:35:41.682000 | 2019-06-17T04:21:47 | 2019-06-17T04:21:47 | 192,273,761 | 0 | 0 | null | false | 2023-07-25T13:59:51 | 2019-06-17T04:16:04 | 2019-06-17T04:33:03 | 2023-07-25T13:59:48 | 31 | 0 | 0 | 5 |
Java
| false | false |
package com.Still.service.impl;
import com.Still.domain.User;
import com.Still.repository.UserRepository;
import com.Still.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author: Mr.Still
* @program: shiro_demo
* @create: 2019-06-16 21:43
**/
@Service
@Transactional
public class LoginServiceImpl implements ILoginService {
@Autowired
private UserRepository userRepository;
/**
* 以用户名查询 用户
* @param username
* @return
*/
@Override
public User findByName(String username) {
User user = userRepository.findByName(username);
return user;
}
}
|
UTF-8
|
Java
| 785 |
java
|
LoginServiceImpl.java
|
Java
|
[
{
"context": "saction.annotation.Transactional;\n\n/**\n * @author: Mr.Still\n * @program: shiro_demo\n * @create: 2019-06-16 21",
"end": 347,
"score": 0.9935012459754944,
"start": 339,
"tag": "USERNAME",
"value": "Mr.Still"
}
] | null |
[] |
package com.Still.service.impl;
import com.Still.domain.User;
import com.Still.repository.UserRepository;
import com.Still.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author: Mr.Still
* @program: shiro_demo
* @create: 2019-06-16 21:43
**/
@Service
@Transactional
public class LoginServiceImpl implements ILoginService {
@Autowired
private UserRepository userRepository;
/**
* 以用户名查询 用户
* @param username
* @return
*/
@Override
public User findByName(String username) {
User user = userRepository.findByName(username);
return user;
}
}
| 785 | 0.723017 | 0.707412 | 36 | 20.361111 | 19.874821 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false |
9
|
dcf3cf9ddb6cd5e191307255eeb27a04e2eda6dc
| 4,501,125,795,476 |
fb616f4ecec8223c9916a4087ede3c94cfb0a900
|
/e-toll-driver-profile-service/src/main/java/io/linx/etoll/controller/VehicleController.java
|
c918b3e4daa9cf3976b580ba0db6d7f8f86d4a47
|
[] |
no_license
|
tshumal/e-toll-spring-cloud-app
|
https://github.com/tshumal/e-toll-spring-cloud-app
|
ebfe5525a1b00b170442e9d70431a9fa43e5edfc
|
5d68e7c8548526cee31db8b7fb5a65c855b8c125
|
refs/heads/master
| 2021-04-28T21:36:51.369000 | 2017-04-01T06:59:12 | 2017-04-01T06:59:12 | 77,767,421 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.linx.etoll.controller;
import io.linx.etoll.model.DriverVehicleDetails;
import io.linx.etoll.service.VehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* Created by lingani on 3/25/17.
*/
@RestController
public class VehicleController {
@Autowired
VehicleService vehicleService;
@RequestMapping(value="/driver/{driverId}/vehicledetails", method= RequestMethod.GET)
public DriverVehicleDetails getCustomerVehicleDetails(@PathVariable Integer driverId) throws InterruptedException {
return vehicleService.getCustomerVehicleDetails(driverId);
}
}
|
UTF-8
|
Java
| 673 |
java
|
VehicleController.java
|
Java
|
[
{
"context": "ramework.web.bind.annotation.*;\n\n/**\n * Created by lingani on 3/25/17.\n */\n@RestController\npublic class Vehi",
"end": 268,
"score": 0.9994771480560303,
"start": 261,
"tag": "USERNAME",
"value": "lingani"
}
] | null |
[] |
package io.linx.etoll.controller;
import io.linx.etoll.model.DriverVehicleDetails;
import io.linx.etoll.service.VehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* Created by lingani on 3/25/17.
*/
@RestController
public class VehicleController {
@Autowired
VehicleService vehicleService;
@RequestMapping(value="/driver/{driverId}/vehicledetails", method= RequestMethod.GET)
public DriverVehicleDetails getCustomerVehicleDetails(@PathVariable Integer driverId) throws InterruptedException {
return vehicleService.getCustomerVehicleDetails(driverId);
}
}
| 673 | 0.79049 | 0.783061 | 22 | 29.59091 | 32.137005 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
9
|
48ff6c0dfa674b220a62c01a20477ad3792ef92b
| 1,245,540,541,950 |
09699e2571446be6cf4c37dece997ae1981361c0
|
/Arbiter-Android-master(OpenGDS solution)/Arbiter-Android/src/com/lmn/OpenGDS_Android/Dialog/ArbiterDialogs_Expansion.java
|
953adeb2c3c0274b6fc2d0bc622cd8f7178f3d50
|
[
"MIT"
] |
permissive
|
eltory/Mobile
|
https://github.com/eltory/Mobile
|
53555114237a1390deeb47cc140fdae54a345ff8
|
3674100a4ce2736c936fe7b1702ab51257cec330
|
refs/heads/master
| 2020-03-25T10:19:00.416000 | 2018-08-07T01:46:06 | 2018-08-07T01:46:06 | 143,690,219 | 1 | 0 | null | true | 2018-08-06T08:34:13 | 2018-08-06T07:12:34 | 2018-08-06T08:28:13 | 2018-08-06T08:28:11 | 27,356 | 0 | 0 | 1 |
HTML
| false | null |
package com.lmn.OpenGDS_Android.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.res.Resources;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.widget.RelativeLayout;
import com.lmn.Arbiter_Android.Activities.HasThreadPool;
import com.lmn.Arbiter_Android.Activities.MapActivity;
import com.lmn.Arbiter_Android.ConnectivityListeners.ConnectivityListener;
import com.lmn.Arbiter_Android.R;
import com.lmn.OpenGDS_Android.BaseClasses.Image;
import com.lmn.OpenGDS_Android.BaseClasses.Validation;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.AOIBoundaryImageDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ImagesDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.BoundaryImageDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.AddressSearchDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.CoordinateSearchDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.AddValidateLayersDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationDetailOptionSettingDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationErrorReportDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationOptionDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationOptionSettingDialog;
import org.apache.cordova.CordovaWebView;
import java.util.ArrayList;
/**
* 다이얼로그 인터페이스 클래스
* @author JiJungKeun
* @version 1.1 2017/01/02
*/
public class ArbiterDialogs_Expansion {
private Resources resources;
private FragmentManager fragManager;
public ArbiterDialogs_Expansion(Context context, Resources resources, FragmentManager fragManager){
this.setResources(resources);
this.setFragManager(fragManager);
}
public void setFragManager(FragmentManager fragManager){
this.fragManager = fragManager;
}
public void setResources(Resources resources){
this.resources = resources;
}
public void showCoordinateSearchDialog(final CordovaWebView webview){
String title = resources.getString(R.string.action_coordinate);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.coordinates_search_dialog;
DialogFragment dialog;
dialog = CoordinateSearchDialog.newInstance(title, ok, cancel, layout, webview);
dialog.show(fragManager, "OpenGDS_CoordinateSearchDialog");
}
public void showAddressSearchDialog(final CordovaWebView webview, HasThreadPool hasThreadPool){
String title = resources.getString(R.string.action_address);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.address_search_dialog;
DialogFragment dialog;
dialog = AddressSearchDialog.newInstance(title, ok, cancel, layout, webview, hasThreadPool);
dialog.show(fragManager, "OpenGDS_AddressSearchDialog");
}
public void showImagesDialog(HasThreadPool hasThreadPool, final CordovaWebView webview, Image imageOption){
String title = resources.getString(R.string.action_image);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.images_dialog;
DialogFragment dialog;
dialog = ImagesDialog.newInstance(title, ok, cancel, layout, hasThreadPool, webview, resources, imageOption);
dialog.show(fragManager, "OpenGDS_ImagesDialog");
}
public void showBoundaryImageDialog(final CordovaWebView webview, String name, String path){
String title = resources.getString(R.string.action_boundary);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.boundary_image_dialog;
DialogFragment dialog;
dialog = BoundaryImageDialog.newInstance(title, ok, cancel, layout, webview, name, path);
dialog.show(fragManager, "OpenGDS_BoundaryDialog");
}
public void showAOIBoundaryImageDialog(final CordovaWebView webview, String name, String path){
String title = resources.getString(R.string.action_AOI_image);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.aoi_image_dialog;
DialogFragment dialog;
dialog = AOIBoundaryImageDialog.newInstance(title, ok, cancel, layout, webview, name, path);
dialog.show(fragManager, "OpenGDS_AOIBoundaryDialog");
}
//add validation layers dialog
public void showAddValidateLayersDialog(HasThreadPool hasThreadPool, ConnectivityListener connectivityListener, final CordovaWebView webview){
String title = resources.getString(R.string.action_validationLayerList);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.add_validate_layers_dialog;
DialogFragment dialog = AddValidateLayersDialog.newInstance(title, ok, cancel, layout, connectivityListener, hasThreadPool, webview);
dialog.show(fragManager, "OpenGDS_AddValidateLayersDialog");
}
//validation option dialog
public void showValidationOptionDialog(HasThreadPool hasThreadPool, ArrayList<Validation> checkedLayers, final CordovaWebView webview){
String title = resources.getString(R.string.action_validationOption);
String ok = resources.getString(R.string.start_validation_button);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.validation_option_dialog;
DialogFragment dialog = ValidationOptionDialog.newInstance(title, ok, cancel, layout, hasThreadPool, checkedLayers, webview);
dialog.show(fragManager, "OpenGDS_ValidationOptionDialog");
}
//validation option setting dialog
public void showValidationOptionSettingDialog(HasThreadPool hasThreadPool, Validation selectedLayer){
String title = resources.getString(R.string.action_optionSetting);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.validation_option_setting_dialog;
DialogFragment dialog = ValidationOptionSettingDialog.newInstance(title, ok, cancel, layout, hasThreadPool, selectedLayer);
dialog.show(fragManager, "OpenGDS_ValidationOptionSettingDialog");
}
//validation detail option setting dialog
public void showValidationDetailOptionSettingDialog(HasThreadPool hasThreadPool, String optionName, Validation selectedLayer, RelativeLayout selectedOptionNameLayout){
String title = resources.getString(R.string.action_detailOptionSetting);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.validation_detail_option_setting_dialog;
DialogFragment dialog = ValidationDetailOptionSettingDialog.newInstance(title, ok, cancel, layout, hasThreadPool, optionName, selectedLayer, selectedOptionNameLayout);
dialog.show(fragManager, "OpenGDS_ValidationDetailOptionSettingDialog");
}
public void showValidationErrorReportDialog(MapActivity mapActivity){
String title = resources.getString(R.string.report);
String ok = resources.getString(android.R.string.ok);
int layout = R.layout.validation_report_table;
//Create Progress dialog
ProgressDialog reportProgressDialog = new ProgressDialog(mapActivity);
reportProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
reportProgressDialog.setIcon(mapActivity.getResources().getDrawable(R.drawable.icon));
reportProgressDialog.setTitle(R.string.loading);
reportProgressDialog.setMessage(mapActivity.getString(R.string.action_report_progress));
reportProgressDialog.setCanceledOnTouchOutside(false);
reportProgressDialog.show();
DialogFragment dialog = ValidationErrorReportDialog.newInstance(title, ok, layout, reportProgressDialog);
dialog.show(fragManager, "validationReportDialog");
}
}
|
UTF-8
|
Java
| 7,928 |
java
|
ArbiterDialogs_Expansion.java
|
Java
|
[
{
"context": "util.ArrayList;\n\n/**\n * 다이얼로그 인터페이스 클래스\n * @author JiJungKeun\n * @version 1.1 2017/01/02\n */\npublic class Arbit",
"end": 1432,
"score": 0.9998119473457336,
"start": 1422,
"tag": "NAME",
"value": "JiJungKeun"
}
] | null |
[] |
package com.lmn.OpenGDS_Android.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.res.Resources;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.widget.RelativeLayout;
import com.lmn.Arbiter_Android.Activities.HasThreadPool;
import com.lmn.Arbiter_Android.Activities.MapActivity;
import com.lmn.Arbiter_Android.ConnectivityListeners.ConnectivityListener;
import com.lmn.Arbiter_Android.R;
import com.lmn.OpenGDS_Android.BaseClasses.Image;
import com.lmn.OpenGDS_Android.BaseClasses.Validation;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.AOIBoundaryImageDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ImagesDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.BoundaryImageDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.AddressSearchDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.CoordinateSearchDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.AddValidateLayersDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationDetailOptionSettingDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationErrorReportDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationOptionDialog;
import com.lmn.OpenGDS_Android.Dialog.Dialogs.ValidationOptionSettingDialog;
import org.apache.cordova.CordovaWebView;
import java.util.ArrayList;
/**
* 다이얼로그 인터페이스 클래스
* @author JiJungKeun
* @version 1.1 2017/01/02
*/
public class ArbiterDialogs_Expansion {
private Resources resources;
private FragmentManager fragManager;
public ArbiterDialogs_Expansion(Context context, Resources resources, FragmentManager fragManager){
this.setResources(resources);
this.setFragManager(fragManager);
}
public void setFragManager(FragmentManager fragManager){
this.fragManager = fragManager;
}
public void setResources(Resources resources){
this.resources = resources;
}
public void showCoordinateSearchDialog(final CordovaWebView webview){
String title = resources.getString(R.string.action_coordinate);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.coordinates_search_dialog;
DialogFragment dialog;
dialog = CoordinateSearchDialog.newInstance(title, ok, cancel, layout, webview);
dialog.show(fragManager, "OpenGDS_CoordinateSearchDialog");
}
public void showAddressSearchDialog(final CordovaWebView webview, HasThreadPool hasThreadPool){
String title = resources.getString(R.string.action_address);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.address_search_dialog;
DialogFragment dialog;
dialog = AddressSearchDialog.newInstance(title, ok, cancel, layout, webview, hasThreadPool);
dialog.show(fragManager, "OpenGDS_AddressSearchDialog");
}
public void showImagesDialog(HasThreadPool hasThreadPool, final CordovaWebView webview, Image imageOption){
String title = resources.getString(R.string.action_image);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.images_dialog;
DialogFragment dialog;
dialog = ImagesDialog.newInstance(title, ok, cancel, layout, hasThreadPool, webview, resources, imageOption);
dialog.show(fragManager, "OpenGDS_ImagesDialog");
}
public void showBoundaryImageDialog(final CordovaWebView webview, String name, String path){
String title = resources.getString(R.string.action_boundary);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.boundary_image_dialog;
DialogFragment dialog;
dialog = BoundaryImageDialog.newInstance(title, ok, cancel, layout, webview, name, path);
dialog.show(fragManager, "OpenGDS_BoundaryDialog");
}
public void showAOIBoundaryImageDialog(final CordovaWebView webview, String name, String path){
String title = resources.getString(R.string.action_AOI_image);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.aoi_image_dialog;
DialogFragment dialog;
dialog = AOIBoundaryImageDialog.newInstance(title, ok, cancel, layout, webview, name, path);
dialog.show(fragManager, "OpenGDS_AOIBoundaryDialog");
}
//add validation layers dialog
public void showAddValidateLayersDialog(HasThreadPool hasThreadPool, ConnectivityListener connectivityListener, final CordovaWebView webview){
String title = resources.getString(R.string.action_validationLayerList);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.add_validate_layers_dialog;
DialogFragment dialog = AddValidateLayersDialog.newInstance(title, ok, cancel, layout, connectivityListener, hasThreadPool, webview);
dialog.show(fragManager, "OpenGDS_AddValidateLayersDialog");
}
//validation option dialog
public void showValidationOptionDialog(HasThreadPool hasThreadPool, ArrayList<Validation> checkedLayers, final CordovaWebView webview){
String title = resources.getString(R.string.action_validationOption);
String ok = resources.getString(R.string.start_validation_button);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.validation_option_dialog;
DialogFragment dialog = ValidationOptionDialog.newInstance(title, ok, cancel, layout, hasThreadPool, checkedLayers, webview);
dialog.show(fragManager, "OpenGDS_ValidationOptionDialog");
}
//validation option setting dialog
public void showValidationOptionSettingDialog(HasThreadPool hasThreadPool, Validation selectedLayer){
String title = resources.getString(R.string.action_optionSetting);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.validation_option_setting_dialog;
DialogFragment dialog = ValidationOptionSettingDialog.newInstance(title, ok, cancel, layout, hasThreadPool, selectedLayer);
dialog.show(fragManager, "OpenGDS_ValidationOptionSettingDialog");
}
//validation detail option setting dialog
public void showValidationDetailOptionSettingDialog(HasThreadPool hasThreadPool, String optionName, Validation selectedLayer, RelativeLayout selectedOptionNameLayout){
String title = resources.getString(R.string.action_detailOptionSetting);
String ok = resources.getString(android.R.string.ok);
String cancel = resources.getString(android.R.string.cancel);
int layout = R.layout.validation_detail_option_setting_dialog;
DialogFragment dialog = ValidationDetailOptionSettingDialog.newInstance(title, ok, cancel, layout, hasThreadPool, optionName, selectedLayer, selectedOptionNameLayout);
dialog.show(fragManager, "OpenGDS_ValidationDetailOptionSettingDialog");
}
public void showValidationErrorReportDialog(MapActivity mapActivity){
String title = resources.getString(R.string.report);
String ok = resources.getString(android.R.string.ok);
int layout = R.layout.validation_report_table;
//Create Progress dialog
ProgressDialog reportProgressDialog = new ProgressDialog(mapActivity);
reportProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
reportProgressDialog.setIcon(mapActivity.getResources().getDrawable(R.drawable.icon));
reportProgressDialog.setTitle(R.string.loading);
reportProgressDialog.setMessage(mapActivity.getString(R.string.action_report_progress));
reportProgressDialog.setCanceledOnTouchOutside(false);
reportProgressDialog.show();
DialogFragment dialog = ValidationErrorReportDialog.newInstance(title, ok, layout, reportProgressDialog);
dialog.show(fragManager, "validationReportDialog");
}
}
| 7,928 | 0.808783 | 0.807264 | 184 | 41.945652 | 37.194221 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false |
9
|
361b184908767441362c64ee60ece2ca391fd070
| 17,446,157,209,301 |
c54062a41a990c192c3eadbb9807e9132530de23
|
/solutions/staticattrmeth/src/main/java/staticattrmeth/bank/BankTransaction.java
|
3a7a4d13a5b0007388b4a0fb65911aaeb5621244
|
[] |
no_license
|
Training360/strukturavalto-java-public
|
https://github.com/Training360/strukturavalto-java-public
|
0d76a9dedd7f0a0a435961229a64023931ec43c7
|
82d9b3c54437dd7c74284f06f9a6647ec62796e3
|
refs/heads/master
| 2022-07-27T15:07:57.915000 | 2021-12-01T08:57:06 | 2021-12-01T08:57:06 | 306,286,820 | 13 | 115 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package staticattrmeth.bank;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class BankTransaction {
private static final long MIN_TRX_VALUE = 1;
private static final long MAX_TRX_VALUE = 10_000_000;
private static long countTrx = 0;
private static BigDecimal sumOfTrxs = new BigDecimal("0");
private static long currentMinValue = MAX_TRX_VALUE;
private static long currentMaxValue = MIN_TRX_VALUE;
private long trxValue;
public BankTransaction(long trxValue) {
if (trxValue <= MIN_TRX_VALUE && trxValue >= MAX_TRX_VALUE) {
throw new IllegalArgumentException("This transaction cannot be excepted! " + trxValue);
}
countTrx++;
sumOfTrxs = sumOfTrxs.add(new BigDecimal(Long.toString(trxValue)));
if (trxValue < currentMinValue) currentMinValue = trxValue;
if (trxValue > currentMaxValue) currentMaxValue = trxValue;
this.trxValue = trxValue;
}
public static void initTheDay() {
countTrx = 0;
sumOfTrxs = new BigDecimal("0");
currentMinValue = MAX_TRX_VALUE;
currentMaxValue = MIN_TRX_VALUE;
}
public static BigDecimal averageOfTransaction() {
return countTrx == 0 ? new BigDecimal("0") : sumOfTrxs.divide(new BigDecimal(Long.toString(countTrx)), 0, RoundingMode.HALF_UP);
}
public static long getCurrentMinValue() {
return countTrx == 0 ? 0 : currentMinValue;
}
public static long getCurrentMaxValue() {
return countTrx == 0 ? 0 : currentMaxValue;
}
public static BigDecimal getSumOfTrxs() {
return sumOfTrxs;
}
public long getTrxValue() {
return trxValue;
}
}
|
UTF-8
|
Java
| 1,713 |
java
|
BankTransaction.java
|
Java
|
[] | null |
[] |
package staticattrmeth.bank;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class BankTransaction {
private static final long MIN_TRX_VALUE = 1;
private static final long MAX_TRX_VALUE = 10_000_000;
private static long countTrx = 0;
private static BigDecimal sumOfTrxs = new BigDecimal("0");
private static long currentMinValue = MAX_TRX_VALUE;
private static long currentMaxValue = MIN_TRX_VALUE;
private long trxValue;
public BankTransaction(long trxValue) {
if (trxValue <= MIN_TRX_VALUE && trxValue >= MAX_TRX_VALUE) {
throw new IllegalArgumentException("This transaction cannot be excepted! " + trxValue);
}
countTrx++;
sumOfTrxs = sumOfTrxs.add(new BigDecimal(Long.toString(trxValue)));
if (trxValue < currentMinValue) currentMinValue = trxValue;
if (trxValue > currentMaxValue) currentMaxValue = trxValue;
this.trxValue = trxValue;
}
public static void initTheDay() {
countTrx = 0;
sumOfTrxs = new BigDecimal("0");
currentMinValue = MAX_TRX_VALUE;
currentMaxValue = MIN_TRX_VALUE;
}
public static BigDecimal averageOfTransaction() {
return countTrx == 0 ? new BigDecimal("0") : sumOfTrxs.divide(new BigDecimal(Long.toString(countTrx)), 0, RoundingMode.HALF_UP);
}
public static long getCurrentMinValue() {
return countTrx == 0 ? 0 : currentMinValue;
}
public static long getCurrentMaxValue() {
return countTrx == 0 ? 0 : currentMaxValue;
}
public static BigDecimal getSumOfTrxs() {
return sumOfTrxs;
}
public long getTrxValue() {
return trxValue;
}
}
| 1,713 | 0.663748 | 0.652072 | 54 | 30.722221 | 28.606148 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
9
|
239b4e7a7368cc47659aad59b1e1338869d43580
| 5,686,536,701,632 |
341714fe3490167fdc241c2841d54bf6156e8e6f
|
/Practicas Resueltas/EjemploMock/src/test/java/CuentaCasoATest.java
|
ce4ddf687d4c54358132344330ab1274767bc47b
|
[] |
no_license
|
santisanudo13/ProcesosSoftware
|
https://github.com/santisanudo13/ProcesosSoftware
|
169b447c401f54f310b4838e8364b4cc5c9aa0d0
|
3a1773bf6687b24ca9f6b023d7215b3908ac48eb
|
refs/heads/master
| 2021-09-05T05:14:40.948000 | 2018-01-24T09:35:27 | 2018-01-24T09:35:27 | 105,000,144 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import es.unican.ps.banco.dominio.casoA.Cuenta;
import es.unican.ps.banco.dominio.casoA.Movimiento;
public class CuentaCasoATest {
private static Cuenta cuenta;
//////// Pruebas con Mock /////////
private static Movimiento movimientoa = mock(Movimiento.class);
private static Movimiento movimientob = mock(Movimiento.class);
private static Movimiento movimientoc = mock(Movimiento.class);
@BeforeClass
public static void setUpBeforeClass() throws Exception {
when(movimientoa.getImporte()).thenReturn(100.0);
when(movimientob.getImporte()).thenReturn(300.0);
when(movimientoc.getImporte()).thenReturn(-100.0);
}
@Before
public void setUpBefore() throws Exception {
cuenta=new Cuenta("794311","Juan Gomez");
}
@Test
public void testAddMovimientoYGetSaldo() {
//Test getSaldo() y addMovimiento()
assertTrue(cuenta.getSaldo()==0);
cuenta.addMovimiento(movimientoa);
assertTrue(cuenta.getSaldo()==100);
cuenta.addMovimiento(movimientob);
assertTrue(cuenta.getSaldo()==400);
cuenta.addMovimiento(movimientoc);
assertTrue(cuenta.getSaldo()==300);
}
@Test
public void testIngresar() {
// Ingresar una cantidad positiva
try {
cuenta.ingresar(500);
cuenta.ingresar(300);
System.out.println(cuenta.getSaldo());
} catch (Exception e) {
fail("No deber�a lanzar excepci�n");
}
assertTrue(cuenta.getSaldo()==800);
try {
cuenta.ingresar(-200);
fail("Deber�a lanzar excepci�n por ingresar cantidad negativa");
} catch (Exception e) {
}
}
}
|
UTF-8
|
Java
| 1,735 |
java
|
CuentaCasoATest.java
|
Java
|
[
{
"context": " throws Exception {\n\t\tcuenta=new Cuenta(\"794311\",\"Juan Gomez\");\n\t}\n\n\t@Test\n\tpublic void testAddMovimientoYGetS",
"end": 929,
"score": 0.9996578097343445,
"start": 919,
"tag": "NAME",
"value": "Juan Gomez"
}
] | null |
[] |
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import es.unican.ps.banco.dominio.casoA.Cuenta;
import es.unican.ps.banco.dominio.casoA.Movimiento;
public class CuentaCasoATest {
private static Cuenta cuenta;
//////// Pruebas con Mock /////////
private static Movimiento movimientoa = mock(Movimiento.class);
private static Movimiento movimientob = mock(Movimiento.class);
private static Movimiento movimientoc = mock(Movimiento.class);
@BeforeClass
public static void setUpBeforeClass() throws Exception {
when(movimientoa.getImporte()).thenReturn(100.0);
when(movimientob.getImporte()).thenReturn(300.0);
when(movimientoc.getImporte()).thenReturn(-100.0);
}
@Before
public void setUpBefore() throws Exception {
cuenta=new Cuenta("794311","<NAME>");
}
@Test
public void testAddMovimientoYGetSaldo() {
//Test getSaldo() y addMovimiento()
assertTrue(cuenta.getSaldo()==0);
cuenta.addMovimiento(movimientoa);
assertTrue(cuenta.getSaldo()==100);
cuenta.addMovimiento(movimientob);
assertTrue(cuenta.getSaldo()==400);
cuenta.addMovimiento(movimientoc);
assertTrue(cuenta.getSaldo()==300);
}
@Test
public void testIngresar() {
// Ingresar una cantidad positiva
try {
cuenta.ingresar(500);
cuenta.ingresar(300);
System.out.println(cuenta.getSaldo());
} catch (Exception e) {
fail("No deber�a lanzar excepci�n");
}
assertTrue(cuenta.getSaldo()==800);
try {
cuenta.ingresar(-200);
fail("Deber�a lanzar excepci�n por ingresar cantidad negativa");
} catch (Exception e) {
}
}
}
| 1,731 | 0.720324 | 0.697163 | 72 | 22.958334 | 20.534821 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.680556 | false | false |
9
|
d9cdc8e57c75dc62f2804bd1b261cb773e3ab1c3
| 858,993,508,915 |
2efd58242ba7e4c59f76bd9f623d3b333f67992f
|
/app/src/main/java/com/ws/mesh/incores2/constant/AppLifeStatusConstant.java
|
38f613cd045f5124ae5afb26c385e4c92edbca75
|
[] |
no_license
|
zhaoliufeng/IncoreS2
|
https://github.com/zhaoliufeng/IncoreS2
|
5bcf7208e359e99cca35ea2886c793be8e7a1e86
|
5cf8cc8893b7fd440301fc2159408b3c35251499
|
refs/heads/master
| 2020-03-24T00:05:40.115000 | 2018-09-19T01:39:29 | 2018-09-19T01:39:29 | 138,289,207 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ws.mesh.incores2.constant;
/**
* Created by we_smart on 2017/11/20.
*/
public class AppLifeStatusConstant {
//正常启动
public static final int NORMAL_START = 1;
//异常杀死
public static final int KILL_PROGRESS = -1;
//杀死重启
public static final int RESTART_APP = 0;
//应该开始启动
public static final int APP_START = 2;
//直接返回
public static final int APP_MAIN_BACK = 3;
}
|
UTF-8
|
Java
| 461 |
java
|
AppLifeStatusConstant.java
|
Java
|
[
{
"context": " com.ws.mesh.incores2.constant;\n\n/**\n * Created by we_smart on 2017/11/20.\n */\n\npublic class AppLifeStatusCon",
"end": 66,
"score": 0.9994317889213562,
"start": 58,
"tag": "USERNAME",
"value": "we_smart"
}
] | null |
[] |
package com.ws.mesh.incores2.constant;
/**
* Created by we_smart on 2017/11/20.
*/
public class AppLifeStatusConstant {
//正常启动
public static final int NORMAL_START = 1;
//异常杀死
public static final int KILL_PROGRESS = -1;
//杀死重启
public static final int RESTART_APP = 0;
//应该开始启动
public static final int APP_START = 2;
//直接返回
public static final int APP_MAIN_BACK = 3;
}
| 461 | 0.645084 | 0.611511 | 23 | 17.130434 | 18.618141 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.26087 | false | false |
9
|
2b93d76391703f570bfa84ef18353409b56b6355
| 7,894,149,955,493 |
a39f6d63e0203c18aa2da226472e1e807cf9e98a
|
/spring-boot-basic/src/main/java/com/gang/mars/basic/threadpool/GangMarsThreadPoolExecutor.java
|
36074d41e60bdb978dd585e8413af39f26942f40
|
[] |
no_license
|
g-smll/gang-mars-java
|
https://github.com/g-smll/gang-mars-java
|
7b421dae913afff311f66a3a28e9818759576e6f
|
4928466edc8e63c38053c7e8cca8a91e721b7453
|
refs/heads/master
| 2023-06-03T16:20:04.484000 | 2021-06-24T09:31:12 | 2021-06-24T09:31:12 | 370,247,721 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gang.mars.basic.threadpool;
import java.util.concurrent.*;
/**
* @author gang.chen
* @description
* @time 2021/1/12 13:35
*/
public class GangMarsThreadPoolExecutor extends ThreadPoolExecutor {
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
/**
* @param corePoolSize 核心线程数
* @param maximumPoolSize 最大线程数
* @param keepAliveTime 线程空闲,最长活跃时间
* @param unit 时间单位
* @param workQueue 阻塞队列(线程安全)
* @param threadFactory
* */
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
}
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
}
/**
* @param corePoolSize 线程池中的常驻核心线程数
* @param maximumPoolSize 线程池能够容纳同时执行的最大线程数,值大于1
* @param keepAliveTime 多余空闲线程存活时间,
* 1,当前线程池数量超过corePoolSize时
* 2,当空闲时间达到keepAliveTime时
* 多余空闲线程会被钱销毁,直到只剩下corePoolSize个线程为止
* @param unit 存活时间单位
* @param workQueue 任务队列,被提交但尚未被执行的任务
* @param threadFactory 生产线程池中工作线程工厂,用户创建线程,一般默认即可
* @param handler 拒绝策略
* */
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
}
}
|
UTF-8
|
Java
| 2,350 |
java
|
GangMarsThreadPoolExecutor.java
|
Java
|
[
{
"context": "l;\n\nimport java.util.concurrent.*;\n\n/**\n * @author gang.chen\n * @description\n * @time 2021/1/12 13:35\n",
"end": 89,
"score": 0.5347943305969238,
"start": 88,
"tag": "NAME",
"value": "g"
},
{
"context": "\n\nimport java.util.concurrent.*;\n\n/**\n * @author gang.chen\n * @description\n * @time 2021/1/12 13:35\n */\npubl",
"end": 97,
"score": 0.8550631999969482,
"start": 89,
"tag": "USERNAME",
"value": "ang.chen"
}
] | null |
[] |
package com.gang.mars.basic.threadpool;
import java.util.concurrent.*;
/**
* @author gang.chen
* @description
* @time 2021/1/12 13:35
*/
public class GangMarsThreadPoolExecutor extends ThreadPoolExecutor {
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
/**
* @param corePoolSize 核心线程数
* @param maximumPoolSize 最大线程数
* @param keepAliveTime 线程空闲,最长活跃时间
* @param unit 时间单位
* @param workQueue 阻塞队列(线程安全)
* @param threadFactory
* */
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
}
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
}
/**
* @param corePoolSize 线程池中的常驻核心线程数
* @param maximumPoolSize 线程池能够容纳同时执行的最大线程数,值大于1
* @param keepAliveTime 多余空闲线程存活时间,
* 1,当前线程池数量超过corePoolSize时
* 2,当空闲时间达到keepAliveTime时
* 多余空闲线程会被钱销毁,直到只剩下corePoolSize个线程为止
* @param unit 存活时间单位
* @param workQueue 任务队列,被提交但尚未被执行的任务
* @param threadFactory 生产线程池中工作线程工厂,用户创建线程,一般默认即可
* @param handler 拒绝策略
* */
public GangMarsThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
}
}
| 2,350 | 0.721834 | 0.714855 | 46 | 42.608696 | 49.990643 | 211 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
9
|
0d33e139faee05ec923bfdc38cac71752837f865
| 31,645,319,102,118 |
c3b47768160700862cb48badf8853ca626a1fb40
|
/src/main/java/validator/exception/NotSupportedValidationType.java
|
8ea058be3d868d47ac2982179b3d6758bd5035a8
|
[] |
no_license
|
anton-isupov/Validation
|
https://github.com/anton-isupov/Validation
|
5cdb798f6cf29d33e3da59c1c34fc267d926eb44
|
a293bddb32185044cdf7baafbbf60b81d47a3df2
|
refs/heads/master
| 2022-12-11T01:14:41.210000 | 2020-09-15T16:34:27 | 2020-09-15T16:34:27 | 293,696,870 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package validator.exception;
public class NotSupportedValidationType extends Exception {
public NotSupportedValidationType() {
}
public NotSupportedValidationType(String message) {
super(message);
}
public NotSupportedValidationType(String message, Throwable cause) {
super(message, cause);
}
public NotSupportedValidationType(Throwable cause) {
super(cause);
}
public NotSupportedValidationType(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
|
UTF-8
|
Java
| 630 |
java
|
NotSupportedValidationType.java
|
Java
|
[] | null |
[] |
package validator.exception;
public class NotSupportedValidationType extends Exception {
public NotSupportedValidationType() {
}
public NotSupportedValidationType(String message) {
super(message);
}
public NotSupportedValidationType(String message, Throwable cause) {
super(message, cause);
}
public NotSupportedValidationType(Throwable cause) {
super(cause);
}
public NotSupportedValidationType(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| 630 | 0.728571 | 0.728571 | 23 | 26.391304 | 32.408722 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false |
9
|
f48d65c2b4828fd99d8f01035f594747f8efef9e
| 1,752,346,670,670 |
740cd5a82a3868e2c10780349ff4a00d7234240f
|
/src/main/java/pull/camel/DevSeedRoutes.java
|
a7f6e37d4c144620c29bb9fd54b5741f04227b2b
|
[
"MIT"
] |
permissive
|
poly-on-fire/autopm
|
https://github.com/poly-on-fire/autopm
|
2f2101530e7395549c98570f291e810148268a18
|
934c803de1c4d0500dee5f08739aa97b6259fceb
|
refs/heads/master
| 2018-09-29T17:59:48.810000 | 2018-08-25T22:01:46 | 2018-08-25T22:01:46 | 119,426,535 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pull.camel;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import pull.service.DailyEmail;
import pull.service.DevSeed;
// TODO: Comment this to explain that it only runs from IDE in one-of configuration?
public class DevSeedRoutes extends RouteBuilder {
ApplicationContext applicationContext;
DailyEmail dailyEmail;
DevSeed devSeed;
public DevSeedRoutes(ApplicationContext applicationContext){
super();
this.applicationContext = applicationContext;
this.dailyEmail = applicationContext.getBean(DailyEmail.class);
this.devSeed = applicationContext.getBean(DevSeed.class);
}
@Override
public void configure() throws Exception {
from("timer://something?delay=6s&repeatCount=1").log("\n\n\t .... running ........ for dev seed").bean(devSeed);
}
}
|
UTF-8
|
Java
| 896 |
java
|
DevSeedRoutes.java
|
Java
|
[] | null |
[] |
package pull.camel;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import pull.service.DailyEmail;
import pull.service.DevSeed;
// TODO: Comment this to explain that it only runs from IDE in one-of configuration?
public class DevSeedRoutes extends RouteBuilder {
ApplicationContext applicationContext;
DailyEmail dailyEmail;
DevSeed devSeed;
public DevSeedRoutes(ApplicationContext applicationContext){
super();
this.applicationContext = applicationContext;
this.dailyEmail = applicationContext.getBean(DailyEmail.class);
this.devSeed = applicationContext.getBean(DevSeed.class);
}
@Override
public void configure() throws Exception {
from("timer://something?delay=6s&repeatCount=1").log("\n\n\t .... running ........ for dev seed").bean(devSeed);
}
}
| 896 | 0.784598 | 0.782366 | 28 | 31 | 29.747749 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false |
9
|
e9d1f1b686806cea8649febd89c1ca0b58275a8e
| 13,417,477,894,843 |
8087387158c25cfa871c650219df9942497ab997
|
/src/main/java/data/AppUserRepository.java
|
1755b0afca9b0607e91714e6db086d0bae01e420
|
[] |
no_license
|
ockermark/meetingCalendar
|
https://github.com/ockermark/meetingCalendar
|
b05b63cd444497c447068a97284d2d370753f4f0
|
0bb9d53dfeaab21c5a11e010e39c7bdf40d51d42
|
refs/heads/master
| 2023-04-18T19:47:53.118000 | 2021-05-09T20:47:50 | 2021-05-09T20:47:50 | 365,844,514 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package data;
import models.AppUser;
import java.util.List;
public class AppUserRepository {
private List<AppUser> appUserStorage;
public List<AppUser> findAll() {
return appUserStorage;
}
public AppUser findById(int userId){
}
public AppUser findByUsername(String user){
}
public int getAppUserCount(){
}
public AppUser persists(AppUser appUser){
}
public boolean remove(int userId){
}
}
|
UTF-8
|
Java
| 465 |
java
|
AppUserRepository.java
|
Java
|
[] | null |
[] |
package data;
import models.AppUser;
import java.util.List;
public class AppUserRepository {
private List<AppUser> appUserStorage;
public List<AppUser> findAll() {
return appUserStorage;
}
public AppUser findById(int userId){
}
public AppUser findByUsername(String user){
}
public int getAppUserCount(){
}
public AppUser persists(AppUser appUser){
}
public boolean remove(int userId){
}
}
| 465 | 0.658065 | 0.658065 | 35 | 12.285714 | 16.277191 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false |
9
|
5e3681f2d70529af51c39622635680290d8f7015
| 19,026,705,146,621 |
5c75629c7129f8b9dbf26351be7eccbd1b8ff949
|
/src/ua/insomnia/eventlist/utils/DateUtils.java
|
084e5df77279c6c7926583befe1345e08cab8536
|
[] |
no_license
|
vchernyshov/EventList
|
https://github.com/vchernyshov/EventList
|
5bd546b7859fc4fd5cb9ce95c10de5b4f2a8c1f6
|
50cdfc6687139bc87f0f9f9694c0d23dbb498530
|
refs/heads/master
| 2021-01-25T06:37:00.186000 | 2015-03-10T16:21:07 | 2015-03-10T16:21:07 | 31,966,520 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ua.insomnia.eventlist.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import android.util.Log;
public class DateUtils {
private static final String TAG = "DateUtils";
public static String getCurrentDate(){
String date = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Calendar now = Calendar.getInstance();
date = dateFormat.format(now.getTime());
Log.i(TAG, "now = "+date);
return date;
}
public static String getNextDate(String currentDate){
String nextDate = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Calendar c = Calendar.getInstance();
try {
c.setTime(dateFormat.parse(currentDate));
} catch (ParseException e) {
Log.e(TAG, "Cant parse date string.\n"+e.toString());
}
c.add(Calendar.DAY_OF_YEAR, +1);
nextDate = dateFormat.format(c.getTime());
Log.i(TAG, "next date = "+nextDate);
return nextDate;
}
public static String getPreviousDate(String currentDate){
String previousDate = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Calendar c = Calendar.getInstance();
try {
c.setTime(dateFormat.parse(currentDate));
} catch (ParseException e) {
Log.e(TAG, "Cant parse date string.\n"+e.toString());
}
c.add(Calendar.DAY_OF_YEAR, -1);
previousDate = dateFormat.format(c.getTime());
Log.i(TAG, "previous date = "+previousDate);
return previousDate;
}
public static String getDateToShow(String date){
Log.i(TAG, "input string = " +date);
String res = null;
String formatInput = "yyyy-MM-dd";
String formatToShow = "d MMMM (EE)";
SimpleDateFormat format = new SimpleDateFormat(formatInput, Locale.getDefault());
SimpleDateFormat dateFormat = new SimpleDateFormat(formatToShow, Locale.getDefault());
Calendar c = Calendar.getInstance();
try {
c.setTime(format.parse(date));
} catch (ParseException e) {
Log.e(TAG, "Cant parse date string.\n"+e.toString());
}
res = dateFormat.format(c.getTime());
Log.i(TAG, "output string = " +res);
return res;
}
}
|
UTF-8
|
Java
| 2,205 |
java
|
DateUtils.java
|
Java
|
[] | null |
[] |
package ua.insomnia.eventlist.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import android.util.Log;
public class DateUtils {
private static final String TAG = "DateUtils";
public static String getCurrentDate(){
String date = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Calendar now = Calendar.getInstance();
date = dateFormat.format(now.getTime());
Log.i(TAG, "now = "+date);
return date;
}
public static String getNextDate(String currentDate){
String nextDate = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Calendar c = Calendar.getInstance();
try {
c.setTime(dateFormat.parse(currentDate));
} catch (ParseException e) {
Log.e(TAG, "Cant parse date string.\n"+e.toString());
}
c.add(Calendar.DAY_OF_YEAR, +1);
nextDate = dateFormat.format(c.getTime());
Log.i(TAG, "next date = "+nextDate);
return nextDate;
}
public static String getPreviousDate(String currentDate){
String previousDate = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Calendar c = Calendar.getInstance();
try {
c.setTime(dateFormat.parse(currentDate));
} catch (ParseException e) {
Log.e(TAG, "Cant parse date string.\n"+e.toString());
}
c.add(Calendar.DAY_OF_YEAR, -1);
previousDate = dateFormat.format(c.getTime());
Log.i(TAG, "previous date = "+previousDate);
return previousDate;
}
public static String getDateToShow(String date){
Log.i(TAG, "input string = " +date);
String res = null;
String formatInput = "yyyy-MM-dd";
String formatToShow = "d MMMM (EE)";
SimpleDateFormat format = new SimpleDateFormat(formatInput, Locale.getDefault());
SimpleDateFormat dateFormat = new SimpleDateFormat(formatToShow, Locale.getDefault());
Calendar c = Calendar.getInstance();
try {
c.setTime(format.parse(date));
} catch (ParseException e) {
Log.e(TAG, "Cant parse date string.\n"+e.toString());
}
res = dateFormat.format(c.getTime());
Log.i(TAG, "output string = " +res);
return res;
}
}
| 2,205 | 0.705215 | 0.704308 | 72 | 29.625 | 23.477789 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.458333 | false | false |
9
|
4565f05ae46e757035b16f55ff00b1c5173e2a5f
| 24,266,565,284,325 |
0b4deed8121cd249e494b90f5b664d48813ad813
|
/Primalidad/src/entrega1/TestStructure.java
|
4fff76970ac68af38e4faa0d742b6b71930d8246
|
[] |
no_license
|
hromeroprog/TeoriaAvanzadaComputacion
|
https://github.com/hromeroprog/TeoriaAvanzadaComputacion
|
eaa829ef444fa7293fe833c35e29acbdfacb67c9
|
384ca96884e7baef3cf1961e7b0e1c4cf58b186b
|
refs/heads/main
| 2023-04-20T22:03:28.774000 | 2021-05-17T20:56:08 | 2021-05-17T20:56:08 | 337,817,444 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package entrega1;
import java.math.BigInteger;
public class TestStructure {
public long time;
BigInteger result;
public TestStructure(long time, BigInteger result) {
this.time = time;
this.result = result;
}
}
|
UTF-8
|
Java
| 221 |
java
|
TestStructure.java
|
Java
|
[] | null |
[] |
package entrega1;
import java.math.BigInteger;
public class TestStructure {
public long time;
BigInteger result;
public TestStructure(long time, BigInteger result) {
this.time = time;
this.result = result;
}
}
| 221 | 0.742081 | 0.737557 | 12 | 17.416666 | 14.739167 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false |
9
|
abc5a6d3414a60776f8cb2d9a6694ff31d4226de
| 12,936,441,529,113 |
279b95f2687bdff46de5036dfa8b5b6685797ea1
|
/src/main/java/com/carnoc/flight/dataMaintenance/dao/BackUpDao.java
|
52666d12847a0e6d14ee104a037ab7c6c73939c7
|
[] |
no_license
|
1069385070/flightCarnoc
|
https://github.com/1069385070/flightCarnoc
|
723d7f5247296c82bc79003cffd282d322f0f077
|
fe35c70d204165a8561c6eaa3dd0e2ac0ba7a23c
|
refs/heads/master
| 2020-04-02T13:08:04.238000 | 2018-11-04T09:54:46 | 2018-11-04T09:54:46 | 154,468,830 | 0 | 0 | null | false | 2018-10-29T03:40:42 | 2018-10-24T08:49:12 | 2018-10-29T03:39:22 | 2018-10-29T03:40:42 | 3,051 | 0 | 2 | 0 |
Java
| false | null |
package com.carnoc.flight.dataMaintenance.dao;
import com.carnoc.flight.dataMaintenance.pojo.BackUp;
import java.util.List;
/**
* @ClassName: BackUpDao
* @Description: TODO 备份日志表实体类接口
* @Author: Administrator
* @CreateDate: 2018/10/31 9:56
* @UpdateUser: Administrator
* @UpdateDate: 2018/10/31 9:56
* @UpdateRemark: 修改内容
* @Version: 1.0
*/
public interface BackUpDao {
/**
* @Author Administrator
* @Description //TODO 添加一条备份日志记录
* @Date 10:00 2018/10/31
* @Param [backUp]
* @return int
* @exception
*/
public int addBackUp(BackUp backUp);
/**
* @Author Administrator
* @Description //TODO 查询所有备份日志记录
* @Date 9:59 2018/11/4
* @Param []
* @return java.util.List<com.carnoc.flight.dataMaintenance.pojo.BackUp>
* @exception
*/
public List<BackUp> selectAllBackUp();
/**
* @Author Administrator
* @Description //TODO 还原数据库
* @Date 11:00 2018/11/4
* @Param [backUp]
* @return int
* @exception
*/
public int restoreMysql(BackUp backUp);
}
|
UTF-8
|
Java
| 1,163 |
java
|
BackUpDao.java
|
Java
|
[
{
"context": "UpDao\n * @Description: TODO 备份日志表实体类接口\n * @Author: Administrator\n * @CreateDate: 2018/10/31 9:56\n * @UpdateUser: A",
"end": 214,
"score": 0.7586885690689087,
"start": 201,
"tag": "NAME",
"value": "Administrator"
},
{
"context": "or\n * @CreateDate: 2018/10/31 9:56\n * @UpdateUser: Administrator\n * @UpdateDate: 2018/10/31 9:56\n * @UpdateRemark:",
"end": 276,
"score": 0.5443575382232666,
"start": 263,
"tag": "NAME",
"value": "Administrator"
},
{
"context": "ublic interface BackUpDao {\n /**\n * @Author Administrator\n * @Description //TODO 添加一条备份日志记录\n * @Dat",
"end": 418,
"score": 0.919793426990509,
"start": 405,
"tag": "NAME",
"value": "Administrator"
},
{
"context": "BackUp(BackUp backUp);\n \n /**\n * @Author Administrator\n * @Description //TODO 查询所有备份日志记录\n * @Dat",
"end": 637,
"score": 0.945016086101532,
"start": 624,
"tag": "NAME",
"value": "Administrator"
},
{
"context": "Up> selectAllBackUp();\n \n /**\n * @Author Administrator\n * @Description //TODO 还原数据库\n * @Date 11:",
"end": 908,
"score": 0.9307860136032104,
"start": 895,
"tag": "NAME",
"value": "Administrator"
}
] | null |
[] |
package com.carnoc.flight.dataMaintenance.dao;
import com.carnoc.flight.dataMaintenance.pojo.BackUp;
import java.util.List;
/**
* @ClassName: BackUpDao
* @Description: TODO 备份日志表实体类接口
* @Author: Administrator
* @CreateDate: 2018/10/31 9:56
* @UpdateUser: Administrator
* @UpdateDate: 2018/10/31 9:56
* @UpdateRemark: 修改内容
* @Version: 1.0
*/
public interface BackUpDao {
/**
* @Author Administrator
* @Description //TODO 添加一条备份日志记录
* @Date 10:00 2018/10/31
* @Param [backUp]
* @return int
* @exception
*/
public int addBackUp(BackUp backUp);
/**
* @Author Administrator
* @Description //TODO 查询所有备份日志记录
* @Date 9:59 2018/11/4
* @Param []
* @return java.util.List<com.carnoc.flight.dataMaintenance.pojo.BackUp>
* @exception
*/
public List<BackUp> selectAllBackUp();
/**
* @Author Administrator
* @Description //TODO 还原数据库
* @Date 11:00 2018/11/4
* @Param [backUp]
* @return int
* @exception
*/
public int restoreMysql(BackUp backUp);
}
| 1,163 | 0.623041 | 0.570507 | 47 | 22.085106 | 15.667869 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.12766 | false | false |
9
|
810a71f4ab18abe3a0eb73f8657376e443c68ad5
| 12,936,441,528,371 |
6ee7d5347450331b75377073fadc0f7ce229017e
|
/CreateCar.java
|
7fa5fdc212a7a50f69890dd7e1aea7c0f234f165
|
[] |
no_license
|
pivanchev/CreatingObjectsPractical
|
https://github.com/pivanchev/CreatingObjectsPractical
|
7378102bb14cec55b33d142658b8e8a9572c65ce
|
75d71e097fa1b5f93670de558e04182246be3275
|
refs/heads/master
| 2020-09-13T22:36:40.038000 | 2019-11-22T00:10:58 | 2019-11-22T00:10:58 | 222,925,657 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package CreatingObjectsPractical;
import java.util.Scanner;
public class CreateCar {
public static void main(String[] args) {
Car c1 = new Car("Ford",2008,"BVD 123",20000 );
c1.printCarInfo();
System.out.println("The price of the car object is: " + c1.getPrice());
Scanner sc=new Scanner(System.in);
Car[] cars= new Car[2];
String make,regNo;
double price;
int year0fManifacture;
for(int i=0;i<cars.length;i++){
System.out.print("Enter the make for Car " + (i+1) + ": ");
make=sc.nextLine();
System.out.print("Enter the year of manifacture for Car " + (i+1) + ": ");
year0fManifacture=sc.nextInt();
sc.nextLine();
System.out.print("Enter the registration number for car " + (i+1) + ": ");
regNo=sc.nextLine();
System.out.print("Enter the price for car " + (i+1) + ": ");
price=sc.nextDouble();
sc.nextLine();
System.out.println(make + ", " +year0fManifacture + ", " +regNo + ", " +price);
System.out.println();
}
}
}
|
UTF-8
|
Java
| 1,356 |
java
|
CreateCar.java
|
Java
|
[
{
"context": " \r\n \r\n \r\n Car c1 = new Car(\"Ford\",2008,\"BVD 123\",20000 );\r\n c1.printCarInf",
"end": 210,
"score": 0.704220712184906,
"start": 206,
"tag": "NAME",
"value": "Ford"
}
] | null |
[] |
package CreatingObjectsPractical;
import java.util.Scanner;
public class CreateCar {
public static void main(String[] args) {
Car c1 = new Car("Ford",2008,"BVD 123",20000 );
c1.printCarInfo();
System.out.println("The price of the car object is: " + c1.getPrice());
Scanner sc=new Scanner(System.in);
Car[] cars= new Car[2];
String make,regNo;
double price;
int year0fManifacture;
for(int i=0;i<cars.length;i++){
System.out.print("Enter the make for Car " + (i+1) + ": ");
make=sc.nextLine();
System.out.print("Enter the year of manifacture for Car " + (i+1) + ": ");
year0fManifacture=sc.nextInt();
sc.nextLine();
System.out.print("Enter the registration number for car " + (i+1) + ": ");
regNo=sc.nextLine();
System.out.print("Enter the price for car " + (i+1) + ": ");
price=sc.nextDouble();
sc.nextLine();
System.out.println(make + ", " +year0fManifacture + ", " +regNo + ", " +price);
System.out.println();
}
}
}
| 1,356 | 0.458702 | 0.441003 | 46 | 27.434782 | 24.755898 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.673913 | false | false |
9
|
46402a288ced9b70ac75a474de8e09a6553a32b2
| 27,118,423,528,376 |
96cea87f57b342f1d4954949f4725c8e1064e357
|
/WebDev/DWGettingStarted/src/test/java/com/javaeeeee/dwstart/resources/HelloResourceTest.java
|
993616a49a4942009e94d6883fb7ec6fe4c20d9e
|
[] |
no_license
|
RyEnd/every-which-way
|
https://github.com/RyEnd/every-which-way
|
250be53cf37e1f1397732d9611c9852bf0985f0b
|
a725422720be13176f4ee556fdae4140e6b85365
|
refs/heads/master
| 2020-04-15T14:04:08.745000 | 2017-06-24T19:13:03 | 2017-06-24T19:13:03 | 58,550,443 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.javaeeeee.dwstart.resources;
import com.ryanmolnar.DWGettingStarted.resources.HelloResource;
import io.dropwizard.testing.junit.ResourceTestRule;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import static junit.framework.Assert.assertEquals;
import org.junit.Rule;
import org.junit.Test;
/**
*
* @author ryan
*/
public class HelloResourceTest {
@Rule
public ResourceTestRule resource = ResourceTestRule.builder()
.addResource(new HelloResource()).build();
@Test
public void testGetGreeting() {
String expected = "Hello world!";
//Obtain client from @Rule.
Client client = resource.client();
//Get WebTarget from client using URI of root resource.
WebTarget helloTarget = client.target("http://localhost:8080/hello");
//To invoke response we use Invocation.Builder
//and specify the media type of representation asked from resource.
Invocation.Builder builder = helloTarget.request(MediaType.TEXT_PLAIN);
//Obtain response.
Response response = builder.get();
//Do assertions.
assertEquals(Response.Status.OK, response.getStatusInfo());
String actual = response.readEntity(String.class);
assertEquals(expected, actual);
/**
* OR
*
actual = resource.client()
.target("http://localhost:8080/hello")
.request(MediaType.TEXT_PLAIN)
.get(String.class);
assertEquals(expected, actual);
*
* even covers response status errors because .get returns errors if outside 2XX
*/
}
@Test
public void testGetNamedGreeting() {
String expected = "Hello Ryan";
String actual = resource.client()
.target("http://localhost:8080/hello/path_param/Ryan")
.request(MediaType.TEXT_PLAIN)
.get(String.class);
assertEquals(expected, actual);
}
@Test
public void testGetNamedGreetingWithParam() {
String expected = "Hello Ryan";
String name = "Ryan";
String actual = resource.client()
.target("http://localhost:8080/hello/query_param")
.queryParam("name", name)
.request(MediaType.TEXT_PLAIN)
.get(String.class);
assertEquals(expected, actual);
}
@Test
public void testGetJSONGreeting() {
String expected = "{\"greeting\":\"Hello world!\"}";
String actual = resource.client()
.target("http://localhost:8080/hello/hello_json")
.request(MediaType.APPLICATION_JSON)
.get(String.class);
assertEquals(expected, actual);
}
}
|
UTF-8
|
Java
| 3,075 |
java
|
HelloResourceTest.java
|
Java
|
[
{
"context": "kage com.javaeeeee.dwstart.resources;\n\nimport com.ryanmolnar.DWGettingStarted.resources.HelloResource;\nimport ",
"end": 63,
"score": 0.9907460808753967,
"start": 53,
"tag": "USERNAME",
"value": "ryanmolnar"
},
{
"context": "it.Rule;\nimport org.junit.Test;\n\n/**\n *\n * @author ryan\n */\npublic class HelloResourceTest {\n\n @Rule\n ",
"end": 457,
"score": 0.9988873600959778,
"start": 453,
"tag": "USERNAME",
"value": "ryan"
},
{
"context": "etNamedGreeting() {\n String expected = \"Hello Ryan\";\n \n String actual = resource.client()\n",
"end": 1899,
"score": 0.9860265254974365,
"start": 1895,
"tag": "NAME",
"value": "Ryan"
},
{
"context": "eetingWithParam() {\n String expected = \"Hello Ryan\";\n String name = \"Ryan\";\n \n String",
"end": 2275,
"score": 0.9976187944412231,
"start": 2271,
"tag": "NAME",
"value": "Ryan"
},
{
"context": "ing expected = \"Hello Ryan\";\n String name = \"Ryan\";\n \n String actual = resource.client()\n",
"end": 2303,
"score": 0.999686062335968,
"start": 2299,
"tag": "NAME",
"value": "Ryan"
}
] | null |
[] |
package com.javaeeeee.dwstart.resources;
import com.ryanmolnar.DWGettingStarted.resources.HelloResource;
import io.dropwizard.testing.junit.ResourceTestRule;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import static junit.framework.Assert.assertEquals;
import org.junit.Rule;
import org.junit.Test;
/**
*
* @author ryan
*/
public class HelloResourceTest {
@Rule
public ResourceTestRule resource = ResourceTestRule.builder()
.addResource(new HelloResource()).build();
@Test
public void testGetGreeting() {
String expected = "Hello world!";
//Obtain client from @Rule.
Client client = resource.client();
//Get WebTarget from client using URI of root resource.
WebTarget helloTarget = client.target("http://localhost:8080/hello");
//To invoke response we use Invocation.Builder
//and specify the media type of representation asked from resource.
Invocation.Builder builder = helloTarget.request(MediaType.TEXT_PLAIN);
//Obtain response.
Response response = builder.get();
//Do assertions.
assertEquals(Response.Status.OK, response.getStatusInfo());
String actual = response.readEntity(String.class);
assertEquals(expected, actual);
/**
* OR
*
actual = resource.client()
.target("http://localhost:8080/hello")
.request(MediaType.TEXT_PLAIN)
.get(String.class);
assertEquals(expected, actual);
*
* even covers response status errors because .get returns errors if outside 2XX
*/
}
@Test
public void testGetNamedGreeting() {
String expected = "Hello Ryan";
String actual = resource.client()
.target("http://localhost:8080/hello/path_param/Ryan")
.request(MediaType.TEXT_PLAIN)
.get(String.class);
assertEquals(expected, actual);
}
@Test
public void testGetNamedGreetingWithParam() {
String expected = "Hello Ryan";
String name = "Ryan";
String actual = resource.client()
.target("http://localhost:8080/hello/query_param")
.queryParam("name", name)
.request(MediaType.TEXT_PLAIN)
.get(String.class);
assertEquals(expected, actual);
}
@Test
public void testGetJSONGreeting() {
String expected = "{\"greeting\":\"Hello world!\"}";
String actual = resource.client()
.target("http://localhost:8080/hello/hello_json")
.request(MediaType.APPLICATION_JSON)
.get(String.class);
assertEquals(expected, actual);
}
}
| 3,075 | 0.585691 | 0.578862 | 95 | 31.378948 | 24.153971 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.410526 | false | false |
9
|
2cf620148979436ce1df1a0fc53d492eda872f36
| 3,384,434,244,324 |
67b73f7bfaa3e37994470ae561488809249ea5fb
|
/src/main/java/com/blacklist/demo/utils/AbstractBloomFilter.java
|
69f5b5882c6ecc451403005f45b93978d6be8673
|
[] |
no_license
|
Dawei21/demo-blacklist
|
https://github.com/Dawei21/demo-blacklist
|
91429f470b1cc70c1962096781b92f3b6b4b2408
|
baefd6d23a64db9b7b937aa50aa549a2c341674c
|
refs/heads/master
| 2020-09-18T20:21:50.182000 | 2019-12-03T12:32:05 | 2019-12-03T12:32:05 | 224,179,016 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.blacklist.demo.utils;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import javax.print.DocFlavor.BYTE_ARRAY;
import com.blacklist.demo.module.BloomFilterConfig;
import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;
/**
* @author sinbad on 2019/11/29
*/
public abstract class AbstractBloomFilter<T> {
private BloomFilter bloomFilter;
public AbstractBloomFilter(BloomFilterConfig bloomFilterConfig) throws Exception {
Type actualTypeArgument = ((ParameterizedType) getClass().getGenericSuperclass())
.getActualTypeArguments()[0];
if (!(actualTypeArgument instanceof Class<?>)) {
throw new RuntimeException("class type no support");
}
if (Long.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter
.create(Funnels.longFunnel(), bloomFilterConfig.getContainerSize());
} else if (String.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter.create(Funnels.stringFunnel(StandardCharsets.UTF_8),
bloomFilterConfig.getContainerSize());
} else if (Integer.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter
.create(Funnels.integerFunnel(), bloomFilterConfig.getContainerSize());
} else if (BYTE_ARRAY.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter
.create(Funnels.byteArrayFunnel(), bloomFilterConfig.getContainerSize());
} else {
throw new RuntimeException("class type no support");
}
}
public boolean putElement(T element) {
return bloomFilter.put(element);
}
public boolean checkUserInBlacklist(T element) {
return bloomFilter.mightContain(element);
}
//用于热启动
public abstract void initBloomFilter();
}
|
UTF-8
|
Java
| 1,833 |
java
|
AbstractBloomFilter.java
|
Java
|
[
{
"context": "rt com.google.common.hash.Funnels;\n\n/**\n * @author sinbad on 2019/11/29\n */\npublic abstract class Abstract",
"end": 351,
"score": 0.9995061159133911,
"start": 345,
"tag": "USERNAME",
"value": "sinbad"
}
] | null |
[] |
package com.blacklist.demo.utils;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import javax.print.DocFlavor.BYTE_ARRAY;
import com.blacklist.demo.module.BloomFilterConfig;
import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;
/**
* @author sinbad on 2019/11/29
*/
public abstract class AbstractBloomFilter<T> {
private BloomFilter bloomFilter;
public AbstractBloomFilter(BloomFilterConfig bloomFilterConfig) throws Exception {
Type actualTypeArgument = ((ParameterizedType) getClass().getGenericSuperclass())
.getActualTypeArguments()[0];
if (!(actualTypeArgument instanceof Class<?>)) {
throw new RuntimeException("class type no support");
}
if (Long.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter
.create(Funnels.longFunnel(), bloomFilterConfig.getContainerSize());
} else if (String.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter.create(Funnels.stringFunnel(StandardCharsets.UTF_8),
bloomFilterConfig.getContainerSize());
} else if (Integer.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter
.create(Funnels.integerFunnel(), bloomFilterConfig.getContainerSize());
} else if (BYTE_ARRAY.class.isAssignableFrom((Class<?>) actualTypeArgument)) {
bloomFilter = BloomFilter
.create(Funnels.byteArrayFunnel(), bloomFilterConfig.getContainerSize());
} else {
throw new RuntimeException("class type no support");
}
}
public boolean putElement(T element) {
return bloomFilter.put(element);
}
public boolean checkUserInBlacklist(T element) {
return bloomFilter.mightContain(element);
}
//用于热启动
public abstract void initBloomFilter();
}
| 1,833 | 0.761382 | 0.755897 | 58 | 30.431034 | 28.207428 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.655172 | false | false |
9
|
0c5b819c631dd067eec4586786fe36c3ca45c5d4
| 33,225,867,016,253 |
d4c416c12d4670339811e5bb15e065a9657c9951
|
/src/main/java/com/project/messdeck/testdata/VendorAccountData.java
|
3e5b3970865d2708633cee6f764f6fdc0b24d63c
|
[] |
no_license
|
shailesh261992/8kalocal
|
https://github.com/shailesh261992/8kalocal
|
6c426e5e1306e6d0d2a6a25678016e0a4bf9eadd
|
47c8e67ec6d5241d50973dd767e6837027600676
|
refs/heads/master
| 2021-01-10T23:13:08.970000 | 2017-04-16T14:45:32 | 2017-04-16T14:45:32 | 69,727,384 | 0 | 0 | null | false | 2017-03-19T10:41:21 | 2016-10-01T08:19:07 | 2016-10-01T08:26:00 | 2017-03-19T10:41:21 | 475 | 0 | 0 | 0 |
Java
| null | null |
package com.project.messdeck.testdata;
import java.time.LocalDateTime;
import com.project.messdeck.entity.VendorAccount;
public class VendorAccountData {
public static VendorAccount getSaiVendorAccount() {
VendorAccount vendorAccount = new VendorAccount();
vendorAccount.setManagerMobNo("7676767676");
vendorAccount.setPenaltyPercentage(20);
vendorAccount.setRegistrationDate(LocalDateTime.now());
vendorAccount.setSubscribeThreshold(120000);
vendorAccount.setUnSubscribeThreshold(120000);
return vendorAccount;
}
}
|
UTF-8
|
Java
| 540 |
java
|
VendorAccountData.java
|
Java
|
[] | null |
[] |
package com.project.messdeck.testdata;
import java.time.LocalDateTime;
import com.project.messdeck.entity.VendorAccount;
public class VendorAccountData {
public static VendorAccount getSaiVendorAccount() {
VendorAccount vendorAccount = new VendorAccount();
vendorAccount.setManagerMobNo("7676767676");
vendorAccount.setPenaltyPercentage(20);
vendorAccount.setRegistrationDate(LocalDateTime.now());
vendorAccount.setSubscribeThreshold(120000);
vendorAccount.setUnSubscribeThreshold(120000);
return vendorAccount;
}
}
| 540 | 0.812963 | 0.768519 | 20 | 26 | 22.047676 | 57 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false |
9
|
75ac2692c3faf8c27b6eda250ec43411b476fee5
| 18,305,150,632,017 |
c85a2c8a6298fc6de4307f828f257c8ff8bbad89
|
/src/main/java/edu/mit/broad/msigdb_browser/genome/swing/fields/GOptionsFieldPlusChooser.java
|
a5213c196b582499d7b55a03e43f02b011d08d0e
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
GSEA-MSigDB/msigdb-xml-browser
|
https://github.com/GSEA-MSigDB/msigdb-xml-browser
|
50787c669a5f34bb16bc05f24f9532674060fa32
|
3890ddb8cac19c4229af45158c65bd54b163d327
|
refs/heads/master
| 2022-02-13T07:46:09.626000 | 2022-01-21T00:16:51 | 2022-01-21T00:16:51 | 85,914,160 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2003-2018 Broad Institute, Inc., Massachusetts Institute of Technology, and Regents of the University of California. All rights reserved.
*/
package edu.mit.broad.msigdb_browser.genome.swing.fields;
import edu.mit.broad.msigdb_browser.genome.swing.GuiHelper;
import edu.mit.broad.msigdb_browser.genome.swing.windows.GListWindow;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p>JTextField with a button that when clicked on popus ups a JList window where i or more
* selections can be made. The selections are then pasted as comma delimited text into
* the JTextField</p>
* <p> </p>
* <p> </p>
* <p> </p>
*
* @author Aravind Subramanian
* @version %I%, %G%
*/
public class GOptionsFieldPlusChooser extends JPanel implements GFieldPlusChooser {
protected final Logger log = Logger.getLogger(GOptionsFieldPlusChooser.class);
protected JTextField tfEntry = new JTextField(40);
protected JButton bEntry = new JButton(GuiHelper.ICON_ELLIPSIS);
protected GListWindow fWindow;
protected GOptionsFieldPlusChooser() {
}
// needed as otherwise a defaulkt one is added and then again one another one is added
// if the setCustomActionListener is called
public GOptionsFieldPlusChooser(final boolean addDefaultActionListener, final Action help_action_opt) {
this.fWindow = new GListWindow(help_action_opt);
if (addDefaultActionListener) {
init();
} else {
jbInit();
}
}
public void setCustomActionListener(final ActionListener customActionListener) {
bEntry.addActionListener(customActionListener);
}
private void init() {
jbInit();
bEntry.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object[] sels = fWindow.show();
format(sels);
}
});
}
private void jbInit() {
this.setLayout(new BorderLayout());
tfEntry.setEditable(true);
this.add(tfEntry, BorderLayout.CENTER);
this.add(bEntry, BorderLayout.EAST);
}
private void format(Object[] sels) {
if (sels == null) {
tfEntry.setText("");
return;
}
StringBuffer buf = new StringBuffer();
for (int i = 0; i < sels.length; i++) {
if (sels[i] == null) {
continue;
}
buf.append(sels[i].toString().trim());
if (i != sels.length - 1) {
buf.append(',');
}
}
tfEntry.setText(buf.toString());
}
/**
* @param mode one of the ListSelectionModel constants
*/
public void setListSelectionMode(int mode) {
fWindow.setListSelectionMode(mode);
}
public String getText() {
return tfEntry.getText();
}
public void setText(String text) {
tfEntry.setText(text);
}
/**
* so that the tf can hbave its events listened to
*
* @return
*/
public JTextField getTextField() {
return tfEntry;
}
public Object getValue() {
return getText();
}
public JComponent getComponent() {
return this;
}
public GListWindow getJListWindow() {
return fWindow;
}
public void setValue(Object obj) {
if (obj == null) {
this.setText(null);
} else {
this.setText(obj.toString());
}
}
} // End GOptionsFieldPlusChooser
|
UTF-8
|
Java
| 3,768 |
java
|
GOptionsFieldPlusChooser.java
|
Java
|
[
{
"context": "<p> </p>\r\n * <p> </p>\r\n * <p> </p>\r\n *\r\n * @author Aravind Subramanian\r\n * @version %I%, %G%\r\n */\r\npublic class GOptions",
"end": 794,
"score": 0.9998618364334106,
"start": 775,
"tag": "NAME",
"value": "Aravind Subramanian"
}
] | null |
[] |
/*
* Copyright (c) 2003-2018 Broad Institute, Inc., Massachusetts Institute of Technology, and Regents of the University of California. All rights reserved.
*/
package edu.mit.broad.msigdb_browser.genome.swing.fields;
import edu.mit.broad.msigdb_browser.genome.swing.GuiHelper;
import edu.mit.broad.msigdb_browser.genome.swing.windows.GListWindow;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p>JTextField with a button that when clicked on popus ups a JList window where i or more
* selections can be made. The selections are then pasted as comma delimited text into
* the JTextField</p>
* <p> </p>
* <p> </p>
* <p> </p>
*
* @author <NAME>
* @version %I%, %G%
*/
public class GOptionsFieldPlusChooser extends JPanel implements GFieldPlusChooser {
protected final Logger log = Logger.getLogger(GOptionsFieldPlusChooser.class);
protected JTextField tfEntry = new JTextField(40);
protected JButton bEntry = new JButton(GuiHelper.ICON_ELLIPSIS);
protected GListWindow fWindow;
protected GOptionsFieldPlusChooser() {
}
// needed as otherwise a defaulkt one is added and then again one another one is added
// if the setCustomActionListener is called
public GOptionsFieldPlusChooser(final boolean addDefaultActionListener, final Action help_action_opt) {
this.fWindow = new GListWindow(help_action_opt);
if (addDefaultActionListener) {
init();
} else {
jbInit();
}
}
public void setCustomActionListener(final ActionListener customActionListener) {
bEntry.addActionListener(customActionListener);
}
private void init() {
jbInit();
bEntry.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object[] sels = fWindow.show();
format(sels);
}
});
}
private void jbInit() {
this.setLayout(new BorderLayout());
tfEntry.setEditable(true);
this.add(tfEntry, BorderLayout.CENTER);
this.add(bEntry, BorderLayout.EAST);
}
private void format(Object[] sels) {
if (sels == null) {
tfEntry.setText("");
return;
}
StringBuffer buf = new StringBuffer();
for (int i = 0; i < sels.length; i++) {
if (sels[i] == null) {
continue;
}
buf.append(sels[i].toString().trim());
if (i != sels.length - 1) {
buf.append(',');
}
}
tfEntry.setText(buf.toString());
}
/**
* @param mode one of the ListSelectionModel constants
*/
public void setListSelectionMode(int mode) {
fWindow.setListSelectionMode(mode);
}
public String getText() {
return tfEntry.getText();
}
public void setText(String text) {
tfEntry.setText(text);
}
/**
* so that the tf can hbave its events listened to
*
* @return
*/
public JTextField getTextField() {
return tfEntry;
}
public Object getValue() {
return getText();
}
public JComponent getComponent() {
return this;
}
public GListWindow getJListWindow() {
return fWindow;
}
public void setValue(Object obj) {
if (obj == null) {
this.setText(null);
} else {
this.setText(obj.toString());
}
}
} // End GOptionsFieldPlusChooser
| 3,755 | 0.59156 | 0.58811 | 142 | 24.591549 | 26.334295 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352113 | false | false |
9
|
08b56e0894a38fc27a9f4d426596a5545b903f67
| 21,577,915,709,571 |
cffa5f9acf00bdc38f74061a310a1693d5944d97
|
/src/org/easycomm/model/HistoryDatabase.java
|
bd52adad22dde2c4887bdf917a873ed6d1a0553a
|
[] |
no_license
|
htlin/android
|
https://github.com/htlin/android
|
009bf512002f711b11a4f992f1a8bd8114aad9f1
|
1ada82beb295e18f838a483ff4383dbea9360afa
|
refs/heads/master
| 2021-01-13T02:31:45.327000 | 2014-07-28T01:13:28 | 2014-07-28T01:13:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.easycomm.model;
import org.easycomm.util.CUtil;
import android.content.res.AssetManager;
import java.util.List;
public class HistoryDatabase {
private static HistoryDatabase Singleton;
private List<HistoryData> mHistory;
public static HistoryDatabase getInstance(AssetManager assets) {
if (Singleton == null) {
Singleton = new HistoryDatabase(assets);
}
return Singleton;
}
private HistoryDatabase(AssetManager assets) {
mHistory = CUtil.makeList();
}
public void append(HistoryData data){
mHistory.add(data);
}
public List<HistoryData> getHistory(){
return mHistory;
}
public void clear(){
mHistory = CUtil.makeList();
}
}
|
UTF-8
|
Java
| 727 |
java
|
HistoryDatabase.java
|
Java
|
[] | null |
[] |
package org.easycomm.model;
import org.easycomm.util.CUtil;
import android.content.res.AssetManager;
import java.util.List;
public class HistoryDatabase {
private static HistoryDatabase Singleton;
private List<HistoryData> mHistory;
public static HistoryDatabase getInstance(AssetManager assets) {
if (Singleton == null) {
Singleton = new HistoryDatabase(assets);
}
return Singleton;
}
private HistoryDatabase(AssetManager assets) {
mHistory = CUtil.makeList();
}
public void append(HistoryData data){
mHistory.add(data);
}
public List<HistoryData> getHistory(){
return mHistory;
}
public void clear(){
mHistory = CUtil.makeList();
}
}
| 727 | 0.690509 | 0.690509 | 39 | 16.641026 | 17.795832 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.282051 | false | false |
9
|
98ca21e881e1500cc74c248ce00085af127eee8c
| 13,288,628,835,302 |
70e9471431e36cf310851dde405a89eea8b96094
|
/trunk/src/main/java/com/jtyp/b2b2c/store/storedomainapply/dao/StoreDomainApplyH4Impl.java
|
6fc074b2ca22fab7c676a5e0cd07d51f9f857051
|
[] |
no_license
|
hlmx/jtyp
|
https://github.com/hlmx/jtyp
|
3272050f73987def7efb076467ab3a8aa20fb0a1
|
bef8820b2cfc57166d672ff11732d22ec23e8821
|
refs/heads/master
| 2018-10-29T11:03:35.883000 | 2018-08-23T08:49:40 | 2018-08-23T08:49:40 | 145,790,385 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jtyp.b2b2c.store.storedomainapply.dao;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import com.jtyp.b2b2c.baseframework.basecrud.dao.BaseH4Impl;
import com.jtyp.b2b2c.baseframework.utils.StringUtil;
import com.jtyp.b2b2c.store.storeaccount.vo.StoreAccountModel;
import com.jtyp.b2b2c.store.storedomainapply.vo.StoreDomainApplyModel;
import com.jtyp.b2b2c.store.storedomainapply.vo.StoreDomainApplyQueryModel;
@Repository
public class StoreDomainApplyH4Impl
extends
BaseH4Impl<StoreDomainApplyModel, StoreDomainApplyQueryModel>
implements
StoreDomainApplyDAO {
/**
* 联表查询商户信息和域名申请
*/
@Override
protected String getMultiSelect() {
return ",a ";
}
@Override
protected String getMultiModel() {
return " ,StoreAccountModel a ";
}
/**
* 页面需要展示商户的名称等信息,所以需要连商户账户表来查询
*
* @param qm
* @return String
*/
@Override
public String getAppendHql(StoreDomainApplyQueryModel qm) {
StringBuffer hql = new StringBuffer(" and o.accountUuid = a.uuid ");
// 凭借hql的where部分
hql.append(this.appHql(qm, hql.toString()));
// 拼接hql的order 部分
hql.append(this.appOrderBy(qm, hql.toString()));
return hql.toString();
}
/**
* 如有其他子表,拼接hql的其他表的属性
*
* @param @param qm
* @param @param hql
* @param @return
* @return String
*
*/
private String appHql(StoreDomainApplyQueryModel qm, String hql) {
StringBuffer buffer = new StringBuffer(hql);
// 商户名称或者编号
if (!StringUtil.isEmpty(qm.getStoreNameOrUuid())) {
buffer.append(" and (a.storeName like:storeNameOrUuid or a.storeUuid like:storeNameOrUuid) ");
}
return buffer.toString();
}
/**
* 拼接order By
*
* 按照单列排序使用
*
* @param @param qm
* @param @param hql
* @param @return
* @return String
*
*/
private String appOrderBy(StoreDomainApplyQueryModel qm, String hql) {
StringBuffer buffer = new StringBuffer(hql);
if ("account.storeUuid".equals(qm.getSortName())) {
buffer.append(" order by a.storeUuid ").append(qm.getSortType());
} else {
buffer.append(" order by o.applyTime ").append(qm.getSortType());
}
return buffer.toString();
}
/**
* 重写赋值方法,防止sql注入
*/
@Override
protected void setAppendHqlValue(StoreDomainApplyQueryModel qm, Query q) {
// 商户名称或者编号
if (!StringUtil.isEmpty(qm.getStoreNameOrUuid())) {
q.setString("storeNameOrUuid", "%" + qm.getStoreNameOrUuid() + "%");
}
}
/**
* 多表查询,组装需要先是到页面的list<br>
*
* 将查询出的商户账户对象中需要的字段放进new的对象,<br>
*
* 把新的对象set进域名申请对象,以便在页面中能取到商户名称和商户编号等
*/
@Override
protected List<StoreDomainApplyModel> exeResultList(List<Object[]> tempList) {
List<StoreDomainApplyModel> list = new ArrayList<StoreDomainApplyModel>();
if (tempList != null && tempList.size() > 0) {
for (Object[] obj : tempList) {
// 拼接StoreDomainApplyModel
StoreDomainApplyModel domainApplyModel = (StoreDomainApplyModel) obj[0];
//如果是一对多的关系,这里获取对象后,必须先new一个对象,
//然后把需要的的字段取出来set进新的对象
//(注:不能直接把取出的对象直接等于新的对象,例如account = accountModel,这样是不对的),
//在把这个新对象set进主model里就行了
//这样就避免了一对多情况下页面显示出错的问题
StoreAccountModel accountModel= (StoreAccountModel) obj[1];
StoreAccountModel account = new StoreAccountModel();
account.setStoreUuid(accountModel.getStoreUuid());
account.setStoreName(accountModel.getStoreName());
domainApplyModel.setAccount(account);
list.add(domainApplyModel);
}
}
return list;
}
/**
* 根据关联的商户的uuid获取该商户的域名申请记录uuid
* @param accountUuid
* @return
* StoreDomainApplyModel
*/
public String getDomainApplyUuidByAccountUuid(String accountUuid){
StringBuffer hql = new StringBuffer();
hql.append("select d.uuid from StoreDomainApplyModel d where d.accountUuid =:accountUuid ");
Query query = this.getH4Session().createQuery(hql.toString());
query.setString("accountUuid", accountUuid);
Object object = query.uniqueResult();
if(object != null){
return (String)object;
}
return null;
}
/**
* 根据关联的商户的uuid获取该商户的域名申请记录
* @param accountUuid
* @return
* StoreDomainApplyModel
*/
public StoreDomainApplyModel getDomainApplyByAccountUuid(String accountUuid){
StringBuffer hql = new StringBuffer();
hql.append(" from StoreDomainApplyModel d where d.accountUuid =:accountUuid ");
Query query = this.getH4Session().createQuery(hql.toString());
query.setString("accountUuid", accountUuid);
Object object = query.uniqueResult();
if(object != null){
return (StoreDomainApplyModel)object;
}
return null;
}
/**
* 查询域名是否可用,如果可用则商户可以进一步申请域名,否则返回重新查询域名
* @param domain
* @return
* boolean 已经存在返回 true 不存在返回false
*/
public boolean isDomainExisted(String domain){
StringBuffer hql = new StringBuffer();
hql.append("select d.uuid from StoreDomainApplyModel d where d.storeDomain =:storeDomain ");
//未审核和审核已经通过的域名都不能再次申请
hql.append(" and d.auditState in (0,1)");
Query query = this.getH4Session().createQuery(hql.toString());
query.setString("storeDomain", domain);
List<String> list = query.list();
if(list !=null && list.size() > 0){
return true;
}
return false;
}
}
|
UTF-8
|
Java
| 5,951 |
java
|
StoreDomainApplyH4Impl.java
|
Java
|
[] | null |
[] |
package com.jtyp.b2b2c.store.storedomainapply.dao;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import com.jtyp.b2b2c.baseframework.basecrud.dao.BaseH4Impl;
import com.jtyp.b2b2c.baseframework.utils.StringUtil;
import com.jtyp.b2b2c.store.storeaccount.vo.StoreAccountModel;
import com.jtyp.b2b2c.store.storedomainapply.vo.StoreDomainApplyModel;
import com.jtyp.b2b2c.store.storedomainapply.vo.StoreDomainApplyQueryModel;
@Repository
public class StoreDomainApplyH4Impl
extends
BaseH4Impl<StoreDomainApplyModel, StoreDomainApplyQueryModel>
implements
StoreDomainApplyDAO {
/**
* 联表查询商户信息和域名申请
*/
@Override
protected String getMultiSelect() {
return ",a ";
}
@Override
protected String getMultiModel() {
return " ,StoreAccountModel a ";
}
/**
* 页面需要展示商户的名称等信息,所以需要连商户账户表来查询
*
* @param qm
* @return String
*/
@Override
public String getAppendHql(StoreDomainApplyQueryModel qm) {
StringBuffer hql = new StringBuffer(" and o.accountUuid = a.uuid ");
// 凭借hql的where部分
hql.append(this.appHql(qm, hql.toString()));
// 拼接hql的order 部分
hql.append(this.appOrderBy(qm, hql.toString()));
return hql.toString();
}
/**
* 如有其他子表,拼接hql的其他表的属性
*
* @param @param qm
* @param @param hql
* @param @return
* @return String
*
*/
private String appHql(StoreDomainApplyQueryModel qm, String hql) {
StringBuffer buffer = new StringBuffer(hql);
// 商户名称或者编号
if (!StringUtil.isEmpty(qm.getStoreNameOrUuid())) {
buffer.append(" and (a.storeName like:storeNameOrUuid or a.storeUuid like:storeNameOrUuid) ");
}
return buffer.toString();
}
/**
* 拼接order By
*
* 按照单列排序使用
*
* @param @param qm
* @param @param hql
* @param @return
* @return String
*
*/
private String appOrderBy(StoreDomainApplyQueryModel qm, String hql) {
StringBuffer buffer = new StringBuffer(hql);
if ("account.storeUuid".equals(qm.getSortName())) {
buffer.append(" order by a.storeUuid ").append(qm.getSortType());
} else {
buffer.append(" order by o.applyTime ").append(qm.getSortType());
}
return buffer.toString();
}
/**
* 重写赋值方法,防止sql注入
*/
@Override
protected void setAppendHqlValue(StoreDomainApplyQueryModel qm, Query q) {
// 商户名称或者编号
if (!StringUtil.isEmpty(qm.getStoreNameOrUuid())) {
q.setString("storeNameOrUuid", "%" + qm.getStoreNameOrUuid() + "%");
}
}
/**
* 多表查询,组装需要先是到页面的list<br>
*
* 将查询出的商户账户对象中需要的字段放进new的对象,<br>
*
* 把新的对象set进域名申请对象,以便在页面中能取到商户名称和商户编号等
*/
@Override
protected List<StoreDomainApplyModel> exeResultList(List<Object[]> tempList) {
List<StoreDomainApplyModel> list = new ArrayList<StoreDomainApplyModel>();
if (tempList != null && tempList.size() > 0) {
for (Object[] obj : tempList) {
// 拼接StoreDomainApplyModel
StoreDomainApplyModel domainApplyModel = (StoreDomainApplyModel) obj[0];
//如果是一对多的关系,这里获取对象后,必须先new一个对象,
//然后把需要的的字段取出来set进新的对象
//(注:不能直接把取出的对象直接等于新的对象,例如account = accountModel,这样是不对的),
//在把这个新对象set进主model里就行了
//这样就避免了一对多情况下页面显示出错的问题
StoreAccountModel accountModel= (StoreAccountModel) obj[1];
StoreAccountModel account = new StoreAccountModel();
account.setStoreUuid(accountModel.getStoreUuid());
account.setStoreName(accountModel.getStoreName());
domainApplyModel.setAccount(account);
list.add(domainApplyModel);
}
}
return list;
}
/**
* 根据关联的商户的uuid获取该商户的域名申请记录uuid
* @param accountUuid
* @return
* StoreDomainApplyModel
*/
public String getDomainApplyUuidByAccountUuid(String accountUuid){
StringBuffer hql = new StringBuffer();
hql.append("select d.uuid from StoreDomainApplyModel d where d.accountUuid =:accountUuid ");
Query query = this.getH4Session().createQuery(hql.toString());
query.setString("accountUuid", accountUuid);
Object object = query.uniqueResult();
if(object != null){
return (String)object;
}
return null;
}
/**
* 根据关联的商户的uuid获取该商户的域名申请记录
* @param accountUuid
* @return
* StoreDomainApplyModel
*/
public StoreDomainApplyModel getDomainApplyByAccountUuid(String accountUuid){
StringBuffer hql = new StringBuffer();
hql.append(" from StoreDomainApplyModel d where d.accountUuid =:accountUuid ");
Query query = this.getH4Session().createQuery(hql.toString());
query.setString("accountUuid", accountUuid);
Object object = query.uniqueResult();
if(object != null){
return (StoreDomainApplyModel)object;
}
return null;
}
/**
* 查询域名是否可用,如果可用则商户可以进一步申请域名,否则返回重新查询域名
* @param domain
* @return
* boolean 已经存在返回 true 不存在返回false
*/
public boolean isDomainExisted(String domain){
StringBuffer hql = new StringBuffer();
hql.append("select d.uuid from StoreDomainApplyModel d where d.storeDomain =:storeDomain ");
//未审核和审核已经通过的域名都不能再次申请
hql.append(" and d.auditState in (0,1)");
Query query = this.getH4Session().createQuery(hql.toString());
query.setString("storeDomain", domain);
List<String> list = query.list();
if(list !=null && list.size() > 0){
return true;
}
return false;
}
}
| 5,951 | 0.710857 | 0.706213 | 203 | 24.453201 | 24.262756 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.906404 | false | false |
9
|
b3bf84b768845f3e60bd99a3278e852a94265bbb
| 20,066,087,224,498 |
aa1658606d6a79ece8ee40f9f0c4381600eb7b20
|
/ISchool/src/db/ChargeLog.java
|
d1890cc7f4b36ba85c92a822bdf87a68dd328f64
|
[] |
no_license
|
chilinh12003/2.Java
|
https://github.com/chilinh12003/2.Java
|
74e16b110d0df5e2e943fbf74e28e6a5544c5f1e
|
818bb55d933f9305f862de2b0c582e8903214e2b
|
refs/heads/master
| 2021-01-21T04:41:57.070000 | 2017-08-25T09:51:33 | 2017-08-25T09:51:33 | 48,158,761 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package db;
import java.sql.Timestamp;
/**
* ChargeLog entity. @author MyEclipse Persistence Tools
*/
public class ChargeLog extends DAOBase implements java.io.Serializable
{
public enum ChargeType
{
Nothing(0), Register(1), Renew(2), BuyContent(3), Restore(4), Deregister(5) ;
private int value;
private ChargeType(int value)
{
this.value = value;
}
public Short GetValue()
{
return ((Integer) this.value).shortValue();
}
public static ChargeType FromValue(short iValue)
{
for (ChargeType type : ChargeType.values())
{
if (type.GetValue() == iValue)
return type;
}
return Nothing;
}
}
public enum Status
{
/*
* 0: Đăng ký sub 1: Hủy sub 2: Tạm dừng 3: Đăng ký lại
*/
Nothing(-1), ChargeSuccess(0), ChargeFail(1), ;
private int value;
private Status(int value)
{
this.value = value;
}
public Short GetValue()
{
return ((Integer) this.value).shortValue();
}
public static Status FromValue(short iValue)
{
for (Status type : Status.values())
{
if (type.GetValue() == iValue)
return type;
}
return Nothing;
}
}
// Fields
private ChargeLogId id;
private Timestamp chargeDate;
private Float price;
private Short chargeTypeId;
private Short statusId;
private Short channelId;
private Timestamp logDate;
private Integer partnerId;
private String detail;
private String chargeCode;
private Timestamp nextRenewalTime;
private String transId;
// Constructors
/** default constructor */
public ChargeLog()
{
}
/** minimal constructor */
public ChargeLog(ChargeLogId id)
{
this.id = id;
}
/** full constructor */
public ChargeLog(ChargeLogId id, Timestamp chargeDate, Float price, Short chargeTypeId, Short statusId,
Short channelId, Timestamp logDate, Integer partnerId, String detail, String chargeCode,
Timestamp nextRenewalTime, String transId)
{
this.id = id;
this.chargeDate = chargeDate;
this.price = price;
this.chargeTypeId = chargeTypeId;
this.statusId = statusId;
this.channelId = channelId;
this.logDate = logDate;
this.partnerId = partnerId;
this.detail = detail;
this.chargeCode = chargeCode;
this.nextRenewalTime = nextRenewalTime;
this.transId = transId;
}
// Property accessors
public ChargeLogId getId()
{
return this.id;
}
public void setId(ChargeLogId id)
{
this.id = id;
}
public Timestamp getChargeDate()
{
return this.chargeDate;
}
public void setChargeDate(Timestamp chargeDate)
{
this.chargeDate = chargeDate;
}
public Float getPrice()
{
return this.price;
}
public void setPrice(Float price)
{
this.price = price;
}
public Short getChargeTypeId()
{
return this.chargeTypeId;
}
public void setChargeTypeId(Short chargeTypeId)
{
this.chargeTypeId = chargeTypeId;
}
public Short getStatusId()
{
return this.statusId;
}
public void setStatusId(Short statusId)
{
this.statusId = statusId;
}
public Short getChannelId()
{
return this.channelId;
}
public void setChannelId(Short channelId)
{
this.channelId = channelId;
}
public Timestamp getLogDate()
{
return this.logDate;
}
public void setLogDate(Timestamp logDate)
{
this.logDate = logDate;
}
public Integer getPartnerId()
{
return this.partnerId;
}
public void setPartnerId(Integer partnerId)
{
this.partnerId = partnerId;
}
public String getDetail()
{
return this.detail;
}
public void setDetail(String detail)
{
this.detail = detail;
}
public String getChargeCode()
{
return this.chargeCode;
}
public void setChargeCode(String chargeCode)
{
this.chargeCode = chargeCode;
}
public Timestamp getNextRenewalTime()
{
return this.nextRenewalTime;
}
public void setNextRenewalTime(Timestamp nextRenewalTime)
{
this.nextRenewalTime = nextRenewalTime;
}
public String getTransId()
{
return this.transId;
}
public void setTransId(String transId)
{
this.transId = transId;
}
}
|
UTF-8
|
Java
| 3,989 |
java
|
ChargeLog.java
|
Java
|
[] | null |
[] |
package db;
import java.sql.Timestamp;
/**
* ChargeLog entity. @author MyEclipse Persistence Tools
*/
public class ChargeLog extends DAOBase implements java.io.Serializable
{
public enum ChargeType
{
Nothing(0), Register(1), Renew(2), BuyContent(3), Restore(4), Deregister(5) ;
private int value;
private ChargeType(int value)
{
this.value = value;
}
public Short GetValue()
{
return ((Integer) this.value).shortValue();
}
public static ChargeType FromValue(short iValue)
{
for (ChargeType type : ChargeType.values())
{
if (type.GetValue() == iValue)
return type;
}
return Nothing;
}
}
public enum Status
{
/*
* 0: Đăng ký sub 1: Hủy sub 2: Tạm dừng 3: Đăng ký lại
*/
Nothing(-1), ChargeSuccess(0), ChargeFail(1), ;
private int value;
private Status(int value)
{
this.value = value;
}
public Short GetValue()
{
return ((Integer) this.value).shortValue();
}
public static Status FromValue(short iValue)
{
for (Status type : Status.values())
{
if (type.GetValue() == iValue)
return type;
}
return Nothing;
}
}
// Fields
private ChargeLogId id;
private Timestamp chargeDate;
private Float price;
private Short chargeTypeId;
private Short statusId;
private Short channelId;
private Timestamp logDate;
private Integer partnerId;
private String detail;
private String chargeCode;
private Timestamp nextRenewalTime;
private String transId;
// Constructors
/** default constructor */
public ChargeLog()
{
}
/** minimal constructor */
public ChargeLog(ChargeLogId id)
{
this.id = id;
}
/** full constructor */
public ChargeLog(ChargeLogId id, Timestamp chargeDate, Float price, Short chargeTypeId, Short statusId,
Short channelId, Timestamp logDate, Integer partnerId, String detail, String chargeCode,
Timestamp nextRenewalTime, String transId)
{
this.id = id;
this.chargeDate = chargeDate;
this.price = price;
this.chargeTypeId = chargeTypeId;
this.statusId = statusId;
this.channelId = channelId;
this.logDate = logDate;
this.partnerId = partnerId;
this.detail = detail;
this.chargeCode = chargeCode;
this.nextRenewalTime = nextRenewalTime;
this.transId = transId;
}
// Property accessors
public ChargeLogId getId()
{
return this.id;
}
public void setId(ChargeLogId id)
{
this.id = id;
}
public Timestamp getChargeDate()
{
return this.chargeDate;
}
public void setChargeDate(Timestamp chargeDate)
{
this.chargeDate = chargeDate;
}
public Float getPrice()
{
return this.price;
}
public void setPrice(Float price)
{
this.price = price;
}
public Short getChargeTypeId()
{
return this.chargeTypeId;
}
public void setChargeTypeId(Short chargeTypeId)
{
this.chargeTypeId = chargeTypeId;
}
public Short getStatusId()
{
return this.statusId;
}
public void setStatusId(Short statusId)
{
this.statusId = statusId;
}
public Short getChannelId()
{
return this.channelId;
}
public void setChannelId(Short channelId)
{
this.channelId = channelId;
}
public Timestamp getLogDate()
{
return this.logDate;
}
public void setLogDate(Timestamp logDate)
{
this.logDate = logDate;
}
public Integer getPartnerId()
{
return this.partnerId;
}
public void setPartnerId(Integer partnerId)
{
this.partnerId = partnerId;
}
public String getDetail()
{
return this.detail;
}
public void setDetail(String detail)
{
this.detail = detail;
}
public String getChargeCode()
{
return this.chargeCode;
}
public void setChargeCode(String chargeCode)
{
this.chargeCode = chargeCode;
}
public Timestamp getNextRenewalTime()
{
return this.nextRenewalTime;
}
public void setNextRenewalTime(Timestamp nextRenewalTime)
{
this.nextRenewalTime = nextRenewalTime;
}
public String getTransId()
{
return this.transId;
}
public void setTransId(String transId)
{
this.transId = transId;
}
}
| 3,989 | 0.697862 | 0.694591 | 242 | 15.429752 | 17.943588 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.545455 | false | false |
9
|
24fbc84c4e1021e1b94e13a89fc1a743d461b3e1
| 30,769,145,718,577 |
0fe18366e8b7f304610a171af3f090fb52cfa5a2
|
/src/java/main/org/wonderly/logging/SimpleFormatter.java
|
1728e29ca34a2859143e79ffe1ddf089f97a4dff
|
[] |
no_license
|
greggwon/JavEcho
|
https://github.com/greggwon/JavEcho
|
38ca0b232ff7fd55e9747feeaf71e02d4e6c431b
|
1f8c5c5ad8f5096c23822487f853219563f0e6cb
|
refs/heads/master
| 2022-05-09T18:32:39.570000 | 2017-06-08T03:09:28 | 2017-06-08T03:09:28 | 92,002,849 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.wonderly.logging;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.logging.LogRecord;
public class SimpleFormatter extends java.util.logging.Formatter {
GregorianCalendar c = new GregorianCalendar();
SimpleDateFormat fmt = new SimpleDateFormat( "mm/dd/yyyy HH:MM:SS");
@Override
public String format(LogRecord record) {
String dt = "";
synchronized(this) {
c.setTimeInMillis(record.getMillis());
dt = fmt.format(c.getTime());
}
return dt +" ["+record.getLoggerName()+"] # "+record.getLevel()+" # "+formatMessage(record)+System.lineSeparator();
}
}
|
UTF-8
|
Java
| 621 |
java
|
SimpleFormatter.java
|
Java
|
[] | null |
[] |
package org.wonderly.logging;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.logging.LogRecord;
public class SimpleFormatter extends java.util.logging.Formatter {
GregorianCalendar c = new GregorianCalendar();
SimpleDateFormat fmt = new SimpleDateFormat( "mm/dd/yyyy HH:MM:SS");
@Override
public String format(LogRecord record) {
String dt = "";
synchronized(this) {
c.setTimeInMillis(record.getMillis());
dt = fmt.format(c.getTime());
}
return dt +" ["+record.getLoggerName()+"] # "+record.getLevel()+" # "+formatMessage(record)+System.lineSeparator();
}
}
| 621 | 0.73591 | 0.73591 | 20 | 30.049999 | 28.874685 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.45 | false | false |
9
|
d5aed52fc13c5f86fdf251b4c07cf08c3eef7eab
| 3,092,376,476,326 |
f121bdb278a88e66089df0d8a8c6b96354864eee
|
/Jsp01_MyBoard/src/com/my/biz/MyBoardBiz.java
|
b2c753e433d2c7ce93bc466f3c0a97a29e948ff2
|
[] |
no_license
|
moonhyeji/Web_Study
|
https://github.com/moonhyeji/Web_Study
|
9cc4b46b9d790e6a1aaf0654b9ca4acac43cf558
|
98854ac64553a7eb3822212457d6ea3fb7b3dd5a
|
refs/heads/main
| 2023-05-30T15:49:02.569000 | 2021-06-14T07:34:12 | 2021-06-14T07:34:12 | 348,465,386 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.my.biz;
import java.util.List;
import com.my.dao.MyBoardDao;
import com.my.dto.MyBoardDto;
public class MyBoardBiz {
private MyBoardDao dao = new MyBoardDao();
//private: 클래스 내부에서만 사용 가능
//새로운 MyBoardDao 클래스 객체를 생성해서 , dao라는 이름의 객체에 담는다.
//이 dao라는 객체는 클래스 내부에서만 사용 가능하다.
public List<MyBoardDto> selectList(){ //List<MyBoardDto> 타입의 selectList메소드 받아서, 배열 안에 넣어서 list형태로 받을 거라서,
return dao.selectList(); //return list;
}
public MyBoardDto selectOne(int myno) { //int myno받아서.
return dao.selectOne(myno); //dao.selectOne(myno); 로 전달해줄 것이다.
} //return dto // int 숫자 하나 받아와서 그 번호에 해당하는 데이터 출력해 줘야 하니까
public int insert(MyBoardDto dto) { //회원가입 //타입: int
return dao.insert(dto); //Dao에서 row값 int 로 받아서 res변수에 넣은 다음에 return res해줄거라서,
}
public int update(MyBoardDto dto) { //수정
return dao.update(dto);
}
public int delete (int myno) { //탈퇴.
return dao.delete(myno);
}
}
|
UTF-8
|
Java
| 1,261 |
java
|
MyBoardBiz.java
|
Java
|
[] | null |
[] |
package com.my.biz;
import java.util.List;
import com.my.dao.MyBoardDao;
import com.my.dto.MyBoardDto;
public class MyBoardBiz {
private MyBoardDao dao = new MyBoardDao();
//private: 클래스 내부에서만 사용 가능
//새로운 MyBoardDao 클래스 객체를 생성해서 , dao라는 이름의 객체에 담는다.
//이 dao라는 객체는 클래스 내부에서만 사용 가능하다.
public List<MyBoardDto> selectList(){ //List<MyBoardDto> 타입의 selectList메소드 받아서, 배열 안에 넣어서 list형태로 받을 거라서,
return dao.selectList(); //return list;
}
public MyBoardDto selectOne(int myno) { //int myno받아서.
return dao.selectOne(myno); //dao.selectOne(myno); 로 전달해줄 것이다.
} //return dto // int 숫자 하나 받아와서 그 번호에 해당하는 데이터 출력해 줘야 하니까
public int insert(MyBoardDto dto) { //회원가입 //타입: int
return dao.insert(dto); //Dao에서 row값 int 로 받아서 res변수에 넣은 다음에 return res해줄거라서,
}
public int update(MyBoardDto dto) { //수정
return dao.update(dto);
}
public int delete (int myno) { //탈퇴.
return dao.delete(myno);
}
}
| 1,261 | 0.662176 | 0.662176 | 32 | 29.15625 | 28.664122 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false |
9
|
d65e1ef46afae1247363907d123802e1c3ac22bc
| 6,339,371,751,676 |
f2811973abc6e19f6b3bb0995d03a469736a573f
|
/build/tmp/expandedArchives/forge-1.19.2-43.2.0_mapped_official_1.19.2-sources.jar_7264b978664e4fd2ce092b3069758124/net/minecraft/client/multiplayer/chat/LoggedChatMessage.java
|
261e06f221079663f1ad13b42b9751f8e06855d1
|
[] |
no_license
|
WelpSTudent/Create-Addon
|
https://github.com/WelpSTudent/Create-Addon
|
1edb7c0642224a19bb6d0abafe208bee765b3f38
|
c2e4dbba9d30a944d17e5a741c80fc9be272a4d0
|
refs/heads/master
| 2023-04-30T05:28:42.901000 | 2023-03-29T07:01:55 | 2023-03-29T07:01:55 | 364,394,488 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.minecraft.client.multiplayer.chat;
import com.mojang.authlib.GameProfile;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Objects;
import java.util.UUID;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MessageSignature;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.network.chat.SignedMessageHeader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public interface LoggedChatMessage extends LoggedChatEvent {
static LoggedChatMessage.Player player(GameProfile p_242244_, Component p_242277_, PlayerChatMessage p_242412_, ChatTrustLevel p_242155_) {
return new LoggedChatMessage.Player(p_242244_, p_242277_, p_242412_, p_242155_);
}
static LoggedChatMessage.System system(Component p_242325_, Instant p_242334_) {
return new LoggedChatMessage.System(p_242325_, p_242334_);
}
Component toContentComponent();
default Component toNarrationComponent() {
return this.toContentComponent();
}
boolean canReport(UUID p_242315_);
@OnlyIn(Dist.CLIENT)
public static record Player(GameProfile profile, Component displayName, PlayerChatMessage message, ChatTrustLevel trustLevel) implements LoggedChatMessage, LoggedChatMessageLink {
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT);
public Component toContentComponent() {
if (!this.message.filterMask().isEmpty()) {
Component component = this.message.filterMask().apply(this.message.signedContent());
return Objects.requireNonNullElse(component, CommonComponents.EMPTY);
} else {
return this.message.serverContent();
}
}
public Component toNarrationComponent() {
Component component = this.toContentComponent();
Component component1 = this.getTimeComponent();
return Component.translatable("gui.chatSelection.message.narrate", this.displayName, component, component1);
}
public Component toHeadingComponent() {
Component component = this.getTimeComponent();
return Component.translatable("gui.chatSelection.heading", this.displayName, component);
}
private Component getTimeComponent() {
LocalDateTime localdatetime = LocalDateTime.ofInstant(this.message.timeStamp(), ZoneOffset.systemDefault());
return Component.literal(localdatetime.format(TIME_FORMATTER)).withStyle(ChatFormatting.ITALIC, ChatFormatting.GRAY);
}
public boolean canReport(UUID p_242210_) {
return this.message.hasSignatureFrom(p_242210_);
}
public SignedMessageHeader header() {
return this.message.signedHeader();
}
public byte[] bodyDigest() {
return this.message.signedBody().hash().asBytes();
}
public MessageSignature headerSignature() {
return this.message.headerSignature();
}
public UUID profileId() {
return this.profile.getId();
}
}
@OnlyIn(Dist.CLIENT)
public static record System(Component message, Instant timeStamp) implements LoggedChatMessage {
public Component toContentComponent() {
return this.message;
}
public boolean canReport(UUID p_242173_) {
return false;
}
}
}
|
UTF-8
|
Java
| 3,625 |
java
|
LoggedChatMessage.java
|
Java
|
[] | null |
[] |
package net.minecraft.client.multiplayer.chat;
import com.mojang.authlib.GameProfile;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Objects;
import java.util.UUID;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MessageSignature;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.network.chat.SignedMessageHeader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public interface LoggedChatMessage extends LoggedChatEvent {
static LoggedChatMessage.Player player(GameProfile p_242244_, Component p_242277_, PlayerChatMessage p_242412_, ChatTrustLevel p_242155_) {
return new LoggedChatMessage.Player(p_242244_, p_242277_, p_242412_, p_242155_);
}
static LoggedChatMessage.System system(Component p_242325_, Instant p_242334_) {
return new LoggedChatMessage.System(p_242325_, p_242334_);
}
Component toContentComponent();
default Component toNarrationComponent() {
return this.toContentComponent();
}
boolean canReport(UUID p_242315_);
@OnlyIn(Dist.CLIENT)
public static record Player(GameProfile profile, Component displayName, PlayerChatMessage message, ChatTrustLevel trustLevel) implements LoggedChatMessage, LoggedChatMessageLink {
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT);
public Component toContentComponent() {
if (!this.message.filterMask().isEmpty()) {
Component component = this.message.filterMask().apply(this.message.signedContent());
return Objects.requireNonNullElse(component, CommonComponents.EMPTY);
} else {
return this.message.serverContent();
}
}
public Component toNarrationComponent() {
Component component = this.toContentComponent();
Component component1 = this.getTimeComponent();
return Component.translatable("gui.chatSelection.message.narrate", this.displayName, component, component1);
}
public Component toHeadingComponent() {
Component component = this.getTimeComponent();
return Component.translatable("gui.chatSelection.heading", this.displayName, component);
}
private Component getTimeComponent() {
LocalDateTime localdatetime = LocalDateTime.ofInstant(this.message.timeStamp(), ZoneOffset.systemDefault());
return Component.literal(localdatetime.format(TIME_FORMATTER)).withStyle(ChatFormatting.ITALIC, ChatFormatting.GRAY);
}
public boolean canReport(UUID p_242210_) {
return this.message.hasSignatureFrom(p_242210_);
}
public SignedMessageHeader header() {
return this.message.signedHeader();
}
public byte[] bodyDigest() {
return this.message.signedBody().hash().asBytes();
}
public MessageSignature headerSignature() {
return this.message.headerSignature();
}
public UUID profileId() {
return this.profile.getId();
}
}
@OnlyIn(Dist.CLIENT)
public static record System(Component message, Instant timeStamp) implements LoggedChatMessage {
public Component toContentComponent() {
return this.message;
}
public boolean canReport(UUID p_242173_) {
return false;
}
}
}
| 3,625 | 0.724138 | 0.697103 | 98 | 36 | 35.859703 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.622449 | false | false |
9
|
1839ba229c58328964a00586a195102142e7b081
| 4,363,686,791,860 |
cb3982135c4f5098e79cb07aef8f021415ae7823
|
/src/com/alieninvaders/Sprite.java
|
c907bd177698e0a4538b9c144099fc16904c8cd3
|
[
"MIT"
] |
permissive
|
bale2838/AlienInvaders
|
https://github.com/bale2838/AlienInvaders
|
2924054f89ea578e2155191deb27129ab0b46785
|
8b4e19166e183b32d0ce66c018ff73bdc184fa86
|
refs/heads/master
| 2021-01-09T20:40:03.493000 | 2016-07-24T23:58:33 | 2016-07-24T23:58:33 | 63,022,824 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.alieninvaders;
import java.awt.Graphics;
import java.awt.Image;
/*
* A sprite to be displayed on the screen.
* A sprite contains no state information i.e. its just an image with no location.
* This will allow the use of multiple sprites in alot of different places without
* having to store multiple copies of the image.
*/
public class Sprite {
//The image to be drawn
private Image image;
/*
* Create a new sprite based on the image.
*
* @param image The image that is this sprite.
*/
public Sprite(Image image){
this.image = image;
}
/*
* Get the width of the drawn sprite
*
* @return The width in pixels of this sprite.
*/
public int getWidth(){
return image.getWidth(null);
}
/*
* Get the height of the drawn sprite.
*
* @return The height in pixels of the sprite.
*/
public int getHeight(){
return image.getHeight(null);
}
/*
* Draw the sprite onto graphics context provided.
*
* @param g The graphics context on which to draw the sprite
* @param x The x location at which to draw the sprite
* @param y The y location at which to draw the sprite
*/
public void draw(Graphics g, int x, int y){
g.drawImage(image, x, y, null);
}
}
|
UTF-8
|
Java
| 1,228 |
java
|
Sprite.java
|
Java
|
[] | null |
[] |
package com.alieninvaders;
import java.awt.Graphics;
import java.awt.Image;
/*
* A sprite to be displayed on the screen.
* A sprite contains no state information i.e. its just an image with no location.
* This will allow the use of multiple sprites in alot of different places without
* having to store multiple copies of the image.
*/
public class Sprite {
//The image to be drawn
private Image image;
/*
* Create a new sprite based on the image.
*
* @param image The image that is this sprite.
*/
public Sprite(Image image){
this.image = image;
}
/*
* Get the width of the drawn sprite
*
* @return The width in pixels of this sprite.
*/
public int getWidth(){
return image.getWidth(null);
}
/*
* Get the height of the drawn sprite.
*
* @return The height in pixels of the sprite.
*/
public int getHeight(){
return image.getHeight(null);
}
/*
* Draw the sprite onto graphics context provided.
*
* @param g The graphics context on which to draw the sprite
* @param x The x location at which to draw the sprite
* @param y The y location at which to draw the sprite
*/
public void draw(Graphics g, int x, int y){
g.drawImage(image, x, y, null);
}
}
| 1,228 | 0.679153 | 0.679153 | 56 | 20.946428 | 22.130634 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.035714 | false | false |
9
|
9337e638e1b410432efb4442fd99e8bed8ecaa05
| 5,823,975,684,434 |
0224171c6412c40fcac97ab04ae88b5a3974fdcf
|
/medicineInfo_service/src/main/java/com/med/info/service/operate/impl/MissDistrictOperateService.java
|
ddbec1df4b7a635ae720b4a249018352d5765da6
|
[] |
no_license
|
fresheagle/medicineInfo
|
https://github.com/fresheagle/medicineInfo
|
42e24e9a0a7aee982834ec1a5527acda4c7b71d9
|
c656c1f943db401832cf0e1d75d5b458a48c402c
|
refs/heads/master
| 2022-07-17T11:50:34.345000 | 2019-07-07T10:20:11 | 2019-07-07T10:20:11 | 150,563,126 | 1 | 1 | null | false | 2022-06-29T17:22:48 | 2018-09-27T09:34:02 | 2019-07-07T10:20:23 | 2022-06-29T17:22:48 | 4,826 | 1 | 1 | 5 |
Java
| false | false |
//package com.med.info.service.operate.impl;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import com.med.info.domain.Miss_district;
//import com.med.info.mapper.domain.OperateDTO;
//import com.med.info.service.BaseService;
//import com.med.info.service.MissDistrictService;
//
//@Component
//@Order(1)
//public class MissDistrictOperateService extends AbstractOperateService<Miss_district, Miss_district>{
//
// @Autowired
// private MissDistrictService districtService;
//
// @Override
// public boolean needDealMapper() {
// return false;
// }
//
// @Override
// public BaseService<Miss_district> baseService(String menuType) {
// // TODO Auto-generated method stub
// return districtService;
// }
//
// @Override
// public Class<?> getCurrentObjectClass() {
// // TODO Auto-generated method stub
// return Miss_district.class;
// }
//
// @Override
// public String getCurrentMenuType() {
// // TODO Auto-generated method stub
// return "missDistrict";
// }
//
// @Override
// public String getJsonParamKey() {
// // TODO Auto-generated method stub
// return "missDistrict";
// }
//
//
//}
|
UTF-8
|
Java
| 1,232 |
java
|
MissDistrictOperateService.java
|
Java
|
[] | null |
[] |
//package com.med.info.service.operate.impl;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import com.med.info.domain.Miss_district;
//import com.med.info.mapper.domain.OperateDTO;
//import com.med.info.service.BaseService;
//import com.med.info.service.MissDistrictService;
//
//@Component
//@Order(1)
//public class MissDistrictOperateService extends AbstractOperateService<Miss_district, Miss_district>{
//
// @Autowired
// private MissDistrictService districtService;
//
// @Override
// public boolean needDealMapper() {
// return false;
// }
//
// @Override
// public BaseService<Miss_district> baseService(String menuType) {
// // TODO Auto-generated method stub
// return districtService;
// }
//
// @Override
// public Class<?> getCurrentObjectClass() {
// // TODO Auto-generated method stub
// return Miss_district.class;
// }
//
// @Override
// public String getCurrentMenuType() {
// // TODO Auto-generated method stub
// return "missDistrict";
// }
//
// @Override
// public String getJsonParamKey() {
// // TODO Auto-generated method stub
// return "missDistrict";
// }
//
//
//}
| 1,232 | 0.720779 | 0.719968 | 49 | 24.142857 | 22.426296 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.020408 | false | false |
9
|
dbfdcdf70d49240f8835dc534bd53d6270b0850e
| 29,394,756,205,981 |
a5d098f3e0ff4e43e9b810a3a10d583d82c7115a
|
/wint-framework/src/main/java/wint/mvc/form/MessageHoldField.java
|
3edea1a4c416ff78a05937d8b2d5951441ca4dd7
|
[
"Apache-2.0"
] |
permissive
|
pister/wint
|
https://github.com/pister/wint
|
37a335fa3661bef5a32f8596ee26b32961a0029d
|
e69ab937b02c644c63a68ced2e9331405c6b5e8c
|
refs/heads/master
| 2023-08-18T21:38:04.814000 | 2023-08-11T06:04:52 | 2023-08-11T06:04:52 | 11,913,134 | 27 | 16 |
Apache-2.0
| false | 2023-04-17T17:45:38 | 2013-08-06T01:35:19 | 2022-11-25T07:53:54 | 2023-04-17T17:45:34 | 2,432 | 31 | 22 | 3 |
Java
| false | false |
package wint.mvc.form;
import wint.mvc.form.config.FieldConfig;
/**
* User: huangsongli
* Date: 14-4-24
* Time: 下午3:46
*/
public class MessageHoldField implements Field {
private String name;
private String message;
public MessageHoldField(String name, String message) {
this.name = name;
this.message = message;
}
public String getName() {
return name;
}
public String getLabel() {
throw new UnsupportedOperationException();
}
public void setValue(String value) {
throw new UnsupportedOperationException();
}
public String getValue() {
throw new UnsupportedOperationException();
}
public String[] getValues() {
throw new UnsupportedOperationException();
}
public void setValues(String[] values) {
throw new UnsupportedOperationException();
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public FieldConfig getFieldConfig() {
throw new UnsupportedOperationException();
}
public boolean hasValue(Object value) {
return false;
}
public int getValuesLength() {
return 0;
}
}
|
UTF-8
|
Java
| 1,273 |
java
|
MessageHoldField.java
|
Java
|
[
{
"context": "rt wint.mvc.form.config.FieldConfig;\n\n/**\n * User: huangsongli\n * Date: 14-4-24\n * Time: 下午3:46\n */\npublic class",
"end": 90,
"score": 0.9989169836044312,
"start": 79,
"tag": "USERNAME",
"value": "huangsongli"
}
] | null |
[] |
package wint.mvc.form;
import wint.mvc.form.config.FieldConfig;
/**
* User: huangsongli
* Date: 14-4-24
* Time: 下午3:46
*/
public class MessageHoldField implements Field {
private String name;
private String message;
public MessageHoldField(String name, String message) {
this.name = name;
this.message = message;
}
public String getName() {
return name;
}
public String getLabel() {
throw new UnsupportedOperationException();
}
public void setValue(String value) {
throw new UnsupportedOperationException();
}
public String getValue() {
throw new UnsupportedOperationException();
}
public String[] getValues() {
throw new UnsupportedOperationException();
}
public void setValues(String[] values) {
throw new UnsupportedOperationException();
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public FieldConfig getFieldConfig() {
throw new UnsupportedOperationException();
}
public boolean hasValue(Object value) {
return false;
}
public int getValuesLength() {
return 0;
}
}
| 1,273 | 0.631994 | 0.624901 | 64 | 18.828125 | 18.40818 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28125 | false | false |
13
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.